added timeout on sideboard + show construct and/or sideboard on reconnect

This commit is contained in:
BetaSteward 2011-09-03 21:44:05 -04:00
parent a4ed12b47b
commit ea44fc973f
18 changed files with 161 additions and 53 deletions

View file

@ -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(