summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-09-08 18:41:21 +0100
committerKHobbits <rob@khobbits.co.uk>2012-09-08 18:41:21 +0100
commit7fa6ce12636662ba74d5a49f33e34edbee4e0197 (patch)
tree7fdd059257add979ad04cab98eb1f6b38d9dd5b1
parentd98f96c1dfdd58755cf44031c5a4368599578328 (diff)
downloadEssentials-7fa6ce12636662ba74d5a49f33e34edbee4e0197.tar
Essentials-7fa6ce12636662ba74d5a49f33e34edbee4e0197.tar.gz
Essentials-7fa6ce12636662ba74d5a49f33e34edbee4e0197.tar.lz
Essentials-7fa6ce12636662ba74d5a49f33e34edbee4e0197.tar.xz
Essentials-7fa6ce12636662ba74d5a49f33e34edbee4e0197.zip
Look out for nulls.
-rw-r--r--Essentials/src/com/earth2me/essentials/ItemDb.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java8
2 files changed, 14 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java
index 18df08347..10fd12937 100644
--- a/Essentials/src/com/earth2me/essentials/ItemDb.java
+++ b/Essentials/src/com/earth2me/essentials/ItemDb.java
@@ -139,6 +139,14 @@ public class ItemDb implements IConf, IItemDb
{
ItemData itemData = new ItemData(item.getTypeId(), item.getDurability());
List<String> nameList = names.get(itemData);
+ if (nameList == null) {
+ itemData = new ItemData(item.getTypeId(), (short) 0);
+ nameList = names.get(itemData);
+ if (nameList == null) {
+ return null;
+ }
+ }
+
if (nameList.size() > 15)
{
nameList = nameList.subList(0, 14);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
index 260c76693..11d633286 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
@@ -37,7 +37,7 @@ public class Commanditemdb extends EssentialsCommand
itemStack = ess.getItemDb().get(args[0]);
}
sender.sendMessage(_("itemType", itemStack.getType().toString(), itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability())));
-
+
if (itemHeld && itemStack.getType() != Material.AIR)
{
int maxuses = itemStack.getType().getMaxDurability();
@@ -47,6 +47,10 @@ public class Commanditemdb extends EssentialsCommand
sender.sendMessage(_("durability", Integer.toString(durability)));
}
}
- sender.sendMessage(_("itemNames", ess.getItemDb().names(itemStack)));
+ final String itemNameList = ess.getItemDb().names(itemStack);
+ if (itemNameList != null)
+ {
+ sender.sendMessage(_("itemNames", ess.getItemDb().names(itemStack)));
+ }
}
}