diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt index aff933e2..713b626b 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt @@ -525,9 +525,12 @@ class ServerConnection(val server: StarboundServer, type: ConnectionType) : Conn private val isDisconnecting = AtomicBoolean() private suspend fun disconnect0(reason: String) { - // initiate shipworld shutdown + // make server forget shipworld right away + // This should account for extremely unlikely case + // where client initiated disconnect, + // and reconnects before this function finishes running if (::shipWorld.isInitialized) { - shipWorld.eventLoop.shutdown() + server.notifyWorldUnloaded(shipWorld.worldID) } // stop being counted towards player count, vanish from connection list