Renamed /find to /itemdb

This commit is contained in:
Khyperia 2011-12-07 05:58:44 +08:00 committed by snowleo
parent a0d66ce230
commit d573671933
2 changed files with 18 additions and 6 deletions

View file

@ -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()));
}
}

View file

@ -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]