PocketInventory
Example PocketInventory usage.
class ShopCommand(
private val plugin: TestPlugin
) : PocketCommand() {
private val inventory: PocketInventory = PocketInventory(plugin, "Shop", 4)
init {
// golden apple
inventory.setItem(11, ItemStack(Material.GOLDEN_APPLE)) { /* buy logic */ }
// close item
inventory.setItem(53, ItemStack(Material.DARK_OAK_DOOR_ITEM)) { it.view.close() }
}
override fun getName(): String {
return "shop"
}
override fun handle(sender: CommandSender, command: Command, args: Array<out String>): Boolean {
inventory.open(sender)
return true
}
override fun requirePlayer(): Boolean {
return true
}
}Last updated