public ArenaEditorExecutor() {
   super();
   this.ac = BattleArena.getBAC();
   this.aac = BattleArena.getArenaEditor();
 }
Пример #2
0
  public static boolean alterArena(CommandSender sender, Arena arena, String[] args) {
    if (args.length < 3) {
      showAlterHelp(sender);
      //			sendMessage(sender,ChatColor.YELLOW+ "      or /arena alter MainArena spawnitem
      // <itemname>:<matchEndTime between spawn> ");
      return false;
    }
    BattleArenaController ac = BattleArena.getBAC();
    String arenaName = arena.getName();
    String changetype = args[2];
    String value = null;
    if (args.length > 3) value = args[3];
    String[] otherOptions = args.length > 4 ? Arrays.copyOfRange(args, 4, args.length) : null;
    if (Defaults.DEBUG)
      System.out.println("alterArena " + arenaName + ":" + changetype + ":" + value);

    boolean success = false;
    ChangeType ct = ChangeType.fromName(changetype);
    if (ct == null) {
      sendMessage(
          sender,
          ChatColor.RED
              + "Option: &6"
              + changetype
              + "&c does not exist. \n&cValid options are &6"
              + ChangeType.getValidList());
      showAlterHelp(sender);
      return false;
    }
    switch (ct) {
      case TEAMSIZE:
        success = changeTeamSize(sender, arena, ac, value);
        break;
      case NTEAMS:
        success = changeNTeams(sender, arena, ac, value);
        break;
      case TYPE:
        success = changeType(sender, arena, ac, value);
        break;
      case SPAWNLOC:
        success = changeSpawn(sender, arena, ac, changetype, value, otherOptions);
        break;
      case VLOC:
        success = changeVisitorSpawn(sender, arena, ac, changetype, value, otherOptions);
        break;
      case WAITROOM:
        success = changeWaitroomSpawn(sender, arena, ac, changetype, value, otherOptions);
        break;
      case ADDREGION:
        success = addWorldGuardRegion(sender, arena, ac, value);
        break;
      default:
        sendMessage(
            sender,
            ChatColor.RED
                + "Option: &6"
                + changetype
                + "&c does not exist. \n&cValid options are &6"
                + ChangeType.getValidList());
        break;
    }
    if (success) BattleArena.saveArenas();
    return success;
  }