added getter for ArrayList Player in Game and created a flag for ready status in Player
This commit is contained in:
		@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ public class Player {
 | 
			
		||||
    private ArrayList<BonusCard> 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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user