@Override public void startEvent() { super.startEvent(); Server server = Bukkit.getServer(); int osize = teams.size(); nrounds = getNRounds(osize); int nteams = (int) Math.pow(2, nrounds); server.broadcastMessage( Log.colorChat( eventParams.getPrefix() + "&e The " + eventParams.toPrettyString() + oParms.getName() + " tournament is starting!")); preliminary_round = teams.size() != nteams; if (preliminary_round) nrounds++; TreeMap<Double, Team> sortTeams = new TreeMap<Double, Team>(Collections.reverseOrder()); BTInterface bti = new BTInterface(eventParams); // System.out.println("startEvent:: bti=" + bti); for (Team t : teams) { Double elo = Defaults.DEFAULT_ELO; if (bti.isValid()) { elo = (double) bti.getElo(t); } while (sortTeams.containsKey(elo)) { elo += 0.0001; } sortTeams.put(elo, t); } competingTeams.addAll(teams); teams.clear(); aliveTeams.clear(); ArrayList<Team> ts = new ArrayList<Team>(sortTeams.values()); for (Team t : ts) { teams.add(t); aliveTeams.add(t); } server.broadcastMessage( Log.colorChat( eventParams.getPrefix() + "&6 " + teams.size() + " &e" + MessageUtil.getTeamsOrPlayers(teams.size()) + " will compete in a &6" + nrounds + "&e round tournament")); if (preliminary_round) { makePreliminaryRound(); } else { makeNextRound(); } startRound(); }
public String getRankMessage(OfflinePlayer player) { BTInterface bti = new BTInterface(mp); return bti.isValid() ? bti.getRankMessage(player) : ""; }
public void resetStats() { if (!enabled) return; BTInterface bti = new BTInterface(mp); if (bti.isValid()) bti.resetStats(); }
public boolean setRating(OfflinePlayer player, int rating) { BTInterface bti = new BTInterface(mp); return bti.isValid() && bti.setRating(player, rating); }
public void printTopX( CommandSender sender, int x, int minTeamSize, String headerMsg, String bodyMsg) { BTInterface bti = new BTInterface(mp); if (!bti.isValid()) return; bti.printTopX(sender, x, minTeamSize, headerMsg, bodyMsg); }