Class GameController
java.lang.Object
it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
it.polimi.ingsw.server.controller.game_controller.GameController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CommunicationControllerprivate booleanprivate final booleanfinal UUID -
Constructor Summary
ConstructorsConstructorDescriptionGameController(UUID roomId, boolean isExpertMode) GameController(UUID gameUUID, List<org.javatuples.Pair<String, Integer>> players, boolean isExpertMode) -
Method Summary
Modifier and TypeMethodDescriptionintvoidprivate voidaddPlayerEffective(Player player) base(SugarMessage message, Peer peer) booleancontainsPeer(Peer peer) Return true if there is the player in the gamebooleancontainsPlayer(String username) Return true if there is the player in the gamegetPeerFromPlayer(@NotNull String username) Returns a peer associated to the username providedgetTeamPeers(String username) Returns the peers of the player's teamvoidremovePlayer(String username) voidsetInactivePlayer(Peer peer) voidvoidupdatePeerIfOlder(@NotNull String username, @NotNull Peer peer) Used when a player plays a move, it checks if the user has logged In from a new connection, if yes, it updates the peer socketMethods inherited from class it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
drop, process, process, processFromLowerLayers
-
Field Details
-
roomId
-
players
-
isExpertMode
private final boolean isExpertMode -
communicationController
-
gameStarted
private boolean gameStarted
-
-
Constructor Details
-
GameController
-
GameController
public GameController(UUID gameUUID, List<org.javatuples.Pair<String, Integer>> players, boolean isExpertMode) throws GameStateInitializationFailureException
-
-
Method Details
-
addPlayerEffective
-
activePlayers
public int activePlayers() -
removePlayer
-
getPlayers
-
addPlayer
-
startGame
-
containsPeer
Return true if there is the player in the game- Parameters:
peer- of the player to check- Returns:
- true if the players list contains the peer provided
-
containsPlayer
Return true if there is the player in the game- Parameters:
username- of the player to check- Returns:
- true if the players list contains the player provided
-
getPeerFromPlayer
public Optional<Peer> getPeerFromPlayer(@NotNull @NotNull String username) throws IllegalArgumentException Returns a peer associated to the username provided- Parameters:
username- of the player- Returns:
- an Optional
that contains the peer, or it can be empty - Throws:
IllegalArgumentException
-
updatePeerIfOlder
Used when a player plays a move, it checks if the user has logged In from a new connection, if yes, it updates the peer socket- Parameters:
username- of the playerpeer- to check if it has changed
-
getTeamPeers
Returns the peers of the player's team- Parameters:
username- of the player- Returns:
- a List
that contains the player's team peers
-
getLightGameState
-
getGameUUID
-
setInactivePlayer
-
base
-