Move /kit to Game

This commit is contained in:
Spencer 2017-12-31 20:58:34 -05:00 committed by Alexander Meech
parent 81d7cb144b
commit fd369bf8ea
2 changed files with 22 additions and 23 deletions

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@ -414,6 +415,11 @@ public abstract class Game extends ListenerComponent implements Lifetimed
private HashMap<UUID, LinkedList<Triple<Double, Double, Double>>> _playerPastLocs = new HashMap<>();
private Set<DebugCommand> _debugCommands = new HashSet<>();
public enum Perm implements Permission
{
DEBUG_KIT_COMMAND
}
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{
@ -512,6 +518,22 @@ public abstract class Game extends ListenerComponent implements Lifetimed
new AntiExpOrbModule().register(this);
new GameSummaryModule()
.register(this);
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
String kit = Arrays.stream(args).collect(Collectors.joining(" "));
for (Kit gkit : GetKits())
{
if (kit.equalsIgnoreCase(gkit.GetName()))
{
SetKit(caller, gkit, true);
return;
}
}
caller.sendMessage(F.main("Kit", "Sorry, but that is not a kit!"));
});
}
// You should never use this so please don't. Use Module.register instead

View File

@ -94,7 +94,6 @@ public abstract class SuperSmash extends Game
public enum Perm implements Permission
{
DEBUG_LIVES_COMMAND,
DEBUG_KIT_COMMAND,
DEBUG_SMASH_COMMAND,
DEBUG_NEXTSMASH_COMMAND,
DEBUG_COOLDOWN_COMMAND,
@ -169,28 +168,6 @@ public abstract class SuperSmash extends Game
{
giveSmashItem(caller);
});
registerDebugCommand("kit", Perm.DEBUG_KIT_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
String kit = "";
for (int i = 0; i < args.length; i++)
{
kit += args[i] + " ";
}
kit = kit.trim();
for (Kit gkit : GetKits())
{
if (kit.equalsIgnoreCase(gkit.GetName()))
{
SetKit(caller, gkit, true);
return;
}
}
caller.sendMessage(F.main("Kit", "Sorry that is not a kit!"));
});
registerDebugCommand("lives", Perm.DEBUG_LIVES_COMMAND, PermissionGroup.ADMIN, (caller, args) ->
{
Announce(C.cWhiteB + caller.getName() + C.cAquaB + " reset their lives!");