Ejemplo n.º 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;
  }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
  private void commit(final Arena arena, final String sTeam) {
    arena.getDebugger().i("[BD] checking end: " + sTeam);
    arena.getDebugger().i("win: " + false);

    for (final ArenaTeam team : arena.getTeams()) {
      if (!team.getName().equals(sTeam)) {
        /*
        team is sTeam and win
        team is not sTeam and not win
        */
        continue;
      }
      for (final ArenaPlayer ap : team.getTeamMembers()) {
        if (ap.getStatus() == Status.FIGHT || ap.getStatus() == Status.DEAD) {
          ap.addLosses();
          /*
          arena.removePlayer(ap.get(), CFG.TP_LOSE.toString(),
          		true, false);*/

          ap.setStatus(Status.LOST);

          // ap.setTelePass(false);
        }
      }
    }
    /*
    if (!win && getLifeMap().size() > 1) {
    	return; // if not a win trigger AND more than one team left. out!
    }

    for (ArenaTeam team : arena.getTeams()) {
    	for (ArenaPlayer ap : team.getTeamMembers()) {
    		if (!ap.getStatus().equals(Status.FIGHT)) {
    			continue;
    		}
    		winteam = team.getName();
    		break;
    	}
    }

    if (arena.getTeam(winteam) != null) {

    	ArenaModuleManager
    			.announce(
    					arena,
    					Language.parse(arena, MSG.TEAM_HAS_WON,
    							arena.getTeam(winteam).getColor()
    									+ winteam + ChatColor.YELLOW),
    					"WINNER");
    	arena.broadcast(Language.parse(arena, MSG.TEAM_HAS_WON,
    			arena.getTeam(winteam).getColor() + winteam
    					+ ChatColor.YELLOW));
    }

    getLifeMap().clear();
    new EndRunnable(arena, arena.getArenaConfig().getInt(
    		CFG.TIME_ENDCOUNTDOWN));
    		*/
    PACheck.handleEnd(arena, false);
  }
Ejemplo n.º 4
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;
  }
Ejemplo n.º 5
0
  @Override
  public PACheck checkCommand(final PACheck res, final String string) {
    if (res.getPriority() > PRIORITY) {
      return res;
    }

    if ("blocktype".equalsIgnoreCase(string)) {
      res.setPriority(this, PRIORITY);
    }

    for (final ArenaTeam team : arena.getTeams()) {
      final String sTeam = team.getName();
      if (string.contains(sTeam + "block")) {
        res.setPriority(this, PRIORITY);
      }
    }

    return res;
  }
Ejemplo n.º 6
0
  @Override
  public PACheck checkSetBlock(final PACheck res, final Player player, final Block block) {

    if (res.getPriority() > PRIORITY
        || !PAA_Region.activeSelections.containsKey(player.getName())) {
      return res;
    }
    if (block == null
        || !block
            .getType()
            .name()
            .equals(arena.getArenaConfig().getString(CFG.GOAL_BLOCKDESTROY_BLOCKTYPE))) {
      return res;
    }

    if (!PVPArena.hasAdminPerms(player) && !PVPArena.hasCreatePerms(player, arena)) {
      return res;
    }
    res.setPriority(this, PRIORITY); // success :)

    return res;
  }