diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/chest/SupportGiveChestPage.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/chest/SupportGiveChestPage.java index 91dd74820..ce40a2352 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/chest/SupportGiveChestPage.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/chest/SupportGiveChestPage.java @@ -21,6 +21,8 @@ public class SupportGiveChestPage extends SupportGiveItemPage super(plugin, shop, player, target, chestPage); _treasureType = treasureType; + _lowerBound = -100; + _upperBound = 100; buildPage(); } @@ -39,7 +41,8 @@ public class SupportGiveChestPage extends SupportGiveItemPage C.cYellow + _treasureType.getItemName() + C.mBody + "." )); - item.setAmount(Math.max(_count, 1)); + // Clamp between 1 and 64 always + item.setAmount(Math.min(Math.max(Math.abs(_count), 1), 64)); return item; } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/item/SupportGiveItemPage.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/item/SupportGiveItemPage.java index b6a18709e..b4a6864a5 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/item/SupportGiveItemPage.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/item/SupportGiveItemPage.java @@ -13,6 +13,8 @@ import mineplex.staffServer.ui.SupportShop; public abstract class SupportGiveItemPage extends SupportPage { protected int _count = 1; + protected int _lowerBound = 1; + protected int _upperBound = 64; protected int _submitButtonSlot = getSlotIndex(3, 4); @@ -38,7 +40,7 @@ public abstract class SupportGiveItemPage extends SupportPage private void addArrows() { int minusSlot = getSlotIndex(3, 2); - if (_count > 1) + if (_count > _lowerBound) { addButton(minusSlot, new ShopItem(Material.ARROW, "-1", new String[0], 1, false, true), @@ -53,7 +55,7 @@ public abstract class SupportGiveItemPage extends SupportPage } int plusSlot = getSlotIndex(3, 6); - if (_count < 64) + if (_count < _upperBound) { addButton(plusSlot, new ShopItem(Material.ARROW, "+1", new String[0], 1, false, true), @@ -70,7 +72,7 @@ public abstract class SupportGiveItemPage extends SupportPage protected void addSubmitButton() { - addButton(_submitButtonSlot, new ShopItem(Material.EMERALD_BLOCK, "Give " + getItemName(), new String[0], 1, false, true), (p, c) -> { + addButton(_submitButtonSlot, new ShopItem(_count > 0 ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, "Give " + getItemName(), new String[0], 1, false, true), (p, c) -> { giveUnknownSalesPackage(_count, getItemName(), true, (success) -> goBack()); }); }