From d7d9ac729bb65d033548a456889c2d9b5b3ce50f Mon Sep 17 00:00:00 2001 From: Electroid Date: Tue, 6 Jun 2017 01:08:39 -0700 Subject: [PATCH] Add blitz command --- .../tc/oc/pgm/commands/AdminCommands.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/PGM/src/main/java/tc/oc/pgm/commands/AdminCommands.java b/PGM/src/main/java/tc/oc/pgm/commands/AdminCommands.java index 8ffa835..48f0af0 100644 --- a/PGM/src/main/java/tc/oc/pgm/commands/AdminCommands.java +++ b/PGM/src/main/java/tc/oc/pgm/commands/AdminCommands.java @@ -18,6 +18,10 @@ import tc.oc.commons.core.restart.RestartManager; import tc.oc.commons.core.util.TimeUtils; import tc.oc.pgm.PGM; import tc.oc.pgm.PGMTranslations; +import tc.oc.pgm.blitz.BlitzMatchModule; +import tc.oc.pgm.blitz.BlitzMatchModuleImpl; +import tc.oc.pgm.blitz.BlitzProperties; +import tc.oc.pgm.blitz.Lives; import tc.oc.pgm.map.PGMMap; import tc.oc.pgm.match.Competitor; import tc.oc.pgm.match.Match; @@ -223,4 +227,24 @@ public class AdminCommands implements Commands { sender.sendMessage(ChatColor.GREEN + PGMTranslations.get().t("command.admin.pgm", sender)); } + + @Command( + aliases = {"blitz"}, + desc = "Enable blitz on the fly", + usage = " ", + min = 0, + max = 2 + ) + @CommandPermissions("pgm.blitz") + public void blitz(CommandContext args, CommandSender sender) throws CommandException { + Match match = CommandUtils.getMatch(sender); + BlitzMatchModule blitz = match.needMatchModule(BlitzMatchModuleImpl.class); + if(blitz.activated()) { + blitz.deactivate(); + } + int lives = args.getInteger(0, 1); + Lives.Type type = tc.oc.commons.bukkit.commands.CommandUtils.getEnum(args, sender, 1, Lives.Type.class, Lives.Type.INDIVIDUAL); + blitz.activate(BlitzProperties.create(match, lives, type)); + } + }