コード例 #1
0
  @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());
    }
  }
コード例 #2
0
 @Override
 public void handlePlayer(Player player, String cmd, String[] args) {
   game = GameManager.INSTANCE.getRawSession(player);
   if (game == null) {
     ChatUtils.error(player, "You are currently not in a game.");
     return;
   }
   game.rejoin(player);
 }
コード例 #3
0
 private static HungerGame insideGame(Location loc) {
   for (HungerGame game : GameManager.INSTANCE.getRawGames()) {
     if (game.getWorlds().size() <= 0 && game.getCuboids().size() <= 0) return null;
     if (game.getWorlds().contains(loc.getWorld())) return game;
     for (Cuboid c : game.getCuboids()) {
       if (c.isLocationWithin(loc)) return game;
     }
   }
   return null;
 }
コード例 #4
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);
  }
コード例 #5
0
  @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());
  }