浏览代码

This does prevent using wood axes everytime you tree fell

TfT_02 12 年之前
父节点
当前提交
00279502e4
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java

+ 5 - 2
src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java

@@ -84,6 +84,8 @@ public class WoodCutting {
                 if (health >= 2) {
                     Combat.dealDamage(player, random.nextInt(health - 1));
                 }
+                inHand.setDurability((short) (inHand.getType().getMaxDurability()));
+                return;
             }
         }
         else if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) {
@@ -94,11 +96,12 @@ public class WoodCutting {
             if (health >= 2) {
                 Combat.dealDamage(player, random.nextInt(health - 1));
             }
+            inHand.setDurability((short) (inHand.getType().getMaxDurability()));
+            return;
         }
 
         /* Damage the tool */
-        if (inHand.getDurability() + durabilityLoss > inHand.getType().getMaxDurability()) inHand.setDurability((short) (inHand.getType().getMaxDurability()));
-        else inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
+        inHand.setDurability((short) (inHand.getDurability() + durabilityLoss));
 
         //Prepare ItemStacks
         ItemStack item = null;