Fix shop removal with partial transactions (Fixes #307)

This commit is contained in:
Phoenix616 2020-05-06 20:53:59 +01:00
parent 7fbf50cefe
commit a427c8c5a0

View File

@ -52,7 +52,19 @@ public class EmptyShopDeleter implements Listener {
} }
private static boolean shopShouldBeRemoved(Inventory inventory, ItemStack[] stock) { private static boolean shopShouldBeRemoved(Inventory inventory, ItemStack[] stock) {
return Properties.REMOVE_EMPTY_SHOPS && !ChestShopSign.isAdminShop(inventory) && !InventoryUtil.hasItems(stock, inventory); if (Properties.REMOVE_EMPTY_SHOPS && !ChestShopSign.isAdminShop(inventory)) {
if (Properties.ALLOW_PARTIAL_TRANSACTIONS) {
for (ItemStack itemStack : stock) {
if (inventory.containsAtLeast(itemStack, 1)) {
return false;
}
}
return true;
} else if (!InventoryUtil.hasItems(stock, inventory)) {
return true;
}
}
return false;
} }
private static boolean isInRemoveWorld(Sign sign) { private static boolean isInRemoveWorld(Sign sign) {