Skip to content

Commit

Permalink
fix: try to resolve scenarios that incorrectly cancel outboundRoomQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Dec 12, 2024
1 parent 75f3e63 commit a1ebd76
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/main/kotlin/gg/skytils/skytilsmod/listeners/DungeonListener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,28 @@ object DungeonListener {

@SubscribeEvent
fun onWorldLoad(event: WorldEvent.Unload) {
team.clear()
deads.clear()
disconnected.clear()
missingPuzzles.clear()
completedPuzzles.clear()
teamCached.clear()
printDevMessage("closed room queue world load", "dungeonws")
outboundRoomQueue.cancel()
isSoloDungeon = false
if (event.world == mc.theWorld) {
team.clear()
deads.clear()
disconnected.clear()
missingPuzzles.clear()
completedPuzzles.clear()
teamCached.clear()
printDevMessage("closed room queue world load", "dungeonws")
outboundRoomQueue.cancel()
isSoloDungeon = false
}
}

@SubscribeEvent
fun onLocationUpdate(event: LocationChangeEvent) {
if (event.packet.mode.getOrNull() == "dungeon") {
printDevMessage("closed room queue", "dungeonws")
outboundRoomQueue.cancel()
outboundRoomQueue = Channel(UNLIMITED) {
printDevMessage("failed to deliver $it", "dungeonws")
outboundRoomQueue.also {
outboundRoomQueue = Channel(UNLIMITED) {
printDevMessage("failed to deliver $it", "dungeonws")
}
it.cancel()
}
}
}
Expand Down

0 comments on commit a1ebd76

Please sign in to comment.