Package org.prithvidiamond1.AudioPlayer
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
Modifier and TypeFieldDescriptionfinal com.sedmelluq.discord.lavaplayer.player.AudioPlayer
The audio player instance that connects with theTrackScheduler
-
Constructor Summary
ConstructorDescriptionTrackScheduler
(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 TypeMethodDescriptionvoid
addPlayerControlsHandler
(PlayerControlsHandler playerControlsHandler) Method to link a player controls handler to the audio player's track schedulervoid
Method that clears the track queuecom.sedmelluq.discord.lavaplayer.track.AudioTrack
Method that gets the last played trackcom.sedmelluq.discord.lavaplayer.track.AudioTrack
Method that gets the next track in the queue;int
Method that gets the current size of the queueIterator<com.sedmelluq.discord.lavaplayer.track.AudioTrack>
Method that gets all the tracks in the queue in the form an iteratorvoid
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 queuevoid
onEvent
(com.sedmelluq.discord.lavaplayer.player.event.AudioEvent event) Method that runs when anAudioEvent
occursvoid
queue
(com.sedmelluq.discord.lavaplayer.track.AudioTrack track) Method that adds a track to the back of the deque (normal queuing)
-
Field Details
-
audioPlayer
public final com.sedmelluq.discord.lavaplayer.player.AudioPlayer audioPlayerThe audio player instance that connects with theTrackScheduler
-
-
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 invokedserverVoiceChannel
- the server in which the play command was invokedaudioPlayer
- 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
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
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 anAudioEvent
occurs- Specified by:
onEvent
in interfacecom.sedmelluq.discord.lavaplayer.player.event.AudioEventListener
- Parameters:
event
- The event
-