Search in sources :

Example 1 with Node

use of au.com.mineauz.minigamesregions.Node in project Minigames by AddstarMC.

the class SetNodeCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
    if (args != null) {
        MinigamePlayer ply = Minigames.plugin.pdata.getMinigamePlayer((Player) sender);
        RegionModule rmod = RegionModule.getMinigameModule(minigame);
        if (args[0].equalsIgnoreCase("create") && args.length >= 2) {
            if (!rmod.hasNode(args[1])) {
                rmod.addNode(args[1], new Node(args[1], ply.getLocation()));
                sender.sendMessage(ChatColor.GRAY + "Added new node called " + args[1] + " to " + minigame);
            } else
                sender.sendMessage(ChatColor.RED + "A node by the name " + args[1] + " already exists in " + minigame);
            return true;
        } else if (args[0].equalsIgnoreCase("modify")) {
            rmod.displayMenu(ply, null);
            return true;
        } else if (args[0].equalsIgnoreCase("delete") && args.length >= 2) {
            if (rmod.hasNode(args[1])) {
                rmod.removeNode(args[1]);
                sender.sendMessage(ChatColor.GRAY + "Removed a node called " + args[1] + " from " + minigame);
            } else
                sender.sendMessage(ChatColor.RED + "A node by the name " + args[1] + " doesn't exists in " + minigame);
            return true;
        }
    }
    return false;
}
Also used : RegionModule(au.com.mineauz.minigamesregions.RegionModule) MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) Node(au.com.mineauz.minigamesregions.Node)

Aggregations

MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)1 Node (au.com.mineauz.minigamesregions.Node)1 RegionModule (au.com.mineauz.minigamesregions.RegionModule)1