From 23ae030924a9a8b4aed8be72a6b8506255dff624 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 7 Mar 2018 14:52:52 +0100 Subject: [PATCH] Correct double autoflow --- src/main/java/net/Broken/audio/TrackScheduler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/Broken/audio/TrackScheduler.java b/src/main/java/net/Broken/audio/TrackScheduler.java index ebbf48c..72e0069 100644 --- a/src/main/java/net/Broken/audio/TrackScheduler.java +++ b/src/main/java/net/Broken/audio/TrackScheduler.java @@ -87,8 +87,11 @@ public class TrackScheduler extends AudioEventAdapter { currentPlayingTrack = track; } if(track.getSubmittedUser() != MainBot.jda.getSelfUser()) { + needAutoPlay(); } + else + logger.debug("Bot add, ignore autoFlow"); } public void pause() { @@ -166,19 +169,19 @@ public class TrackScheduler extends AudioEventAdapter { 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) if (endReason.mayStartNext) { + logger.debug("End of track, start next."); nextTrack(); - needAutoPlay(); } } private void needAutoPlay(){ if((queue.size() < 1) && autoFlow && currentPlayingTrack != null){ - logger.info("Auto add needed!"); + logger.debug("Auto add needed!"); AudioM audioM = AudioM.getInstance(null); YoutubeTools youtubeTools = YoutubeTools.getInstance(null); try { String id = youtubeTools.getRelatedVideo(currentPlayingTrack.getAudioTrack().getInfo().identifier, history); - logger.info("Related id: "+id); + logger.debug("Related id: "+id); audioM.loadAndPlayAuto(id); } catch (GoogleJsonResponseException e) {