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 666f1b8b..69bab269 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 @@ -96,6 +96,23 @@ public void updatePlayerActiveState(int id, boolean active) { this.players.get(id).setActive(active); } + /** + * This method will be used to check if the given color parameter is already taken. + * If yes it will return true, otherwise false. + * + * @param color as the color which should be checked if taken as a Color enumeration. + * @return true or false. + */ + public boolean isColorTaken(Color color) { + for (Map.Entry entry : this.players.entrySet()) { + if (entry.getValue().getColor() == color) { + return true; + } + } + + return false; + } + /** * This method will be used to return the player which has the given id parameter. *