diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java index addf72151..bac333340 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java @@ -226,6 +226,10 @@ public class CollectionsManager { } } + public void addCurrencyToPlayerCollection(String player, CollectionType collectionType, int currency) { + addCurrencyToPlayerCollection(_playerDAO.getPlayer(player), collectionType, currency); + } + public void addCurrencyToPlayerCollection(Player player, CollectionType collectionType, int currency) { _readWriteLock.writeLock().lock(); try { diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java index b03491bef..c5584d3a2 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java @@ -106,7 +106,8 @@ public class HallServer extends AbstractServer { } private void cancelTournamentQueues() { - + for (TournamentQueue tournamentQueue : _tournamentQueues.values()) + tournamentQueue.leaveAllPlayers(_collectionsManager); } /** @@ -160,6 +161,9 @@ public class HallServer extends AbstractServer { } public boolean joinQueue(String queueId, Player player, String deckName) throws HallException { + if (_shutdown) + throw new HallException("Server is in shutdown mode. Server will be restarted after all running games are finished."); + _hallDataAccessLock.writeLock().lock(); try { if (isPlayerBusy(player.getName())) @@ -185,6 +189,9 @@ public class HallServer extends AbstractServer { * @return If table joined, otherwise false (if the user already is sitting at a table or playing). */ public boolean joinTableAsPlayer(String tableId, Player player, String deckName) throws HallException { + if (_shutdown) + throw new HallException("Server is in shutdown mode. Server will be restarted after all running games are finished."); + _hallDataAccessLock.writeLock().lock(); try { if (isPlayerBusy(player.getName())) diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java index bbb125390..4b9d1379b 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java @@ -94,6 +94,15 @@ public class SingleEliminationRecurringQueue implements TournamentQueue { } } + @Override + public void leaveAllPlayers(CollectionsManager collectionsManager) { + if (_cost > 0) { + for (String player : _playerDecks.keySet()) + collectionsManager.addCurrencyToPlayerCollection(player, _currencyCollection, _cost); + } + _playerDecks.clear(); + } + @Override public synchronized boolean isPlayerSignedUp(String player) { return _playerDecks.containsKey(player); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/TournamentQueue.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/TournamentQueue.java index e2ece075f..98c6b26c5 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/TournamentQueue.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/TournamentQueue.java @@ -19,6 +19,8 @@ public interface TournamentQueue { public void leavePlayer(CollectionsManager collectionsManager, Player player); + public void leaveAllPlayers(CollectionsManager collectionsManager); + public int getPlayerCount(); public boolean isPlayerSignedUp(String player);