Updated 'PowerCardState' class.

Updated the 'PowerCardState' class by adding the 'SelectedPiecesMessage' handling to it.
This commit is contained in:
Daniel Grigencha
2024-12-06 08:57:08 +01:00
parent 77b0207214
commit 12cf5f3e71

View File

@@ -2,6 +2,7 @@
import pp.mdga.game.Piece;
import pp.mdga.game.card.PowerCard;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.DiceNowMessage;
import pp.mdga.message.server.PossibleCardsMessage;
import pp.mdga.server.ServerGameLogic;
@@ -85,6 +86,18 @@ public void addSelectedPiece(Piece piece) {
this.selectedPieces.add(piece);
}
/**
* This method will be called whenever the server received an SelectedPiecesMessage 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 SelectedPiecesMessage object.
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(SelectedPiecesMessage msg, int from) {
this.currentState.received(msg, from);
}
/**
* This method will be used to return currentState attribute of PowerCardState class.
*