diff options
author | Khyperia <khyperia@live.com> | 2011-12-07 05:58:44 +0800 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-12-07 08:53:14 +0800 |
commit | d57367193307c07f4e6924419b7ca16369f4dbf9 (patch) | |
tree | 71d45c1fef28e39eddfe4a371e6cbab6dc1814a2 | |
parent | a0d66ce23049b6309090b9fcf021487fce71d75d (diff) | |
download | Essentials-d57367193307c07f4e6924419b7ca16369f4dbf9.tar Essentials-d57367193307c07f4e6924419b7ca16369f4dbf9.tar.gz Essentials-d57367193307c07f4e6924419b7ca16369f4dbf9.tar.lz Essentials-d57367193307c07f4e6924419b7ca16369f4dbf9.tar.xz Essentials-d57367193307c07f4e6924419b7ca16369f4dbf9.zip |
Renamed /find to /itemdb
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java (renamed from Essentials/src/com/earth2me/essentials/commands/Commandfind.java) | 20 | ||||
-rw-r--r-- | Essentials/src/plugin.yml | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfind.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java index 40590501f..2fff20e8c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfind.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java @@ -2,12 +2,13 @@ package com.earth2me.essentials.commands; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class Commandfind extends EssentialsCommand +public class Commanditemdb extends EssentialsCommand { - public Commandfind() + public Commanditemdb() { super("find"); } @@ -15,11 +16,22 @@ public class Commandfind extends EssentialsCommand @Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { + ItemStack itemStack = null; if (args.length < 1) { - throw new NotEnoughArgumentsException(); + if (sender instanceof Player) + { + itemStack = ((Player)sender).getItemInHand(); + } + if (itemStack == null) + { + throw new NotEnoughArgumentsException(); + } + } + else + { + itemStack = ess.getItemDb().get(args[0]); } - ItemStack itemStack = ess.getItemDb().get(args[0]); sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData())); } } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 681ff428f..ac1ced96e 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -102,10 +102,10 @@ commands: description: Satisfy the hunger. usage: /<command> [player] aliases: [efeed] - find: + itemdb: description: Searches for an item. usage: /<command> <item> - aliases: [efind] + aliases: [eitemdb] fireball: description: Throw a fireball. usage: /<command> [small] |