Class TrackScheduler

java.lang.Object
org.prithvidiamond1.AudioPlayer.TrackScheduler
All Implemented Interfaces:
com.sedmelluq.discord.lavaplayer.player.event.AudioEventListener

public class TrackScheduler extends Object implements com.sedmelluq.discord.lavaplayer.player.event.AudioEventListener
This class holds all the functions related to scheduling player tracks such as the track queue and player control functions
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final com.sedmelluq.discord.lavaplayer.player.AudioPlayer
    The audio player instance that connects with the TrackScheduler
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrackScheduler(org.javacord.api.entity.channel.TextChannel textChannel, org.javacord.api.entity.channel.ServerVoiceChannel serverVoiceChannel, com.sedmelluq.discord.lavaplayer.player.AudioPlayer audioPlayer)
    A simple constructor for the track scheduler
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method to link a player controls handler to the audio player's track scheduler
    void
    Method that clears the track queue
    com.sedmelluq.discord.lavaplayer.track.AudioTrack
    Method that gets the last played track
    com.sedmelluq.discord.lavaplayer.track.AudioTrack
    Method that gets the next track in the queue;
    int
    Method that gets the current size of the queue
    Iterator<com.sedmelluq.discord.lavaplayer.track.AudioTrack>
    Method that gets all the tracks in the queue in the form an iterator
    void
    jump(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
    Method that adds a track to the front of the deque (jumps the queue)
    void
    Method that plays the next track in the queue
    void
    onEvent(com.sedmelluq.discord.lavaplayer.player.event.AudioEvent event)
    Method that runs when an AudioEvent occurs
    void
    queue(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
    Method that adds a track to the back of the deque (normal queuing)

    Methods inherited from class java.lang.Object

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

    • audioPlayer

      public final com.sedmelluq.discord.lavaplayer.player.AudioPlayer audioPlayer
      The audio player instance that connects with the TrackScheduler
  • Constructor Details

    • TrackScheduler

      public TrackScheduler(org.javacord.api.entity.channel.TextChannel textChannel, org.javacord.api.entity.channel.ServerVoiceChannel serverVoiceChannel, com.sedmelluq.discord.lavaplayer.player.AudioPlayer audioPlayer)
      A simple constructor for the track scheduler
      Parameters:
      textChannel - the text channel in which the play command was invoked
      serverVoiceChannel - the server in which the play command was invoked
      audioPlayer - the audio player to be linked to this track scheduler
  • Method Details

    • getQueueSize

      public int getQueueSize()
      Method that gets the current size of the queue
      Returns:
      the size of the queue
    • getNextTrackInQueue

      public com.sedmelluq.discord.lavaplayer.track.AudioTrack getNextTrackInQueue()
      Method that gets the next track in the queue;
      Returns:
      the next track in the queue
    • nextTrack

      public void nextTrack()
      Method that plays the next track in the queue
    • clearTrackQueue

      public void clearTrackQueue()
      Method that clears the track queue
    • getLastPlayedTrack

      public com.sedmelluq.discord.lavaplayer.track.AudioTrack getLastPlayedTrack()
      Method that gets the last played track
      Returns:
      the last played track
    • queue

      public void queue(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
      Method that adds a track to the back of the deque (normal queuing)
      Parameters:
      track - the AudioTrack to be added
    • jump

      public void jump(com.sedmelluq.discord.lavaplayer.track.AudioTrack track)
      Method that adds a track to the front of the deque (jumps the queue)
      Parameters:
      track - the AudioTrack to be added
    • getTracksInQueue

      public Iterator<com.sedmelluq.discord.lavaplayer.track.AudioTrack> getTracksInQueue()
      Method that gets all the tracks in the queue in the form an iterator
      Returns:
      an iterator to iter through the tracks in the queue.=
    • addPlayerControlsHandler

      public void addPlayerControlsHandler(PlayerControlsHandler playerControlsHandler)
      Method to link a player controls handler to the audio player's track scheduler
      Parameters:
      playerControlsHandler - the player controls handler
    • onEvent

      public void onEvent(com.sedmelluq.discord.lavaplayer.player.event.AudioEvent event)
      Method that runs when an AudioEvent occurs
      Specified by:
      onEvent in interface com.sedmelluq.discord.lavaplayer.player.event.AudioEventListener
      Parameters:
      event - The event