fix: fixed bug where spectators would never be in the playing state

This commit is contained in:
Yannik Bretschneider 2021-06-07 17:47:41 +02:00
parent 383fa456fc
commit 054662957a

View File

@ -11,6 +11,7 @@ import uulm.teamname.marvelous.gamelibrary.messages.server.ConfirmSelectionMessa
import uulm.teamname.marvelous.gamelibrary.messages.server.GameAssignmentMessage; import uulm.teamname.marvelous.gamelibrary.messages.server.GameAssignmentMessage;
import uulm.teamname.marvelous.gamelibrary.messages.server.GeneralAssignmentMessage; import uulm.teamname.marvelous.gamelibrary.messages.server.GeneralAssignmentMessage;
import uulm.teamname.marvelous.server.netconnector.Client; import uulm.teamname.marvelous.server.netconnector.Client;
import uulm.teamname.marvelous.server.netconnector.ClientState;
import uulm.teamname.marvelous.server.netconnector.SUID; import uulm.teamname.marvelous.server.netconnector.SUID;
import uulm.teamname.marvelous.server.netconnector.UserManager; import uulm.teamname.marvelous.server.netconnector.UserManager;
@ -185,6 +186,9 @@ public class LobbyManager {
participant.sendMessage(response); participant.sendMessage(response);
if (complete) { if (complete) {
lobby.getPlayer1().getClient().state = ClientState.Playing;
lobby.getPlayer2().getClient().state = ClientState.Playing;
lobby.getSpectators().forEach(spectator -> spectator.getClient().state = ClientState.Playing);
LobbyRunner.getInstance().startLobby(lobby); LobbyRunner.getInstance().startLobby(lobby);
} }