Don't protect tools which has unbreakable flag

Technically unbreakable tools are unconditionally unbreakable. Long trees are can't be chopping down with unbreakable but low durability tools.
This commit is contained in:
Hazar 2022-06-03 17:21:39 +03:00 committed by GitHub
parent 7f1c9ab3a3
commit 7a77e95fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ public class TreeFallManager extends Manager implements Listener {
return;
short toolDamage = this.getToolDamage(detectedTree.getDetectedTreeBlocks(), tool.containsEnchantment(Enchantment.SILK_TOUCH));
if (!ConfigurationManager.Setting.PROTECT_TOOL.getBoolean() && !ItemUtils.hasEnoughDurability(tool, toolDamage))
if (!tool.getItemMeta().isUnbreakable() && !ConfigurationManager.Setting.PROTECT_TOOL.getBoolean() && !ItemUtils.hasEnoughDurability(tool, toolDamage))
return;
// Trigger fall event