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:
LevelX2 2013-09-21 19:30:03 +02:00
parent 3817b6ebe1
commit be883d6b70

View file

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