ItemBuilder

The ItemBuilder class is expansive, allowing you to customize your ItemStack in many ways in a builder environment.

There are over 30 methods in the ItemBuilder for you to use to customize your ItemStack!

Example

In this example, we make a Diamond Sword with a custom name, lore, and enchantments.

ItemStack sword = new ItemBuilder(Material.DIAMOND_SWORD)
    .setName("<red>Amazing Sword") // Names are in MiniMessage format
    //.setName(Component.text("Amazing Sword")) // or alternatively in Component format
                
    .setLore("<gray>It's amazing!") // Lore is in MiniMessage format
    //.setLore(Component.text("It's amazing!")) // or alternatively in Component format

    .addEnchantment(Enchantment.DAMAGE_ALL, 5)
    .addEnchantment(Enchantment.DURABILITY, 3)
    .build();

Last updated