mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-24 19:15:48 +01:00
a84c68d49d
- 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.
35 lines
1.1 KiB
Java
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;
|
|
|
|
}
|
|
}
|