From 148295ddb4324e0c6125fb17236921a723aaeeb7 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 26 Jul 2018 17:25:55 +0200 Subject: [PATCH] Don't check vendor balance at admin shops Should fix errors with economy plugins when the vendor does not have a valid name. --- .../shopchest/listeners/ShopInteractListener.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index 1f5a0e1..ca4d4be 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -1120,8 +1120,12 @@ public class ShopInteractListener implements Listener { String worldName = shop.getLocation().getWorld().getName(); - if (econ.getBalance(shop.getVendor(), worldName) >= price || shop.getShopType() == ShopType.ADMIN || Config.autoCalculateItemAmount) { - int amountForMoney = (int) (amount / price * econ.getBalance(shop.getVendor(), worldName)); + if (shop.getShopType() == ShopType.ADMIN || econ.getBalance(shop.getVendor(), worldName) >= price || Config.autoCalculateItemAmount) { + int amountForMoney = 1; + + if (shop.getShopType() != ShopType.ADMIN) { + amountForMoney = (int) (amount / price * econ.getBalance(shop.getVendor(), worldName)); + } plugin.debug("Vendor has enough money for " + amountForMoney + " item(s) (#" + shop.getID() + ")");