Fixed:Client Resilience (TCP)

This commit is contained in:
rubenpirreram
2026-05-08 17:16:09 +02:00
parent e78096d2e0
commit 9fe23c6f9e
7 changed files with 91 additions and 10 deletions
@@ -40,6 +40,9 @@ public class Game implements Serializable {
public List<Player> getPlayers() {
return playersList;
}
//TODO
Map<Player,Boolean> disconnetedPlayers = new HashMap<>();
//TODO
public boolean SkipNotConnectedPlayer(Player player)
{
@@ -47,9 +50,28 @@ public class Game implements Serializable {
{
return false;
}
nextPlayerSetup();
return true;
if(currentState.getGameStage().equals(GameStages.SLOT_CHOICE))
{
nextPlayerSetup();
disconnetedPlayers.put(player,false);
}
else
{
nextPlayerSetup();
}
return true;
}
//TODO
public boolean ReconnectPlayer(Player player)
{
if(!disconnetedPlayers.containsKey(player))
{
return false;
}
return disconnetedPlayers.put(player,false);
}
/**
* Returns the current number of players participating in the game.
@@ -728,6 +750,14 @@ public class Game implements Serializable {
if (currentState.getRound() < 10) {
nextRound();
for(Map.Entry<Player,Boolean> entry: disconnetedPlayers.entrySet())
{
if(!entry.getValue())
{
orderLogicCard.pushNoEffect(entry.getKey());
disconnetedPlayers.remove(entry.getKey());
}
}
currentState.PlayerUpdate(orderLogicCard.pull(), null);
currentState.GameStageUpdate(GameStages.SLOT_CHOICE);
} else {