aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/SBData.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/SBData.kt')
-rw-r--r--src/main/kotlin/util/SBData.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/kotlin/util/SBData.kt b/src/main/kotlin/util/SBData.kt
index 353bb06..0b2c404 100644
--- a/src/main/kotlin/util/SBData.kt
+++ b/src/main/kotlin/util/SBData.kt
@@ -7,6 +7,7 @@ import kotlin.jvm.optionals.getOrNull
import kotlin.time.Duration.Companion.seconds
import moe.nea.firmament.events.AllowChatEvent
import moe.nea.firmament.events.ProcessChatEvent
+import moe.nea.firmament.events.ProfileSwitchEvent
import moe.nea.firmament.events.ServerConnectedEvent
import moe.nea.firmament.events.SkyblockServerUpdateEvent
import moe.nea.firmament.events.WorldReadyEvent
@@ -54,6 +55,7 @@ object SBData {
ProcessChatEvent.subscribe(receivesCancelled = true, "SBData:loadProfile") { event ->
val profileMatch = profileRegex.matchEntire(event.unformattedString)
if (profileMatch != null) {
+ val oldProfile = profileId
try {
profileId = UUID.fromString(profileMatch.groupValues[1])
hasReceivedProfile = true
@@ -61,6 +63,9 @@ object SBData {
profileId = null
e.printStackTrace()
}
+ if (oldProfile != profileId) {
+ ProfileSwitchEvent.publish(ProfileSwitchEvent(oldProfile, profileId))
+ }
}
}
}