From 2a285849a8c875bee223b895d7b26ba869d4bd38 Mon Sep 17 00:00:00 2001 From: q210520993 <210520993@qq.com> Date: Mon, 1 Jul 2024 10:48:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=8D=A1=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- .../feature/realizer/vanilla/VanillaAttTaskBuilder.kt | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 35a0b1a..e3be762 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,7 +55,7 @@ taboolib { isSkipKotlinRelocate =true isSkipKotlin = true } - taboolib = "6.1.1-beta17" + taboolib = "6.1.1" } } diff --git a/src/main/kotlin/com/skillw/attsystem/internal/feature/realizer/vanilla/VanillaAttTaskBuilder.kt b/src/main/kotlin/com/skillw/attsystem/internal/feature/realizer/vanilla/VanillaAttTaskBuilder.kt index ba070c5..c2fa6e3 100644 --- a/src/main/kotlin/com/skillw/attsystem/internal/feature/realizer/vanilla/VanillaAttTaskBuilder.kt +++ b/src/main/kotlin/com/skillw/attsystem/internal/feature/realizer/vanilla/VanillaAttTaskBuilder.kt @@ -38,11 +38,14 @@ internal open class VanillaAttTaskBuilder(key: String, val attribute: BukkitAttr private val valuesCache = WeakHashMap() protected fun changed(uuid: UUID, value: Double): Boolean = - valuesCache.run { - return if (get(uuid) != value) { - put(uuid, value) + synchronized(valuesCache) { + val current = valuesCache[uuid] + return if (current != value) { + valuesCache[uuid] = value true - } else false + } else { + false + } }