package pw.yumc.Residence.commandmain;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;

import cn.citycraft.PluginHelper.commands.BaseCommand;
import pw.yumc.Residence.ResidenceMain;

public class CommandResWorld extends BaseCommand {
    ResidenceMain plugin;

    public CommandResWorld(final ResidenceMain plugin) {
        super("resworld");
        this.plugin = plugin;
        setMinimumArguments(2);
        setPossibleArguments("remove <世界名称>");
    }

    @Override
    public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
        if (args[0].equalsIgnoreCase("remove")) {
            if (sender instanceof ConsoleCommandSender) {
                plugin.getResidenceManager().removeAllFromWorld(sender, args[1]);
            } else {
                sender.sendMessage(ChatColor.RED + "当前命令必须从控制台执行.");
            }
        }
    }

}
