From cd5f6fbe2c0c7cabcc5362b8924d78f7b2b751fa Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 12 Jan 2025 18:11:26 +0100 Subject: fix: profile detection not applying when leaving skyblock --- src/main/kotlin/util/SBData.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main') diff --git a/src/main/kotlin/util/SBData.kt b/src/main/kotlin/util/SBData.kt index e785ff6..b2f9449 100644 --- a/src/main/kotlin/util/SBData.kt +++ b/src/main/kotlin/util/SBData.kt @@ -19,6 +19,11 @@ object SBData { "CLICK THIS TO SUGGEST IT IN CHAT [NO DASHES]", ) var profileId: UUID? = null + get() { + // TODO: allow unfiltered access to this somehow + if (!isOnSkyblock) return null + return field + } /** * Source: https://hypixel-skyblock.fandom.com/wiki/Time_Systems @@ -37,11 +42,15 @@ object SBData { HypixelModAPI.getInstance().createHandler(ClientboundLocationPacket::class.java) { MC.onMainThread { val lastLocraw = locraw + val oldProfileId = profileId locraw = Locraw(it.serverName, it.serverType.getOrNull()?.name?.uppercase(), it.mode.getOrNull(), it.map.getOrNull()) SkyblockServerUpdateEvent.publish(SkyblockServerUpdateEvent(lastLocraw, locraw)) + if(oldProfileId != profileId) { + ProfileSwitchEvent.publish(ProfileSwitchEvent(oldProfileId, profileId)) + } profileIdCommandDebounce = TimeMark.now() } } -- cgit