merge the new developmentbranch into the test branch #39
@@ -1,8 +1,10 @@
|
||||
package pp.mdga.message.client;
|
||||
|
||||
import com.jme3.network.serializing.Serializable;
|
||||
import pp.mdga.game.Piece;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A message sent by a client to indicate that a piece has been selected for a bonus cards.
|
||||
@@ -10,43 +12,24 @@
|
||||
@Serializable
|
||||
public class SelectedPiecesMessage extends ClientMessage {
|
||||
/**
|
||||
* The piece identifier.
|
||||
* Create SelectedPiecesMessage attributes.
|
||||
*/
|
||||
private final UUID pieceIdentifier;
|
||||
private final List<Piece> pieces;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
private SelectedPiecesMessage() {
|
||||
this.pieces = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for SelectedPieces
|
||||
*
|
||||
* @param pieceIdentifier the piece identifier
|
||||
* @param pieces the piece identifier
|
||||
*/
|
||||
public SelectedPiecesMessage(UUID pieceIdentifier) {
|
||||
this.pieceIdentifier = pieceIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor for serialization purposes.
|
||||
*/
|
||||
private SelectedPiecesMessage() {
|
||||
pieceIdentifier = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the piece identifier
|
||||
*
|
||||
* @return the piece identifier
|
||||
*/
|
||||
public UUID getPieceIdentifier() {
|
||||
return pieceIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this message.
|
||||
*
|
||||
* @return a string representation of this message
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SelectedPieces{pieceIdentifier=" + pieceIdentifier + '}';
|
||||
public SelectedPiecesMessage(List<Piece> pieces) {
|
||||
this.pieces = pieces;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,4 +42,30 @@ public String toString() {
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
interpreter.received(this, from);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return pieces of SelectedPiecesMessage class.
|
||||
*
|
||||
* @return pieces as a List of Piece objects.
|
||||
*/
|
||||
public List<Piece> getPieces() {
|
||||
return pieces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this message.
|
||||
*
|
||||
* @return a string representation of this message
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("SelectedPieces{Number of pieces: ").append(this.pieces.size()).append(" | ");
|
||||
for (Piece piece : this.pieces) {
|
||||
stringBuilder.append(piece).append(", ");
|
||||
}
|
||||
stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
||||
stringBuilder.deleteCharAt(stringBuilder.length() - 1);
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user