- All Known Implementing Classes:
NetworkHandlerRMI
,NetworkHandlerSocket
public interface NetworkHandler
This is the interface used by the client to communicate with the server.
Aside from getPlayer, all the methods are processed on the server
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Choose the personal objective cardvoid
createRoom
(String nickname, Token token, int nPlayers) Create a room with the passed parametersvoid
getRooms()
Get the existing roomsvoid
Make the player join the specified roomvoid
Make the player leave the room he is currently part ofvoid
pickCard
(CardPlayableIF card) Pick the passed cardvoid
playCard
(CardPlayableIF card, Coordinates coords, Side side) Play a card according to the parametersvoid
playStarter
(Side side) Play the starter cardvoid
Reconnect the passed player to an existing game he was previously part ofvoid
sendChatMessage
(List<PlayerLobby> receivers, String text) Send a chat message to the receivers (either a single player, or all the other players)void
Starts the thread sending pings to servervoid
stopPing()
Stops the thread sending pings to server
-
Method Details
-
getPlayer
PlayerLobby getPlayer()- Returns:
- The current valid player associated to this NetworkHandler. Null is no valid player is currently associated.
-
getRooms
void getRooms()Get the existing rooms -
createRoom
Create a room with the passed parameters- Parameters:
nickname
- of the player who is creating the roomtoken
- of the player who is creating the roomnPlayers
- of the room that is being created
-
joinRoom
Make the player join the specified room- Parameters:
nickname
- the nickname the client wants to join the room withtoken
- chosen by the player who wants to join the roomgameId
- of the game that the client wants to join
-
reconnect
Reconnect the passed player to an existing game he was previously part of- Parameters:
nickname
- of the player who wants to reconnecttoken
- of the player who wants to reconnect
-
leaveRoom
void leaveRoom()Make the player leave the room he is currently part of -
playStarter
Play the starter card- Parameters:
side
- on which the starter card should be played
-
choosePersonalObjective
Choose the personal objective card- Parameters:
card
- the chosen personal objective
-
playCard
Play a card according to the parameters- Parameters:
card
- the player wants to playcoords
- where the card should be playedside
- on which the card should be played
-
pickCard
Pick the passed card- Parameters:
card
- the player wants to pick
-
startPing
void startPing()Starts the thread sending pings to server -
stopPing
void stopPing()Stops the thread sending pings to server -
sendChatMessage
Send a chat message to the receivers (either a single player, or all the other players)- Parameters:
receivers
- of the chat messagetext
- of the chat message
-