Setting item properties

Setting specific properties to items, such as its display name, lore, etc.

Chain creation

If you want to create an item with properties all in one go, then just combine the methods of your choice below. Here is an example:

ItemStack item = new FluidItem(Material.DIAMOND_SWORD).setName("Ruby Sword")
.setLore("&6Made from the", "&6finest of rubies").setModel(1).build();

The build() method is what builds the item from a FluidItem to an ItemStack. You can still store the fluid item in a variable if you want to change values later on, but to get the item itself, you will need to call this method.

Properties

Display name

item.setName(DISPLAY NAME)

Lore

item.setLore(LORE...)
item.setLore(INDEX, LORE)
item.setLore(INDEX[], LORE[])
item.addLore(LORE...)
item.addLore(ALLOW DUPLICATES, LORE...)

Custom Model Data

item.setModel(ID)

Item Flags

item.addFlags(FLAGS...)
item.removeFlags(FLAGS...)
item.removeFlags()

Durability

item.setUnbreakable()
item.setUnbreakable(UNBREAKABLE)

Custom Data

item.setData(KEY, DATA TYPE, VALUE)
item.getData(KEY, DATA TYPE)
item.hasData(KEY, DATA TYPE)

Enchantment

item.enchant(ENCHANTMENT, LEVEL)
item.enchant(ENCHANTMENT, LEVEL, BYPASS LIMIT)
item.addEnchantGlow()

Last updated

Was this helpful?