Fixed some abilities not properly handling Unbreaking items.

This commit is contained in:
gmcferrin 2012-02-03 13:28:17 -05:00
parent 892f4935ae
commit c001bb8d2c

View File

@ -258,7 +258,10 @@ public class mcBlockListener implements Listener
} }
} }
if(LoadProperties.toolsLoseDurabilityFromAbilities) if(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss); m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
plugin.misc.treeFeller.clear(); plugin.misc.treeFeller.clear();
} }
} }
@ -396,6 +399,8 @@ public class mcBlockListener implements Listener
mat = Material.SNOW_BALL; mat = Material.SNOW_BALL;
if(block.getTypeId() == 82) if(block.getTypeId() == 82)
mat = Material.CLAY_BALL; mat = Material.CLAY_BALL;
if(block.getTypeId() == 110)
mat = Material.DIRT;
byte type = block.getData(); byte type = block.getData();
@ -441,7 +446,13 @@ public class mcBlockListener implements Listener
*/ */
if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player)) if(block.getTypeId() == 18 && mcPermissions.getInstance().woodcutting(player) && PP.getSkillLevel(SkillType.WOODCUTTING) >= 100 && m.isAxes(player.getItemInHand()) && m.blockBreakSimulate(block, player))
{ {
m.damageTool(player, (short)1);
if(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
if(Math.random() * 10 > 9) if(Math.random() * 10 > 9)
{ {
ItemStack x = new ItemStack(Material.SAPLING, 1, (short)0, block.getData()); ItemStack x = new ItemStack(Material.SAPLING, 1, (short)0, block.getData());