mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fixed that timeout for autoconcede is only applied if the player has priority. This prevents that player autoconcede if other players need more time to finish their turns.
This commit is contained in:
parent
3817b6ebe1
commit
be883d6b70
1 changed files with 14 additions and 1 deletions
|
@ -170,6 +170,14 @@ public class GameSession extends GameWatcher {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the timeout counter after priority in game changed
|
||||
*
|
||||
*/
|
||||
public void signalPriorityChange() {
|
||||
setupTimeout();
|
||||
}
|
||||
|
||||
private synchronized void setupTimeout() {
|
||||
if (!useTimeout) {
|
||||
return;
|
||||
|
@ -179,7 +187,12 @@ public class GameSession extends GameWatcher {
|
|||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GameManager.getInstance().timeout(game.getId(), userId);
|
||||
// if player has no priority, he does not get timeout
|
||||
if(game.getPriorityPlayerId().equals(playerId)) {
|
||||
GameManager.getInstance().timeout(game.getId(), userId);
|
||||
} else {
|
||||
setupTimeout();
|
||||
}
|
||||
}
|
||||
},
|
||||
ConfigSettings.getInstance().getMaxSecondsIdle(), TimeUnit.SECONDS
|
||||
|
|
Loading…
Reference in a new issue