Tree Feller damages the tool (again)

This commit is contained in:
nossr50 2012-02-22 23:42:03 -08:00
parent 472bfa51da
commit cb4b5d1c71

View File

@ -60,6 +60,8 @@ public class WoodCutting
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP, mcMMO plugin) private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP, mcMMO plugin)
{ {
int durabilityLoss = 0;
for(Block x : toBeFelled) for(Block x : toBeFelled)
{ {
//Stupid NoCheat compatibility stuff //Stupid NoCheat compatibility stuff
@ -70,6 +72,8 @@ public class WoodCutting
{ {
if(x.getType() == Material.LOG || x.getType() == Material.LEAVES) if(x.getType() == Material.LOG || x.getType() == Material.LEAVES)
{ {
durabilityLoss++; //Damage the tool more if the Tree is larger
if(x.getType() == Material.LOG) if(x.getType() == Material.LOG)
{ {
byte type = x.getData(); byte type = x.getData();
@ -119,6 +123,17 @@ public class WoodCutting
} }
} }
} }
if(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
{
short durability = player.getItemInHand().getDurability();
durability += (LoadProperties.abilityDurabilityLoss * durabilityLoss);
player.getItemInHand().setDurability(durability);
}
}
} }
private static boolean treeFellerCompatible(Block block) private static boolean treeFellerCompatible(Block block)
{ {