added default constructor for serialization purposes

This commit is contained in:
Daniel Grigencha
2024-11-24 23:55:48 +01:00
committed by Felix
parent 1582038dfe
commit f97eea3e5e
16 changed files with 136 additions and 3 deletions

View File

@@ -23,6 +23,13 @@ public DeselectTSK(Color color) {
this.color = color;
}
/**
* Default constructor for serialization purposes.
*/
private DeselectTSK() {
color = null;
}
/**
* Returns the color associated with the TSK to be deselected.
*

View File

@@ -14,14 +14,23 @@ public class RequestMove extends ClientMessage {
/**
* Constructor for RequestMove
*
* @param pieceIdentifier the piece identifier
*/
public RequestMove(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/**
* Default constructor for serialization purposes.
*/
private RequestMove() {
pieceIdentifier = null;
}
/**
* Getter for the piece identifier
*
* @return the piece identifier
*/
public String getPieceIdentifier() {

View File

@@ -21,7 +21,7 @@ public class RequestPlayCard extends ClientMessage {
/**
* Constructs a new RequestPlayCard instance.
*
* @param card the bonus card to be played
* @param card the bonus card to be played
* @param pieceIdentifier the identifier of the piece
*/
public RequestPlayCard(BonusCard card, String pieceIdentifier) {
@@ -29,6 +29,14 @@ public RequestPlayCard(BonusCard card, String pieceIdentifier) {
this.card = card;
}
/**
* Default constructor for serialization purposes.
*/
private RequestPlayCard() {
card = null;
pieceIdentifier = null;
}
/**
* Gets the bonus card associated with this request.
*

View File

@@ -22,6 +22,13 @@ public SelectCard(BonusCard card) {
this.card = card;
}
/**
* Default constructor for serialization purposes.
*/
private SelectCard() {
card = null;
}
/**
* Gets the bonus card associated with this selection.
*

View File

@@ -3,15 +3,32 @@
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by a client to select a TSK.
*/
@Serializable
public class SelectTSK extends ClientMessage {
/**
* The color associated with the TSK to be selected.
*/
private final Color color;
/**
* Constructs a new SelectTSK message with the specified color.
*
* @param color the color associated with the TSK to be selected
*/
public SelectTSK(Color color) {
this.color = color;
}
/**
* Default constructor for serialization purposes.
*/
private SelectTSK() {
color = null;
}
public Color getColor() {
return color;
}

View File

@@ -14,14 +14,23 @@ public class SelectedPieces extends ClientMessage {
/**
* Constructor for SelectedPieces
*
* @param pieceIdentifier the piece identifier
*/
public SelectedPieces(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/**
* Default constructor for serialization purposes.
*/
private SelectedPieces() {
pieceIdentifier = null;
}
/**
* Getter for the piece identifier
*
* @return the piece identifier
*/
public String getPieceIdentifier() {

View File

@@ -8,7 +8,6 @@
*/
@Serializable
public class ActivePlayer extends ServerMessage {
/**
* The color of the active player.
*/
@@ -24,6 +23,13 @@ public ActivePlayer(Color color) {
this.color = color;
}
/**
* Default constructor for serialization purposes.
*/
private ActivePlayer() {
color = null;
}
/**
* Getter for the color of the active player
*

View File

@@ -31,6 +31,14 @@ public Dice(int diceEye, List<String> moveablePieces) {
this.moveablePieces = moveablePieces;
}
/**
* Default constructor for serialization purposes.
*/
private Dice() {
diceEye = 0;
moveablePieces = null;
}
/**
* Constructor for inactivePlayer
*

View File

@@ -23,6 +23,13 @@ public LobbyPlayerJoin(String name) {
this.name = name;
}
/**
* Default constructor for serialization purposes.
*/
private LobbyPlayerJoin() {
name = null;
}
/**
* Returns the name of the player joining the lobby.
*

View File

@@ -30,6 +30,14 @@ public LobbyPlayerLeave(String name, Color color) {
this.color = color;
}
/**
* Default constructor for serialization purposes.
*/
private LobbyPlayerLeave() {
name = null;
color = null;
}
/**
* Returns the name of the player leaving the lobby.
*

View File

@@ -22,6 +22,13 @@ public MoveMessage(String identifier) {
this.pieceIdentifier = identifier;
}
/**
* Default constructor for serialization purposes.
*/
private MoveMessage() {
pieceIdentifier = null;
}
/**
* Returns the identifier of the piece that should be moved.
*

View File

@@ -30,6 +30,14 @@ public PlayCard(BonusCard card, String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/**
* Default constructor for serialization purposes.
*/
private PlayCard() {
card = null;
pieceIdentifier = null;
}
/**
* Returns the card that should be played.
*

View File

@@ -21,6 +21,13 @@ public ReconnectBriefing(Game game) {
this.game = game;
}
/**
* Default constructor for serialization purposes.
*/
private ReconnectBriefing() {
this(null);
}
/**
* Returns the game.
*

View File

@@ -22,6 +22,14 @@ public StartPiece(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/**
* Default constructor for serialization purposes.
*/
private StartPiece() {
super();
this.pieceIdentifier = "";
}
/**
* Gets the identifier for the piece.
*

View File

@@ -30,6 +30,15 @@ public UpdateReady(Color color, boolean ready) {
this.ready = ready;
}
/**
* Default constructor for serialization purposes.
*/
private UpdateReady() {
super();
this.color = null;
this.ready = false;
}
/**
* Gets the color associated with the update.
*

View File

@@ -25,10 +25,18 @@ public class UpdateTSK extends ServerMessage {
* @param color the color associated with the update
*/
public UpdateTSK(String name, Color color) {
super();
this.name = name;
this.color = color;
}
/**
* Default constructor for serialization purposes.
*/
private UpdateTSK() {
this("", null);
}
/**
* Gets the name associated with the update.
*