File tree Expand file tree Collapse file tree 8 files changed +18
-15
lines changed
sdk/src/server-api/sc/protocol Expand file tree Collapse file tree 8 files changed +18
-15
lines changed Original file line number Diff line number Diff line change 1
1
package sc.protocol
2
2
3
+ /* * Common interface for all packets sent via the XML Protocol. */
3
4
interface ProtocolPacket
5
+
6
+ /* * Interface for all packets sent by the server to clients. */
7
+ interface ResponsePacket : ProtocolPacket
Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ package sc.protocol.responses
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
5
import sc.protocol.ProtocolPacket
6
+ import sc.protocol.ResponsePacket
6
7
7
8
/* * Response to an erroneous packet, including an error [message]. */
8
9
@XStreamAlias(" errorpacket" )
9
10
data class ErrorPacket (
10
11
val originalRequest : ProtocolPacket ,
11
12
@XStreamAsAttribute
12
13
val message : String ,
13
- ): ProtocolPacket
14
+ ): ResponsePacket
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package sc.protocol.responses
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
5
import com.thoughtworks.xstream.annotations.XStreamImplicit
6
- import sc.protocol.ProtocolPacket
6
+ import sc.protocol.ResponsePacket
7
7
8
8
/* * Response to [sc.protocol.requests.PrepareGameRequest].
9
9
* @param reservations the reservations for the reserved slots */
@@ -13,4 +13,4 @@ data class GamePreparedResponse(
13
13
val roomId : String ,
14
14
@XStreamImplicit(itemFieldName = " reservation" )
15
15
val reservations : List <String >
16
- ): ProtocolPacket
16
+ ): ResponsePacket
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ package sc.protocol.responses
2
2
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
- import sc.protocol.ProtocolPacket
5
+ import sc.protocol.ResponsePacket
6
6
7
7
/* * Response to client who successfully joined a game. */
8
8
@XStreamAlias(value = " joined" )
9
9
data class JoinedRoomResponse (
10
10
@XStreamAsAttribute
11
11
val roomId : String
12
- ): ProtocolPacket
12
+ ): ResponsePacket
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ package sc.protocol.responses
2
2
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
- import sc.protocol.ProtocolPacket
5
+ import sc.protocol.ResponsePacket
6
6
7
7
/* * Sent to client as response to successfully joining a GameRoom as Observer. */
8
8
@XStreamAlias(value = " observed" )
9
9
data class ObservationResponse (
10
10
@XStreamAsAttribute
11
11
val roomId : String
12
- ): ProtocolPacket
12
+ ): ResponsePacket
Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ package sc.protocol.responses
2
2
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
- import sc.protocol.ProtocolPacket
6
- import sc.protocol.requests.ILobbyRequest
5
+ import sc.protocol.ResponsePacket
7
6
import sc.shared.Score
8
7
9
8
/* * Response to GetScoreForPlayerRequest. */
10
9
@XStreamAlias(" playerScore" )
11
10
data class PlayerScoreResponse (
12
11
@XStreamAsAttribute
13
12
val score : Score
14
- ): ProtocolPacket
13
+ ): ResponsePacket
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package sc.protocol.responses
2
2
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
- import sc.protocol.ProtocolPacket
5
+ import sc.protocol.ResponsePacket
6
6
7
7
/* * Sent to all administrative clients when a player joined a game via a JoinRoomRequest.
8
8
* @param existing whether the joined room has existed beforehand or was newly created. */
@@ -12,4 +12,4 @@ data class RoomWasJoinedEvent(
12
12
val roomId : String ,
13
13
@XStreamAsAttribute
14
14
val existing : Boolean
15
- ): ProtocolPacket
15
+ ): ResponsePacket
Original file line number Diff line number Diff line change @@ -2,12 +2,11 @@ package sc.protocol.responses
2
2
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5
- import sc.protocol.ProtocolPacket
6
- import sc.protocol.requests.ILobbyRequest
5
+ import sc.protocol.ResponsePacket
7
6
8
7
/* * Response to TestModeRequest containing the current status of testMode. */
9
8
@XStreamAlias(value = " testing" )
10
9
data class TestModeResponse (
11
10
@XStreamAsAttribute
12
11
val testMode : Boolean
13
- ): ProtocolPacket
12
+ ): ResponsePacket
You can’t perform that action at this time.
0 commit comments