Merge branch 'fix/lobby-cleanup-blocked' into 'main'
Fix: Lobby cleanup got blocked by previous feature for rejoining lobby while game is still going See merge request cs108-fs26/Gruppe-13!184
This commit was merged in pull request #340.
This commit is contained in:
+5
@@ -98,9 +98,14 @@ public class GetGameStateHandler extends CommandHandler<GetGameStateRequest> {
|
||||
}
|
||||
|
||||
try {
|
||||
// Remove all active players
|
||||
for (String playerName : lobby.getPlayerNames()) {
|
||||
lobbyManager.removePlayer(playerName);
|
||||
}
|
||||
// Also remove all absent players so the lobby can be deleted
|
||||
for (String playerName : lobby.getAbsentPlayers()) {
|
||||
lobbyManager.removePlayer(playerName);
|
||||
}
|
||||
lobby.initGame(null);
|
||||
} catch (RuntimeException e) {
|
||||
LOGGER.log(
|
||||
|
||||
@@ -217,7 +217,7 @@ public class LobbyManager {
|
||||
for (Map.Entry<LobbyId, Lobby> e : activeLobbies.entrySet()) {
|
||||
LobbyId id = e.getKey();
|
||||
Lobby l = e.getValue();
|
||||
if (l.getPlayerNames().isEmpty()) {
|
||||
if (!l.hasAnyPlayers()) {
|
||||
Instant created = creationTimes.get(id);
|
||||
if (created != null && created.isBefore(cutoff)) {
|
||||
result.add(id);
|
||||
|
||||
Reference in New Issue
Block a user