diff --git a/README.md b/README.md index 200062100..171ebae1d 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,8 @@ RevertUnEnchantable: true # Removes enchantments that normally can't be applied RevertSpecificEnchantments: false # Only revert specific enchantments SpecificEnchantments: - "DIG_SPEED" # The name of the enchantment in the spigot api +RevertUnbreakables: + Enabled: true # Revert unbreakable items, items with less than 0 durability will be automatically removed or set to 0 durability, which will break on the next use. Items with higher than max durability will be set to legal maximum durability. # Only removes player heads, not mob heads RemoveIllegalHeads: true RemoveSpawnEggs: true diff --git a/pom.xml b/pom.xml index bd1488fef..cc38b9b43 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.moomoo anarchyexploitfixes - 1.23.1 + 1.24.0 jar AnarchyExploitFixes diff --git a/src/main/java/me/moomoo/anarchyexploitfixes/Main.java b/src/main/java/me/moomoo/anarchyexploitfixes/Main.java index 1d7b16b80..606c1a7a2 100644 --- a/src/main/java/me/moomoo/anarchyexploitfixes/Main.java +++ b/src/main/java/me/moomoo/anarchyexploitfixes/Main.java @@ -242,6 +242,15 @@ public void revert(ItemStack item) { } } + if (getConfig().getBoolean("RevertUnbreakables.Enabled")) { + if (item.getDurability() > item.getType().getMaxDurability()) { + item.setDurability(item.getType().getMaxDurability()); + } + if (item.getDurability() < 0) { + item.subtract(item.getAmount()); + } + } + if (getConfig().getBoolean("RevertEnchantments")) revertEnchantments(item); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c29da8b4a..8659b0854 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -18,6 +18,8 @@ RevertUnEnchantable: true # Removes enchantments that normally can't be applied RevertSpecificEnchantments: false # Only revert specific enchantments SpecificEnchantments: - "DIG_SPEED" # The name of the enchantment in the spigot api +RevertUnbreakables: + Enabled: true # Revert unbreakable items, items with less than 0 durability will be automatically removed or set to 0 durability, which will break on the next use. Items with higher than max durability will be set to legal maximum durability. # Only removes player heads, not mob heads RemoveIllegalHeads: true RemoveSpawnEggs: true