Ejemplo n.º 1
0
  @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();
  }
Ejemplo n.º 2
0
 @Override
 public void addTeam(Team t) {
   super.addTeam(t);
   int size = teams.size();
   int nrounds = getNRounds(size);
   int idealteam = (int) Math.pow(2, nrounds);
   if (size > 2 && size % idealteam == 0) {
     Bukkit.broadcastMessage(
         Log.colorChat(
             eventParams.getPrefix()
                 + "&6"
                 + size
                 + " "
                 + MessageUtil.getTeamsOrPlayers(teams.size())
                 + "&e have joined, Current tournament will have &6"
                 + nrounds
                 + "&e rounds"));
   }
 }
Ejemplo n.º 3
0
 private void announceTourneySize() {
   int size = 0;
   for (Team t : teams) {
     if (t.size() > 0) size++;
   }
   int nrounds = getNRounds(size);
   int idealteam = (int) Math.pow(eventParams.getMinTeams(), nrounds);
   if (nrounds > 1 && size % idealteam == 0) {
     Bukkit.broadcastMessage(
         Log.colorChat(
             eventParams.getPrefix()
                 + "&6"
                 + size
                 + " "
                 + MessageUtil.getTeamsOrPlayers(teams.size())
                 + "&e have joined, Current tournament will have &6"
                 + nrounds
                 + "&e rounds"));
   }
 }