Skip to content

Commit d282cb4

Browse files
committed
Add LavalinkNode.getCachedPlayers()
1 parent 8edae46 commit d282cb4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/kotlin/dev/arbjerg/lavalink/client/LavalinkNode.kt

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import reactor.util.retry.Retry
2929
import java.io.Closeable
3030
import java.io.IOException
3131
import java.time.Duration
32+
import java.util.*
3233
import java.util.concurrent.ConcurrentHashMap
3334
import java.util.concurrent.TimeUnit
3435
import java.util.function.Consumer
@@ -427,6 +428,11 @@ class LavalinkNode(
427428
*/
428429
fun getCachedPlayer(guildId: Long): LavalinkPlayer? = playerCache[guildId]
429430

431+
/**
432+
* @return an unmodifiable view of all cached players for this node.
433+
*/
434+
fun getCachedPlayers(): Map<Long, LavalinkPlayer> = Collections.unmodifiableMap(playerCache)
435+
430436
internal fun transferOrphansToSelf() {
431437
lavalink.transferOrphansTo(this)
432438
}

0 commit comments

Comments
 (0)