BaseKInventoryImpl

open class BaseKInventoryImpl(owner: KInventoryHolder, val size: Int = 3*9, type: InventoryType?, title: Component?, private: Boolean = true) : BaseKInventory

Inheritors

Constructors

Link copied to clipboard
constructor(owner: KInventoryHolder, size: Int = 3*9, type: InventoryType?, title: Component?, private: Boolean = true)

Properties

Link copied to clipboard

All animations Identifier maps to the animation

Link copied to clipboard
open override var content: MutableMap<Int, KItem>

Content of the container

Link copied to clipboard

The current animation if one is running

Link copied to clipboard
open override var id: UUID

The unique ID of this identifiable

Link copied to clipboard
open override var inventories: MutableList<Inventory>

Client side inventory instances

Link copied to clipboard

Sets whether the items can be clicked while the inventory is inside an animation

Link copied to clipboard

Animation which will be played when the inventory is opened

Link copied to clipboard

the length of a row in the inventory

Link copied to clipboard
val size: Int

of the content container, should be a multiple of the rowLength

Link copied to clipboard
open override var title: Component?

Title of the inventory rendered in the bukkit inventory

Link copied to clipboard
open override var views: MutableList<InventoryView>

Views which currently look at the inventory

Functions

Link copied to clipboard
open override fun addAnimation(identifier: String, animation: Animation<KInventory>)

Adds the animation

Link copied to clipboard
open override fun clearInventory()

Clears the inventory from all items inside it

Link copied to clipboard
open override fun closed()

Sets the inventory to closed Should be called when the inventory has been closed.

Link copied to clipboard
open override fun getItems(): Map<Int, KItem>

Returns all the items in the inventory which have been set

Link copied to clipboard
open override fun getKHolder(): KInventoryHolder

Returns the KInventoryHolder of this inventory

Link copied to clipboard
open override fun getRowFor(index: Int): KRow

Gets the row for the given index This will create a new row for the returned value

Link copied to clipboard
open override fun getRowForItem(item: KItem): KRow?
Link copied to clipboard
open override fun getSlotForItem(item: KItem): Int
Link copied to clipboard
open override fun hasID(): Boolean
Link copied to clipboard
open override fun isAnimating(): Boolean

Whether the object is currently inside an animation

Link copied to clipboard
open override fun isEqual(inventory: Inventory): Boolean

Checks whether the given inventory is the same inventory

Link copied to clipboard
open override fun isOpened(): Boolean
Link copied to clipboard
open override fun isPrivate(): Boolean

Checks whether the inventory is private. Private indicated that only one player at a time can open the same reference to a KInventory

Link copied to clipboard
open override fun itemClicked(item: ItemStack, player: Player, event: InventoryClickEvent)

Notifies the inventory that the given item has been clicked by the given player

Link copied to clipboard
open override fun onClose(action: KInventory.() -> Unit)

Executed when the inventory is closed To catch this the bukkit event is used

Link copied to clipboard
open override fun onItemClicked(action: KInventory.(item: ItemStack, player: Player, event: InventoryClickEvent) -> Unit)

Executes the passed function, when a bukkit org.bukkit.inventory.ItemStack is clicked

Link copied to clipboard
open override fun onOpen(action: KInventory.() -> Unit)

Executed when the inventory is opened To catch this the bukkit event is used

Link copied to clipboard
open override fun opened()

Sets the inventory to opened Should be called when the inventory has been opened.

Link copied to clipboard
open override fun setItem(slot: Int, value: KItem)

Sets the given item at the given position

open override fun setItem(row: Int, slot: Int, item: KItem)

Sets the given item relative to the slot of the given row

Link copied to clipboard
abstract fun setRow(index: Int, row: KRow)

Sets the given row at the given index

Link copied to clipboard
open override fun startAnimation(animation: Animation<KInventory>)

Starts the given animation, but will not save it

open override fun startAnimation(identifier: String)

Starts the animation with the given identifier

Link copied to clipboard
abstract fun swapRow(row: KRow, otherRow: KRow)

Swaps two rows in an inventory

abstract fun swapRow(index: Int, otherIndex: Int)

Swaps two rows based on their index

Link copied to clipboard
open override fun toBukkitInventory(): Inventory

Constructs the bukkit inventory from this KInventory with the current set content