Don't check vendor balance at admin shops

Should fix errors with economy plugins when the vendor
does not have a valid name.
This commit is contained in:
Eric 2018-07-26 17:25:55 +02:00
parent 1a0920f239
commit 148295ddb4

View File

@ -1120,8 +1120,12 @@ public class ShopInteractListener implements Listener {
String worldName = shop.getLocation().getWorld().getName(); String worldName = shop.getLocation().getWorld().getName();
if (econ.getBalance(shop.getVendor(), worldName) >= price || shop.getShopType() == ShopType.ADMIN || Config.autoCalculateItemAmount) { if (shop.getShopType() == ShopType.ADMIN || econ.getBalance(shop.getVendor(), worldName) >= price || Config.autoCalculateItemAmount) {
int amountForMoney = (int) (amount / price * econ.getBalance(shop.getVendor(), worldName)); 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() + ")"); plugin.debug("Vendor has enough money for " + amountForMoney + " item(s) (#" + shop.getID() + ")");