mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
server: fixed rare error on player reconnection with tournament;
This commit is contained in:
parent
378d6c6c22
commit
b61bd22c85
1 changed files with 14 additions and 1 deletions
|
|
@ -73,7 +73,20 @@ public class TournamentSession {
|
||||||
setupTimeout(timeout);
|
setupTimeout(timeout);
|
||||||
managerFactory.userManager().getUser(userId).ifPresent(user -> {
|
managerFactory.userManager().getUser(userId).ifPresent(user -> {
|
||||||
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
|
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
|
||||||
user.ccConstruct(tournament.getPlayer(playerId).getDeck(), tableId, null, remaining);
|
|
||||||
|
// can be called on reconnection, so make sure tournament still active
|
||||||
|
Deck lastDeck = tournament.getPlayer(playerId).getDeck();
|
||||||
|
if (!tournament.isDoneConstructing() && lastDeck != null) {
|
||||||
|
user.ccConstruct(lastDeck, tableId, null, remaining);
|
||||||
|
} else {
|
||||||
|
logger.error("Found bad state on reconnection: player has tournament session, but don't have deck"
|
||||||
|
+ ", deck " + lastDeck
|
||||||
|
+ ", user " + user.getName()
|
||||||
|
+ ", state " + tournament.getTournamentState()
|
||||||
|
+ ", t type " + tournament.getTournamentType()
|
||||||
|
+ ", t id " + tournament.getId()
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue