From 59a35b170c7158d2bef4dbcc69b8c92bf1d48205 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 18 Sep 2013 15:42:54 -0400 Subject: [PATCH] Oh yeah, that's why. --- .../com/gmail/nossr50/skills/repair/RepairManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 0a8afb649..1b2f46057 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -83,10 +83,10 @@ public class RepairManager extends SkillManager { ItemStack toRemove = new MaterialData(repairMaterialId, repairMaterialMetadata).toItemStack(1); // Check if they have the proper material to repair with - if (!inventory.containsAtLeast(toRemove, 1)) { + if (!inventory.contains(Material.getMaterial(repairMaterialId))) { String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterialId)); - if (repairMaterialMetadata > 0) { + if (repairMaterialMetadata != (byte) -1 && !inventory.containsAtLeast(toRemove, 1)) { message += ":" + repairMaterialMetadata; } @@ -130,6 +130,11 @@ public class RepairManager extends SkillManager { } // Remove the item + if (repairMaterialMetadata == -1) { + toRemove = inventory.getItem(inventory.first(Material.getMaterial(repairMaterialId))).clone(); + toRemove.setAmount(1); + } + inventory.removeItem(toRemove); // Give out XP like candy