Fix: Game
This commit is contained in:
@@ -36,6 +36,12 @@ public class Game implements Serializable {
|
||||
o.update(this);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The current number of players.
|
||||
*/
|
||||
public int getCurrentPlayerNumber() {
|
||||
return playersList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of players participating in the game.
|
||||
@@ -189,7 +195,7 @@ public class Game implements Serializable {
|
||||
}
|
||||
if(currentState.getGameStage()!= GameStages.WAITING)
|
||||
return false;
|
||||
if(playersList.contains(player))
|
||||
if(playersList.stream().anyMatch(player.getUserName()::equals))
|
||||
return false;
|
||||
playersList.add(player);
|
||||
if(playersList.size()>=nPlayers)
|
||||
|
||||
Reference in New Issue
Block a user