ChestShop-3/com/Acrobot/ChestShop/Commands/ItemInfo.java
Acrobot a84c68d49d - Changed how configuration works, so it works with plugin folder in different place
- Added support for Deadbolt
- By default, left clicking your own sign doesn't do anything
- Restricted signs now check if you've got permission ChestShop.group.groupName
- Added support for stacking unstackable things
- Updated Register
- Changed how plugins are loaded.
2011-09-06 19:01:57 +02:00

35 lines
1.1 KiB
Java

package com.Acrobot.ChestShop.Commands;
import com.Acrobot.ChestShop.Config.Config;
import com.Acrobot.ChestShop.Config.Language;
import com.Acrobot.ChestShop.Items.Items;
import org.bukkit.ChatColor;
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) {
ItemStack item;
if (args.length == 0) {
if (!(sender instanceof Player)) return false;
item = ((Player) sender).getItemInHand();
} else {
item = Items.getItemStack(args[0]);
}
if (item == null || item.getType() == Material.AIR) return false;
sender.sendMessage(Config.getLocal(Language.iteminfo));
sender.sendMessage(item.getTypeId() + (item.getDurability() != 0 ? " : " + item.getDurability() : "") + " - " + ChatColor.GRAY + item.getType().name());
return true;
}
}