KRow

interface KRow

Models a row inside a regular KInventory type

A row consists of 9 slots which can be filled with items

Author

Devin

Since

1.0.0

Inheritors

Properties

Link copied to clipboard
abstract var index: Int

Index of the row inside the parent container

Link copied to clipboard
abstract val items: Map<Int, KItem>

The items contained in the KRow Maps the Slot to the KItem inside the row

Link copied to clipboard
abstract val name: String

Name of the row

Link copied to clipboard

The parent container of this row. This should always be set by the parent inventory or page, and will be set automatically when using the builders!

Functions

Link copied to clipboard
abstract fun clicked(player: Player, kItem: KItem)

Executed the onClicked event listeners for this row

Link copied to clipboard
abstract fun onClick(action: InventoryContentContainer.(player: Player, row: KRowImpl, item: KItem) -> Unit)

Executed when any item inside the row is clicked

Link copied to clipboard
abstract fun setItem(slot: Int, item: KItem)

Sets the given item in the given slot. When changing an item in a slot, the inventory will update accordingly

abstract fun setItem(range: IntRange, item: KItem)

Sets the given item in the given range. When changing an item in a slot, the inventory will update accordingly

Link copied to clipboard
abstract fun shift(direction: ShiftDirection, amount: Int, wrap: Boolean)

Shifts the items inside the row to the given direction. Because items can also be set at a negative slot or slot larger than 9, the items next to it will come. If wrap is enabled, it will wrap the last items back to the beginning.