RegisteredKItem

Models a registered KItems

Registered KItems will, when initialized add a UUID to their NBT tags, so they can be identified later again.

This allows the item to be tracked inside bukkit events, which allows for event listeners on this item

Since

1.0.2

See also

Inheritors

Properties

Link copied to clipboard

Whether the item can be clicked while inside an animation or not

Link copied to clipboard

Determines the behaviour of the item when being dragged around the inventory

Link copied to clipboard
abstract var id: UUID

The unique ID of this identifiable

Link copied to clipboard
abstract var model: Key?

The custom model of this item

Link copied to clipboard

The parent inventory, the item is inside of

Link copied to clipboard
abstract var slot: Int

Slot of the item in the parent inventory, if the parent inventory is set

Functions

Link copied to clipboard
abstract fun addBehavior(kItemBehavior: KItemBehavior): KItemBehavior

Adds a behavior to the item.

abstract fun addBehavior(identifier: KIdentifier, block: ItemStack.(context: KItemBehaviorContext) -> Unit): KItemBehavior

Adds a behavior to the item with a specific identifier and functionality block.

Link copied to clipboard
abstract fun clicked(player: Player, kInventory: KInventory)

The item has been clicked by a player inside an inventory

Link copied to clipboard
abstract fun draggable(): Boolean
Link copied to clipboard
abstract fun enchant(enchantment: Enchantment, level: Int)

Enchants this item with the given parameters

Link copied to clipboard
abstract fun hasID(): Boolean
Link copied to clipboard
abstract fun leftClicked(player: Player, event: PlayerInteractEvent)

When the item has been left-clicked by a player

Link copied to clipboard
abstract fun onClick(action: KInventory.(RegisteredKItem, Player) -> Unit)

Executed when the item is valid clicked in an inventory

Link copied to clipboard
abstract fun onLeftClick(action: RegisteredKItem.(Player, PlayerInteractEvent) -> Unit)

Executed when the player left-clicked with this item outside an inventory

Link copied to clipboard
abstract fun onRightClick(action: RegisteredKItem.(Player, PlayerInteractEvent) -> Unit)

Executed when the player right-clicked with this item outside an inventory

Link copied to clipboard
abstract fun rightClicked(player: Player, event: PlayerInteractEvent)

When the item has been right-clicked by a player

Link copied to clipboard
abstract fun setDisplayName(name: Component)

Sets the display name of the item

Link copied to clipboard
abstract fun setItemLore(lore: List<Component>)

Sets the lore of the item

Link copied to clipboard
abstract fun toItemStack(): ItemStack

Transforms the KItem to a Bukkit ItemStack