Package com.garbagemule.MobArena.commands.setup

Source Code of com.garbagemule.MobArena.commands.setup.RemoveArenaCommand

package com.garbagemule.MobArena.commands.setup;

import org.bukkit.command.CommandSender;

import com.garbagemule.MobArena.*;
import com.garbagemule.MobArena.commands.*;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.framework.ArenaMaster;

@CommandInfo(
    name    = "removearena",
    pattern = "(del(.)*|r(e)?m(ove)?)arena",
    usage   = "/ma removearena <arena>",
    desc    = "remove an arena",
    permission = "mobarena.setup.removearena"
)
public class RemoveArenaCommand implements Command
{
    @Override
    public boolean execute(ArenaMaster am, CommandSender sender, String... args) {
        // Require an arena name
        if (args.length != 1) return false;
       
        if (am.getArenas().size() == 1) {
            Messenger.tell(sender, "At least one arena must exist.");
            return true;
        }
       
        Arena arena = am.getArenaWithName(args[0]);
        if (arena == null) {
            Messenger.tell(sender, "There is no arena with that name.");
            return true;
        }
        am.removeArenaNode(arena);
        Messenger.tell(sender, "Arena '" + arena.configName() + "' deleted.");
        return true;
    }
}
TOP

Related Classes of com.garbagemule.MobArena.commands.setup.RemoveArenaCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.