* Fixed table health checking of tournament tables (waiting tournament tables were accidently removed).

This commit is contained in:
LevelX2 2015-02-08 14:01:20 +01:00
parent 3a2d78310b
commit 5727791526
2 changed files with 23 additions and 7 deletions

View file

@ -867,14 +867,29 @@ public class TableController {
public boolean isTournamentStillValid() {
if (table.getTournament() != null) {
TournamentController tournamentController = TournamentManager.getInstance().getTournamentController(table.getTournament().getId());
if (tournamentController != null) {
return tournamentController.isTournamentStillValid(table.getState());
if (!table.getState().equals(TableState.WAITING) && !table.getState().equals(TableState.READY_TO_START) && !table.getState().equals(TableState.STARTING) ) {
TournamentController tournamentController = TournamentManager.getInstance().getTournamentController(table.getTournament().getId());
if (tournamentController != null) {
return tournamentController.isTournamentStillValid(table.getState());
} else {
return false;
}
} else {
return false;
// check if table creator is still a valid user, if not remove table
User user = UserManager.getInstance().getUser(userId);
return user != null;
}
}
return true;
return false;
}
public UUID getUserId(UUID playerId) {
for (Map.Entry<UUID, UUID> entry: userPlayerMap.entrySet()) {
if (entry.getValue().equals(playerId)) {
return entry.getKey();
}
}
return null;
}
public boolean isMatchTableStillValid() {

View file

@ -477,9 +477,10 @@ public class TournamentController {
logger.debug("Tournament user is missing but player active -> start quit - tournamentId: " + tournament.getId() + " state: " + tableState.toString());
// active tournament player but the user is no longer online
quit(entry.getKey());
} else {
activePlayers++;
}
}
activePlayers++;
}
}
} else {
// tournament player is missing