added an ArrayList of Player in game and added the received methods in clientgamelogic

This commit is contained in:
Hanno Fleischer
2024-11-25 11:19:17 +01:00
parent 7c5720cb9d
commit 15d1c36dad
3 changed files with 196 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ public class Game {
private Board board;
private Color activeColor;
private List<Color> order;
private final ArrayList<Player> playerList = new ArrayList<>(4);
private final ArrayList<Observer> observers = new ArrayList<>();
private Player startPlayer;
@@ -400,4 +401,16 @@ public Piece getPieceThroughIdentifier(String identifier) {
int index = Integer.parseInt(parts[1]);
return board.getPlayerData().get(color).getPieces()[index];
}
public ArrayList<Player> getPlayerList() {
return playerList;
}
public void addPlayerToList(Player player) {
playerList.add(player);
}
public void removePlayerFromList(Player player) {
playerList.remove(player);
}
}