added logic to the 'LobbyState' class
- for leaving the lobby
This commit is contained in:
@@ -3,10 +3,7 @@
|
||||
import pp.mdga.game.Color;
|
||||
import pp.mdga.game.Player;
|
||||
import pp.mdga.message.client.*;
|
||||
import pp.mdga.message.server.LobbyPlayerJoinedMessage;
|
||||
import pp.mdga.message.server.ServerStartGameMessage;
|
||||
import pp.mdga.message.server.UpdateReadyMessage;
|
||||
import pp.mdga.message.server.UpdateTSKMessage;
|
||||
import pp.mdga.message.server.*;
|
||||
import pp.mdga.server.ServerGameLogic;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -105,6 +102,18 @@ public void received(LobbyNotReadyMessage msg, int from) {
|
||||
this.logic.getServerSender().broadcast(new UpdateReadyMessage(from, false));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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) {
|
||||
this.logic.getGame().removePlayer(from);
|
||||
this.logic.getServerSender().broadcast(new LobbyPlayerLeaveMessage(from));
|
||||
this.logic.getServerSender().disconnectClient(from);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg as the message which was sent by the player as a ForceStartGame object.
|
||||
* @param from as the client id of the player as an Integer.
|
||||
|
||||
Reference in New Issue
Block a user