mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Fixed table health checking of tournament tables (waiting tournament tables were accidently removed).
This commit is contained in:
parent
3a2d78310b
commit
5727791526
2 changed files with 23 additions and 7 deletions
|
@ -867,14 +867,29 @@ public class TableController {
|
|||
|
||||
public boolean isTournamentStillValid() {
|
||||
if (table.getTournament() != null) {
|
||||
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 {
|
||||
// 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() {
|
||||
|
|
|
@ -477,10 +477,11 @@ 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// tournament player is missing
|
||||
logger.debug("Tournament player is missing - tournamentId: " + tournament.getId() + " state: " + tableState.toString());
|
||||
|
|
Loading…
Reference in a new issue