From 3abe5e796a1b1466ae71c9a6a3c2146f28f11b84 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 25 Jul 2020 19:06:38 +0400 Subject: [PATCH] Server: removed unnecessary logs, extra comments --- Mage.Server/src/main/java/mage/server/Session.java | 2 +- .../src/main/java/mage/server/game/GamesRoomManager.java | 2 +- Mage.Sets/src/mage/cards/b/BringToLight.java | 3 --- .../WatchersFromDelayedTriggeredAbilitiesTest.java | 2 +- Mage/src/main/java/mage/cards/decks/Deck.java | 9 +++++++++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index 83b8ec85e8..f5bf2d98d8 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -232,7 +232,7 @@ public class Session { if (reconnect) { // must be connected to receive the message Optional room = GamesRoomManager.instance.getRoom(GamesRoomManager.instance.getMainRoomId()); if (!room.isPresent()) { - logger.error("main room not found"); + logger.warn("main room not found"); // after server restart users try to use old rooms on reconnect return null; } ChatManager.instance.joinChat(room.get().getChatId(), userId); diff --git a/Mage.Server/src/main/java/mage/server/game/GamesRoomManager.java b/Mage.Server/src/main/java/mage/server/game/GamesRoomManager.java index 73eaeba89b..c67c834fc2 100644 --- a/Mage.Server/src/main/java/mage/server/game/GamesRoomManager.java +++ b/Mage.Server/src/main/java/mage/server/game/GamesRoomManager.java @@ -43,7 +43,7 @@ public enum GamesRoomManager { if (rooms.containsKey(roomId)) { return Optional.of(rooms.get(roomId)); } - logger.error("room not found : " + roomId); + logger.warn("room not found : " + roomId); // after server restart users try to use old rooms on reconnect return Optional.empty(); } diff --git a/Mage.Sets/src/mage/cards/b/BringToLight.java b/Mage.Sets/src/mage/cards/b/BringToLight.java index 60809c48b0..88f7e78a9c 100644 --- a/Mage.Sets/src/mage/cards/b/BringToLight.java +++ b/Mage.Sets/src/mage/cards/b/BringToLight.java @@ -86,9 +86,6 @@ class BringToLightEffect extends OneShotEffect { Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), game, true, new MageObjectReference(source.getSourceObject(game), game)); game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); - if (!cardWasCast) { - Logger.getLogger(BringToLightEffect.class).error("Bring to Light: spellAbility == null " + card.getName()); - } } } return true; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/WatchersFromDelayedTriggeredAbilitiesTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/WatchersFromDelayedTriggeredAbilitiesTest.java index afb479968d..e2b75f82f1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/watchers/WatchersFromDelayedTriggeredAbilitiesTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/watchers/WatchersFromDelayedTriggeredAbilitiesTest.java @@ -31,7 +31,7 @@ public class WatchersFromDelayedTriggeredAbilitiesTest extends CardTestPlayerBas // can play until end step checkPlayableAbility("can play bolt on 1", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", true); - checkPlayableAbility("can play bolt on 2", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false); + checkPlayableAbility("can't play bolt on 2", 2, PhaseStep.PRECOMBAT_MAIN, playerA, "Cast Lightning Bolt", false); setStrictChooseMode(true); setStopAt(2, PhaseStep.END_TURN); diff --git a/Mage/src/main/java/mage/cards/decks/Deck.java b/Mage/src/main/java/mage/cards/decks/Deck.java index 8ffb88bcc0..7c80c0de46 100644 --- a/Mage/src/main/java/mage/cards/decks/Deck.java +++ b/Mage/src/main/java/mage/cards/decks/Deck.java @@ -55,6 +55,15 @@ public class Deck implements Serializable { return currentDeck; } + /** + * Warning, AI can't play Mock cards, so call it with extra params in real games or tests + * + * @param deckCardLists cards to load + * @param ignoreErrors - do not raise exception error on wrong deck + * @param mockCards - use it for GUI only code, real game cards must be real + * @return + * @throws GameException + */ public static Deck load(DeckCardLists deckCardLists, boolean ignoreErrors, boolean mockCards) throws GameException { Deck deck = new Deck(); deck.setName(deckCardLists.getName());