aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/soundchan/TrackScheduler.java
diff options
context:
space:
mode:
authorMatt Kohls <mattkohls13@gmail.com>2019-05-04 19:27:40 -0400
committerMatt Kohls <mattkohls13@gmail.com>2019-05-04 19:27:40 -0400
commitab1fe085c2da8083fc083f4452026f6d2eec30b3 (patch)
treef086bb1f40ec994ab8d6d349e06117826cef5214 /src/main/java/soundchan/TrackScheduler.java
parentffe6f521c4525479d1c1fb19f1e2b06cc955ee75 (diff)
downloadSoundChan-feature/auto-leave-channel.tar.gz
SoundChan-feature/auto-leave-channel.tar.bz2
SoundChan-feature/auto-leave-channel.zip
Adding in bits needed to clean up when people leave channelfeature/auto-leave-channel
SoundChan will leave a channel after 10 seconds if it is the only member left. When it leaves it will empty the queue of audio to play. When SoundChan is the last member in a channel, it will pause any playing audio. New command to drop play queue and stop current audio.
Diffstat (limited to 'src/main/java/soundchan/TrackScheduler.java')
-rw-r--r--src/main/java/soundchan/TrackScheduler.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/soundchan/TrackScheduler.java b/src/main/java/soundchan/TrackScheduler.java
index cf7b1f8..7c14ebc 100644
--- a/src/main/java/soundchan/TrackScheduler.java
+++ b/src/main/java/soundchan/TrackScheduler.java
@@ -80,6 +80,14 @@ public class TrackScheduler extends AudioEventAdapter {
player.startTrack(queue.poll(), false);
}
+ /**
+ * Cleans out the queue of tracks and stops any playing track
+ */
+ public void emptyQueue() {
+ player.stopTrack();
+ queue.clear();
+ }
+
@Override
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
// Only start the next track if the end reason is suitable for it (FINISHED or LOAD_FAILED)