From 761788518c4ef295cb9ec108e0bc10af0d7e2d3e Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Thu, 11 Jan 2024 06:21:56 -0500 Subject: use correct coroutine thing (#903) Using SkyHanniMod.coroutineScope instead of CoroutineScope(Dispatchers.Default) #903 --- .../skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt | 9 ++++----- .../hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index a2b337668..8f7457d7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.rift.area.mirrorverse +import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.data.jsonobjects.repo.DanceRoomInstructionsJson import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -12,9 +14,6 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase -import at.hannibal2.skyhanni.data.jsonobjects.repo.DanceRoomInstructionsJson -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.isActive @@ -142,7 +141,7 @@ object DanceRoomHelper { val countdownString = "%01d:%03d".format(seconds, milliseconds) countdown = countdownString - CoroutineScope(Dispatchers.Default).launch { + SkyHanniMod.coroutineScope.launch { delay(1) var updatedSeconds = seconds var updatedMilliseconds = milliseconds - 1 @@ -170,7 +169,7 @@ object DanceRoomHelper { } fun start(interval: Long): Job { - return CoroutineScope(Dispatchers.Default).launch { + return SkyHanniMod.coroutineScope.launch { while (isActive && found) { index++ startCountdown(0, 500) diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index e1f837a7b..baf43b001 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -32,8 +32,6 @@ import at.hannibal2.skyhanni.utils.RenderUtils.exactPlayerEyeLocation import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.SoundUtils.playSound import at.hannibal2.skyhanni.utils.toLorenzVec -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch import net.minecraft.client.Minecraft @@ -208,7 +206,7 @@ object VampireSlayerFeatures { } private fun playTwinclawsSound() { - CoroutineScope(Dispatchers.Default).launch { + SkyHanniMod.coroutineScope.launch { repeat(15) { delay(50) SoundUtils.createSound("random.orb", 0.5f).playSound() -- cgit