From 024aff0af5a7b24dd540b0a3601d9d92a44c2687 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 10 Jun 2012 18:31:28 +0100 Subject: [PATCH] Remove dura command and merge into itemdb. --- .../commands/Commanddurability.java | 41 ------------------- .../essentials/commands/Commanditemdb.java | 12 ++++++ Essentials/src/plugin.yml | 6 +-- 3 files changed, 13 insertions(+), 46 deletions(-) delete mode 100644 Essentials/src/com/earth2me/essentials/commands/Commanddurability.java diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddurability.java b/Essentials/src/com/earth2me/essentials/commands/Commanddurability.java deleted file mode 100644 index 130164443..000000000 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddurability.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.earth2me.essentials.commands; - -import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.User; -import org.bukkit.Material; -import org.bukkit.Server; -import org.bukkit.inventory.ItemStack; - -public class Commanddurability extends EssentialsCommand -{ - public int durability; - public int maxuses; - - public Commanddurability() - { - super("durability"); - } - - @Override - protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception - { - ItemStack itemStack = user.getItemInHand(); - maxuses = itemStack.getType().getMaxDurability(); - durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability()); - if (itemStack.getType() != Material.AIR) - { - if (maxuses != 0) - { - user.sendMessage(_("durability", Integer.toString(durability))); - } - else - { - user.sendMessage(_("noDurability")); - } - } - else - { - user.sendMessage(_("nothingInHand")); - } - } -} \ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java index c35656c72..728a419a9 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.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -33,5 +35,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 c1af012d4..55fb38de0 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -79,10 +79,6 @@ commands: description: States current depth, relative to sea level. usage: /depth aliases: [edepth] - durability: - description: Shows the uses an item has left. - usage: / - aliases: [edura,dura,edurability] eco: description: Manages the server economy. usage: / @@ -114,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]