@Override
  public void handle(CommandSender cs, String cmd, String[] args) {
    if (args.length < 1) {
      ChatUtils.helpCommand(cs, getUsage(), HungerGames.CMD_ADMIN);
      return;
    }
    game = GameManager.INSTANCE.getRawGame(args[0]);
    if (game == null) {
      ChatUtils.error(cs, Lang.getNotExist().replace("<item>", args[0]));
      return;
    }

    boolean flag;
    if (args.length == 1) {
      flag = true;
    } else {
      flag = Boolean.valueOf(args[1]);
    }
    game.setEnabled(flag);
    if (flag) {
      ChatUtils.send(cs, "%s has been enabled.", game.getName());
    } else {
      ChatUtils.send(cs, "%s has been disabled and stopped if it was running.", game.getName());
    }
  }
Exemplo n.º 2
0
  @Override
  public void handle(CommandSender cs, String label, String[] args) {
    String name = (args.length < 1) ? Defaults.Config.DEFAULT_GAME.getGlobalString() : args[0];
    if (name == null) {
      ChatUtils.helpCommand(cs, getUsage(), HungerGames.CMD_ADMIN);
      return;
    }

    game = GameManager.INSTANCE.getRawGame(name);
    if (game == null) {
      ChatUtils.error(cs, "%s does not exist.", name);
      return;
    }
    if (!game.checkForGameOver(false)) game.stopGame(cs, false);
  }
  @Override
  public void handlePlayer(Player player, String label, String[] args) {
    if (args.length < 1) {
      ChatUtils.helpCommand(player, getUsage(), HungerGames.CMD_ADMIN);
      return;
    }
    game = GameManager.INSTANCE.getRawGame(args[0]);

    if (game == null) {
      ChatUtils.error(player, Lang.getNotExist().replace("<item>", args[0]));
      return;
    }

    ChatUtils.send(player, "Click the two corners add an infowall.");
    SessionListener.addSession(
        SessionType.INFO_WALL_ADDER, player, game.getName(), "game", game.getName());
  }