Updated 'LobbyState' class.

Updated the 'LobbyState' class by removing the 'received(LeaveGameMessage msg, int from)' from it.
This commit is contained in:
Daniel Grigencha
2024-12-02 23:21:42 +01:00
parent a1d10521ac
commit 002a42be38

View File

@@ -143,23 +143,6 @@ public void received(LobbyNotReadyMessage msg, int from) {
this.logic.getServerSender().broadcast(new UpdateReadyMessage(from, false));
}
/**
* This method will be called whenever the server received an LeaveGameMessage message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a LeaveGameMessage object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(LeaveGameMessage msg, int from) {
if (from == this.logic.getGame().getHost()) {
this.logic.getServerSender().broadcast(new ShutdownMessage());
}
this.logic.getGame().removePlayer(from);
this.logic.getServerSender().broadcast(new LobbyPlayerLeaveMessage(from));
this.logic.getServerSender().disconnectClient(from);
}
/**
* This method will be called whenever the server received a StartGame message.
* It will also get the client id of the player who send this message.