mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Re-added unbreaking enchant handling for Tree Feller
This commit is contained in:
parent
071f7edade
commit
51d681974c
@ -7,6 +7,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -136,10 +137,11 @@ public abstract class TreeFeller {
|
|||||||
|
|
||||||
if (inHandMaterial != Material.AIR) {
|
if (inHandMaterial != Material.AIR) {
|
||||||
short durabilityLoss = 0;
|
short durabilityLoss = 0;
|
||||||
|
int unbreakingLevel = inHand.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||||
|
|
||||||
for (Block block : treeFellerBlocks) {
|
for (Block block : treeFellerBlocks) {
|
||||||
if (BlockChecks.isLog(block)) {
|
if (BlockChecks.isLog(block) && Misc.getRandom().nextInt(unbreakingLevel + 1) == 0) {
|
||||||
durabilityLoss += Misc.toolDurabilityLoss;
|
durabilityLoss += Misc.toolDurabilityLoss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user