int draft = 0, match = 0, sideboard = 0, tournament = 0, construct = 0, waiting = 0;
for (Map.Entry<UUID, Table> tableEntry : tables.entrySet()) {
if (tableEntry != null) {
Table table = tableEntry.getValue();
if (table != null) {
if (table.isTournament()) {
if (tableEntry.getKey() != null) {
TournamentPlayer tournamentPlayer = table.getTournament().getPlayer(tableEntry.getKey());
if (tournamentPlayer != null) {
if (!tournamentPlayer.isEliminated()) {
switch (table.getState()) {
case WAITING:
case STARTING:
case READY_TO_START:
waiting++;
break;
case CONSTRUCTING:
construct++;
break;
case DRAFTING:
draft++;
break;
case DUELING:
tournament++;
break;
}
if (!isConnected()) {
tournamentPlayer.setDisconnectInfo(" (discon. "+ getDisconnectDuration() + ")");
} else {
tournamentPlayer.setDisconnectInfo("");
}
}
} else {
// can happen if tournamet has just ended
logger.debug(getName() + " tournament player missing - tableId:" + table.getId(), null);
}
} else {
logger.error(getName() + " tournament key missing - tableId: " + table.getId(), null);
}
} else {
switch (table.getState()) {
case WAITING:
case STARTING:
case READY_TO_START:
waiting++;
break;