package nautilus.game.arcade.command; import java.util.ArrayList; import org.bukkit.entity.Player; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.Game.GameState; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.C; public class SetCommand extends CommandBase { public SetCommand(ArcadeManager plugin) { super(plugin, Rank.ADMIN, "set"); } @Override public void Execute(Player caller, String[] args) { if (Plugin.GetGame() == null) return; if (args.length == 0) { caller.sendMessage("/game set (Map)"); return; } String game = args[0].toLowerCase(); if (args.length > 1) Plugin.GetGameCreationManager().MapPref = args[1]; //Parse Game ArrayList matches = new ArrayList(); for (GameType type : GameType.values()) { if (type.toString().toLowerCase().equals(game)) { matches.clear(); matches.add(type); break; } if (type.toString().toLowerCase().contains(game)) { matches.add(type); } } if (matches.size() == 0) { caller.sendMessage("No results for: " + game); return; } if (matches.size() > 1) { caller.sendMessage("Matched multiple games;"); for (GameType cur : matches) caller.sendMessage(cur.toString()); return; } GameType type = matches.get(0); Plugin.GetGameCreationManager().SetNextGameType(type); //End Current if (Plugin.GetGame().GetState() == GameState.Recruit) { Plugin.GetGame().SetState(GameState.Dead); Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " has changed game to " + type.GetName() + "."); } else { Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " set next game to " + type.GetName() + "."); } } }