From 3de5b150ce27c577b91c710029da6f9e0f257cfa Mon Sep 17 00:00:00 2001 From: Boy Date: Wed, 31 Jul 2024 18:35:28 +0200 Subject: [PATCH] fix: bonfire-cooldown system --- gradle.properties | 2 +- gradle/libs.versions.toml | 4 ++-- .../mineinabyss/bonfire/listeners/BonfireListener.kt | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index d2e0126..0dfe8e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group=com.mineinabyss version=1.11 -idofrontVersion=0.24.14 +idofrontVersion=0.24.15 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 28fc84d..fd13479 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -gearyPaper = "0.30.3" -blocky = "0.10.1" +gearyPaper = "0.30.10-dev.3" +blocky = "0.10.3-dev.2" [libraries] geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" } diff --git a/src/main/kotlin/com/mineinabyss/bonfire/listeners/BonfireListener.kt b/src/main/kotlin/com/mineinabyss/bonfire/listeners/BonfireListener.kt index b20dd1b..e9738d1 100644 --- a/src/main/kotlin/com/mineinabyss/bonfire/listeners/BonfireListener.kt +++ b/src/main/kotlin/com/mineinabyss/bonfire/listeners/BonfireListener.kt @@ -11,12 +11,15 @@ import com.mineinabyss.bonfire.extensions.canBreakBonfire import com.mineinabyss.bonfire.extensions.isBonfire import com.mineinabyss.bonfire.extensions.removeOldBonfire import com.mineinabyss.bonfire.extensions.updateBonfireState +import com.mineinabyss.geary.actions.ActionGroupContext +import com.mineinabyss.geary.actions.execute import com.mineinabyss.geary.helpers.with +import com.mineinabyss.geary.papermc.bridge.cooldowns.Cooldowns +import com.mineinabyss.geary.papermc.bridge.cooldowns.StartCooldown import com.mineinabyss.geary.papermc.datastore.decode import com.mineinabyss.geary.papermc.datastore.encode import com.mineinabyss.geary.papermc.datastore.encodeComponentsTo import com.mineinabyss.geary.papermc.datastore.remove -import com.mineinabyss.geary.papermc.features.general.cooldown.Cooldown import com.mineinabyss.geary.papermc.tracking.entities.toGeary import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull import com.mineinabyss.geary.serialization.setPersisting @@ -38,7 +41,7 @@ import kotlin.math.abs import kotlin.time.Duration.Companion.seconds class BonfireListener : Listener { - val cooldown = Cooldown(length = bonfire.config.bonfireInteractCooldown) + private val cooldown = StartCooldown(length = bonfire.config.bonfireInteractCooldown, display = null, "bonfire:interaction_cooldown") private fun currentTime() = LocalDateTime.now().toInstant(ZoneOffset.UTC).epochSecond @@ -95,11 +98,12 @@ class BonfireListener : Listener { val gearyPlayer = player.toGeary() val gearyBonfire = baseEntity.toGearyOrNull() ?: return - if (!Cooldown.isComplete(gearyPlayer, gearyBonfire)) { + + if (!Cooldowns.isComplete(gearyPlayer, "bonfire:interaction_cooldown")) { isCancelled = true return } - Cooldown.start(gearyPlayer, gearyBonfire, cooldown) + cooldown.execute(ActionGroupContext(gearyPlayer)) gearyBonfire.with { bonfireData: Bonfire -> when (player.uniqueId) {