From 6a34143826f84922c4fb011be726e83e81fa41d9 Mon Sep 17 00:00:00 2001 From: Not a cow <104355555+Not-a-cowfr@users.noreply.github.com> Date: Wed, 23 Oct 2024 02:06:47 -0700 Subject: Fix: Unlock mouse on barn tp (#2799) Co-authored-by: Cal --- .../java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt index f7d8e20be..3e1388a67 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -8,13 +8,20 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.features.garden.SensitivityReducer import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object LockMouseLook { + private val gardenTeleportPattern by RepoPattern.pattern( + "chat.garden.teleport", + "§aTeleported you to .*", + ) + private val config get() = SkyHanniMod.feature.misc private val storage get() = SkyHanniMod.feature.storage var lockedMouse = false @@ -32,7 +39,7 @@ object LockMouseLook { @SubscribeEvent fun onChat(event: LorenzChatEvent) { - if (!event.message.startsWith("§aTeleported you to §r§aPlot")) return + if (!gardenTeleportPattern.matches(event.message)) return if (lockedMouse) toggleLock() } -- cgit