24
24
public abstract class AbstractClient implements ILobbyClientListener {
25
25
private static final Logger logger = LoggerFactory .getLogger (AbstractClient .class );
26
26
27
- /** The handler reacts to messages from the server received by the lobby client */
27
+ /** The handler reacts to messages from the server received by the lobby client. */
28
28
protected IGameHandler handler ;
29
29
30
- /** The lobby client, that connects to the room */
30
+ /** The lobby client that connects to the room. */
31
31
private LobbyClient client ;
32
32
33
33
private String gameType ;
34
34
35
- /** If the client made an error (rule violation), store reason here */
35
+ /** If the client made an error (rule violation), store reason here. */
36
36
private String error ;
37
37
38
- /** current id to identify the client instance internal */
38
+ /** Current id to identify the client instance internally. */
39
39
private PlayerType id ;
40
- /** the current room in which the player is */
40
+ /** Current room of the player. */
41
41
private String roomId ;
42
- /** the current host */
43
42
private String host ;
44
- /** the current port */
45
43
private int port ;
46
- /** current figurecolor to identify which client belongs to which player */
44
+ /** Current team color to identify which client belongs to which player. */
47
45
private Team color ;
48
46
49
47
public AbstractClient (String host , int port , PlayerType id ) throws IOException {
@@ -71,18 +69,12 @@ public void setHandler(IGameHandler handler) {
71
69
this .handler = handler ;
72
70
}
73
71
74
- /**
75
- * Tell this client to observe the game given by the preparation handler
76
- *
77
- * @return controllable game
78
- */
72
+ /** Tell this client to observe the game given by the preparation handler. */
79
73
public IControllableGame observeGame (PrepareGameProtocolMessage handle ) {
80
74
return this .client .observe (handle );
81
75
}
82
76
83
- /**
84
- * Called when a new message is sent to the room, e.g. move requests
85
- */
77
+ /** Called when a new message is sent to the room, e.g. move requests. */
86
78
@ Override
87
79
public void onRoomMessage (String roomId , Object data ) {
88
80
if (data instanceof MoveRequest ) {
@@ -93,16 +85,12 @@ public void onRoomMessage(String roomId, Object data) {
93
85
this .roomId = roomId ;
94
86
}
95
87
96
- /**
97
- * sends the <code>move</code> to the server
98
- *
99
- * @param move the move you want to do
100
- */
88
+ /** Sends the <code>move</code> to the server. */
101
89
public void sendMove (Move move ) {
102
90
this .client .sendMessageToRoom (this .roomId , move );
103
91
}
104
92
105
- /** Called when an error is sent to the room */
93
+ /** Called when an error is sent to the room. */
106
94
@ Override
107
95
public void onError (String roomId , ProtocolErrorMessage response ) {
108
96
logger .debug ("onError: Client {} received error {}" , this , response .getMessage ());
0 commit comments