Ejemplo n.º 1
0
 @Command(
     aliases = {"cancel"},
     desc = "Cancels the current countdown.")
 @CommandPermissions("cardinal.cancel")
 public static void cancel(final CommandContext cmd, CommandSender sender) {
   GameHandler handler = GameHandler.getGameHandler();
   if (GameHandler.getGameHandler().getMatch().getState() == MatchState.CYCLING) BossBar.delete();
   if (GameHandler.getGameHandler().getMatch().getState() == MatchState.STARTING) BossBar.delete();
   if (!handler.getMatch().getModules().getModule(CycleTimerModule.class).isCancelled())
     handler.getMatch().getModules().getModule(CycleTimerModule.class).setCancelled(true);
   if (!handler.getMatch().getModules().getModule(StartTimer.class).isCancelled())
     handler.getMatch().getModules().getModule(StartTimer.class).setCancelled(true);
   if (handler.getMatch().getState().equals(MatchState.STARTING))
     handler.getMatch().setState(MatchState.WAITING);
   if (handler.getMatch().getState().equals(MatchState.CYCLING))
     handler.getMatch().setState(MatchState.ENDED);
   ChatUtil.getGlobalChannel()
       .sendLocalizedMessage(
           new UnlocalizedChatMessage(
               ChatColor.GREEN + "{0}",
               new LocalizedChatMessage(ChatConstant.GENERIC_COUNTDOWN_CANELLED)));
 }