@MCCommand(
     cmds = {"select", "sel"},
     admin = true)
 public boolean arenaSelect(CommandSender sender, Arena arena) {
   aac.setCurrentArena(sender, arena);
   return MessageUtil.sendMessage(sender, "&2You have selected arena &6" + arena.getName());
 }
 @MCCommand(
     cmds = {"hidespawns"},
     admin = true,
     selection = true,
     usage = "hidespawns")
 public boolean arenaHideSpawns(Player sender) {
   Arena arena = aac.getArena(sender);
   ArenaDebugger ad = ArenaDebugger.getDebugger(arena);
   ad.hideSpawns(sender);
   ArenaDebugger.removeDebugger(ad);
   return sendMessage(sender, ChatColor.YELLOW + "You are hiding spawns for &6" + arena.getName());
 }
  @MCCommand(
      cmds = {"showspawns"},
      admin = true,
      selection = true,
      usage = "showspawns")
  public boolean arenaShowSpawns(Player sender) {
    Arena arena = aac.getArena(sender);

    ArenaDebugger ad = ArenaDebugger.getDebugger(arena);
    ad.hideSpawns(sender);
    ad.showSpawns(sender);
    return sendMessage(sender, ChatColor.GREEN + "You are showing spawns for &6" + arena.getName());
  }
 @MCCommand(
     cmds = {"ds", "deletespawn"},
     selection = true,
     admin = true,
     usage = "/aa deleteSpawn <index>")
 public boolean arenaDeleteSpawn(CommandSender sender, Integer number) {
   if (number <= 0 || number > 10000) {
     return MessageUtil.sendMessage(
         sender, "&cYou need to specify an index within the range &61-10000");
   }
   Arena a = aac.getArena(sender);
   TimedSpawn ts = a.deleteTimedSpawn(new Long(number));
   if (ts != null) {
     ac.updateArena(a);
     BattleArena.saveArenas();
     return MessageUtil.sendMessage(
         sender,
         "&6" + a.getName() + "&e has deleted index=&4" + number + "&e that had spawn=" + ts);
   } else {
     return MessageUtil.sendMessage(sender, "&cThere was no spawn at that index");
   }
 }
  @MCCommand(
      cmds = {"as", "addspawn"},
      selection = true,
      inGame = true,
      admin = true,
      min = 2,
      usage =
          "/aa addspawn <mob/item/block/spawnGroup> [buffs or effects] [number] [fs=first spawn time] [rt=respawn time] [trigger=<trigger type>]")
  public boolean arenaAddSpawn(Player sender, String[] args) {
    Long number = -1L;
    try {
      number = Long.parseLong(args[args.length - 1].toString());
    } catch (Exception e) {
      return MessageUtil.sendMessage(
          sender, "&cYou need to specify an index as the final value. &61-10000");
    }
    if (number == -1) {
      number = 1L;
    }
    if (number <= 0 || number > 10000) {
      return MessageUtil.sendMessage(
          sender, "&cYou need to specify an index within the range &61-10000");
    }

    Arena a = aac.getArena(sender);
    SpawnInstance spawn = parseSpawn(Arrays.copyOfRange(args, 0, args.length - 1));
    if (spawn == null) {
      return MessageUtil.sendMessage(sender, "Couldnt recognize spawn " + args[1]);
    }
    Location l = sender.getLocation();
    spawn.setLocation(l);
    TimedSpawn ts = new TimedSpawn(0, 30, 0, spawn);

    a.addTimedSpawn(number, ts);
    ac.updateArena(a);
    BattleArena.saveArenas();
    return MessageUtil.sendMessage(
        sender, "&6" + a.getName() + "&e now has spawn &6" + spawn + "&2  index=&4" + number);
  }
예제 #6
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;
  }
예제 #7
0
 public static String makeRegionName(Arena arena) {
   return "ba-" + arena.getName().toLowerCase();
 }