minor changes to the server state automaton

This commit is contained in:
Daniel Grigencha
2024-11-26 23:28:49 +01:00
parent 84c289cfd1
commit 5a911326ba
47 changed files with 1007 additions and 470 deletions

View File

@@ -11,7 +11,6 @@ public class Game {
/**
* Constants.
*/
public static final int MAX_PLAYERS = 4;
public static final int AMOUNT_OF_TURBO_CARDS = 16;
public static final int AMOUNT_OF_SHIELD_AND_SWAP_CARDS = 12;
@@ -27,7 +26,6 @@ public class Game {
private Board board;
private Color activeColor;
private final ArrayList<Observer> observers = new ArrayList<>();
private Player currentPlayer;
private boolean allRanked = false;
private boolean movablePieces = false;
private boolean allReady = false;
@@ -104,7 +102,13 @@ public Player getPlayerById(int id) {
return this.players.get(id);
}
public Player getCurrentPlayer(Color color) {
/**
* This method will be used to the get the player depending on the given color parameter.
*
* @param color as the color of the player as a Color enumeration.
* @return the player with the given color as a Player object.
*/
public Player getPlayerByColor(Color color) {
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
if (entry.getValue().getColor() == color) {
return entry.getValue();

View File

@@ -20,7 +20,6 @@ public interface ClientInterpreter {
*/
void received(DeselectTSK msg, int from);
/**
* Processes a received ForceStartGame message.
*
@@ -61,6 +60,14 @@ public interface ClientInterpreter {
*/
void received(LobbyReady msg, int from);
/**
* Processes a received Disconnected message.
*
* @param msg the Disconnected message to be processed
* @param from the connection ID from which the message was received
*/
void received(Disconnected msg, int from);
/**
* Processes a received RequestBriefing message.
*
@@ -70,12 +77,12 @@ public interface ClientInterpreter {
void received(RequestBriefing msg, int from);
/**
* Processes a received RequestDice message.
* Processes a received RequestDie message.
*
* @param msg the RequestDice message to be processed
* @param msg the RequestDie message to be processed
* @param from the connection ID from which the message was received
*/
void received(RequestDice msg, int from);
void received(RequestDie msg, int from);
/**
* Processes a received RequestMove message.
@@ -140,12 +147,4 @@ public interface ClientInterpreter {
* @param from the connection ID from which the message was received
*/
void received(SelectedPieces msg, int from);
/**
* Processes a received disconnect message.
*
* @param msg the disconnect message to be processed
* @param from the connection ID from which the message was received
*/
void received(Disconnected msg, int from);
}

View File

@@ -6,11 +6,11 @@
* A message sent by a client to request a die roll.
*/
@Serializable
public class RequestDice extends ClientMessage {
public class RequestDie extends ClientMessage {
/**
* Constructs a new RequestDice instance.
* Constructs a new RequestDie instance.
*/
public RequestDice() {
public RequestDie() {
super();
}
@@ -21,7 +21,7 @@ public RequestDice() {
*/
@Override
public String toString() {
return "RequestDice{}";
return "RequestDie{}";
}
/**

View File

@@ -193,4 +193,11 @@ public interface ServerInterpreter {
* @param msg the WaitPiece message received
*/
void received(WaitPiece msg);
/**
* Handles a Spectator message received from the server.
*
* @param msg the Spectator message received.
*/
void received(Spectator msg);
}

View File

@@ -0,0 +1,32 @@
package pp.mdga.message.server;
/**
*
*/
public class Spectator extends ServerMessage {
/**
* Construc
*/
public Spectator() {
super();
}
/**
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
*
* @return
*/
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class Ceremony extends ServerState {
public Ceremony(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class ChoosePiece extends Turn {
public ChoosePiece(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class ChoosePieceState extends TurnState {
public ChoosePieceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class DetermineStartPlayer extends Game {
public DetermineStartPlayer(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,9 @@
package pp.mdga.server;
import pp.mdga.server.automaton.GameState;
public class DetermineStartPlayerState extends GameState {
public DetermineStartPlayerState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class FirstRoll extends RollDice {
public FirstRoll(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class FirstRollStateState extends RollDiceState {
public FirstRollStateState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class Interrupt extends ServerState {
public Interrupt(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,14 +0,0 @@
package pp.mdga.server;
public class Lobby extends ServerState {
/**
* Constructs a server state of the specified game logic.
*
* @param logic the game logic
*/
public Lobby(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class MovePiece extends Turn {
public MovePiece(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class MovePieceState extends TurnState {
public MovePieceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class NoPiece extends ChoosePiece {
public NoPiece(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class NoPieceState extends ChoosePieceState {
public NoPieceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class NoTurn extends ChoosePiece {
public NoTurn(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class NoTurnState extends ChoosePieceState {
public NoTurnState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class PowerCard extends Turn {
public PowerCard(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class PowerCardState extends TurnState {
public PowerCardState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class RollDice extends Turn {
public RollDice(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class RollDiceState extends TurnState {
public RollDiceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class SecondRoll extends RollDice {
public SecondRoll(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class SecondRollState extends RollDiceState {
public SecondRollState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class SelectPiece extends ChoosePiece {
public SelectPiece(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class SelectPieceState extends ChoosePieceState {
public SelectPieceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -2,128 +2,215 @@
import pp.mdga.game.Game;
import pp.mdga.message.client.*;
import pp.mdga.message.server.NoTurn;
import pp.mdga.message.server.StartPiece;
import pp.mdga.server.automaton.*;
import java.lang.System.Logger;
/**
*
*/
public class ServerGameLogic implements ClientInterpreter {
/**
* Constants.
*/
private static final Logger LOGGER = System.getLogger(ServerGameLogic.class.getName());
/**
*
*/
private final ServerSender serverSender;
private final Game game;
private final ServerState state;
private final ServerState lobby = new Lobby(this);
private final ServerState game = new Game(this);
private final ServerState interrupt = new Interrupt(this);
private final ServerState ceremony = new Ceremony(this);
private final ServerState turn = new Turn(this);
private final ServerState determineStartPlayer = new DetermineStartPlayer(this);
private final ServerState rollDice = new RollDice(this);
private final ServerState powerCard = new PowerCard(this);
private final ServerState movePiece = new MovePiece(this);
private final ServerState choosePiece = new ChoosePiece(this);
private final ServerState firstRoll = new FirstRoll(this);
private final ServerState secondRoll = new SecondRoll(this);
private final ServerState thirdRoll = new ThirdRoll(this);
private final ServerState noPiece = new NoPiece(this);
private final ServerState noTurn = new NoTurn(this);
private final ServerState waitingPiece = new WaitingPiece(this);
private final ServerState startPiece = new StartPiece(this);
private final ServerState selectPiece = new SelectPiece(this);
/**
* States
*/
private ServerState currentState;
private final ServerState lobbyState;
private final ServerState gameState;
private final ServerState interruptState;
private final ServerState ceremonyState;
/**
* Constructor.
*
* @param serverSender
* @param game
*/
public ServerGameLogic(ServerSender serverSender, Game game) {
this.serverSender = serverSender;
this.game = game;
this.state = lobby;
this.lobbyState = new LobbyState(this);
this.gameState = new GameState(this);
this.interruptState = new InterruptState(this);
this.ceremonyState = new CeremonyState(this);
this.currentState = this.lobbyState;
}
@Override
public void received(AnimationEnd msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(DeselectTSK msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(StartGame msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(JoinServer msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(LeaveGame msg, int from) {
}
@Override
public void received(LobbyNotReady msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(LobbyReady msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(LobbyNotReady msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(Disconnected msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(RequestBriefing msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(RequestDice msg, int from) {
public void received(RequestDie msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(RequestMove msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(RequestPlayCard msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(SelectCard msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(SelectTSK msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(ForceContinueGame msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(ClientStartGame msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(NoPowerCard msg, int from) {
this.currentState.received(msg, from);
}
@Override
public void received(SelectedPieces msg, int from) {
this.currentState.received(msg, from);
}
/**
* This method will be used to return serverSender attribute of ServerGameLogic class.
*
* @return serverSender as a ServerSender object.
*/
public ServerSender getServerSender() {
return this.serverSender;
}
/**
* This method will be used to return game attribute of ServerGameLogic class.
*
* @return game as a Game object.
*/
public Game getGame() {
return this.game;
}
/**
* This method will be used to return currentState attribute of ServerGameLogic class.
*
* @return currentState as a ServerState object.
*/
public ServerState getCurrentState() {
return this.currentState;
}
/**
* This method will be used to return lobbyState attribute of ServerGameLogic class.
*
* @return lobbyState as a ServerState object.
*/
public ServerState getLobbyState() {
return this.lobbyState;
}
/**
* This method will be used to return gameState attribute of ServerGameLogic class.
*
* @return gameState as a ServerState object.
*/
public ServerState getGameState() {
return this.gameState;
}
/**
* This method will be used to return interruptState attribute of ServerGameLogic class.
*
* @return interruptState as a ServerState object.
*/
public ServerState getInterruptState() {
return this.interruptState;
}
/**
* This method will be used to return ceremonyState attribute of ServerGameLogic class.
*
* @return ceremonyState as a ServerState object.
*/
public ServerState getCeremonyState() {
return this.ceremonyState;
}
/**
* This method will be used to set currentState attribute of ServerGameLogic class to the given state parameter.
* In Addition, the currentState will be exited, changed and entered.
*
* @param state as the new currentState attribute as a ServerState object.
*/
public void setCurrentState(ServerState state) {
if (this.currentState != null) {
this.currentState.exit();
}
this.currentState = state;
this.currentState.enter();
}
}

View File

@@ -13,4 +13,12 @@ public interface ServerSender {
* @param message the message
*/
void send(int id, ServerMessage message);
/**
* This method will be used to send the given message parameter to all connected players which are saved inside the
* players attribute of Game class.
*
* @param message as the message which will be sent to all players as a ServerMessage.
*/
void broadcast(ServerMessage message);
}

View File

@@ -1,25 +0,0 @@
package pp.mdga.server;
/**
* Defines the behavior and state transitions for the server-side game logic.
* Different states of the game logic implement this interface to handle various game events and actions.
*/
public class ServerState {
/**
* The server logic object.
*/
private final ServerGameLogic logic;
/**
* Constructs a server state of the specified game logic.
*
* @param logic the game logic
*/
public ServerState(ServerGameLogic logic) {
this.logic = logic;
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class StartPiece extends ChoosePiece {
public StartPiece(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class StartPieceState extends ChoosePieceState {
public StartPieceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class ThirdRoll extends RollDice {
public ThirdRoll(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class ThirdRollState extends RollDiceState {
public ThirdRollState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class Turn extends Game {
public Turn(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,9 @@
package pp.mdga.server;
import pp.mdga.server.automaton.GameState;
public class TurnState extends GameState {
public TurnState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.server;
public class WaitingPiece extends ChoosePiece {
public WaitingPiece(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class WaitingPieceState extends ChoosePieceState {
public WaitingPieceState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,33 @@
package pp.mdga.server.automaton;
import pp.mdga.server.ServerGameLogic;
/**
*
*/
public class CeremonyState extends ServerState {
/**
* Constructor.
*
* @param logic as the server game logic which is the automaton as a ServerGameLogic object.
*/
public CeremonyState(ServerGameLogic logic) {
super(logic);
}
/**
* This method will be used whenever this state will be entered.
*/
@Override
public void enter() {
// ToDo: Close server.
}
/**
* This method will be used whenever this state will be exited.
*/
@Override
public void exit() {
}
}

View File

@@ -0,0 +1,60 @@
package pp.mdga.server.automaton;
import pp.mdga.message.client.Disconnected;
import pp.mdga.message.client.LeaveGame;
import pp.mdga.message.server.PauseGame;
import pp.mdga.server.ServerGameLogic;
/**
*
*/
public class GameState extends ServerState {
/**
* Constructor.
*
* @param logic as the server game logic which is the automaton as a ServerGameLogic object.
*/
public GameState(ServerGameLogic logic) {
super(logic);
}
/**
* This method will be used whenever this state will be entered.
*/
@Override
public void enter() {
}
/**
* This method will be used whenever this state will be exited.
*/
@Override
public void exit() {
}
/**
*
* @param msg as the message which was sent by the player as a Disconnected object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(Disconnected msg, int from) {
this.logic.getServerSender().broadcast(new PauseGame());
this.logic.setCurrentState(this.logic.getInterruptState());
}
/**
*
* @param msg as the message which was sent by the player as a LeaveGame object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(LeaveGame msg, int from) {
this.logic.getGame().updatePlayerActiveState(from, false);
if (this.logic.getGame().getNumberOfActivePlayers() == 1) {
this.logic.setCurrentState(this.logic.getCeremonyState());
}
}
}

View File

@@ -0,0 +1,47 @@
package pp.mdga.server.automaton;
import com.jme3.system.Timer;
import pp.mdga.message.client.ForceContinueGame;
import pp.mdga.message.server.ResumeGame;
import pp.mdga.server.ServerGameLogic;
/**
*
*/
public class InterruptState extends ServerState {
/**
* Attributes.
*/
private Timer timer;
/**
* Constructor.
*
* @param logic as the server game logic which is the automaton as a ServerGameLogic object.
*/
public InterruptState(ServerGameLogic logic) {
super(logic);
}
/**
* This method will be used whenever this state will be entered.
*/
@Override
public void enter() {
// Create timer and connect signal.
}
/**
* This method will be used whenever this state will be exited.
*/
@Override
public void exit() {
}
@Override
public void received(ForceContinueGame msg, int from) {
this.logic.getServerSender().broadcast(new ResumeGame());
this.logic.setCurrentState(this.logic.getGameState());
}
}

View File

@@ -0,0 +1,88 @@
package pp.mdga.server.automaton;
import pp.mdga.message.client.*;
import pp.mdga.message.server.ServerStartGame;
import pp.mdga.message.server.UpdateReady;
import pp.mdga.message.server.UpdateTSK;
import pp.mdga.server.ServerGameLogic;
/**
*
*/
public class LobbyState extends ServerState {
/**
* Constructs a server state of the specified game logic.
*
* @param logic the game logic
*/
public LobbyState(ServerGameLogic logic) {
super(logic);
}
/**
* This method will be used whenever this state will be entered.
*/
@Override
public void enter() {
}
/**
* This method will be used whenever this state will be exited.
*/
@Override
public void exit() {
}
/**
*
* @param msg as the message which was sent by the player as a SelectTSK object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(SelectTSK msg, int from) {
this.logic.getServerSender().broadcast(new UpdateTSK(from, msg.getColor()));
}
/**
*
* @param msg as the message which was sent by the player as a DeselectTSK object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(DeselectTSK msg, int from) {
this.logic.getServerSender().broadcast(new UpdateTSK(from, msg.getColor()));
}
/**
*
* @param msg as the message which was sent by the player as a LobbyReady object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(LobbyReady msg, int from) {
this.logic.getServerSender().broadcast(new UpdateReady(from, true));
}
/**
*
* @param msg as the message which was sent by the player as a LobbyNotReady object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(LobbyNotReady msg, int from) {
this.logic.getServerSender().broadcast(new UpdateReady(from, false));
}
/**
*
* @param msg as the message which was sent by the player as a ForceStartGame object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(ForceStartGame msg, int from) {
this.logic.getServerSender().broadcast(new ServerStartGame());
this.logic.setCurrentState(this.logic.getGameState());
}
}

View File

@@ -0,0 +1,196 @@
package pp.mdga.server.automaton;
import pp.mdga.message.client.*;
import pp.mdga.server.ServerGameLogic;
/**
* Defines the behavior and state transitions for the server-side game logic.
* Different states of the game logic implement this interface to handle various game events and actions.
*/
public abstract class ServerState {
/**
* The server logic object.
*/
protected final ServerGameLogic logic;
/**
* Constructs a server state of the specified game logic.
*
* @param logic the game logic
*/
public ServerState(ServerGameLogic logic) {
this.logic = logic;
}
/**
* This method will be used whenever this state will be entered.
*/
public abstract void enter();
/**
* This method will be used whenever this state will be exited.
*/
public abstract void exit();
/**
* This method will be called whenever the server received an AnimationEnd message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a AnimationEnd object.
* @param from as the client id of the player as an Integer.
*/
public void received(AnimationEnd msg, int from) {}
/**
* This method will be called whenever the server received an DeselectTSK message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a DeselectTSK object.
* @param from as the client id of the player as an Integer.
*/
public void received(DeselectTSK msg, int from) {}
/**
* This method will be called whenever the server received a StartGame message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a StartGame object.
* @param from as the client id of the player as an Integer.
*/
public void received(StartGame msg, int from) {}
/**
* This method will be called whenever the server received a JoinServer message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a JoinServer object.
* @param from as the client id of the player as an Integer.
*/
public void received(JoinServer msg, int from) {}
/**
* This method will be called whenever the server received an LeaveGame message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a LeaveGame object.
* @param from as the client id of the player as an Integer.
*/
public void received(LeaveGame msg, int from) {}
/**
* This method will be called whenever the server received a LobbyReady message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a LobbyReady object.
* @param from as the client id of the player as an Integer.
*/
public void received(LobbyReady msg, int from) {}
/**
* This method will be called whenever the server received a LobbyNotReady message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a LobbyNotReady object.
* @param from as the client id of the player as an Integer.
*/
public void received(LobbyNotReady msg, int from) {}
/**
* This method will be called whenever the server received a Disconnected message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a Disconnected object.
* @param from as the client id of the player as an Integer.
*/
public void received(Disconnected msg, int from) {}
/**
* This method will be called whenever the server received a Briefing message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a Briefing object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestBriefing msg, int from) {}
/**
* This method will be called whenever the server received a Die message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a Die object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestDie msg, int from) {}
/**
* This method will be called whenever the server received a RequestMove message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a RequestMove object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestMove msg, int from) {}
/**
* This method will be called whenever the server received a PlayCard message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a PlayCard object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestPlayCard msg, int from) {}
/**
* This method will be called whenever the server received a SelectCard message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a SelectCard object.
* @param from as the client id of the player as an Integer.
*/
public void received(SelectCard msg, int from) {}
/**
* This method will be called whenever the server received a SelectTSK message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a SelectTSK object.
* @param from as the client id of the player as an Integer.
*/
public void received(SelectTSK msg, int from) {}
/**
* This method will be called whenever the server received a ForceContinueGame message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a ForceContinueGame object.
* @param from as the client id of the player as an Integer.
*/
public void received(ForceContinueGame msg, int from) {}
/**
* This method will be called whenever the server received a ClientStartGame message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a ClientStartGame object.
* @param from as the client id of the player as an Integer.
*/
public void received(ClientStartGame msg, int from) {}
/**
* This method will be called whenever the server received a NoPowerCard message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a NoPowerCard object.
* @param from as the client id of the player as an Integer.
*/
public void received(NoPowerCard msg, int from) {}
/**
* This method will be called whenever the server received a SelectedPieces message.
* It will also get the client id of the player who send this message.
*
* @param msg as the message which was sent by the player as a SelectedPieces object.
* @param from as the client id of the player as an Integer.
*/
public void received(SelectedPieces msg, int from) {}
}