예제 #1
0
  @Override
  public PACheck checkJoin(final CommandSender sender, final PACheck res, final String[] args) {
    if (res.getPriority() >= PRIORITY) {
      return res;
    }

    final int maxPlayers = arena.getArenaConfig().getInt(CFG.READY_MAXPLAYERS);
    final int maxTeamPlayers = arena.getArenaConfig().getInt(CFG.READY_MAXTEAMPLAYERS);

    if (maxPlayers > 0 && arena.getFighters().size() >= maxPlayers) {
      res.setError(this, Language.parse(arena, MSG.ERROR_JOIN_ARENA_FULL));
      return res;
    }

    if (args == null || args.length < 1) {
      return res;
    }

    if (!arena.isFreeForAll()) {
      final ArenaTeam team = arena.getTeam(args[0]);

      if (team != null && maxTeamPlayers > 0 && team.getTeamMembers().size() >= maxTeamPlayers) {
        res.setError(this, Language.parse(arena, MSG.ERROR_JOIN_TEAM_FULL));
        return res;
      }
    }

    res.setPriority(this, PRIORITY);
    return res;
  }
예제 #2
0
 @Override
 public PACheck getLives(final PACheck res, final ArenaPlayer aPlayer) {
   if (res.getPriority() <= PRIORITY + 1000) {
     res.setError(
         this,
         String.valueOf(
             getLifeMap().containsKey(aPlayer.getArenaTeam().getName())
                 ? getLifeMap().get(aPlayer.getArenaTeam().getName())
                 : 0));
   }
   return res;
 }
예제 #3
0
  @Override
  public PACheck checkEnd(final PACheck res) {

    if (res.getPriority() > PRIORITY) {
      return res;
    }

    final int count = TeamManager.countActiveTeams(arena);

    if (count == 1) {
      res.setPriority(this, PRIORITY); // yep. only one team left. go!
    } else if (count == 0) {
      res.setError(this, "No teams playing!");
    }

    return res;
  }