On admin and infinite shops, the player must have enough items

This commit is contained in:
Eric 2016-05-27 15:00:39 +02:00
parent c4bc318a25
commit 4c022dd9dc

View File

@ -205,12 +205,20 @@ public class InteractShop implements Listener{
if (perm.has(p, "shopchest.sell")) {
if (shop.getShopType() == ShopType.INFINITE) {
if (!shop.getVendor().getUniqueId().equals(p.getUniqueId())) {
if (Utils.getAmount(p.getInventory(), shop.getProduct().getType(), shop.getProduct().getDurability(), shop.getProduct().getItemMeta()) >= shop.getProduct().getAmount()) {
sell(p, shop);
} else {
p.sendMessage(Config.not_enough_items());
}
} else {
e.setCancelled(false);
}
} else if (shop.getShopType() == ShopType.ADMIN) {
if (Utils.getAmount(p.getInventory(), shop.getProduct().getType(), shop.getProduct().getDurability(), shop.getProduct().getItemMeta()) >= shop.getProduct().getAmount()) {
sell(p, shop);
} else {
p.sendMessage(Config.not_enough_items());
}
} else {
if (!shop.getVendor().getUniqueId().equals(p.getUniqueId())) {
if (Utils.getAmount(p.getInventory(), shop.getProduct().getType(), shop.getProduct().getDurability(), shop.getProduct().getItemMeta()) >= shop.getProduct().getAmount()) {