static {
   Class<?>[] args = {};
   try {
     Version version = Util.getCraftBukkitVersion();
     if (version.compareTo("v1_6_1") >= 0) {
       final Class<?> clazz = Class.forName("mc.alk.arena.util.compat.v1_6_1.EventHelper");
       handler = (IEventHelper) clazz.getConstructor(args).newInstance((Object[]) args);
     } else {
       final Class<?> clazz = Class.forName("mc.alk.arena.util.compat.pre.EventHelper");
       handler = (IEventHelper) clazz.getConstructor(args).newInstance((Object[]) args);
     }
   } catch (Exception e) {
     Log.printStackTrace(e);
   }
 }
示例#2
0
  @Override
  public void openEvent(EventParams mp) throws NeverWouldJoinException {
    aliveTeams.clear();
    competingTeams.clear();
    rounds.clear();
    round = -1;
    nrounds = -1;
    timeBetweenRounds = oParms.getTimeBetweenRounds();
    String color = Util.getColor(mp.getPrefix());
    mp.setPrefix(color + "[" + mp.getName() + " " + oParms.getName() + "]");
    mp.setCommand(oParms.getCommand());
    mp.setName(mp.getName() + " " + oParms.getName());
    mp.setTimeBetweenRounds(oParms.getTimeBetweenRounds());
    mp.setSecondsTillMatch(oParms.getSecondsTillMatch());
    mp.setSecondsToLoot(oParms.getSecondsToLoot());

    TimeUtil.testClock();
    super.openEvent(mp);
  }
  private static boolean changeSpawn(
      CommandSender sender,
      Arena arena,
      BattleArenaController ac,
      String changetype,
      String value,
      String[] otherOptions) {
    if (!BAExecutor.checkPlayer(sender)) return false;
    int locindex = verifySpawnLocation(sender, changetype);
    if (locindex == -1) return false;

    Player p = (Player) sender;
    Location loc = null;
    ac.removeArena(arena);
    loc = parseLocation(p, value);
    if (loc == null) {
      loc = p.getLocation();
    }
    arena.setSpawnLoc(locindex - 1, loc);
    ac.addArena(arena);
    sendMessage(
        sender, "&2team &6" + changetype + "&2 spawn set to location=&6" + Util.getLocString(loc));
    return true;
  }