Merge branch 'feature/clean-project' of https://github.com/Flowsqy/ShopChest into feature/clean-project

This commit is contained in:
Flowsqy 2022-12-22 20:59:50 +01:00
commit 355572f7f3

View File

@ -279,7 +279,11 @@ public class ShopInteractListener implements Listener {
Container c = (Container) b.getState(); Container c = (Container) b.getState();
ItemStack itemStack = shop.getProduct().getItemStack(); ItemStack itemStack = shop.getProduct().getItemStack();
int amount = (p.isSneaking() ? itemStack.getMaxStackSize() : shop.getProduct().getAmount()); int amount = (p.isSneaking() ? itemStack.getMaxStackSize() : shop.getProduct().getAmount());
// If shop has higher amounts than a stack, use the shop amount to allow players to use bulk discount
if(shop.getProduct().getAmount()>itemStack.getMaxStackSize())
amount = shop.getProduct().getAmount();
if (Utils.getAmount(c.getInventory(), itemStack) >= amount) { if (Utils.getAmount(c.getInventory(), itemStack) >= amount) {
if (confirmed || !Config.confirmShopping) { if (confirmed || !Config.confirmShopping) {
buy(p, shop, p.isSneaking()); buy(p, shop, p.isSneaking());
@ -636,7 +640,7 @@ public class ShopInteractListener implements Listener {
ItemStack itemStack = shop.getProduct().getItemStack(); ItemStack itemStack = shop.getProduct().getItemStack();
int amount = shop.getProduct().getAmount(); int amount = shop.getProduct().getAmount();
if (stack) amount = itemStack.getMaxStackSize(); if (stack && amount<=shop.getProduct().getAmount()) amount = itemStack.getMaxStackSize();
String worldName = shop.getLocation().getWorld().getName(); String worldName = shop.getLocation().getWorld().getName();