Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

ItemBuilder

RedMagic edited this page Apr 16, 2024 · 2 revisions

More info and source code click here

Any ItemBuilder is a very powerfull util class to be able to change / modify a ItemStack. Instead of getting the ItemMeta changing it then setting it back. (See below)

val itemStack = ItemStack(Material.DIAMOND)
val itemMeta = itemStack.itemMeta
itemMeta?.setDisplayName("Diamond")
itemStack.itemMeta = itemMeta

You are able to create a new instance of the ItemBuilder class and modfiy it so much as you want. (See below)

val itemStack = ItemBuilder(Material.DIAMOND)
    .setName("Diamond")
    .build()
Clone this wiki locally