Class TrackScheduler

java.lang.Object
com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter
lavalink.client.player.event.AudioEventAdapterWrapped
de.presti.ree6.audio.music.TrackScheduler
All Implemented Interfaces:
com.sedmelluq.discord.lavaplayer.player.event.AudioEventListener, lavalink.client.player.event.IPlayerEventListener

public class TrackScheduler extends lavalink.client.player.event.AudioEventAdapterWrapped
This class schedules tracks for the audio player. It contains the queue of tracks.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrackScheduler(GuildMusicManager guildMusicManager, lavalink.client.player.IPlayer player)
    Constructs a TrackScheduler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the current Queue.
    boolean
    Toggle the loop.
    void
    nextTrack(net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, boolean silent)
    Get the next Track from the Queue.
    void
    nextTrack(net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, int position, boolean silent)
    Get the next Track from the Queue.
    void
    onTrackEnd(com.sedmelluq.discord.lavaplayer.player.AudioPlayer player, com.sedmelluq.discord.lavaplayer.track.AudioTrack track, com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason endReason)
     
    void
    onTrackEnd(lavalink.client.player.IPlayer player, com.sedmelluq.discord.lavaplayer.track.AudioTrack track, com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason endReason)
    Used to inform user about the next song or problems.
    void
    queue(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
    Add the next track to queue or play right away if nothing is in the queue.
    void
    queue(com.sedmelluq.discord.lavaplayer.track.AudioTrack track, boolean force)
    Add the next track to queue or play right away if nothing is in the queue.
    void
    seekPosition(net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion channel, int seekAmountInSeconds)
    Seek to a specific position in the current track.
    void
    Shuffle the current playlsist.
    void
    stopAll(net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Stop every Song-Player on the Guild.

    Methods inherited from class lavalink.client.player.event.AudioEventAdapterWrapped

    onEvent

    Methods inherited from class com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter

    onEvent, onPlayerPause, onPlayerResume, onTrackException, onTrackStart, onTrackStuck, onTrackStuck

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TrackScheduler

      public TrackScheduler(GuildMusicManager guildMusicManager, lavalink.client.player.IPlayer player)
      Constructs a TrackScheduler.
      Parameters:
      guildMusicManager - The GuildMusicManager related to this TrackScheduler.
      player - The audio player this scheduler uses
  • Method Details

    • queue

      public void queue(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
      Add the next track to queue or play right away if nothing is in the queue.
      Parameters:
      track - The track to play or add to queue.
    • queue

      public void queue(com.sedmelluq.discord.lavaplayer.track.AudioTrack track, boolean force)
      Add the next track to queue or play right away if nothing is in the queue.
      Parameters:
      track - The track to play or add to queue.
      force - If the track should be played right away.
    • loop

      public boolean loop()
      Toggle the loop.
      Returns:
      if the loop is activ or not.
    • shuffle

      public void shuffle()
      Shuffle the current playlsist.
    • clearQueue

      public void clearQueue()
      Clear the current Queue.
    • nextTrack

      public void nextTrack(net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, boolean silent)
      Get the next Track from the Queue.
      Parameters:
      textChannel - the Text-Channel where the command have been performed from.
      silent - should the bot send a message or not?
    • nextTrack

      public void nextTrack(net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, int position, boolean silent)
      Get the next Track from the Queue.
      Parameters:
      textChannel - the Text-Channel where the command have been performed from.
      position - the position of the track it should skip to. (relative to the current track)
      silent - should the bot send a message or not?
    • seekPosition

      public void seekPosition(net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion channel, int seekAmountInSeconds)
      Seek to a specific position in the current track.
      Parameters:
      channel - the Text-Channel where the command have been performed from.
      seekAmountInSeconds - the amount of seconds to seek to.
    • onTrackEnd

      public void onTrackEnd(com.sedmelluq.discord.lavaplayer.player.AudioPlayer player, com.sedmelluq.discord.lavaplayer.track.AudioTrack track, com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason endReason)
      Overrides:
      onTrackEnd in class com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter
    • onTrackEnd

      public void onTrackEnd(lavalink.client.player.IPlayer player, com.sedmelluq.discord.lavaplayer.track.AudioTrack track, com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason endReason)
      Used to inform user about the next song or problems.
      Parameters:
      player - the current AudioPlayer.
      track - the current Track.
      endReason - the current end Reason.
    • stopAll

      public void stopAll(net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Stop every Song-Player on the Guild.
      Parameters:
      guild - The Guild entity.
      interactionHook - the InteractionHook, incase it is a SlashCommand.