From 6eb8fd4d3c5f7e327a6b5691edfc5ac22888c1a4 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 26 Feb 2024 15:35:39 +0100 Subject: Fix ancestral spade solver being visible outside hub --- .../moe/nea/firmament/features/diana/AncestralSpadeSolver.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt') diff --git a/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt b/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt index 442d8cf..cd399b3 100644 --- a/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt +++ b/src/main/kotlin/moe/nea/firmament/features/diana/AncestralSpadeSolver.kt @@ -16,6 +16,7 @@ import moe.nea.firmament.events.SoundReceiveEvent import moe.nea.firmament.events.WorldKeyboardEvent import moe.nea.firmament.events.WorldReadyEvent import moe.nea.firmament.events.WorldRenderLastEvent +import moe.nea.firmament.util.SBData import moe.nea.firmament.util.TimeMark import moe.nea.firmament.util.WarpUtil import moe.nea.firmament.util.render.RenderInWorldContext @@ -30,8 +31,10 @@ object AncestralSpadeSolver { private var lastTeleportAttempt = TimeMark.farPast() + fun isEnabled() = + DianaWaypoints.TConfig.ancestralSpadeSolver && SBData.skyblockLocation == "hub" fun onKeyBind(event: WorldKeyboardEvent) { - if (!DianaWaypoints.TConfig.ancestralSpadeSolver) return + if (!isEnabled()) return if (!event.matches(DianaWaypoints.TConfig.ancestralSpadeTeleport)) return if (lastTeleportAttempt.passedTime() < 3.seconds) return @@ -40,7 +43,7 @@ object AncestralSpadeSolver { } fun onParticleSpawn(event: ParticleSpawnEvent) { - if (!DianaWaypoints.TConfig.ancestralSpadeSolver) return + if (!isEnabled()) return if (event.particleEffect != ParticleTypes.DRIPPING_LAVA) return if (event.offset.x != 0.0F || event.offset.y != 0F || event.offset.z != 0F) return @@ -51,7 +54,7 @@ object AncestralSpadeSolver { } fun onPlaySound(event: SoundReceiveEvent) { - if (!DianaWaypoints.TConfig.ancestralSpadeSolver) return + if (!isEnabled()) return if (!SoundEvents.BLOCK_NOTE_BLOCK_HARP.matchesId(event.sound.value().id)) return if (lastDing.passedTime() > 1.seconds) { @@ -90,7 +93,7 @@ object AncestralSpadeSolver { } fun onWorldRender(event: WorldRenderLastEvent) { - if (!DianaWaypoints.TConfig.ancestralSpadeSolver) return + if (!isEnabled()) return RenderInWorldContext.renderInWorld(event) { nextGuess?.let { color(1f, 1f, 0f, 0.5f) -- cgit