forked from External/mage
added timeout on sideboard + show construct and/or sideboard on reconnect
This commit is contained in:
parent
a4ed12b47b
commit
ea44fc973f
18 changed files with 161 additions and 53 deletions
|
|
@ -96,12 +96,13 @@ public class TournamentSession {
|
|||
}
|
||||
}
|
||||
|
||||
public void construct(Deck deck, int timeout) throws MageException {
|
||||
public void construct(int timeout) {
|
||||
if (!killed) {
|
||||
setupTimeout(timeout);
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.construct(deck, tableId, timeout);
|
||||
int remaining = (int) futureTimeout.getDelay(TimeUnit.SECONDS);
|
||||
user.construct(tournament.getPlayer(playerId).getDeck(), tableId, remaining);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -121,6 +122,8 @@ public class TournamentSession {
|
|||
}
|
||||
|
||||
private synchronized void setupTimeout(int seconds) {
|
||||
if (futureTimeout != null && !futureTimeout.isDone())
|
||||
return;
|
||||
cancelTimeout();
|
||||
if (seconds > 0) {
|
||||
futureTimeout = timeoutExecutor.schedule(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue