From ecd96a81dd02ba59166dbbfc1c122678c5b607d7 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 8 Sep 2012 16:33:00 +0100 Subject: Fix /itemdb showing 'uses left' on none held items. --- Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()); -- cgit v1.2.3