use of au.com.mineauz.minigamesregions.RegionModule 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;
}
use of au.com.mineauz.minigamesregions.RegionModule in project Minigames by AddstarMC.
the class SetRegionCommand 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.length == 2) {
if (args[0].equalsIgnoreCase("select")) {
Location ploc = ply.getLocation();
ploc.setY(ploc.getY() - 1);
if (args[1].equals("1")) {
Location p2 = ply.getSelectionPoints()[1];
ply.clearSelection();
ply.setSelection(ploc, p2);
ply.sendMessage(ChatColor.GRAY + "Point 1 selected");
} else {
Location p2 = ply.getSelectionPoints()[0];
ply.clearSelection();
ply.setSelection(p2, ploc);
ply.sendMessage(ChatColor.GRAY + "Point 2 selected");
}
return true;
} else if (args[0].equalsIgnoreCase("create")) {
if (ply.hasSelection()) {
String name = args[1];
rmod.addRegion(name, new Region(name, ply.getSelectionPoints()[0], ply.getSelectionPoints()[1]));
ply.clearSelection();
ply.sendMessage(ChatColor.GRAY + "Created new region for " + minigame.getName(false) + " named " + name);
} else {
ply.sendMessage(ChatColor.RED + "You have not made a selection!");
}
return true;
} else if (args[0].equalsIgnoreCase("delete")) {
if (rmod.hasRegion(args[1])) {
rmod.removeRegion(args[1]);
ply.sendMessage(ChatColor.GRAY + "Removed the region named " + args[1] + " from " + minigame.getName(false));
} else {
ply.sendMessage(ChatColor.GRAY + "No region by the name " + args[1] + " was found in " + minigame.getName(false));
}
return true;
}
} else if (args.length == 1) {
if (args[0].equalsIgnoreCase("modify")) {
rmod.displayMenu(ply, null);
return true;
}
}
}
return false;
}
Aggregations