Skip to content

Commit

Permalink
1.24.0 - Patch unbreakables
Browse files Browse the repository at this point in the history
  • Loading branch information
moom0o committed Mar 22, 2022
1 parent 000da36 commit e79d41d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.moomoo</groupId>
<artifactId>anarchyexploitfixes</artifactId>
<version>1.23.1</version>
<version>1.24.0</version>
<packaging>jar</packaging>

<name>AnarchyExploitFixes</name>
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/me/moomoo/anarchyexploitfixes/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e79d41d

Please sign in to comment.