From d09480c3d272f270fb1b45c51bc3540b5416c09a Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Sun, 8 Sep 2024 07:03:51 +1000 Subject: Backend: Use on DelayedRun to add scheduled tasks (#2462) --- src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt | 6 +++--- src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt b/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt index 4d825b2e9..36dc3c6f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/FixedRateTimerManager.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LorenzUtils -import net.minecraft.client.Minecraft import kotlin.concurrent.fixedRateTimer @SkyHanniModule @@ -12,8 +12,8 @@ object FixedRateTimerManager { init { fixedRateTimer(name = "skyhanni-fixed-rate-timer-manager", period = 1000L) { - Minecraft.getMinecraft().addScheduledTask { - if (!LorenzUtils.onHypixel) return@addScheduledTask + DelayedRun.onThread.execute { + if (!LorenzUtils.onHypixel) return@execute SecondPassedEvent(totalSeconds).postAndCatch() totalSeconds++ } diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index 79d329f22..551f44699 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -7,12 +7,12 @@ import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.chat.Text import at.hannibal2.skyhanni.utils.chat.Text.asComponent import at.hannibal2.skyhanni.utils.chat.Text.send import com.google.gson.JsonObject -import net.minecraft.client.Minecraft import net.minecraft.util.IChatComponent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.apache.commons.io.FileUtils @@ -169,7 +169,7 @@ class RepoManager(private val configLocation: File) { val comp = CompletableFuture() if (!atomicShouldManuallyReload.get()) return comp ErrorManager.resetCache() - Minecraft.getMinecraft().addScheduledTask { + DelayedRun.onThread.execute { error = false successfulConstants.clear() unsuccessfulConstants.clear() -- cgit