@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; }
@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; }
@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; }
@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; }
@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; }