Class PlayerDisconnectionAction
java.lang.Object
it.polimi.ingsw.controller.action.Action
it.polimi.ingsw.controller.action.PlayerDisconnectionAction
public class PlayerDisconnectionAction extends Action
An action to notify the model that a player is no longer connected with the server
-
Constructor Summary
Constructors Constructor Description PlayerDisconnectionAction(java.lang.String username) -
Method Summary
Modifier and Type Method Description PhaseTypeperformAction(IGameState gameState)Disconnect a Player.Methods inherited from class it.polimi.ingsw.controller.action.Action
getUsername, isCurrentPlayer, setUsernameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
PlayerDisconnectionAction
public PlayerDisconnectionAction(java.lang.String username)
-
-
Method Details
-
performAction
public PhaseType performAction(IGameState gameState) throws InvalidActionException, InvalidUsernameException, NoConnectedPlayerExceptionDisconnect a Player. If the player is in the initial setup phase: initial resources and leader to discard are chosen randomly. if the player must adds marbles they are added in order, if possible, and discarded otherwise.- Specified by:
performActionin classAction- Parameters:
gameState- the current state of this game- Returns:
- the next turn phase if the player was the current player, null otherwise
- Throws:
InvalidActionException- this Action is not correctly initializedInvalidUsernameException- the player for which this action must be performed doesn't exist in this gameNoConnectedPlayerException
-