Skip to content

Commit

Permalink
Rename protocol to player
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Mar 17, 2024
1 parent 77878ca commit c345d20
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.arbjerg.lavalink.client

import dev.arbjerg.lavalink.client.protocol.*
import dev.arbjerg.lavalink.client.player.*
import java.util.function.Consumer

abstract class AbstractAudioLoadResultHandler : Consumer<LavalinkLoadResult> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.arbjerg.lavalink.client

import dev.arbjerg.lavalink.client.protocol.LoadFailed
import dev.arbjerg.lavalink.client.protocol.PlaylistLoaded
import dev.arbjerg.lavalink.client.protocol.SearchResult
import dev.arbjerg.lavalink.client.protocol.TrackLoaded
import dev.arbjerg.lavalink.client.player.LoadFailed
import dev.arbjerg.lavalink.client.player.PlaylistLoaded
import dev.arbjerg.lavalink.client.player.SearchResult
import dev.arbjerg.lavalink.client.player.TrackLoaded
import java.util.function.Consumer

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dev.arbjerg.lavalink.client.loadbalancing.ILoadBalancer
import dev.arbjerg.lavalink.client.loadbalancing.VoiceRegion
import dev.arbjerg.lavalink.client.loadbalancing.builtin.DefaultLoadBalancer
import dev.arbjerg.lavalink.client.event.ClientEvent
import dev.arbjerg.lavalink.client.player.LavalinkPlayer
import dev.arbjerg.lavalink.internal.ReconnectTask
import reactor.core.Disposable
import reactor.core.publisher.Flux
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/dev/arbjerg/lavalink/client/LavalinkNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package dev.arbjerg.lavalink.client

import dev.arbjerg.lavalink.client.event.ClientEvent
import dev.arbjerg.lavalink.client.http.HttpBuilder
import dev.arbjerg.lavalink.client.protocol.*
import dev.arbjerg.lavalink.client.protocol.Track
import dev.arbjerg.lavalink.client.protocol.toCustom
import dev.arbjerg.lavalink.client.player.*
import dev.arbjerg.lavalink.client.player.Track
import dev.arbjerg.lavalink.client.player.toCustom
import dev.arbjerg.lavalink.internal.*
import dev.arbjerg.lavalink.internal.error.RestException
import dev.arbjerg.lavalink.internal.loadbalancing.Penalties
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/dev/arbjerg/lavalink/client/Link.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.arbjerg.lavalink.client

import dev.arbjerg.lavalink.client.player.LavalinkPlayer
import dev.arbjerg.lavalink.client.player.PlayerUpdateBuilder
import dev.arbjerg.lavalink.protocol.v4.VoiceState
import java.time.Duration
import java.util.function.Consumer
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/dev/arbjerg/lavalink/client/event/events.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.arbjerg.lavalink.client.event

import dev.arbjerg.lavalink.client.LavalinkNode
import dev.arbjerg.lavalink.client.protocol.Track
import dev.arbjerg.lavalink.client.protocol.TrackException
import dev.arbjerg.lavalink.client.protocol.toCustom
import dev.arbjerg.lavalink.client.player.Track
import dev.arbjerg.lavalink.client.player.TrackException
import dev.arbjerg.lavalink.client.player.toCustom
import dev.arbjerg.lavalink.protocol.v4.*
import dev.arbjerg.lavalink.protocol.v4.Message.EmittedEvent.TrackEndEvent.AudioTrackEndReason

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.arbjerg.lavalink.client.protocol
package dev.arbjerg.lavalink.client.player

import dev.arbjerg.lavalink.internal.toJsonElement
import dev.arbjerg.lavalink.protocol.v4.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package dev.arbjerg.lavalink.client
package dev.arbjerg.lavalink.client.player

import dev.arbjerg.lavalink.client.protocol.Track
import dev.arbjerg.lavalink.protocol.v4.Filters
import dev.arbjerg.lavalink.protocol.v4.PlayerUpdateTrack
import dev.arbjerg.lavalink.protocol.v4.VoiceState
import dev.arbjerg.lavalink.client.protocol.TrackUpdateBuilder

