CustomItem

class CustomItem(val item: ItemStack, val id: String)

Represents a custom item that can have event listeners associated with it. These events can be triggered when the item is interacted with in various ways (e.g., left-click, right-click, drop, etc.).

Parameters

item

The ItemStack that represents the custom item.

id

The unique identifier for the custom item.

Constructors

Link copied to clipboard
constructor(item: ItemStack, id: String)

Properties

Link copied to clipboard
val id: String
Link copied to clipboard
val item: ItemStack

Functions

Link copied to clipboard
fun giveTo(player: Player): HashMap<Int, ItemStack>

Gives the custom item to a player.

Link copied to clipboard
fun onBlockBreak(action: (Player, Material) -> Unit): CustomItem
Link copied to clipboard
fun onBlockInteract(action: (Player, Material) -> Unit): CustomItem
Link copied to clipboard
fun onDrop(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onEntityInteract(action: (Player, Entity) -> Unit): CustomItem
Link copied to clipboard
fun onLeftClick(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onLeftClickAir(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onLeftClickBlock(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onPickup(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onRightClick(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onRightClickAir(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onRightClickBlock(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onShiftLeftClick(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onShiftLeftClickAir(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onShiftLeftClickBlock(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onShiftRightClick(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onShiftRightClickAir(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun onShiftRightClickBlock(action: (Player) -> Unit): CustomItem
Link copied to clipboard
fun openGuiOnRightClick(guiProvider: (Player) -> GuiBuilder): CustomItem

Opens a GUI when the item is right-clicked.

Link copied to clipboard
fun openGuiOnRightClickWithMeta(guiProvider: (Player, ItemStack) -> GuiBuilder): CustomItem

Opens a GUI when the item is right-clicked, passing the item as a parameter.