use of mage.server.draft.DraftSession in project mage by magefree.
the class User method removeUserFromAllTables.
public void removeUserFromAllTables(DisconnectReason reason) {
logger.trace("REMOVE " + userName + " Draft sessions " + draftSessions.size());
for (DraftSession draftSession : draftSessions.values()) {
draftSession.setKilled();
}
draftSessions.clear();
logger.trace("REMOVE " + userName + " Tournament sessions " + userTournaments.size());
for (UUID tournamentId : userTournaments.values()) {
managerFactory.tournamentManager().quit(tournamentId, userId);
}
userTournaments.clear();
constructing.clear();
logger.trace("REMOVE " + userName + " Tables " + tables.size());
for (Entry<UUID, Table> entry : tables.entrySet()) {
logger.debug("-- leave tableId: " + entry.getValue().getId());
managerFactory.tableManager().leaveTable(userId, entry.getValue().getId());
}
tables.clear();
sideboarding.clear();
logger.trace("REMOVE " + userName + " Game sessions: " + gameSessions.size());
for (GameSessionPlayer gameSessionPlayer : gameSessions.values()) {
logger.debug("-- kill game session of gameId: " + gameSessionPlayer.getGameId());
managerFactory.gameManager().quitMatch(gameSessionPlayer.getGameId(), userId);
gameSessionPlayer.quitGame();
}
gameSessions.clear();
logger.trace("REMOVE " + userName + " watched Games " + watchedGames.size());
for (Iterator<UUID> it = watchedGames.iterator(); it.hasNext(); ) {
// Iterator to prevent ConcurrentModificationException
UUID gameId = it.next();
managerFactory.gameManager().stopWatching(gameId, userId);
}
watchedGames.clear();
logger.trace("REMOVE " + userName + " Chats ");
managerFactory.chatManager().removeUser(userId, reason);
}
Aggregations