Skip to content

Commit e00aa58

Browse files
committed
refactor(client): update LobbyClientListener interface
1 parent b426aa9 commit e00aa58

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

plugin/src/client/sc/plugin2021/AbstractClient.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package sc.plugin2021
22

33
import org.slf4j.LoggerFactory
44
import sc.api.plugins.IGameState
5-
import sc.framework.plugins.Player
65
import sc.framework.plugins.protocol.MoveRequest
6+
import sc.networking.clients.AbstractLobbyClientListener
77
import sc.networking.clients.IControllableGame
88
import sc.networking.clients.ILobbyClientListener
99
import sc.networking.clients.LobbyClient
@@ -22,7 +22,7 @@ import kotlin.system.exitProcess
2222
abstract class AbstractClient(
2323
host: String,
2424
port: Int
25-
): ILobbyClientListener {
25+
): AbstractLobbyClientListener() {
2626
companion object {
2727
private val logger = LoggerFactory.getLogger(AbstractClient::class.java)
2828
}
@@ -105,11 +105,6 @@ abstract class AbstractClient(
105105
client.joinRoomRequest(GamePlugin.PLUGIN_UUID)
106106
}
107107

108-
override fun onGameJoined(roomId: String) {}
109-
override fun onGamePrepared(response: GamePreparedResponse) {}
110-
override fun onGamePaused(roomId: String, nextPlayer: Player) {}
111-
override fun onGameObserved(roomId: String) {}
112-
113108
override fun onGameLeft(roomId: String) {
114109
logger.info("$this: Got game left in room $roomId")
115110
client.stop()

sdk/src/server-api/sc/networking/clients/AbstractLobbyClientListener.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import sc.shared.GameResult
99

1010
abstract class AbstractLobbyClientListener: ILobbyClientListener {
1111
override fun onNewState(roomId: String, state: IGameState) {}
12+
override fun onGameOver(roomId: String, data: GameResult) {}
13+
override fun onGamePaused(roomId: String, nextPlayer: Player) {}
1214
override fun onRoomMessage(roomId: String, data: ProtocolMessage) {}
1315
override fun onError(roomId: String?, error: ProtocolErrorMessage) {}
16+
1417
override fun onGamePrepared(response: GamePreparedResponse) {}
1518
override fun onGameLeft(roomId: String) {}
1619
override fun onGameJoined(roomId: String) {}
17-
override fun onGameOver(roomId: String, data: GameResult) {}
18-
override fun onGamePaused(roomId: String, nextPlayer: Player) {}
1920
override fun onGameObserved(roomId: String) {}
2021
}

sdk/src/server-api/sc/networking/clients/ILobbyClientListener.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import sc.shared.GameResult
1111
/** Receives updates within a GameRoom on the client-side. */
1212
interface ILobbyClientListener {
1313
fun onNewState(roomId: String, state: IGameState)
14+
fun onGameOver(roomId: String, data: GameResult)
15+
fun onGamePaused(roomId: String, nextPlayer: Player)
1416
fun onRoomMessage(roomId: String, data: ProtocolMessage)
1517
fun onError(roomId: String?, error: ProtocolErrorMessage)
18+
1619
fun onGamePrepared(response: GamePreparedResponse)
1720
fun onGameLeft(roomId: String)
1821
fun onGameJoined(roomId: String)
19-
fun onGameOver(roomId: String, data: GameResult)
20-
fun onGamePaused(roomId: String, nextPlayer: Player)
2122
fun onGameObserved(roomId: String)
2223
}

0 commit comments

Comments
 (0)