From d644b4c3310b581c94200c2f4f04725534e7f056 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 6 Jun 2012 18:27:52 -0400 Subject: [PATCH] Fixed NPE with repairing items that rely on metadata. --- Changelog.txt | 1 + .../nossr50/skills/repair/SimpleRepairManager.java | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 5daa251cf..0d5c74e60 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -21,6 +21,7 @@ Version 1.3.09 = Fixed bug with locale strings when trying to teleport to a non-existent player = Fixed bug with Tree Feller changing durability before checking for axe splintering = Fixed bug with Repair Mastery permission due to typo + = Fixed bug with repairing items that use metadata ! API methods can now only be used in a static way ! Changed Spout settings to be in their own config file (spout.yml) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java index e166bf244..ce1f3cc87 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/SimpleRepairManager.java @@ -205,17 +205,9 @@ public class SimpleRepairManager implements RepairManager { ItemStack[] contents = inventory.getContents(); for (int i = 0; i < contents.length; i++) { ItemStack item = contents[i]; - - //DEBUG TIME! + if (item == null) { - System.out.println("The item is null."); - System.out.println("Content length: " + contents.length); - System.out.println("Current contents: " + i); - } - else { - System.out.println("The item is: " + item.toString()); - System.out.println("Content length: " + contents.length); - System.out.println("Current contents: " + i); + continue; } if (item.getTypeId() == itemId) { @@ -223,6 +215,7 @@ public class SimpleRepairManager implements RepairManager { location = i; } } + if (location != -1) { break; }