6886484d79
cmds for jnr devs smaller head hitbox in MS added MB to parser plugin
88 lines
2.0 KiB
Java
88 lines
2.0 KiB
Java
package nautilus.game.arcade.command;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.command.CommandSender;
|
|
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;
|
|
import mineplex.core.common.util.UtilPlayer;
|
|
|
|
public class SetCommand extends CommandBase<ArcadeManager>
|
|
{
|
|
public SetCommand(ArcadeManager plugin)
|
|
{
|
|
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "set");
|
|
}
|
|
|
|
@Override
|
|
public void Execute(Player caller, String[] args)
|
|
{
|
|
if (Plugin.GetGame() == null)
|
|
return;
|
|
|
|
if (args.length == 0)
|
|
{
|
|
caller.sendMessage("/game set <GameType> (Map)");
|
|
return;
|
|
}
|
|
|
|
String game = args[0].toLowerCase();
|
|
|
|
if (args.length > 1)
|
|
{
|
|
Plugin.GetGameCreationManager().MapPref = args[1];
|
|
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[1]);
|
|
}
|
|
|
|
//Parse Game
|
|
ArrayList<GameType> matches = new ArrayList<GameType>();
|
|
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.GetGame().setGame(type, caller, true);
|
|
}
|
|
|
|
@Override
|
|
public List<String> onTabComplete(CommandSender sender, String commandLabel, String[] args)
|
|
{
|
|
String lastArg = args[args.length - 1];
|
|
|
|
return getMatches(lastArg, GameType.values());
|
|
}
|
|
}
|