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 515aa1da..199f2481 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 @@ -152,6 +152,22 @@ public Player getPlayerByColor(Color color) { return null; } + /** + * 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. + * @return the id of the player as an Integer. + */ + public int getPlayerIdByColor(Color color) { + for (Map.Entry entry : this.players.entrySet()) { + if (entry.getValue().getColor() == color) { + return entry.getKey(); + } + } + + return -1; + } + /** * This method will be used to return the number of active players of this game. *