public void createMap(String id, Player p) throws EmptyClipboardException { Selection sel = WorldEditUtilities.getWorldEdit().getSelection(p); if (sel != null) { MapConfiguration.getMaps().reloadMap(id); Location b1 = new Location( p.getWorld(), sel.getNativeMinimumPoint().getBlockX(), sel.getNativeMinimumPoint().getBlockY(), sel.getNativeMinimumPoint().getBlockZ()); Location b2 = new Location( p.getWorld(), sel.getNativeMaximumPoint().getBlockX(), sel.getNativeMaximumPoint().getBlockY(), sel.getNativeMaximumPoint().getBlockZ()); MapConfiguration.getMaps().getMap(id).set("region.p1.w", b1.getWorld().getName()); MapConfiguration.getMaps().getMap(id).set("region.p1.x", b1.getBlockX()); MapConfiguration.getMaps().getMap(id).set("region.p1.y", b1.getBlockY()); MapConfiguration.getMaps().getMap(id).set("region.p1.z", b1.getBlockZ()); MapConfiguration.getMaps().getMap(id).set("region.p2.w", b2.getWorld().getName()); MapConfiguration.getMaps().getMap(id).set("region.p2.x", b2.getBlockX()); MapConfiguration.getMaps().getMap(id).set("region.p2.y", b2.getBlockY()); MapConfiguration.getMaps().getMap(id).set("region.p2.z", b2.getBlockZ()); MapConfiguration.getMaps().saveMap(id); List<String> enabled = DataConfiguration.getData().getDataFile().getStringList("enabled-maps"); enabled.add(id); DataConfiguration.getData().getDataFile().set("enabled-maps", enabled); DataConfiguration.getData().saveData(); } else { throw new EmptyClipboardException(); } }
public Map(GameState gameState, MapConfiguration config) { this.config = config; nodes = new ArrayList<Node>(); int id = 0; for (NodeConfiguration nc : config.getNodes()) nodes.add(nc.createNode(gameState, id++)); lanes = new ArrayList<Lane>(); for (LaneConfiguration lc : config.getLanes()) lanes.add(lc.createLane(gameState)); }
public void setTeamSpawn(String map, String team, Location l) { MapConfiguration.getMaps().getMap(map).set(team + ".spawn.w", l.getWorld().getName()); MapConfiguration.getMaps().getMap(map).set(team + ".spawn.x", l.getBlockX()); MapConfiguration.getMaps().getMap(map).set(team + ".spawn.y", l.getBlockY()); MapConfiguration.getMaps().getMap(map).set(team + ".spawn.z", l.getBlockZ()); MapConfiguration.getMaps().getMap(map).set(team + ".spawn.pitch", l.getPitch()); MapConfiguration.getMaps().getMap(map).set(team + ".spawn.yaw", l.getYaw()); MapConfiguration.getMaps().saveMap(map); }
public List<Location> getCapturePoints() { List<Location> locs = new ArrayList<Location>(); for (String id : MapConfiguration.getMaps() .getMap(map) .getConfigurationSection("capture-points") .getKeys(false)) { locs.add(CapturePointUtilities.getUtilities().getLocationFromID(map, Integer.parseInt(id))); } return locs; }
public Location loadTeamSpawn(String map, String team) { return new Location( plugin .getServer() .getWorld(MapConfiguration.getMaps().getMap(map).getString(team + ".spawn.w")), MapConfiguration.getMaps().getMap(map).getInt(team + ".spawn.x") + .5, MapConfiguration.getMaps().getMap(map).getInt(team + ".spawn.y"), MapConfiguration.getMaps().getMap(map).getInt(team + ".spawn.z") + .5, MapConfiguration.getMaps().getMap(map).getInt(team + ".spawn.yaw"), MapConfiguration.getMaps().getMap(map).getInt(team + ".spawn.pitch")); }
public GameState(MapConfiguration mapConfig, List<PlayerData> players) { map = mapConfig.createMap(this); this.players = new HashMap<Integer, Player>(); timerTick = 0; this.races = new ArrayList<Race>(); for (int i = 0; i < players.size(); i++) { Race r = null; try { r = (Race) Configuration.copyConfiguration(players.get(i).getRace()); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (r == null) throw new RuntimeException("Error copying race"); this.races.add(r); Node[] startNodes = {map.getStartNode(players.get(i).getStartingSlot() - 1)}; Player p = new Player(this, startNodes, r, players.get(i).getName(), i); this.players.put(i, p); } // TODO this dummy player is for debugging purposes Race r = null; int i = this.players.size(); try { r = (Race) Configuration.copyConfiguration(players.get(0).getRace()); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (r == null) throw new RuntimeException("Error copying race"); this.races.add(r); Node[] nodes = this.getMap().getNodes(); List<Node> dummyStartNodes = new ArrayList<Node>(); for (Node n : nodes) if (n.getOwner() == null) dummyStartNodes.add(n); Player dummyPlayer = new Player(this, dummyStartNodes.toArray(new Node[0]), r, "dummy PLayer", i); this.players.put(i, dummyPlayer); }
public YamlConfiguration(MapConfiguration config) { super(config.getRoot()); initialize(); }
public void setPlayerLimit(String map, Integer count) { MapConfiguration.getMaps().getMap(map).set("playerlimit", count); MapConfiguration.getMaps().saveMap(map); }
public void setTimeLimit(String map, Integer time) { MapConfiguration.getMaps().getMap(map).set("timelimit", time); MapConfiguration.getMaps().saveMap(map); }
/** @return the dimensions of the map */ public Position getDimensions() { return config.getImageSize(); }