Some more changes to the user handling.

This commit is contained in:
LevelX2 2017-08-18 00:12:38 +02:00
parent cb8b4d8cbf
commit fea9dfe8f8
8 changed files with 118 additions and 76 deletions

View file

@ -161,7 +161,7 @@ public enum TableManager {
}
}
// remove user from all tournament sub tables
// removeUserFromAllTables user from all tournament sub tables
public void userQuitTournamentSubTables(UUID userId) {
for (TableController controller : controllers.values()) {
if (controller.getTable() != null) {
@ -174,7 +174,7 @@ public enum TableManager {
}
}
// remove user from all sub tables of a tournament
// removeUserFromAllTables user from all sub tables of a tournament
public void userQuitTournamentSubTables(UUID tournamentId, UUID userId) {
for (TableController controller : controllers.values()) {
if (controller.getTable().isTournamentSubTable() && controller.getTable().getTournament().getId().equals(tournamentId)) {
@ -386,8 +386,8 @@ public enum TableManager {
for (Table table : tableCopy) {
try {
if (table.getState() != TableState.FINISHED
&& ((System.currentTimeMillis() - table.getStartTime().getTime()) / 1000) > 30) { // remove only if table started longer than 30 seconds ago
// remove tables and games not valid anymore
&& ((System.currentTimeMillis() - table.getStartTime().getTime()) / 1000) > 30) { // removeUserFromAllTables only if table started longer than 30 seconds ago
// removeUserFromAllTables tables and games not valid anymore
logger.debug(table.getId() + " [" + table.getName() + "] " + formatter.format(table.getStartTime() == null ? table.getCreateTime() : table.getCreateTime()) + " (" + table.getState().toString() + ") " + (table.isTournament() ? "- Tournament" : ""));
getController(table.getId()).ifPresent(tableController -> {
if ((table.isTournament() && !tableController.isTournamentStillValid())