Fix drill ability cooldown resetting on world swap

This commit is contained in:
Linnea Gräf
2024-10-07 15:08:18 +02:00
parent a8d5fed7d2
commit daa63bd914
4 changed files with 29 additions and 8 deletions

View File

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