use of pl.themolka.arcade.map.MapManager in project Arcade2 by ShootGame.
the class ArcadePlugin method loadMaps.
private void loadMaps() {
this.maps = new MapManager(this);
this.maps.setWorldContainer(this.settings.getWorldContainer().toFile());
MapContainerFillEvent fillEvent = new MapContainerFillEvent(this);
this.getEventBus().publish(fillEvent);
MapManager maps = this.getMaps();
for (MapContainerLoader loader : fillEvent.getMapLoaderList()) {
maps.addMapLoader(loader);
}
maps.getContainer().register(maps.getLoaderListContainer());
this.getLogger().info("Loaded " + maps.getContainer().getMaps().size() + " map(s) into the plugin.");
}
use of pl.themolka.arcade.map.MapManager in project Arcade2 by ShootGame.
the class SimpleGameManager method createGame.
@Override
public Game createGame(ArcadeMap map) throws DOMException, IOException {
MapManager maps = this.plugin.getMaps();
this.plugin.getLogger().info("Accessing the '" + map.getMapInfo().getDirectory().getName() + "' directory...");
File[] copied = maps.copyFiles(map);
StringBuilder copiedFiles = new StringBuilder();
for (int i = 0; i < copied.length; i++) {
File file = copied[i];
copiedFiles.append(file.getName());
if (file.isDirectory()) {
copiedFiles.append("[d]");
} else if (file.isFile()) {
copiedFiles.append("[f]");
}
if (i != copied.length - 1) {
copiedFiles.append(", ");
}
}
this.plugin.getLogger().info("Copied " + copied.length + " map files - " + copiedFiles.toString() + ".");
this.plugin.getLogger().info("Generating new unique world '" + map.getWorldName() + "' for map '" + map.getMapInfo().getName() + "'...");
World world = maps.createWorld(map);
Game game = new Game(this.plugin, this.gameId++, map, world);
map.setGame(game);
// Don't forget to setup the world object!
map.getManifest().getWorld().getSpawn().setWorld(world);
for (ArcadePlayer player : this.plugin.getPlayers()) {
GamePlayer gamePlayer = player.getGamePlayer();
gamePlayer.getBossBarFacet().removeAll();
player.setGamePlayer(new GamePlayer(game, player));
game.getPlayers().playerJoin(player.getGamePlayer());
}
this.resetPlayers(game);
return game;
}
Aggregations