Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -6,7 +6,12 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
|||||||
|
|
||||||
import core.SubCommand;
|
import core.SubCommand;
|
||||||
import core.SubCommandFormattable;
|
import core.SubCommandFormattable;
|
||||||
import dataStructures.*;
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class SubCommandPlaylist extends SubCommand
|
public class SubCommandPlaylist extends SubCommand
|
||||||
{
|
{
|
||||||
@@ -16,8 +21,17 @@ public class SubCommandPlaylist extends SubCommand
|
|||||||
@Override
|
@Override
|
||||||
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
{
|
{
|
||||||
// ArrayList<AudioTrack> playlist = guild.audio.getPlaylist();
|
ArrayList <AudioTrack> playlist = guild.audio.getPlaylist();
|
||||||
String stringPlaylist = guild.audio.getPlaylist(guild.audio.player);
|
String stringPlaylist = "";
|
||||||
|
|
||||||
|
for(AudioTrack track : playlist)
|
||||||
|
{
|
||||||
|
stringPlaylist += (playlist.indexOf(track) + 1) + ": " + track.getInfo().title + "\n";
|
||||||
|
}
|
||||||
|
if(stringPlaylist.equals(""))
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable("Nothing Queued!");
|
||||||
|
}
|
||||||
return new SubCommandFormattable(stringPlaylist);
|
return new SubCommandFormattable(stringPlaylist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ public class CommandManager
|
|||||||
this.register(LocCommands.stub("raffle"), new CommandRaffleMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("raffle"), new CommandRaffleMain(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("poll"), new CommandPollMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("poll"), new CommandPollMain(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("music"), new CommandMusicMain(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("music"), new CommandMusicMain(KittyRole.General, KittyRating.Safe));
|
||||||
|
this.register(LocCommands.stub("defaultdance"), new CommandDefaultDance(KittyRole.General, KittyRating.Safe));
|
||||||
this.register(LocCommands.stub("getsauce"), new CommandGetSauce(KittyRole.General, KittyRating.Safe));
|
this.register(LocCommands.stub("getsauce"), new CommandGetSauce(KittyRole.General, KittyRating.Safe));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package utils.audio;
|
package utils.audio;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Queue;
|
|
||||||
|
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||||
@@ -22,7 +20,8 @@ public class AudioUtils
|
|||||||
public AudioManager am;
|
public AudioManager am;
|
||||||
public final AudioPlayer player;
|
public final AudioPlayer player;
|
||||||
public final AudioPlayerManager playerManager;
|
public final AudioPlayerManager playerManager;
|
||||||
private Queue <AudioTrack> playlist = new LinkedList<>();
|
private boolean isPlaying = false;
|
||||||
|
private ArrayList <AudioTrack> playlist = new ArrayList<AudioTrack>();
|
||||||
|
|
||||||
|
|
||||||
public AudioUtils(Guild guild, AudioPlayerManager playerManager)
|
public AudioUtils(Guild guild, AudioPlayerManager playerManager)
|
||||||
@@ -105,14 +104,11 @@ public class AudioUtils
|
|||||||
{
|
{
|
||||||
playlist.add(track);
|
playlist.add(track);
|
||||||
}
|
}
|
||||||
do
|
if(!isPlaying)
|
||||||
{
|
{
|
||||||
if(player.getPlayingTrack() == null)
|
isPlaying = true;
|
||||||
{
|
startPlay(player);
|
||||||
player.startTrack(playlist.poll(), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
while(!playlist.isEmpty());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +121,33 @@ public class AudioUtils
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startPlay(AudioPlayer player)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if(player.getPlayingTrack() == null)
|
||||||
|
{
|
||||||
|
player.startTrack(playlist.get(0), false);
|
||||||
|
if(!playlist.isEmpty())
|
||||||
|
playlist.remove(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while(!playlist.isEmpty());
|
||||||
|
isPlaying = false;
|
||||||
|
}
|
||||||
|
|
||||||
public String skipVideo(AudioPlayer player)
|
public String skipVideo(AudioPlayer player)
|
||||||
{
|
{
|
||||||
return null;
|
player.stopTrack();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
playlist.remove(0);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
return "Stopped";
|
||||||
|
}
|
||||||
|
return "Skipped";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String stopPlayer(AudioPlayer player)
|
public String stopPlayer(AudioPlayer player)
|
||||||
@@ -137,8 +157,8 @@ public class AudioUtils
|
|||||||
return "Stopped";
|
return "Stopped";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlaylist(AudioPlayer player)
|
public ArrayList<AudioTrack> getPlaylist()
|
||||||
{
|
{
|
||||||
return player.getPlayingTrack().getInfo().title;
|
return playlist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user