From cc02df0f78949ab49ca5138b1f51fe01391fb7e6 Mon Sep 17 00:00:00 2001 From: ementalo Date: Mon, 18 Jun 2012 10:22:28 +0100 Subject: [PATCH] Itemdb shows durability of item in hand --- .../earth2me/essentials/commands/Commanditemdb.java | 12 ++++++++++++ Essentials/src/plugin.yml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java index 6d0a17037..27f51f0b6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java @@ -1,5 +1,7 @@ package com.earth2me.essentials.commands; +import static com.earth2me.essentials.I18n._; +import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -27,5 +29,15 @@ public class Commanditemdb extends EssentialsCommand itemStack = ess.getItemDb().get(args[0]); } sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData())); + + int maxuses = itemStack.getType().getMaxDurability(); + int durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability()); + if (itemStack.getType() != Material.AIR) + { + if (maxuses != 0) + { + sender.sendMessage(_("durability", Integer.toString(durability))); + } + } } } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 32ec97620..5a157046c 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -110,7 +110,7 @@ commands: itemdb: description: Searches for an item. usage: / - aliases: [eitemdb] + aliases: [eitemdb,itemno,eitemno,durability,dura,edura,edurability] fireball: description: Throw a fireball. usage: / [small]