summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-09-08 16:33:00 +0100
committerKHobbits <rob@khobbits.co.uk>2012-09-08 16:33:00 +0100
commitecd96a81dd02ba59166dbbfc1c122678c5b607d7 (patch)
treeda0df89e21f47390ccaacbcc11330e017b672882
parent427108574e2e7119497ccb211fb5a0a446cfc50a (diff)
downloadEssentials-ecd96a81dd02ba59166dbbfc1c122678c5b607d7.tar
Essentials-ecd96a81dd02ba59166dbbfc1c122678c5b607d7.tar.gz
Essentials-ecd96a81dd02ba59166dbbfc1c122678c5b607d7.tar.lz
Essentials-ecd96a81dd02ba59166dbbfc1c122678c5b607d7.tar.xz
Essentials-ecd96a81dd02ba59166dbbfc1c122678c5b607d7.zip
Fix /itemdb showing 'uses left' on none held items.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
index f41c7684f..71b428287 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
@@ -19,10 +19,12 @@ public class Commanditemdb extends EssentialsCommand
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
ItemStack itemStack = null;
+ boolean itemHeld = false;
if (args.length < 1)
{
if (sender instanceof Player)
{
+ itemHeld = true;
itemStack = ((Player)sender).getItemInHand();
}
if (itemStack == null)
@@ -36,7 +38,7 @@ public class Commanditemdb extends EssentialsCommand
}
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getDurability()));
- if (itemStack.getType() != Material.AIR)
+ if (itemHeld && itemStack.getType() != Material.AIR)
{
int maxuses = itemStack.getType().getMaxDurability();
int durability = ((maxuses + 1) - itemStack.getDurability());