interface IUpdatablePlayer {
/**
Expand Down Expand Up @@ -84,7 +82,7 @@ interface IUpdatablePlayer {
* Please use [setVolume] to update the player's volume instead. Setting the volume via filters is
* float based (1.0f is 100% volume) and takes the time of your buffer size to apply.
*
* @param filters The new filters to apply to the player. You can use the [dev.arbjerg.lavalink.client.protocol.FilterBuilder] to easily create this object.
* @param filters The new filters to apply to the player. You can use the [dev.arbjerg.lavalink.client.player.FilterBuilder] to easily create this object.
*
* @return The updated builder, useful for chaining
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package dev.arbjerg.lavalink.client
package dev.arbjerg.lavalink.client.player

import dev.arbjerg.lavalink.client.LavalinkNode
import dev.arbjerg.lavalink.client.loadbalancing.VoiceRegion
import dev.arbjerg.lavalink.client.protocol.Track
import dev.arbjerg.lavalink.client.protocol.toCustom
import dev.arbjerg.lavalink.protocol.v4.*
import kotlin.math.min

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package dev.arbjerg.lavalink.client
package dev.arbjerg.lavalink.client.player

import dev.arbjerg.lavalink.client.protocol.Track
import dev.arbjerg.lavalink.client.LavalinkNode
import dev.arbjerg.lavalink.internal.toKotlin
import dev.arbjerg.lavalink.internal.toLavalinkPlayer
import dev.arbjerg.lavalink.protocol.v4.*
import reactor.core.CoreSubscriber
import reactor.core.publisher.Mono

class PlayerUpdateBuilder internal constructor(private val node: LavalinkNode, private val guildId: Long) : Mono<LavalinkPlayer>(), IUpdatablePlayer {
class PlayerUpdateBuilder internal constructor(private val node: LavalinkNode, private val guildId: Long) : Mono<LavalinkPlayer>(),
IUpdatablePlayer {
private var trackUpdate: Omissible<PlayerUpdateTrack> = Omissible.omitted()
private var position: Omissible<Long> = Omissible.omitted()
private var endTime: Omissible<Long?> = Omissible.omitted()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package dev.arbjerg.lavalink.client.protocol
package dev.arbjerg.lavalink.client.player

import com.fasterxml.jackson.databind.JsonNode
import dev.arbjerg.lavalink.internal.fromJsonElement
import dev.arbjerg.lavalink.internal.toJackson
import dev.arbjerg.lavalink.internal.toJsonElement
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
import dev.arbjerg.lavalink.protocol.v4.Track as ProtocolTrack

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package dev.arbjerg.lavalink.client.protocol
package dev.arbjerg.lavalink.client.player

import dev.arbjerg.lavalink.internal.toJsonElement
import dev.arbjerg.lavalink.protocol.v4.Omissible
import dev.arbjerg.lavalink.protocol.v4.PlayerUpdateTrack
import dev.arbjerg.lavalink.protocol.v4.toOmissible
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.arbjerg.lavalink.client.protocol
package dev.arbjerg.lavalink.client.player

import dev.arbjerg.lavalink.internal.toJackson
import dev.arbjerg.lavalink.protocol.v4.Exception as ProtocolException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dev.arbjerg.lavalink.internal
import dev.arbjerg.lavalink.VERSION as CLIENT_VERSION
import dev.arbjerg.lavalink.client.LavalinkNode
import dev.arbjerg.lavalink.client.LinkState
import dev.arbjerg.lavalink.client.protocol.toCustom
import dev.arbjerg.lavalink.client.player.toCustom
import dev.arbjerg.lavalink.client.event.toClientEvent
import dev.arbjerg.lavalink.protocol.v4.Message
import dev.arbjerg.lavalink.protocol.v4.json
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/arbjerg/lavalink/internal/helpers.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.arbjerg.lavalink.internal

import dev.arbjerg.lavalink.client.LavalinkNode
import dev.arbjerg.lavalink.client.LavalinkPlayer
import dev.arbjerg.lavalink.client.player.LavalinkPlayer
import dev.arbjerg.lavalink.protocol.v4.Player

internal fun Player.toLavalinkPlayer(node: LavalinkNode) = LavalinkPlayer(node, this)
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/JavaJDAExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import dev.arbjerg.lavalink.client.event.TrackStartEvent;
import dev.arbjerg.lavalink.client.loadbalancing.RegionGroup;
import dev.arbjerg.lavalink.client.loadbalancing.builtin.VoiceRegionPenaltyProvider;
import dev.arbjerg.lavalink.client.protocol.*;
import dev.arbjerg.lavalink.client.player.*;
import dev.arbjerg.lavalink.libraries.jda.JDAVoiceUpdateListener;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Guild;
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/d4jTestScript.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dev.arbjerg.lavalink.client.*
import dev.arbjerg.lavalink.client.event.TrackStartEvent
import dev.arbjerg.lavalink.client.protocol.TrackUpdateBuilder
import dev.arbjerg.lavalink.client.player.TrackUpdateBuilder
import dev.arbjerg.lavalink.libraries.discord4j.installVoiceHandler
import discord4j.core.DiscordClientBuilder
import discord4j.core.event.domain.interaction.ChatInputInteractionEvent
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/testScript.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import dev.arbjerg.lavalink.client.event.StatsEvent
import dev.arbjerg.lavalink.client.event.TrackStartEvent
import dev.arbjerg.lavalink.client.loadbalancing.RegionGroup
import dev.arbjerg.lavalink.client.loadbalancing.builtin.VoiceRegionPenaltyProvider
import dev.arbjerg.lavalink.client.protocol.*
import dev.arbjerg.lavalink.client.player.*
import dev.arbjerg.lavalink.libraries.jda.JDAVoiceUpdateListener
import net.dv8tion.jda.api.JDABuilder
import net.dv8tion.jda.api.events.GenericEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dev.arbjerg.lavalink.client.AbstractAudioLoadResultHandler;
import dev.arbjerg.lavalink.client.Link;
import dev.arbjerg.lavalink.client.protocol.*;
import dev.arbjerg.lavalink.client.player.*;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dev.arbjerg.lavalink.client.LavalinkClient;
import dev.arbjerg.lavalink.client.Link;
import dev.arbjerg.lavalink.client.protocol.FilterBuilder;
import dev.arbjerg.lavalink.client.player.FilterBuilder;
import dev.arbjerg.lavalink.protocol.v4.Karaoke;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.GuildVoiceState;
Expand Down

0 comments on commit c345d20

Please sign in to comment.