diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java index 60f34fc8..a00504fc 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/illegals/items/Unbreakables.java @@ -64,17 +64,15 @@ public ItemLegality legalityOf(ItemStack itemStack) { } if (!useWhitelist || blacklistMode == whitelistedTypes.contains(itemStack.getType())) { - if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) { - return ItemLegality.ILLEGAL; + if (skipZeroDurability && itemStack.getType().getMaxDurability() == 0) { + return ItemLegality.LEGAL; } - if (!skipZeroDurability || itemStack.getType().getMaxDurability() != 0) { - if (itemStack.getDurability() > itemStack.getType().getMaxDurability() || itemStack.getDurability() < 0) { - return ItemLegality.ILLEGAL; - } + if (itemStack.getDurability() > itemStack.getType().getMaxDurability() || itemStack.getDurability() < 0) { + return ItemLegality.ILLEGAL; } - else if (itemStack.getDurability() > 2031) { + if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) { return ItemLegality.ILLEGAL; } } @@ -102,14 +100,11 @@ public void handleItem(ItemStack itemStack, ItemLegality legality) { itemStack.setItemMeta(itemMeta); } - if (!skipZeroDurability || itemStack.getType().getMaxDurability() != 0) { - if (itemStack.getDurability() > itemStack.getType().getMaxDurability() || itemStack.getDurability() < 0) { - itemStack.setDurability(itemStack.getType().getMaxDurability()); - itemStack.setItemMeta(itemMeta); - } + if (skipZeroDurability && itemStack.getType().getMaxDurability() == 0) { + return; } - else if (itemStack.getDurability() > 2031) { + if (itemStack.getDurability() > itemStack.getType().getMaxDurability() || itemStack.getDurability() < 0) { itemStack.setDurability(itemStack.getType().getMaxDurability()); itemStack.setItemMeta(itemMeta); }