diff --git a/src/main/kotlin/pw.hamzantal.shopreborn/ClickListeners.kt b/src/main/kotlin/pw.hamzantal.shopreborn/ClickListeners.kt index 2620d7e..14a1f0b 100644 --- a/src/main/kotlin/pw.hamzantal.shopreborn/ClickListeners.kt +++ b/src/main/kotlin/pw.hamzantal.shopreborn/ClickListeners.kt @@ -237,7 +237,7 @@ fun clickInventory(e: InventoryClickEvent, pe: PurchaseEvent) { fun executeSell(item: ItemStack, howMany: Int, singleCost: Double, p: Player, op: OfflinePlayer) { val name = if (item.itemMeta.hasDisplayName()) item.itemMeta.displayName else item.type.prettyName() - if (howMany <= 0) { + if (howMany <= 0 || p containing item < howMany) { p.msg(GlobalConfig.messages.sellNotEnough.replace("%NAME%", name)) return } diff --git a/src/main/kotlin/pw.hamzantal.shopreborn/PurchaseItems.kt b/src/main/kotlin/pw.hamzantal.shopreborn/PurchaseItems.kt index 8e4d5ed..61d7538 100644 --- a/src/main/kotlin/pw.hamzantal.shopreborn/PurchaseItems.kt +++ b/src/main/kotlin/pw.hamzantal.shopreborn/PurchaseItems.kt @@ -4,16 +4,16 @@ import org.bukkit.Material import org.bukkit.inventory.ItemStack object PurchaseItems { - fun paneStack(damage: Int, name: String): ItemStack { - return ItemStack(Material.STAINED_GLASS_PANE, 1, damage.toShort()).apply { + fun paneStack(damage: Int, name: String, amount: Int = 1): ItemStack { + return ItemStack(Material.STAINED_GLASS, amount, damage.toShort()).apply { itemMeta = itemMeta.apply { displayName = name.c } } } - fun blockStack(damage: Int, name: String): ItemStack { - return ItemStack(Material.STAINED_GLASS, 1, damage.toShort()).apply { + fun blockStack(damage: Int, name: String, amount: Int = 1): ItemStack { + return ItemStack(Material.STAINED_GLASS, amount, damage.toShort()).apply { itemMeta = itemMeta.apply { displayName = name.c } @@ -27,12 +27,12 @@ object PurchaseItems { var msgs = GlobalConfig.messages val set1 = paneStack(14, msgs.set1) - val sub10 = paneStack(14, msgs.sub10) - val sub1 = paneStack(14, msgs.sub1) + val sub10 = paneStack(14, msgs.sub10, 10) + val sub1 = paneStack(14, msgs.sub1, 1) - val add1 = paneStack(5, msgs.add1) - val add10 = paneStack(5, msgs.add10) - val set64 = paneStack(5, msgs.set64) + val add1 = paneStack(5, msgs.add1, 1) + val add10 = paneStack(5, msgs.add10, 10) + val set64 = paneStack(5, msgs.set64, 64) val sellConfirm = blockStack(5, msgs.sellConfirm) val sellAll = blockStack(5, msgs.sellAll)