From 6434df04b2d07da0137472e1cc622d761a840ed7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 11 Dec 2014 02:06:34 +0100 Subject: [PATCH] * Some minor changes to server logging. --- .../src/main/java/mage/server/MageServerImpl.java | 4 ++-- .../src/main/java/mage/server/TableController.java | 13 ++++++++----- .../main/java/mage/server/game/PlayerFactory.java | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/MageServerImpl.java b/Mage.Server/src/main/java/mage/server/MageServerImpl.java index 90efd5641b..d6d65dac2d 100644 --- a/Mage.Server/src/main/java/mage/server/MageServerImpl.java +++ b/Mage.Server/src/main/java/mage/server/MageServerImpl.java @@ -242,10 +242,10 @@ public class MageServerImpl implements MageServer { @Override public Boolean execute() throws MageException { UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId(); - if (logger.isDebugEnabled()) { + if (logger.isTraceEnabled()) { User user = UserManager.getInstance().getUser(userId); if (user != null) { - logger.debug("join tourn. tableId: " + tableId + " " + name); + logger.trace("join tourn. tableId: " + tableId + " " + name); } } if (userId == null) { diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index a326960eca..46ab6d0a14 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -375,14 +375,17 @@ public class TableController { } private void updateDeck(UUID userId, UUID playerId, Deck deck) { - if (table.getState() == TableState.SIDEBOARDING) { - match.updateDeck(playerId, deck); - } - else { + if (table.isTournament()) { if (tournament != null) { TournamentManager.getInstance().updateDeck(tournament.getId(), playerId, deck); } else { - logger.fatal("Tournament == null table: " + table.getId()); + logger.fatal("Tournament == null table: " + table.getId() +" userId: " + userId); + } + } else { + if (TableState.SIDEBOARDING.equals(table.getState())) { + match.updateDeck(playerId, deck); + } else { + // deck was meanwhile submitted so the autoupdate can be ignored } } } diff --git a/Mage.Server/src/main/java/mage/server/game/PlayerFactory.java b/Mage.Server/src/main/java/mage/server/game/PlayerFactory.java index 4c3960188a..1ff2764479 100644 --- a/Mage.Server/src/main/java/mage/server/game/PlayerFactory.java +++ b/Mage.Server/src/main/java/mage/server/game/PlayerFactory.java @@ -45,7 +45,7 @@ public class PlayerFactory { private static final PlayerFactory INSTANCE = new PlayerFactory(); private static final Logger logger = Logger.getLogger(PlayerFactory.class); - private Map playerTypes = new LinkedHashMap(); + private final Map playerTypes = new LinkedHashMap<>(); public static PlayerFactory getInstance() { return INSTANCE; @@ -61,7 +61,7 @@ public class PlayerFactory { if (playerTypeClass != null) { con = playerTypeClass.getConstructor(new Class[]{String.class, RangeOfInfluence.class, int.class}); player = (Player)con.newInstance(new Object[] {name, range, skill}); - logger.debug("Player created: " + name + "-" + player.getId().toString()); + logger.debug("Player created: " + name + " - " + player.getId()); return player; } else {