@Override public void execute(final Player p, final String[] args) { if (args.length != 1) { p.sendMessage("§c/team ff <on/off>"); return; } if (!TeamManager.getInstance().isOnTeam(p.getName())) { p.sendMessage("§cYou are not on a team."); return; } if (!TeamManager.getInstance().isLeader(p) && !TeamManager.getInstance().isManager(p)) { p.sendMessage("§cYou must be at least a manager to perform this command."); return; } final Team team = TeamManager.getInstance().getPlayerTeam(p); if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true")) { if (team.isFriendlyFire()) { p.sendMessage("§eFriendly fire is already turned on!"); return; } team.setFriendlyFire(true); TeamManager.getInstance() .messageTeam(team, "§6" + p.getName() + " §ehas §cenabled §efriendly fire!"); } else { if (!args[0].equalsIgnoreCase("off") && !args[0].equalsIgnoreCase("false")) { p.sendMessage("§c/team ff <on/off>"); return; } TeamManager.getInstance() .messageTeam(team, "§6" + p.getName() + " §ehas §adisabled §efriendly fire!"); } }
public static void blinkDeathmatchScoreboard( Player client ) { // if during intermission, we must blink our header if we're the winning team (or tie) //if ( inIntermission && ((int)Game.getGameTime()%2 == 0 ) ) // blink every second if ( (int)Game.getGameTime()%2 == 0 ) // blink every second { if ( TEAM1.getCaptures() > TEAM2.getCaptures() ) client.fEntity.setPlayerStat( STAT_CTF_TEAM1_HEADER, (short)0 ); else if ( TEAM2.getCaptures() > TEAM1.getCaptures() ) client.fEntity.setPlayerStat( STAT_CTF_TEAM2_HEADER, (short)0 ); // Capture tie, check total frags else if ( TEAM1.getScore() > TEAM2.getScore() ) client.fEntity.setPlayerStat( STAT_CTF_TEAM1_HEADER, (short)0 ); else if ( TEAM2.getScore() > TEAM1.getScore() ) client.fEntity.setPlayerStat( STAT_CTF_TEAM2_HEADER, (short)0 ); else { // tie game client.fEntity.setPlayerStat( STAT_CTF_TEAM1_HEADER, (short)0 ); client.fEntity.setPlayerStat( STAT_CTF_TEAM2_HEADER, (short)0 ); } } else { // show both if not blinked client.fEntity.setPlayerStat( STAT_CTF_TEAM1_HEADER, (short)Engine.getImageIndex("ctfsb1") ); client.fEntity.setPlayerStat( STAT_CTF_TEAM2_HEADER, (short)Engine.getImageIndex("ctfsb2") ); } }
private void setupLRNeighbors() { List<Team> teams = pp.getTeams(); for (Team t : teams) { // System.out.println(t); Vertex u = Vertex.vertexFromEmployee(t.getEmployee(0)); Vertex v = Vertex.vertexFromEmployee(t.getEmployee(1)); u.addToNeighbors(v); v.addToNeighbors(u); setCapacity(u, v, 1); setFlow(u, v, 0); } }
protected void start() throws FightException { state = FightStateEnum.ACTIVE; generateTurns(); fighters = CollectionUtils.concat(challengers.getFighters(), defenders.getFighters()); foreach( new FightHandlerAction() { @Override public void call(IFightHandler obj) throws FightException { obj.notifyFightStart(turns, fighters); } }); onStarted(); startFight = Instant.now(); getCurrentTurn().begin(); }
public void nextTurn() throws FightException { if (state == FightStateEnum.FINISHED) { return; } else if (state != FightStateEnum.ACTIVE) { throw new FightException("Invalid request: fight's state doesn't allow this request."); } if (!challengers.isAlive() || !defenders.isAlive()) { stop(); } else { onTurnStopped(); Turn turn = turns.remove(0); if (!turn.hasAbandoned() && turn.getFighter().isAlive()) { turns.add(turn); } while (getCurrentTurn().hasAbandoned()) { turns.remove(0); } turns.get(0).begin(); } }
// Compares first by number and then by name. public int compareTo(Team other) { if (other == null) return -1; if (other.getNumber() != getNumber()) return getNumber() - other.getNumber(); return getName().compareTo(other.getName()); }
// Checks for equality with the specified team. private boolean equals(Team team) { return team.getName().equals(getName()) && team.getNumber() == getNumber(); }
@Override public int hashCode() { return type.ordinal() + 561 * team.ordinal(); }
public IFighter getFighter(long id) { IFighter fighter; if ((fighter = challengers.getFighter(id)) != null) return fighter; if ((fighter = defenders.getFighter(id)) != null) return fighter; return null; }