From f6221c1c342031c37baf57e9827ae37f9ebc8ee3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 2 Mar 2012 12:19:57 -0800 Subject: [PATCH] More tweaks to durability stuff in tree feller --- .../java/com/gmail/nossr50/skills/WoodCutting.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index 228f53282..ab0474abe 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -68,21 +68,22 @@ public class WoodCutting return; } int durabilityLoss = toBeFelled.size(), xp = 0; - - //Damage the tool - player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability()+durabilityLoss)); - + //This is to prevent using wood axes everytime you tree fell - if((player.getItemInHand().getDurability() >= player.getItemInHand().getType().getMaxDurability()) + if((player.getItemInHand().getDurability() + durabilityLoss >= player.getItemInHand().getType().getMaxDurability()) || player.getItemInHand().getType() == Material.AIR || player.getItemInHand() == null) { player.sendMessage(ChatColor.RED+"YOUR AXE SPLINTERS INTO DOZENS OF PIECES"); if(player.getHealth() >= 2) Combat.dealDamage(player, player.getHealth()-1); + player.updateInventory(); //Not sure if needed return; } + //Damage the tool + player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability()+durabilityLoss)); + //Prepare ItemStacks ItemStack item; ItemStack oak = new ItemStack(Material.LOG, 1, (byte)0, (byte)0);