Bug Fixes with Music playing

This commit is contained in:
Alex
2019-12-18 03:07:52 -05:00
parent a63afd3a2b
commit 46cf6f8c97
4 changed files with 18 additions and 10 deletions
-1
View File
@@ -27,7 +27,6 @@ public class CommandMusicMain extends Command
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{
SubCommandFormattable scf = framework.run(guild, channel, user, input);
System.out.println("SCF: " + scf.resString);
scf.Call(res);
}
}
-1
View File
@@ -17,7 +17,6 @@ public class SubCommandStop extends SubCommand
@Override
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
{
return new SubCommandFormattable(guild.audio.stopPlayer(guild.audio.player));
}
+16 -6
View File
@@ -104,9 +104,9 @@ public class AudioUtils
{
playlist.add(track);
}
if(!isPlaying)
if(player.getPlayingTrack() == null)
{
isPlaying = true;
startPlay(player);
}
}
@@ -118,21 +118,31 @@ public class AudioUtils
guild.getAudioManager().setSendingHandler(new AudioPlayerSendHandler(player));
playerManager.loadItemOrdered(player, videoURL, new SmallAudio(player));
return null;
}
private void startPlay(AudioPlayer player)
{
isPlaying = false;
do
{
if(player.getPlayingTrack() == null)
{
player.startTrack(playlist.get(0), false);
if(!playlist.isEmpty())
playlist.remove(0);
if(playlist.isEmpty())
{
isPlaying = false;
}
else
{
player.startTrack(playlist.get(0), false);
if(!playlist.isEmpty())
playlist.remove(0);
}
}
}
while(!playlist.isEmpty());
while(isPlaying);
isPlaying = false;
}