forked from External/mage
disable timeout if game contains any non-human players
This commit is contained in:
parent
8c23757260
commit
8fd03a5bb5
2 changed files with 13 additions and 3 deletions
|
|
@ -57,15 +57,17 @@ import mage.view.SimpleCardsView;
|
|||
public class GameSession extends GameWatcher {
|
||||
|
||||
private UUID playerId;
|
||||
private boolean useTimeout;
|
||||
|
||||
private ScheduledFuture<?> futureTimeout;
|
||||
protected static ScheduledExecutorService timeoutExecutor = ThreadExecutor.getInstance().getTimeoutExecutor();
|
||||
|
||||
private UserData userData;
|
||||
|
||||
public GameSession(Game game, UUID userId, UUID playerId) {
|
||||
public GameSession(Game game, UUID userId, UUID playerId, boolean useTimeout) {
|
||||
super(userId, game);
|
||||
this.playerId = playerId;
|
||||
this.useTimeout = useTimeout;
|
||||
}
|
||||
|
||||
public void ask(final String question) {
|
||||
|
|
@ -158,6 +160,8 @@ public class GameSession extends GameWatcher {
|
|||
}
|
||||
|
||||
private synchronized void setupTimeout() {
|
||||
if (!useTimeout)
|
||||
return;
|
||||
cancelTimeout();
|
||||
futureTimeout = timeoutExecutor.schedule(
|
||||
new Runnable() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue