Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/src/server-api/sc/networking/clients/LobbyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ private void onGameOver(String roomId, GameResult data) {
}

private void onGameLeft(String roomId) {
logger.info("Received LeftGameEvent");
for (ILobbyClientListener listener : this.listeners) {
listener.onGameLeft(roomId);
}
logger.info("Left {}", roomId);
}

private void onGameJoined(String roomId) {
Expand Down
8 changes: 4 additions & 4 deletions server/src/sc/server/Lobby.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ open class Lobby: GameRoomManager(), IClientListener, Closeable {
is JoinPreparedRoomRequest ->
try {
ReservationManager.redeemReservationCode(source, packet.reservationCode)
} catch(e: RescuableClientException) {
} catch (e: RescuableClientException) {
source.send(ProtocolErrorMessage(packet, e.message))
}
is JoinRoomRequest -> {
val gameRoomMessage = this.joinOrCreateGame(source, packet.gameType)
// null is returned if join was unsuccessful
if(gameRoomMessage != null) {
if (gameRoomMessage != null) {
clientManager.clients
.filter { it.isAdministrator }
.forEach { it.send(gameRoomMessage) }
Expand Down Expand Up @@ -109,14 +109,14 @@ open class Lobby: GameRoomManager(), IClientListener, Closeable {
room.step(packet.forced)
}
is CancelRequest -> {
requireNotNull(packet.roomId) { "Can't cancel a game with roomId null!" }
val room = this.findRoom(packet.roomId)
room.cancel()
// TODO check whether all clients receive game over message
}
is PlayerScoreRequest -> {
val displayName = packet.displayName
val score = getScoreOfPlayer(displayName)
?: throw IllegalArgumentException("Score for \"$displayName\" could not be found!")
?: throw IllegalArgumentException("Score for \"$displayName\" could not be found!")
logger.debug("Sending score of player \"{}\"", displayName)
source.send(PlayerScoreResponse(score))
}
Expand Down