2011-05-29 13:25:25 +02:00
|
|
|
package com.Acrobot.ChestShop.Commands;
|
|
|
|
|
2011-06-09 22:54:01 +02:00
|
|
|
import com.Acrobot.ChestShop.Config.Config;
|
2011-06-11 17:36:55 +02:00
|
|
|
import com.Acrobot.ChestShop.Config.Language;
|
2011-05-29 13:25:25 +02:00
|
|
|
import com.Acrobot.ChestShop.Items.Items;
|
2011-08-13 12:08:34 +02:00
|
|
|
import org.bukkit.ChatColor;
|
2011-05-29 13:25:25 +02:00
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
|
|
|
public class ItemInfo implements CommandExecutor {
|
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
2011-08-13 12:08:34 +02:00
|
|
|
ItemStack item;
|
2011-05-29 13:25:25 +02:00
|
|
|
if (args.length == 0) {
|
2011-07-23 21:00:47 +02:00
|
|
|
if (!(sender instanceof Player)) return false;
|
2011-08-13 12:08:34 +02:00
|
|
|
item = ((Player) sender).getItemInHand();
|
2011-05-29 13:25:25 +02:00
|
|
|
} else {
|
2011-08-13 12:08:34 +02:00
|
|
|
item = Items.getItemStack(args[0]);
|
|
|
|
}
|
2011-05-29 13:25:25 +02:00
|
|
|
|
2011-09-06 19:01:57 +02:00
|
|
|
if (item == null || item.getType() == Material.AIR) return false;
|
2011-05-29 13:25:25 +02:00
|
|
|
|
2011-08-13 12:08:34 +02:00
|
|
|
sender.sendMessage(Config.getLocal(Language.iteminfo));
|
|
|
|
sender.sendMessage(item.getTypeId() + (item.getDurability() != 0 ? " : " + item.getDurability() : "") + " - " + ChatColor.GRAY + item.getType().name());
|
|
|
|
return true;
|
2011-05-29 13:25:25 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|