Skip to content

Commit cd5f6fb

Browse files
committed
fix: profile detection not applying when leaving skyblock
1 parent 383e2b8 commit cd5f6fb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/kotlin/util/SBData.kt

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ object SBData {
1919
"CLICK THIS TO SUGGEST IT IN CHAT [NO DASHES]",
2020
)
2121
var profileId: UUID? = null
22+
get() {
23+
// TODO: allow unfiltered access to this somehow
24+
if (!isOnSkyblock) return null
25+
return field
26+
}
2227

2328
/**
2429
* Source: https://hypixel-skyblock.fandom.com/wiki/Time_Systems
@@ -37,11 +42,15 @@ object SBData {
3742
HypixelModAPI.getInstance().createHandler(ClientboundLocationPacket::class.java) {
3843
MC.onMainThread {
3944
val lastLocraw = locraw
45+
val oldProfileId = profileId
4046
locraw = Locraw(it.serverName,
4147
it.serverType.getOrNull()?.name?.uppercase(),
4248
it.mode.getOrNull(),
4349
it.map.getOrNull())
4450
SkyblockServerUpdateEvent.publish(SkyblockServerUpdateEvent(lastLocraw, locraw))
51+
if(oldProfileId != profileId) {
52+
ProfileSwitchEvent.publish(ProfileSwitchEvent(oldProfileId, profileId))
53+
}
4554
profileIdCommandDebounce = TimeMark.now()
4655
}
4756
}

0 commit comments

Comments
 (0)