Module polimi.ingsw.am21.codex
Interface RMIServerConnectionHandler
- All Superinterfaces:
Remote
- All Known Implementing Classes:
RMIServerConnectionHandlerImpl
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connect
(UUID connectionID, RemoteGameEventListener listener) Connects the player to the servervoid
createGame
(UUID connectionID, String gameId, Integer players) Creates a gamevoid
deleteGame
(UUID connectionID, String gameId) Deletes a gamegetGames()
Gets the list of available game IDsGets the current number of players in each gameGets the maximum number of players in each gamegetLobbyObjectiveCards
(UUID connectionID) Gets the ids of the objective cards that the lobby has to offer to the playergetLobbyStarterCard
(UUID connectionID) Gets the id of the starter card that the lobby has to offer to the playervoid
Sends a heartbeat to the servervoid
joinGame
(UUID connectionID, String gameID, CardSideType sideType) Joins a game, by selecting the side of the starter cardvoid
Joins a lobbyvoid
leaveLobby
(UUID connectionID) Leaves a lobbyvoid
lobbyChooseObjective
(UUID connectionID, Boolean first) Chooses the objective card of the playervoid
lobbySetNickname
(UUID connectionID, String nickname) Sets the nickname of the playervoid
lobbySetTokenColor
(UUID connectionID, TokenColor color) Sets the token color of the playervoid
Starts the next turn, to be used when a player is skipping their turn (for example, when the player is disconnected)void
nextTurn
(UUID connectionID, DrawingCardSource drawingSource, DrawingDeckType deckType) Starts the next turn by drawing cards from the deckvoid
placeCard
(UUID connectionID, Integer playerHandCardNumber, CardSideType side, Position position) Places a card on the game boardvoid
sendChatMessage
(UUID connectionID, ChatMessage message) Gets the available tokens of the player
-
Method Details
-
getGames
Gets the list of available game IDs- Throws:
RemoteException
-
getGamesCurrentPlayers
Gets the current number of players in each game- Throws:
RemoteException
-
getGamesMaxPlayers
Gets the maximum number of players in each game- Throws:
RemoteException
-
getLobbyObjectiveCards
javafx.util.Pair<Integer,Integer> getLobbyObjectiveCards(UUID connectionID) throws RemoteException, InvalidActionException Gets the ids of the objective cards that the lobby has to offer to the player- Parameters:
connectionID
- The connection ID of the player- Throws:
RemoteException
InvalidActionException
-
getLobbyStarterCard
Gets the id of the starter card that the lobby has to offer to the player- Parameters:
connectionID
- The connection ID of the player- Throws:
RemoteException
InvalidActionException
-
joinLobby
Joins a lobby- Parameters:
connectionID
- The connection ID of the playergameID
- The game ID of the lobby- Throws:
RemoteException
InvalidActionException
-
lobbySetTokenColor
void lobbySetTokenColor(UUID connectionID, TokenColor color) throws RemoteException, InvalidActionException Sets the token color of the player- Parameters:
connectionID
- The connection ID of the playercolor
- The token color of the player- Throws:
RemoteException
InvalidActionException
-
lobbySetNickname
void lobbySetNickname(UUID connectionID, String nickname) throws RemoteException, InvalidActionException Sets the nickname of the player- Parameters:
connectionID
- The connection ID of the playernickname
- The nickname of the player- Throws:
RemoteException
InvalidActionException
-
lobbyChooseObjective
void lobbyChooseObjective(UUID connectionID, Boolean first) throws RemoteException, InvalidActionException Chooses the objective card of the player- Parameters:
connectionID
- The connection ID of the playerfirst
- True if the player chooses the first objective card, false otherwise- Throws:
RemoteException
InvalidActionException
-
joinGame
void joinGame(UUID connectionID, String gameID, CardSideType sideType) throws RemoteException, InvalidActionException Joins a game, by selecting the side of the starter card- Parameters:
connectionID
- The connection ID of the player- Throws:
RemoteException
InvalidActionException
-
createGame
void createGame(UUID connectionID, String gameId, Integer players) throws RemoteException, InvalidActionException Creates a game- Parameters:
connectionID
- The connection ID of the playergameId
- The game ID of the gameplayers
- The number of players of the game- Throws:
RemoteException
InvalidActionException
-
deleteGame
Deletes a game- Parameters:
connectionID
- The connection ID of the playergameId
- The game ID of the game- Throws:
RemoteException
InvalidActionException
-
nextTurn
Starts the next turn, to be used when a player is skipping their turn (for example, when the player is disconnected)- Parameters:
connectionID
- The connection ID of the player- Throws:
RemoteException
InvalidActionException
-
nextTurn
void nextTurn(UUID connectionID, DrawingCardSource drawingSource, DrawingDeckType deckType) throws RemoteException, InvalidActionException Starts the next turn by drawing cards from the deck- Parameters:
connectionID
- The connection ID of the playerdrawingSource
- The source of the drawing cardsdeckType
- The type of the drawing deck- Throws:
RemoteException
InvalidActionException
-
placeCard
void placeCard(UUID connectionID, Integer playerHandCardNumber, CardSideType side, Position position) throws RemoteException, InvalidActionException Places a card on the game board- Parameters:
connectionID
- The connection ID of the playerplayerHandCardNumber
- The index of the card in the player's handside
- The side of the cardposition
- The position of the card- Throws:
RemoteException
InvalidActionException
-
leaveLobby
Leaves a lobby- Parameters:
connectionID
- The connection ID of the player- Throws:
RemoteException
InvalidActionException
-
sendChatMessage
void sendChatMessage(UUID connectionID, ChatMessage message) throws RemoteException, InvalidActionException Gets the available tokens of the player- Parameters:
connectionID
- The connection ID of the playermessage
- The message to be sent to the player- Throws:
RemoteException
InvalidActionException
-
connect
Connects the player to the server- Parameters:
connectionID
- The connection ID of the playerlistener
- The listener of the player- Throws:
RemoteException
-
heartBeat
Sends a heartbeat to the server- Parameters:
connectionID
- The connection ID of the player- Throws:
RemoteException
PlayerNotFoundException
-