2023-01-28 11:32:16 +00:00
|
|
|
@file:Suppress("PackageDirectoryMismatch")
|
|
|
|
|
2023-01-28 14:41:10 +00:00
|
|
|
package xyz.xenondevs.invui.virtualinventory
|
2023-01-28 11:32:16 +00:00
|
|
|
|
|
|
|
import org.bukkit.inventory.ItemStack
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a copy of [ItemStack] placed on that [slot].
|
|
|
|
*/
|
|
|
|
operator fun VirtualInventory.get(slot: Int): ItemStack? = getItemStack(slot)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the given [items] to the inventory.
|
|
|
|
*/
|
|
|
|
operator fun VirtualInventory.plusAssign(items: Iterable<ItemStack>) {
|
|
|
|
items.forEach { addItem(null, it) }
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds the given [item] to the inventory.
|
|
|
|
*/
|
|
|
|
operator fun VirtualInventory.plusAssign(item: ItemStack) {
|
|
|
|
addItem(null, item)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the [VirtualInventory] contains an [ItemStack] similar to the given [item].
|
|
|
|
*/
|
|
|
|
operator fun VirtualInventory.contains(item: ItemStack) = containsSimilar(item)
|