Fix: Game

This commit is contained in:
rubenpirreram
2026-04-24 16:02:42 +02:00
parent 20ee6ba8e3
commit 10289cd660
@@ -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)