@@ -58,13 +58,13 @@ open class Lobby: GameRoomManager(), IClientListener, Closeable {
5858 is JoinPreparedRoomRequest ->
5959 try {
6060 ReservationManager .redeemReservationCode(source, packet.reservationCode)
61- } catch (e: RescuableClientException ) {
61+ } catch (e: RescuableClientException ) {
6262 source.send(ProtocolErrorMessage (packet, e.message))
6363 }
6464 is JoinRoomRequest -> {
6565 val gameRoomMessage = this .joinOrCreateGame(source, packet.gameType)
6666 // null is returned if join was unsuccessful
67- if (gameRoomMessage != null ) {
67+ if (gameRoomMessage != null ) {
6868 clientManager.clients
6969 .filter { it.isAdministrator }
7070 .forEach { it.send(gameRoomMessage) }
@@ -109,14 +109,14 @@ open class Lobby: GameRoomManager(), IClientListener, Closeable {
109109 room.step(packet.forced)
110110 }
111111 is CancelRequest -> {
112+ requireNotNull(packet.roomId) { " Can't cancel a game with roomId null!" }
112113 val room = this .findRoom(packet.roomId)
113114 room.cancel()
114- // TODO check whether all clients receive game over message
115115 }
116116 is PlayerScoreRequest -> {
117117 val displayName = packet.displayName
118118 val score = getScoreOfPlayer(displayName)
119- ? : throw IllegalArgumentException (" Score for \" $displayName \" could not be found!" )
119+ ? : throw IllegalArgumentException (" Score for \" $displayName \" could not be found!" )
120120 logger.debug(" Sending score of player \" {}\" " , displayName)
121121 source.send(PlayerScoreResponse (score))
122122 }
0 commit comments