public WorldEditPlugin getWorldEdit() {
return p.getWorldEdit();
}
public void createArenaFromSelection(Player pl) {
FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
//SettingsManager s = SettingsManager.getInstance();
WorldEditPlugin we = p.getWorldEdit();
Selection sel = we.getSelection(pl);
if (sel == null) {
msgmgr.sendMessage(PrefixType.WARNING, "You must make a WorldEdit Selection first!", pl);
return;
}
Location max = sel.getMaximumPoint();
Location min = sel.getMinimumPoint();
/* if(max.getWorld()!=SettingsManager.getGameWorld() || min.getWorld()!=SettingsManager.getGameWorld()){
pl.sendMessage(ChatColor.RED+"Wrong World!");
return;
}*/
int no = c.getInt("sg-system.arenano") + 1;
c.set("sg-system.arenano", no);
if (games.size() == 0) {
no = 1;
} else no = games.get(games.size() - 1).getID() + 1;
SettingsManager.getInstance().getSpawns().set(("spawns." + no), null);
c.set("sg-system.arenas." + no + ".world", max.getWorld().getName());
c.set("sg-system.arenas." + no + ".x1", max.getBlockX());
c.set("sg-system.arenas." + no + ".y1", max.getBlockY());
c.set("sg-system.arenas." + no + ".z1", max.getBlockZ());
c.set("sg-system.arenas." + no + ".x2", min.getBlockX());
c.set("sg-system.arenas." + no + ".y2", min.getBlockY());
c.set("sg-system.arenas." + no + ".z2", min.getBlockZ());
c.set("sg-system.arenas." + no + ".enabled", true);
SettingsManager.getInstance().saveSystemConfig();
hotAddArena(no);
pl.sendMessage(ChatColor.GREEN + "Arena ID " + no + " Succesfully added");