Class LavalinkPlayer

  • All Implemented Interfaces:
    dev.arbjerg.lavalink.client.player.IUpdatablePlayer

    
    public final class LavalinkPlayer
     implements IUpdatablePlayer
                        

    Represents a player that is tied to a guild.

    • Constructor Detail

      • LavalinkPlayer

        LavalinkPlayer(LavalinkNode node, Player protocolPlayer)
    • Method Detail

      • getTrack

         final Track getTrack()

        Gets the current track that is playing on the player.

        To get the current position of the track, use position.

      • getVolume

         final Integer getVolume()

        Number between 0 and 1000, where 100 is 100% volume.

      • getState

         final PlayerState getState()

        Gets the current state of the player. See PlayerState for more info.

      • setTrack

         PlayerUpdateBuilder setTrack(Track track)

        Shortcut for setting the encoded track. This will also send any user-data supplied. Please keep in mind that this will set the position field to the current position of the track.

        Parameters:
        track - The track to apply to this builder
        Returns:

        The updated builder, useful for chaining

      • stopTrack

         PlayerUpdateBuilder stopTrack()

        Shortcut for setting the encoded track to {@code null}. This will also clear the user data.

        Returns:

        The updated builder, useful for chaining

      • setPosition

         PlayerUpdateBuilder setPosition(Long position)

        Update the position of the player.

        Parameters:
        position - The new position of the player.
        Returns:

        The updated builder, useful for chaining

      • setEndTime

         PlayerUpdateBuilder setEndTime(Long endTime)

        Update the end time of the track.

        Parameters:
        endTime - The new end time of the track.
        Returns:

        The updated builder, useful for chaining

      • omitEndTime

         PlayerUpdateBuilder omitEndTime()

        Omits the end time from being sent to the node during updates.

        Returns:

        The updated builder, useful for chaining

      • setVolume

         PlayerUpdateBuilder setVolume(Integer volume)

        Update the volume of the player. While you could use the filters to set volume as well, do note that that is float based (1.0f is 100% volume) and takes the time of your buffer size to apply. This method updates the volume instantly after the update is sent out.

        Parameters:
        volume - The new player volume, value is between 0 and 1000 where 100 is 100% (default) volume.
        Returns:

        The updated builder, useful for chaining

      • setPaused

         PlayerUpdateBuilder setPaused(Boolean paused)

        Update the paused state of the player.

        Parameters:
        paused - Whether the player should be paused or not.
        Returns:

        The updated builder, useful for chaining

      • setFilters

         PlayerUpdateBuilder setFilters(Filters filters)

        Update the filters for the player. 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.

        Parameters:
        filters - The new filters to apply to the player.
        Returns:

        The updated builder, useful for chaining

      • setVoiceState

         PlayerUpdateBuilder setVoiceState(VoiceState state)

        Update the voice state for the player.<br> <strong>IMPORTANT:</strong> Only ever use Link.onVoiceServerUpdate to update the voice server as this sets the state of the link to LinkState.CONNECTING

        Returns:

        The updated builder, useful for chaining