From 09431ef27c61e9d5f90ba6c397b960153d8426dc Mon Sep 17 00:00:00 2001 From: roblikescake Date: Sat, 15 Feb 2014 18:03:25 -0500 Subject: [PATCH] Check durability before repairMaterial --- .../nossr50/skills/repair/RepairManager.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index cf207ab73..c20accb1a 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -90,7 +90,15 @@ public class RepairManager extends SkillManager { Material repairMaterial = repairable.getRepairMaterial(); byte repairMaterialMetadata = repairable.getRepairMaterialMetadata(); ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1); + + short startDurability = item.getDurability(); + // Do not repair if at full durability + if (startDurability <= 0) { + player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability")); + return; + } + // Check if they have the proper material to repair with if (!inventory.contains(repairMaterial)) { String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial)); @@ -103,14 +111,6 @@ public class RepairManager extends SkillManager { return; } - short startDurability = item.getDurability(); - - // Do not repair if at full durability - if (startDurability <= 0) { - player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability")); - return; - } - // Do not repair stacked items if (item.getAmount() != 1) { player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));