mirror of
https://e.coding.net/circlecloud/ProtectItem.git
synced 2024-12-27 20:48:51 +00:00
add new command list ...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
6341c07819
commit
b871b570c0
@ -0,0 +1,25 @@
|
||||
package cn.citycraft.ProtectItem.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
import cn.citycraft.ProtectItem.ProtectItem;
|
||||
|
||||
public class CommandList extends BaseCommand {
|
||||
ProtectItem plugin;
|
||||
|
||||
public CommandList(final ProtectItem main) {
|
||||
super("list");
|
||||
this.plugin = main;
|
||||
setPermission("pi.list");
|
||||
setDescription("§b查看已禁封的物品列表");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||
plugin.getItemManager().sendBanList(sender);
|
||||
}
|
||||
|
||||
}
|
@ -19,6 +19,7 @@ public class ProtectItemCommand implements CommandExecutor, DefaultCommand {
|
||||
hsc = new HandlerSubCommand(main);
|
||||
hsc.setDefaultCommand(this);
|
||||
hsc.registerCommand(new CommandBan(main));
|
||||
hsc.registerCommand(new CommandList(main));
|
||||
hsc.registerCommand(new CommandUnban(main));
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -105,6 +106,18 @@ public class ItemManager {
|
||||
itemconfig.save();
|
||||
}
|
||||
|
||||
public void sendBanList(final CommandSender sender) {
|
||||
sender.sendMessage("§6服务器已禁封的物品如下:");
|
||||
sender.sendMessage("§a物品 §c操作");
|
||||
for (final Entry<String, List<ActionType>> item : itemlist.entrySet()) {
|
||||
String acts = "";
|
||||
for (final ActionType act : item.getValue()) {
|
||||
acts += act.toString() + " ";
|
||||
}
|
||||
sender.sendMessage("§a" + item.getKey() + " §c " + acts);
|
||||
}
|
||||
}
|
||||
|
||||
public void unBanItem(final ItemStack item) {
|
||||
final String itemname = getItemName(item);
|
||||
itemlist.remove(itemname);
|
||||
|
Loading…
Reference in New Issue
Block a user