diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-05-04 20:40:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 20:40:27 +0200 |
commit | 54af9243d1d98e165e06c3db304649154e843132 (patch) | |
tree | e2df5e4074b59bbc4681bd621d4f240a1cabc2da /src/main/java/at | |
parent | 28a3c9d9d2ff9291f3e35d13804fc715b0b688c5 (diff) | |
download | skyhanni-54af9243d1d98e165e06c3db304649154e843132.tar.gz skyhanni-54af9243d1d98e165e06c3db304649154e843132.tar.bz2 skyhanni-54af9243d1d98e165e06c3db304649154e843132.zip |
concurrency fix like a pro (#91)
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 5440c2af8..55b893938 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.makeSyncMap import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine import at.hannibal2.skyhanni.utils.RenderUtils.drawColor @@ -22,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GriffinBurrowHelper { private var guessLocation: LorenzVec? = null - private var particleBurrows = mutableMapOf<LorenzVec, BurrowType>() + private val particleBurrows = makeSyncMap(mutableMapOf<LorenzVec, BurrowType>()) private var animationLocation: LorenzVec? = null private var lastDug: LorenzVec? = null private var teleportedLocation: LorenzVec? = null diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 84807dcca..fbb0272f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -262,4 +262,6 @@ object LorenzUtils { fun <T> Property<out T>.onToggle(observer: Runnable) { whenChanged { _, _ -> observer.run() } } + + fun <K, V> makeSyncMap(originalMap: MutableMap<K, V>) = Collections.synchronizedMap(originalMap) }
\ No newline at end of file |