@@ -30,9 +30,7 @@ abstract class AbstractClient @Throws(IOException::class) constructor(
30
30
private val gameType = GamePlugin .PLUGIN_UUID
31
31
}
32
32
33
- /* * The handler reacts to messages from the server received by the lobby client.
34
- * It *must* be initialised before start.
35
- */
33
+ /* * The handler reacts to messages from the server received by the lobby client. */
36
34
protected lateinit var handler: IGameHandler
37
35
38
36
/* * Initialise game handler. */
@@ -44,7 +42,7 @@ abstract class AbstractClient @Throws(IOException::class) constructor(
44
42
private val client = try {
45
43
LobbyClient (Configuration .xStream, Configuration .classesToRegister, host, port)
46
44
} catch (e: ConnectException ) {
47
- logger.error(" Could not connect to Server: " + e.message)
45
+ logger.error(" Could not connect to Server: ${ e.message} " )
48
46
exitProcess(1 )
49
47
}
50
48
@@ -85,13 +83,13 @@ abstract class AbstractClient @Throws(IOException::class) constructor(
85
83
86
84
/* * Called when an erroneous message is sent to the room. */
87
85
override fun onError (roomId : String , error : ProtocolErrorMessage ) {
88
- logger.debug(" onError: Client {} received error {} " , this , error.message)
86
+ logger.debug(" onError: Client $this received error ${ error.message} " )
89
87
this .error = error.message
90
88
}
91
89
92
90
override fun onNewState (roomId : String , state : Any ) {
93
91
val gameState = state as GameState
94
- logger.debug(" {} got a new state {} " , this , gameState)
92
+ logger.debug(" $this got a new state $ gameState" )
95
93
96
94
if (id == PlayerType .OBSERVER ) return
97
95
@@ -119,14 +117,14 @@ abstract class AbstractClient @Throws(IOException::class) constructor(
119
117
override fun onGameObserved (roomId : String ) {}
120
118
121
119
override fun onGameLeft (roomId : String ) {
122
- logger.info(" {} got game left {} " , this , roomId )
120
+ logger.info(" $this got game left $roomID " )
123
121
client.stop()
124
122
}
125
123
126
124
override fun onGameOver (roomId : String , data : GameResult ) {
127
- logger.info(" {} on Game Over with game result {} " , this , data)
125
+ logger.info(" $this on Game Over with game result $ data" )
128
126
if (this ::handler.isInitialized) {
129
- handler.gameEnded(data, team, error.orEmpty() )
127
+ handler.gameEnded(data, team, error)
130
128
}
131
129
}
132
130
0 commit comments