merge the new developmentbranch into the test branch #39
@@ -99,7 +99,7 @@ public void updatePlayerActiveState(int id, boolean active) {
|
|||||||
* If yes it will return true, otherwise false.
|
* If yes it will return true, otherwise false.
|
||||||
*
|
*
|
||||||
* @param color as the color which should be checked if taken as a Color enumeration.
|
* @param color as the color which should be checked if taken as a Color enumeration.
|
||||||
* @return true or false.
|
* @return true or false.
|
||||||
*/
|
*/
|
||||||
public boolean isColorTaken(Color color) {
|
public boolean isColorTaken(Color color) {
|
||||||
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
|
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
|
||||||
@@ -152,6 +152,15 @@ public Player getPlayerByColor(Color color) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return all connected players as a list.
|
||||||
|
*
|
||||||
|
* @return players as a List of Player objects.
|
||||||
|
*/
|
||||||
|
public List<Player> getPlayersAsList() {
|
||||||
|
return new ArrayList<>(this.players.values());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be used to return the id of the active player depending on the activeColor attribute of Game
|
* This method will be used to return the id of the active player depending on the activeColor attribute of Game
|
||||||
* class.
|
* class.
|
||||||
@@ -166,7 +175,7 @@ public int getActivePlayerId() {
|
|||||||
* This method will be used to return the id of the Player defined by the given color parameter.
|
* This method will be used to return the id of the Player defined by the given color parameter.
|
||||||
*
|
*
|
||||||
* @param color as the color of the player as a Color enumeration.
|
* @param color as the color of the player as a Color enumeration.
|
||||||
* @return the id of the player as an Integer.
|
* @return the id of the player as an Integer.
|
||||||
*/
|
*/
|
||||||
public int getPlayerIdByColor(Color color) {
|
public int getPlayerIdByColor(Color color) {
|
||||||
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
|
for (Map.Entry<Integer, Player> entry : this.players.entrySet()) {
|
||||||
@@ -216,8 +225,8 @@ public boolean areAllReady() {
|
|||||||
* @return the piece specified by the UUID
|
* @return the piece specified by the UUID
|
||||||
*/
|
*/
|
||||||
public Piece getPieceThroughUUID(UUID pieceId) {
|
public Piece getPieceThroughUUID(UUID pieceId) {
|
||||||
for (var playerData : board.getPlayerData().values()) {
|
for (var player : this.getPlayers().values()) {
|
||||||
for (var piece : playerData.getPieces()) {
|
for (var piece : player.getPieces()) {
|
||||||
if (piece.getUuid().equals(pieceId)) {
|
if (piece.getUuid().equals(pieceId)) {
|
||||||
return piece;
|
return piece;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user