@ParentCommand("war") @Command( name = "map", aliases = {"select"}, args = "<id>", desc = "Set the current Map (ignores Playlist)") @CommandPermission("TacoWar.admin.set-map") public static void map(CommandContext context) { if (context.eq(0)) { context.sendMessageToSender("&cMust specify the &eMap ID"); return; } if (TacoWar.currentGame() == null) { context.sendMessageToSender("&cThe first game has not started yet"); return; } if (TacoWar.gameRunning()) { context.sendMessageToSender("&cCannot change the &eMap &cin the middle of a game"); return; } WarMap map = TacoWar.getMap(context.getString(0)); if (map == null) { context.sendMessageToSender("&cMap with the id &e" + context.getString(0) + " &cnot found"); return; } Game game = TacoWar.currentGame(); game.setMap(map); if (MapVoteSession.isRunning()) { game.getPlayers().broadcast("&eVoting ended early!"); MapVoteSession.end(); game.getPlayers().broadcast("&eAdmin choese the map"); } game.spawnAtMapLobby(true); }
@ParentCommand("war") @Command( name = "gametype", aliases = {"gt"}, args = "<id>", desc = "Set the current GameType (ignores Playlist)") @CommandPermission("TacoWar.admin.set-gametype") public static void gametype(CommandContext context) { if (context.eq(0)) { context.sendMessageToSender("&cMust specify the &eGameType ID"); return; } if (TacoWar.currentGame() == null) { context.sendMessageToSender("&cThe first game has not started yet"); return; } if (TacoWar.gameRunning()) { context.sendMessageToSender("&cCannot change the &eGameType &cin the middle of a game"); return; } Game game = TacoWar.currentGame(); WarMap map = game.getMap(); if (map == null) { context.sendMessageToSender("&cThe map has not been chosen yet"); return; } GameType gametype = TacoWar.getGameType(context.getString(0)); if (gametype == null) { context.sendMessageToSender( "&cGameType with the id &e" + context.getString(0) + " &cnot found"); return; } if (!map.gameTypeSupported(gametype.getType())) { String gtName = GameType.getGameTypeName(gametype.getType()); context.sendMessageToSender( "&cThe map &e\"" + map.getName() + "\" &cdoes not support &e" + gtName); return; } game.setGameType(gametype); context.sendMessageToSender("&aGameType set to &e" + gametype.getId()); }