From cc18794a9353ee04250bac4ca487becfa4a96f74 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 31 Dec 2012 11:00:27 +0100 Subject: [PATCH] Don't damage the tool more than it's max durability --- .../java/com/gmail/nossr50/skills/gathering/WoodCutting.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index c588ceb37..6e0886f8f 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -97,7 +97,8 @@ public class WoodCutting { } /* Damage the tool */ - inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); + if (inHand.getDurability() + durabilityLoss > inHand.getType().getMaxDurability()) inHand.setDurability((short) (inHand.getType().getMaxDurability())); + else inHand.setDurability((short) (inHand.getDurability() + durabilityLoss)); //Prepare ItemStacks ItemStack item = null;