Entry

class Entry<T : KtInventoryPaginated>(paginated: T, page: Int, lastPage: Int) : AbstractKtInventoryPaginated.Entry<T>

Represents a single page entry in the paginated inventory.

Since

2.0.0

Parameters

T

Type of the paginated inventory

paginated

The paginated inventory instance

page

Current page number

lastPage

Last page number

Constructors

Link copied to clipboard
constructor(paginated: T, page: Int, lastPage: Int)

Properties

Link copied to clipboard

Map of all buttons in the inventory

Link copied to clipboard
Link copied to clipboard
val line: Int

Number of rows in the inventory (must be between 1 and 6)

Link copied to clipboard
val page: Int
Link copied to clipboard
Link copied to clipboard
val size: Int

Total size of inventory (line * 9)

Link copied to clipboard

Storage options for this inventory's storable components

Link copied to clipboard

Set of all storable components in this inventory

Link copied to clipboard
val viewers: List<HumanEntity>

List of entities currently viewing this inventory

Functions

Link copied to clipboard
override fun button(slot: Int, item: KtInventoryButton<KtInventoryBase>)

Adds an existing button to a single slot

fun button(vararg slot: Int, item: KtInventoryButton<KtInventoryBase>)

Adds an existing button to multiple slots

fun button(slot: Int, itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit = {})

Adds a button to a single slot with the given item and click handler

fun button(vararg slot: Int, itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit = {})
fun button(slots: Iterable<Int>, itemStack: ItemStack, onClick: (KtInventoryButton.ClickEvent<AbstractKtInventory>) -> Unit = {})

Adds a button to multiple slots with the given item and click handler

Link copied to clipboard

Creates a new inventory button with the specified item and click handler

Link copied to clipboard
open override fun getInventory(): @NotNull Inventory
Link copied to clipboard
fun getItem(slot: Int): @Nullable ItemStack?

Gets the item at the specified slot

Link copied to clipboard

Gets all storables that have the given slot

Gets all storables that have any of the given slots

Link copied to clipboard
open override fun onClick(event: InventoryClickEvent)

Called when top inventory is clicked

Link copied to clipboard
open fun onClickBottom(event: InventoryClickEvent)

Called when bottom inventory is clicked

Link copied to clipboard
open override fun onClose(event: InventoryCloseEvent)

Called when inventory is closed

Link copied to clipboard
open fun onDrag(event: InventoryDragEvent)

Called when items are dragged in inventory

Link copied to clipboard
open override fun onOpen(event: InventoryOpenEvent)

Called when inventory is opened

Link copied to clipboard
override fun open(player: HumanEntity)

Opens this inventory for the given player

Link copied to clipboard
fun openNextPage(player: HumanEntity)

Opens next page for a player

Link copied to clipboard
fun openPreviousPage(player: HumanEntity)

Opens previous page for a player

Link copied to clipboard

Saves the state of all storable components in this inventory

Link copied to clipboard
fun setItem(slot: Int, item: ItemStack?)

Sets an item at the specified slot

Link copied to clipboard
fun storable(initialize: () -> List<ItemStack?> = { emptyList() }, onPreClick: (KtInventoryStorable.ClickEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onClick: (KtInventoryStorable.ClickEvent) -> Unit = {}, onPreDrag: (KtInventoryStorable.DragEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onDrag: (KtInventoryStorable.DragEvent) -> Unit = {}, save: (List<ItemStack?>) -> Unit = {})

Add a storable component using all slots in the inventory

fun storable(vararg slots: Int, initialize: () -> List<ItemStack?> = { emptyList() }, onPreClick: (KtInventoryStorable.ClickEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onClick: (KtInventoryStorable.ClickEvent) -> Unit = {}, onPreDrag: (KtInventoryStorable.DragEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onDrag: (KtInventoryStorable.DragEvent) -> Unit = {}, save: (List<ItemStack?>) -> Unit = {})
fun storable(slots: Iterable<Int>, initialize: () -> List<ItemStack?> = { emptyList() }, onPreClick: (KtInventoryStorable.ClickEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onClick: (KtInventoryStorable.ClickEvent) -> Unit = {}, onPreDrag: (KtInventoryStorable.DragEvent) -> KtInventoryStorable.EventResult = { KtInventoryStorable.EventResult.Allow }, onDrag: (KtInventoryStorable.DragEvent) -> Unit = {}, save: (List<ItemStack?>) -> Unit = {}): KtInventoryStorable

Add a storable component with the specified slot numbers