Updated 'LobbyState' class.

Updated the 'LobbyState' class by sending a broadcast message after all players are ready. In Addition, the 'ServerStartGameMessage' getting the 'Board' object.
This commit is contained in:
Daniel Grigencha
2024-12-01 23:41:10 +01:00
parent 8f53b76a3e
commit adcf65d7aa

View File

@@ -109,6 +109,7 @@ public void received(LobbyReadyMessage msg, int from) {
}
this.logic.getGame().setAllReady(true);
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getBoard()));
}
/**
@@ -149,7 +150,7 @@ public void received(LeaveGameMessage msg, int from) {
@Override
public void received(StartGameMessage msg, int from) {
if (msg.isForceStartGame() || this.logic.getGame().allReady()) {
this.logic.getServerSender().broadcast(new ServerStartGameMessage());
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getBoard()));
this.logic.setCurrentState(this.logic.getGameState());
}
}