fix: profile detection not applying when leaving skyblock

This commit is contained in:
Linnea Gräf
2025-01-12 18:11:26 +01:00
parent 383e2b8f7d
commit cd5f6fbe2c

View File

@@ -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()
}
}