Skip to content

Commit

Permalink
Rename to getOrAssumePlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Feb 1, 2024
1 parent a4876e0 commit 4ca714f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/arbjerg/lavalink/client/LavalinkNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class LavalinkNode(
*
* @return The local player. This player may not exist on the [LavalinkNode] yet.
*/
fun getOrCreateCachedPlayer(guildId: Long): LavalinkPlayer {
fun getOrAssumePlayer(guildId: Long): LavalinkPlayer {
val cachedPlayer = playerCache[guildId]

if (cachedPlayer == null) {
Expand Down Expand Up @@ -412,7 +412,7 @@ class LavalinkNode(
*
* @return The cached player, or null if not yet cached.
*
* @see [getOrCreateCachedPlayer]
* @see [getOrAssumePlayer]
*/
fun getCachedPlayer(guildId: Long): LavalinkPlayer? = playerCache[guildId]

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/arbjerg/lavalink/client/Link.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Link(
/**
* Gets the player for this link. If the player is not cached, it will be retrieved or created on the server.
*
* If you just want a local player instead, you can use [getOrCreateCachedPlayer]
* If you just want a local player instead, you can use [getOrAssumePlayer]
*/
fun getPlayer() = node.getPlayer(guildId)

Expand All @@ -33,7 +33,7 @@ class Link(
*
* To ensure a player also exist on the node, you can use [getPlayer]
*/
fun getOrCreateCachedPlayer() = node.getOrCreateCachedPlayer(guildId)
fun getOrAssumePlayer() = node.getOrAssumePlayer(guildId)

/**
* Destroys the player for this link. This will also remove the link from the client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LavalinkSocket(private val node: LavalinkNode) : WebSocketListener(), Clos

// Create a local player on the node if we don't have one.
// There probably is an edge-case where this will happen.
node.getOrCreateCachedPlayer(idLong).state = update.state
node.getOrAssumePlayer(idLong).state = update.state
node.lavalink.getLinkIfCached(idLong)?.state = if (update.state.connected) {
LinkState.CONNECTED
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent even
break;
case "now-playing": {
final var link = this.client.getLink(event.getGuild().getIdLong());
final var player = link.getOrCreateCachedPlayer();
final var player = link.getOrAssumePlayer();
final var track = player.getTrack();

if (track == null) {
Expand Down

0 comments on commit 4ca714f

Please sign in to comment.