File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/main/kotlin/dev/arbjerg/lavalink/client Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import dev.arbjerg.lavalink.client.loadbalancing.builtin.DefaultLoadBalancer
66import dev.arbjerg.lavalink.client.event.ClientEvent
77import dev.arbjerg.lavalink.client.player.LavalinkPlayer
88import dev.arbjerg.lavalink.internal.ReconnectTask
9+ import dev.arbjerg.lavalink.protocol.v4.VoiceState
910import reactor.core.Disposable
1011import reactor.core.publisher.Flux
1112import reactor.core.publisher.Sinks
@@ -128,6 +129,7 @@ class LavalinkClient(val userId: Long) : Closeable, Disposable {
128129 val orphans = findOrphanedPlayers()
129130
130131 orphans.mapNotNull { linkMap[it.guildId] }
132+ .filter { ! it.cachedPlayer?.voiceState.isEmpty() } // TODO: do some logging to mark them as skipped?
131133 .forEach { link ->
132134 link.transferNode(node)
133135 }
@@ -225,4 +227,12 @@ class LavalinkClient(val userId: Long) : Closeable, Disposable {
225227 }
226228 }
227229 }
230+
231+ private fun VoiceState?.isEmpty (): Boolean {
232+ if (this == null ) {
233+ return true
234+ }
235+
236+ return this .token.isBlank() || this .endpoint.isBlank() || this .sessionId.isBlank();
237+ }
228238}
You can’t perform that action at this time.
0 commit comments