mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Some changes to server logging.
This commit is contained in:
parent
049744677b
commit
30645e2ee0
4 changed files with 30 additions and 4 deletions
|
@ -369,6 +369,14 @@ public class TableController {
|
|||
|
||||
public synchronized void leaveTable(UUID userId) {
|
||||
UUID playerId = userPlayerMap.get(userId);
|
||||
if (table == null) {
|
||||
logger.error("TableController.leaveTable table == null - userId: " + userId);
|
||||
return;
|
||||
}
|
||||
if (table.isTournament() && tournament == null) {
|
||||
logger.error("TableController.leaveTable tournament == null - userId: " + userId + " table: " + table.getId());
|
||||
return;
|
||||
}
|
||||
if (playerId != null) {
|
||||
if (table.getState() == TableState.WAITING || table.getState() == TableState.STARTING) {
|
||||
table.leaveNotStartedTable(playerId);
|
||||
|
@ -382,7 +390,9 @@ public class TableController {
|
|||
userPlayerMap.remove(userId);
|
||||
} else if (!table.getState().equals(TableState.FINISHED)) {
|
||||
if (table.isTournament()) {
|
||||
logger.debug("TableController.leaveTable before userQuitTournamentSubTables");
|
||||
TableManager.getInstance().userQuitTournamentSubTables(userId);
|
||||
logger.debug("TableController.leaveTable before quit tournament ");
|
||||
TournamentManager.getInstance().quit(tournament.getId(), userId);
|
||||
} else {
|
||||
MatchPlayer matchPlayer = match.getPlayer(playerId);
|
||||
|
@ -396,6 +406,8 @@ public class TableController {
|
|||
match.leave(playerId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("TableController.leaveTable no playerId found for userId: " + userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -171,8 +171,12 @@ public class TableManager {
|
|||
// remove user from all tournament sub tables
|
||||
public void userQuitTournamentSubTables(UUID userId) {
|
||||
for (TableController controller: controllers.values()) {
|
||||
if (controller.getTable().isTournamentSubTable()) {
|
||||
controller.leaveTable(userId);
|
||||
if (controller.getTable() != null) {
|
||||
if (controller.getTable().isTournamentSubTable()) {
|
||||
controller.leaveTable(userId);
|
||||
}
|
||||
} else {
|
||||
logger.error("TableManager.userQuitTournamentSubTables table == null - userId " + userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,6 +223,7 @@ public class TableManager {
|
|||
removeTable(tableId);
|
||||
|
||||
} else {
|
||||
logger.debug("TableManager.leaveTable leaveTable");
|
||||
tableController.leaveTable(userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import mage.cards.decks.Deck;
|
||||
import mage.game.tournament.Tournament;
|
||||
import mage.view.TournamentView;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -62,7 +63,11 @@ public class TournamentManager {
|
|||
}
|
||||
|
||||
public void quit(UUID tournamentId, UUID userId) {
|
||||
controllers.get(tournamentId).quit(userId);
|
||||
if (controllers.contains(tournamentId)) {
|
||||
controllers.get(tournamentId).quit(userId);
|
||||
} else {
|
||||
Logger.getLogger(TournamentManager.class).error("TournamentManager.quit tournament controller missing tournamentid: " + tournamentId + " userId: " + userId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
|
||||
package mage.server.util;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue