Updated 'Game' class.
Updated the 'Game' class by adding the 'isColorTaken' method to it.
This commit is contained in:
		@@ -96,6 +96,23 @@ public void updatePlayerActiveState(int id, boolean active) {
 | 
				
			|||||||
        this.players.get(id).setActive(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<Integer, Player> 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.
 | 
					     * This method will be used to return the player which has the given id parameter.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user