From 919812f775a5faa9f7fdf1d349a1c4e91422e34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=BCnther?= Date: Tue, 17 May 2022 19:02:30 +0200 Subject: [PATCH] Fixed MP refresher not working after rate limit (#6847) --- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index d56e431e05..e3a8ffe83c 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -61,6 +61,7 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.launchIn import java.util.* import kotlin.concurrent.timer +import kotlin.concurrent.timerTask /** * Unciv's world screen @@ -394,9 +395,9 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Bas stopMultiPlayerRefresher() val restartAfter : Long = ex.limitRemainingSeconds.toLong() * 1000 - timer("RestartTimerTimer", true, restartAfter, 0) { + Timer("RestartTimerTimer", true).schedule(timerTask { multiPlayerRefresherJob = multiPlayerRefresher.launchIn(CRASH_HANDLING_DAEMON_SCOPE) - } + }, restartAfter) } catch (ex: Throwable) { postCrashHandlingRunnable { loadingGamePopup.reuseWith("Couldn't download the latest game state!", true)