diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java b/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java index 2c67c651..580e37ff 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/game/Game.java @@ -364,7 +364,7 @@ public void setStartPlayer(Player startPlayer) { /** * This method returns the all ready state. * - * @return the all ready state + * @return the already state */ public Boolean allReady() { return allReady; @@ -413,4 +413,13 @@ public void addPlayerToList(Player player) { public void removePlayerFromList(Player player) { playerList.remove(player); } + + public Player getPlayerFromList(String name) { + for (Player player : playerList) { + if (player.getName().equals(name)) { + return player; + } + } + return null; + } } diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java b/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java index c7b6246e..7371cf7b 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/game/Player.java @@ -12,6 +12,7 @@ public class Player { private ArrayList handCards; private final int id; private Color color; + private boolean isReady; /** * This constructor constructs a new Player object @@ -22,6 +23,18 @@ public Player(int id) { handCards = new ArrayList<>(); } + /** + * This constructor constructs a new Player object + * + * @param name the name of the player + */ + public Player(String name) { + this.name = name; + playerStatistic = new Statistic(); + handCards = new ArrayList<>(); + id = 0; + } + /** * This method returns the give name of the Player * @@ -107,4 +120,22 @@ public Color getColor() { public void setColor(Color color) { this.color = color; } + + /** + * This method returns if the player is ready + * + * @return true if the player is ready, false otherwise + */ + public boolean isReady() { + return isReady; + } + + /** + * This method sets the player to ready + * + * @param ready true if the player is ready, false otherwise + */ + public void setReady(boolean ready) { + isReady = ready; + } }