diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index bec8fda788..f2a236d52f 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -924,7 +924,9 @@ public class TableController { } if (matchPlayer.getPlayer().isHuman()) { humanPlayers++; - if ((table.getState().equals(TableState.WAITING) || table.getState().equals(TableState.STARTING) || table.getState().equals(TableState.READY_TO_START)) || + if ((table.getState().equals(TableState.WAITING) || + table.getState().equals(TableState.STARTING) || + table.getState().equals(TableState.READY_TO_START)) || !match.isDoneSideboarding() || (!matchPlayer.hasQuit() && match.getGame() != null && matchPlayer.getPlayer().isInGame())) { User user = UserManager.getInstance().getUser(userPlayerEntry.getKey()); diff --git a/Mage.Server/src/main/java/mage/server/TableManager.java b/Mage.Server/src/main/java/mage/server/TableManager.java index 1ef11e9f7c..385634738f 100644 --- a/Mage.Server/src/main/java/mage/server/TableManager.java +++ b/Mage.Server/src/main/java/mage/server/TableManager.java @@ -395,8 +395,6 @@ public class TableManager { debugServerState(); } logger.debug("TABLE HEALTH CHECK"); - List toRemove = new ArrayList<>(); - ArrayList tableCopy = new ArrayList<>(); tableCopy.addAll(tables.values()); for (Table table : tableCopy) { @@ -406,13 +404,13 @@ public class TableManager { logger.debug(table.getId() + " [" + table.getName()+ "] " + formatter.format(table.getStartTime() == null ? table.getCreateTime() : table.getCreateTime()) +" (" + table.getState().toString() + ") " + (table.isTournament() ? "- Tournament":"")); TableController tableController = getController(table.getId()); if (tableController != null) { - if (table.isTournament()) { - if (!tableController.isTournamentStillValid()) { - toRemove.add(table.getId()); - } - } else { - if (!tableController.isMatchTableStillValid()) { - toRemove.add(table.getId()); + if ((table.isTournament() && !tableController.isTournamentStillValid()) || + (!table.isTournament() && !tableController.isMatchTableStillValid())) { + try { + logger.warn("Removing unhealthy tableId " + table.getId()); + removeTable(table.getId()); + } catch (Exception e) { + logger.error(e); } } } @@ -422,14 +420,6 @@ public class TableManager { logger.debug(Arrays.toString(ex.getStackTrace())); } } - for (UUID tableId : toRemove) { - try { - logger.warn("Removing unhealthy tableId " + tableId); - removeTable(tableId); - } catch (Exception e) { - logger.error(e); - } - } logger.debug("TABLE HEALTH CHECK - END"); } diff --git a/Mage.Server/src/main/java/mage/server/game/GameWorker.java b/Mage.Server/src/main/java/mage/server/game/GameWorker.java index 16e785604f..7a1ae9753c 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameWorker.java +++ b/Mage.Server/src/main/java/mage/server/game/GameWorker.java @@ -62,7 +62,7 @@ public class GameWorker implements Callable { gameController.gameResult(game.getWinner()); game.cleanUp(); } catch (MageException ex) { - logger.fatal("GameWorker mage error [" + game.getId() + "]" +ex, ex); + logger.fatal("GameWorker mage error [" + game.getId() + "]" + ex, ex); ex.printStackTrace(); } catch (Exception e) { logger.fatal("GameWorker general exception [" + game.getId() + "]" + e.getMessage(), e);