Module polimi.ingsw.am21.codex
Interface RMIServerConnectionHandler
- All Superinterfaces:
Remote
- All Known Implementing Classes:
RMIServerConnectionHandlerImpl
-
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(UUID connectionID, RemoteGameEventListener listener) Connects the player to the servervoidcreateGame(UUID connectionID, String gameId, Integer players) Creates a gamevoiddeleteGame(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 playervoidSends a heartbeat to the servervoidjoinGame(UUID connectionID, String gameID, CardSideType sideType) Joins a game, by selecting the side of the starter cardvoidJoins a lobbyvoidleaveLobby(UUID connectionID) Leaves a lobbyvoidlobbyChooseObjective(UUID connectionID, Boolean first) Chooses the objective card of the playervoidlobbySetNickname(UUID connectionID, String nickname) Sets the nickname of the playervoidlobbySetTokenColor(UUID connectionID, TokenColor color) Sets the token color of the playervoidStarts the next turn, to be used when a player is skipping their turn (for example, when the player is disconnected)voidnextTurn(UUID connectionID, DrawingCardSource drawingSource, DrawingDeckType deckType) Starts the next turn by drawing cards from the deckvoidplaceCard(UUID connectionID, Integer playerHandCardNumber, CardSideType side, Position position) Places a card on the game boardvoidsendChatMessage(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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
joinLobby
Joins a lobby- Parameters:
connectionID- The connection ID of the playergameID- The game ID of the lobby- Throws:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
deleteGame
Deletes a game- Parameters:
connectionID- The connection ID of the playergameId- The game ID of the game- Throws:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
leaveLobby
Leaves a lobby- Parameters:
connectionID- The connection ID of the player- Throws:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionInvalidActionException
-
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:
RemoteExceptionPlayerNotFoundException
-