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); o.update(this);
} }
} }
/**
* The current number of players.
*/
public int getCurrentPlayerNumber() {
return playersList.size();
}
/** /**
* The list of players participating in the game. * The list of players participating in the game.
@@ -189,7 +195,7 @@ public class Game implements Serializable {
} }
if(currentState.getGameStage()!= GameStages.WAITING) if(currentState.getGameStage()!= GameStages.WAITING)
return false; return false;
if(playersList.contains(player)) if(playersList.stream().anyMatch(player.getUserName()::equals))
return false; return false;
playersList.add(player); playersList.add(player);
if(playersList.size()>=nPlayers) if(playersList.size()>=nPlayers)