Add Plugin system and Soundcloud searching
This commit is contained in:
parent
3b65e91d10
commit
791f2b3d60
|
@ -3,7 +3,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.fpghoti</groupId>
|
<groupId>com.fpghoti</groupId>
|
||||||
<artifactId>Biscuit</artifactId>
|
<artifactId>Biscuit</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.8</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
7
pom.xml
7
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.fpghoti</groupId>
|
<groupId>com.fpghoti</groupId>
|
||||||
<artifactId>Biscuit</artifactId>
|
<artifactId>Biscuit</artifactId>
|
||||||
<version>1.7</version>
|
<version>1.8</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -194,5 +194,10 @@
|
||||||
<artifactId>lavaplayer</artifactId>
|
<artifactId>lavaplayer</artifactId>
|
||||||
<version>1.3.50</version>
|
<version>1.3.50</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.pf4j</groupId>
|
||||||
|
<artifactId>pf4j</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -1,5 +1,6 @@
|
||||||
package com.fpghoti.biscuit;
|
package com.fpghoti.biscuit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -10,47 +11,47 @@ import org.fusesource.jansi.AnsiConsole;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.captcha.BCage;
|
import com.fpghoti.biscuit.captcha.BCage;
|
||||||
import com.fpghoti.biscuit.commands.CommandManager;
|
import com.fpghoti.biscuit.commands.CommandManager;
|
||||||
import com.fpghoti.biscuit.commands.client.AddCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.ChanIDCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.DivideCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.GetConfigCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.GuildIDCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.ToggleRoleCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.HelpCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.MultiplyCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.NotSpammerCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.MakeInviteCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.PingCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.PowerCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.RecentSpammersCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.SaveConfigCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.SoftMuteCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.SquareRootCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.SubtractCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.UIDCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.UnSoftMuteCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.WikiCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.ClearCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.ForceSkipCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.ForceSkipToCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.ClearUserSongsCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.LoopMusicCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.MoveToCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.NowPlayingCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.PauseCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.PlayCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.PlayFirstCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.QueueCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.RemoveCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.ShuffleCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.SkipAllCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.SkipCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.TogglePauseCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.UnpauseCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.client.music.VolumeCommand;
|
|
||||||
import com.fpghoti.biscuit.commands.console.GuildSayCommand;
|
import com.fpghoti.biscuit.commands.console.GuildSayCommand;
|
||||||
import com.fpghoti.biscuit.commands.console.SayCommand;
|
import com.fpghoti.biscuit.commands.console.SayCommand;
|
||||||
import com.fpghoti.biscuit.commands.console.ShutdownConsoleCommand;
|
import com.fpghoti.biscuit.commands.console.ShutdownConsoleCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.AddCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.ChanIDCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.DivideCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.GetConfigCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.GuildIDCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.HelpCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.MakeInviteCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.MultiplyCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.NotSpammerCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.PingCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.PowerCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.RecentSpammersCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.SaveConfigCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.SoftMuteCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.SquareRootCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.SubtractCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.ToggleRoleCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.UIDCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.UnSoftMuteCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.WikiCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.ClearCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.ClearUserSongsCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.ForceSkipCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.ForceSkipToCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.LoopMusicCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.MoveToCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.NowPlayingCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.PauseCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.PlayCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.PlayFirstCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.QueueCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.RemoveCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.ShuffleCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.SkipAllCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.SkipCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.TogglePauseCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.UnpauseCommand;
|
||||||
|
import com.fpghoti.biscuit.commands.discord.music.VolumeCommand;
|
||||||
import com.fpghoti.biscuit.listener.CommandListener;
|
import com.fpghoti.biscuit.listener.CommandListener;
|
||||||
import com.fpghoti.biscuit.listener.DMListener;
|
import com.fpghoti.biscuit.listener.DMListener;
|
||||||
import com.fpghoti.biscuit.listener.GuildListener;
|
import com.fpghoti.biscuit.listener.GuildListener;
|
||||||
|
@ -63,6 +64,7 @@ import com.fpghoti.biscuit.listener.ReactionListener;
|
||||||
import com.fpghoti.biscuit.listener.RoleListener;
|
import com.fpghoti.biscuit.listener.RoleListener;
|
||||||
import com.fpghoti.biscuit.logging.BColor;
|
import com.fpghoti.biscuit.logging.BColor;
|
||||||
import com.fpghoti.biscuit.logging.BiscuitLog;
|
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||||
|
import com.fpghoti.biscuit.plugin.PluginController;
|
||||||
import com.github.cage.Cage;
|
import com.github.cage.Cage;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||||
|
@ -95,10 +97,19 @@ public class Main {
|
||||||
public static boolean isPlugin = false;
|
public static boolean isPlugin = false;
|
||||||
public static boolean shutdownStarted = false;
|
public static boolean shutdownStarted = false;
|
||||||
private static Cage cage;
|
private static Cage cage;
|
||||||
|
private static File pluginsDir;
|
||||||
|
private static PluginController pluginController;
|
||||||
|
|
||||||
private static AudioPlayerManager playerManager;
|
private static AudioPlayerManager playerManager;
|
||||||
|
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
|
if(!isPlugin) {
|
||||||
|
pluginsDir = new File("plugins");
|
||||||
|
}else {
|
||||||
|
pluginsDir = new File(PluginCore.plugin.getDataFolder(), "plugins");
|
||||||
|
}
|
||||||
|
pluginsDir.mkdir();
|
||||||
|
|
||||||
final Properties properties = new Properties();
|
final Properties properties = new Properties();
|
||||||
try {
|
try {
|
||||||
properties.load(Main.class.getClassLoader().getResourceAsStream("info.properties"));
|
properties.load(Main.class.getClassLoader().getResourceAsStream("info.properties"));
|
||||||
|
@ -186,6 +197,12 @@ public class Main {
|
||||||
CommandManager.addCommand(new GuildSayCommand());
|
CommandManager.addCommand(new GuildSayCommand());
|
||||||
CommandManager.addCommand(new ShutdownConsoleCommand());
|
CommandManager.addCommand(new ShutdownConsoleCommand());
|
||||||
|
|
||||||
|
//Plugins
|
||||||
|
|
||||||
|
pluginController = new PluginController();
|
||||||
|
pluginController.loadPlugins();
|
||||||
|
pluginController.startPlugins();
|
||||||
|
|
||||||
link = "https://discord.com/oauth2/authorize?&client_id=" + jda.getSelfUser().getId() + "&permissions=8&scope=bot";
|
link = "https://discord.com/oauth2/authorize?&client_id=" + jda.getSelfUser().getId() + "&permissions=8&scope=bot";
|
||||||
log.info("Connection successful!");
|
log.info("Connection successful!");
|
||||||
log.info("Startup successful!");
|
log.info("Startup successful!");
|
||||||
|
@ -244,10 +261,15 @@ public class Main {
|
||||||
return playerManager;
|
return playerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getPluginDirectory() {
|
||||||
|
return pluginsDir;
|
||||||
|
}
|
||||||
|
|
||||||
public static void shutdown() {
|
public static void shutdown() {
|
||||||
if(!shutdownStarted) {
|
if(!shutdownStarted) {
|
||||||
shutdownStarted = true;
|
shutdownStarted = true;
|
||||||
mainBiscuit.log("Shutting down...");
|
mainBiscuit.log("Shutting down...");
|
||||||
|
pluginController.shutdownPlugins();
|
||||||
ArrayList<Biscuit> list = new ArrayList<Biscuit>(biscuits);
|
ArrayList<Biscuit> list = new ArrayList<Biscuit>(biscuits);
|
||||||
for(Biscuit b : list) {
|
for(Biscuit b : list) {
|
||||||
b.remove();
|
b.remove();
|
||||||
|
@ -275,6 +297,10 @@ public class Main {
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PluginController getPluginController() {
|
||||||
|
return pluginController;
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerBiscuit(Biscuit b) {
|
public static void registerBiscuit(Biscuit b) {
|
||||||
biscuits.add(b);
|
biscuits.add(b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
||||||
import com.fpghoti.biscuit.audio.queue.QueuedTrack;
|
import com.fpghoti.biscuit.audio.queue.QueuedTrack;
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
import com.fpghoti.biscuit.audio.request.youtube.YTImmediateRequest;
|
import com.fpghoti.biscuit.audio.request.youtube.YTImmediateRequest;
|
||||||
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||||
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
||||||
|
@ -50,7 +51,6 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
|
public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) {
|
||||||
|
|
||||||
QueuedTrack qt = queue.getLastTrack();
|
QueuedTrack qt = queue.getLastTrack();
|
||||||
String title = track.getInfo().title;
|
String title = track.getInfo().title;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
|
|
||||||
case LOAD_FAILED:
|
case LOAD_FAILED:
|
||||||
warn("Something went wrong while trying to load the current track. Trying alternate track.");
|
warn("Something went wrong while trying to load the current track. Trying alternate track.");
|
||||||
if(!qt.triedAlternative()) {
|
if(!qt.triedAlternative() && !queue.isStuckLooping()) {
|
||||||
qt.useAttempt();
|
qt.useAttempt();
|
||||||
TextChannel channel = qt.getCommandChannel();
|
TextChannel channel = qt.getCommandChannel();
|
||||||
MessageText.send(channel, "The video selected cannot be played through the music player. An alternate track will be played if available.");
|
MessageText.send(channel, "The video selected cannot be played through the music player. An alternate track will be played if available.");
|
||||||
|
@ -89,7 +89,7 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
|
|
||||||
if (endReason.mayStartNext) {
|
if (endReason.mayStartNext) {
|
||||||
if(loop) {
|
if(loop) {
|
||||||
queue(track.makeClone(), qt.getUserId(), qt.getCommandChannel(), 1);
|
queue(qt.getType(), track.makeClone(), qt.getUserId(), qt.getCommandChannel(), 1);
|
||||||
}
|
}
|
||||||
startPlaying();
|
startPlaying();
|
||||||
}
|
}
|
||||||
|
@ -113,21 +113,21 @@ public class AudioScheduler extends AudioEventAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queue(AudioTrack track, String uid, TextChannel channel) {
|
public void queue(RequestType type, AudioTrack track, String uid, TextChannel channel) {
|
||||||
queue(track, uid, channel, null);
|
queue(type, track, uid, channel, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queue(AudioTrack track, String uid, TextChannel channel, Integer place) {
|
public void queue(RequestType type, AudioTrack track, String uid, TextChannel channel, Integer place) {
|
||||||
if(queue.isEmpty() && biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
if(queue.isEmpty() && biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
||||||
QueuedTrack qt = new QueuedTrack(biscuit, track, uid, channel);
|
QueuedTrack qt = new QueuedTrack(biscuit, track, uid, channel, type);
|
||||||
queue.sendQueueMessage(qt);
|
queue.sendQueueMessage(qt);
|
||||||
queue.addPreviousTrack(qt);
|
queue.addPreviousTrack(qt);
|
||||||
biscuit.getAudioPlayer().playTrack(track);
|
biscuit.getAudioPlayer().playTrack(track);
|
||||||
}else {
|
}else {
|
||||||
if(place != null) {
|
if(place != null) {
|
||||||
queue.addAtPlace(new QueuedTrack(biscuit, track, uid, channel), place);
|
queue.addAtPlace(new QueuedTrack(biscuit, track, uid, channel, type), place);
|
||||||
}else {
|
}else {
|
||||||
queue.add(new QueuedTrack(biscuit, track, uid, channel));
|
queue.add(new QueuedTrack(biscuit, track, uid, channel, type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,16 @@ public class PlayCommandUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSearchPhrase(String[] args) {
|
public static String getSearchPhrase(String[] args) {
|
||||||
String searchPhrase = args[0];
|
return getSearchPhrase(args, 0);
|
||||||
if(args.length > 1) {
|
}
|
||||||
for(int i = 1; i < args.length; i++) {
|
|
||||||
|
public static String getSearchPhrase(String[] args, int startArg) {
|
||||||
|
if(startArg >= args.length) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String searchPhrase = args[startArg];
|
||||||
|
if(args.length > startArg + 1) {
|
||||||
|
for(int i = startArg + 1; i < args.length; i++) {
|
||||||
searchPhrase = searchPhrase + " " + args[i];
|
searchPhrase = searchPhrase + " " + args[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.fpghoti.biscuit.audio.queue;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
import com.fpghoti.biscuit.rest.MessageText;
|
import com.fpghoti.biscuit.rest.MessageText;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
|
@ -77,6 +78,17 @@ public class AudioQueue {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueuedTrack getPreviousTrack(int fromEnd) {
|
||||||
|
if(previousTracks.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int index = previousTracks.size() - fromEnd;
|
||||||
|
if(index < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return previousTracks.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
public QueuedTrack getLastTrack() {
|
public QueuedTrack getLastTrack() {
|
||||||
if(previousTracks.isEmpty()) {
|
if(previousTracks.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -183,4 +195,21 @@ public class AudioQueue {
|
||||||
return tracks.size();
|
return tracks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isStuckLooping() {
|
||||||
|
QueuedTrack last = getLastTrack();
|
||||||
|
if(last == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(last.getType() == RequestType.YOUTUBE_IMMEDIATE) {
|
||||||
|
QueuedTrack beforeLast = getPreviousTrack(2);
|
||||||
|
if(beforeLast == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(beforeLast.getTrack().getIdentifier().equals(last.getTrack().getIdentifier())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.fpghoti.biscuit.audio.queue;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.util.Util;
|
import com.fpghoti.biscuit.util.Util;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
@ -17,13 +18,15 @@ public class QueuedTrack {
|
||||||
private AudioTrack track;
|
private AudioTrack track;
|
||||||
private String userId;
|
private String userId;
|
||||||
private TextChannel channel;
|
private TextChannel channel;
|
||||||
|
private RequestType type;
|
||||||
private boolean triedAlternative;
|
private boolean triedAlternative;
|
||||||
|
|
||||||
public QueuedTrack(Biscuit biscuit, AudioTrack track, String userId, TextChannel channel) {
|
public QueuedTrack(Biscuit biscuit, AudioTrack track, String userId, TextChannel channel, RequestType type) {
|
||||||
this.biscuit = biscuit;
|
this.biscuit = biscuit;
|
||||||
this.track = track;
|
this.track = track;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
this.type = type;
|
||||||
this.triedAlternative = false;
|
this.triedAlternative = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ public class QueuedTrack {
|
||||||
duration+=1000;
|
duration+=1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
String desc = "Author: " + track.getInfo().author + "\nLength: " + Util.getTime(duration);
|
String desc = "Type: " + type.toString() + "\nAuthor: " + track.getInfo().author + "\nLength: " + Util.getTime(duration);
|
||||||
|
|
||||||
if(showRemaining) {
|
if(showRemaining) {
|
||||||
desc = desc + "\nTime Remaining: " + Util.getTime(track.getDuration() - track.getPosition());
|
desc = desc + "\nTime Remaining: " + Util.getTime(track.getDuration() - track.getPosition());
|
||||||
|
@ -89,7 +92,7 @@ public class QueuedTrack {
|
||||||
|
|
||||||
embed.setAuthor(name, null, avatar);
|
embed.setAuthor(name, null, avatar);
|
||||||
|
|
||||||
if(isYouTube()) {
|
if(type.toString().toLowerCase().contains("youtube")) {
|
||||||
embed.setThumbnail("https://img.youtube.com/vi/" + track.getIdentifier() + "/mqdefault.jpg");
|
embed.setThumbnail("https://img.youtube.com/vi/" + track.getIdentifier() + "/mqdefault.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +110,8 @@ public class QueuedTrack {
|
||||||
triedAlternative = true;
|
triedAlternative = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isYouTube() {
|
public RequestType getType() {
|
||||||
return track.getInfo().uri.contains("https://www.youtube.com/watch?v=");
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package com.fpghoti.biscuit.audio.request;
|
package com.fpghoti.biscuit.audio.request;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.audio.request.soundcloud.SCPriorityRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.soundcloud.SCRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.youtube.YTImmediateRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.youtube.YTPriorityRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
@ -7,6 +12,46 @@ import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
public abstract class PlayRequest {
|
public abstract class PlayRequest {
|
||||||
|
|
||||||
|
public static PlayRequest createPlayRequest(Message message, String searchPhrase) {
|
||||||
|
return createPlayRequest(message, searchPhrase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayRequest createPlayRequest(Message message, String searchPhrase, int insertSlot) {
|
||||||
|
String contents = message.getContentDisplay().toLowerCase();
|
||||||
|
RequestType type = RequestType.YOUTUBE;
|
||||||
|
if(insertSlot > 0) {
|
||||||
|
type = RequestType.YOUTUBE_PRIORITY;
|
||||||
|
}
|
||||||
|
if(contents.contains("soundcloud.com") && searchPhrase.split(" ").length == 1) {
|
||||||
|
type = RequestType.SOUNDCLOUD;
|
||||||
|
if(insertSlot > 0) {
|
||||||
|
type = RequestType.SOUNDCLOUD_PRIORITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return createPlayRequest(type, message, searchPhrase, insertSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayRequest createPlayRequest(RequestType type, Message message, String searchPhrase) {
|
||||||
|
return createPlayRequest(type, message, searchPhrase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayRequest createPlayRequest(RequestType type, Message message, String searchPhrase, int insertSlot) {
|
||||||
|
switch(type) {
|
||||||
|
case YOUTUBE:
|
||||||
|
return new YTRequest(message, searchPhrase);
|
||||||
|
case YOUTUBE_PRIORITY:
|
||||||
|
return new YTPriorityRequest(message, searchPhrase, insertSlot);
|
||||||
|
case YOUTUBE_IMMEDIATE:
|
||||||
|
return new YTImmediateRequest(message.getTextChannel(), message.getAuthor().getId(), searchPhrase);
|
||||||
|
case SOUNDCLOUD:
|
||||||
|
return new SCRequest(message, searchPhrase);
|
||||||
|
case SOUNDCLOUD_PRIORITY:
|
||||||
|
return new SCPriorityRequest(message, searchPhrase, insertSlot);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private TextChannel channel;
|
private TextChannel channel;
|
||||||
private Biscuit biscuit;
|
private Biscuit biscuit;
|
||||||
private String authorId;
|
private String authorId;
|
||||||
|
|
|
@ -2,8 +2,35 @@ package com.fpghoti.biscuit.audio.request;
|
||||||
|
|
||||||
public enum RequestType {
|
public enum RequestType {
|
||||||
|
|
||||||
YOUTUBE,
|
YOUTUBE{
|
||||||
YOUTUBE_IMMEDIATE,
|
@Override
|
||||||
YOUTUBE_PRIORITY;
|
public String toString() {
|
||||||
|
return "YouTube";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
YOUTUBE_IMMEDIATE{
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "YouTube - Immediate";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
YOUTUBE_PRIORITY{
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "YouTube - Priority";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SOUNDCLOUD{
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Soundcloud";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SOUNDCLOUD_PRIORITY{
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Soundcloud - Priority";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.fpghoti.biscuit.audio.request.soundcloud;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
|
public class SCPriorityRequest extends SCRequest{
|
||||||
|
|
||||||
|
int insertSlot;
|
||||||
|
|
||||||
|
public SCPriorityRequest(Message message, String identifier, int insertSlot) {
|
||||||
|
this(message.getTextChannel(), message.getAuthor().getId(), identifier, insertSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SCPriorityRequest(TextChannel channel, String authorId, String identifier, int insertSlot) {
|
||||||
|
super(channel, authorId, identifier);
|
||||||
|
this.insertSlot = insertSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSlot() {
|
||||||
|
return insertSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSlot(int slotNumber) {
|
||||||
|
insertSlot = slotNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RequestType getType() {
|
||||||
|
return RequestType.SOUNDCLOUD_PRIORITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.fpghoti.biscuit.audio.request.soundcloud;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
|
public class SCRequest extends PlayRequest{
|
||||||
|
|
||||||
|
private boolean searchMode;
|
||||||
|
|
||||||
|
public SCRequest(Message message, String identifier) {
|
||||||
|
this(message.getTextChannel(), message.getAuthor().getId(), identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SCRequest(TextChannel channel, String authorId, String identifier) {
|
||||||
|
super(channel, authorId, identifier);
|
||||||
|
searchMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inSearchMode() {
|
||||||
|
return searchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableSearchMode() {
|
||||||
|
searchMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableSearchMode() {
|
||||||
|
searchMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RequestType getType() {
|
||||||
|
return RequestType.SOUNDCLOUD;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.fpghoti.biscuit.audio.result;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||||
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
|
import com.fpghoti.biscuit.rest.MessageText;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
|
public abstract class ResultHandler implements AudioLoadResultHandler {
|
||||||
|
|
||||||
|
private Biscuit biscuit;
|
||||||
|
private PlayRequest request;
|
||||||
|
|
||||||
|
public PlayRequest getRequest() {
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void handleTrack(AudioTrack track);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trackLoaded(AudioTrack track) {
|
||||||
|
handleTrack(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playlistLoaded(AudioPlaylist playlist) {
|
||||||
|
AudioTrack track = playlist.getTracks().get(0);
|
||||||
|
handleTrack(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadFailed(FriendlyException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
MessageText.send(request.getRequestChannel(), "An error was encountered while attempting to load audio.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Biscuit getBiscuit() {
|
||||||
|
return biscuit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.fpghoti.biscuit.audio.result;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.Main;
|
||||||
|
import com.fpghoti.biscuit.audio.AudioScheduler;
|
||||||
|
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.soundcloud.SCPriorityRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.soundcloud.SCRequest;
|
||||||
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
|
import com.fpghoti.biscuit.rest.MessageText;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
|
public class SCResultHandler extends ResultHandler {
|
||||||
|
|
||||||
|
private Biscuit biscuit;
|
||||||
|
private SCRequest request;
|
||||||
|
|
||||||
|
public SCResultHandler(SCRequest request) {
|
||||||
|
this.request = request;
|
||||||
|
this.biscuit = request.getBiscuit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayRequest getRequest() {
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleTrack(AudioTrack track) {
|
||||||
|
AudioScheduler sched = biscuit.getAudioScheduler();
|
||||||
|
|
||||||
|
switch(request.getType()) {
|
||||||
|
|
||||||
|
case SOUNDCLOUD:
|
||||||
|
sched.queue(request.getType(), track, request.getAuthorId(), request.getRequestChannel());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUNDCLOUD_PRIORITY:
|
||||||
|
SCPriorityRequest prq = (SCPriorityRequest) request;
|
||||||
|
sched.queue(request.getType(), track, request.getAuthorId(), request.getRequestChannel(), prq.getSlot());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
biscuit.error("Soundcloud result handler received an incompatible request.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trackLoaded(AudioTrack track) {
|
||||||
|
handleTrack(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playlistLoaded(AudioPlaylist playlist) {
|
||||||
|
AudioTrack track = playlist.getTracks().get(0);
|
||||||
|
handleTrack(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void noMatches() {
|
||||||
|
if(!request.inSearchMode()) {
|
||||||
|
biscuit.log("Exact match not found. Searching instead...");
|
||||||
|
request.enableSearchMode();
|
||||||
|
Main.getPlayerManager().loadItemOrdered(biscuit.getGuild(),"scsearch:" + request.getIdentifier(), new SCResultHandler(request));
|
||||||
|
}else {
|
||||||
|
MessageText.send(request.getRequestChannel(), "Song match not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadFailed(FriendlyException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
MessageText.send(request.getRequestChannel(), "An error was encountered while attempting to load audio.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,12 +7,11 @@ import com.fpghoti.biscuit.audio.request.youtube.YTPriorityRequest;
|
||||||
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.rest.MessageText;
|
import com.fpghoti.biscuit.rest.MessageText;
|
||||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
|
||||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
|
|
||||||
public class YTResultHandler implements AudioLoadResultHandler {
|
public class YTResultHandler extends ResultHandler {
|
||||||
|
|
||||||
private Biscuit biscuit;
|
private Biscuit biscuit;
|
||||||
private YTRequest request;
|
private YTRequest request;
|
||||||
|
@ -32,16 +31,16 @@ public class YTResultHandler implements AudioLoadResultHandler {
|
||||||
switch(request.getType()) {
|
switch(request.getType()) {
|
||||||
|
|
||||||
case YOUTUBE:
|
case YOUTUBE:
|
||||||
sched.queue(track, request.getAuthorId(), request.getRequestChannel());
|
sched.queue(request.getType(), track, request.getAuthorId(), request.getRequestChannel());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YOUTUBE_PRIORITY:
|
case YOUTUBE_PRIORITY:
|
||||||
YTPriorityRequest prq = (YTPriorityRequest) request;
|
YTPriorityRequest prq = (YTPriorityRequest) request;
|
||||||
sched.queue(track, request.getAuthorId(), request.getRequestChannel(), prq.getSlot());
|
sched.queue(request.getType(), track, request.getAuthorId(), request.getRequestChannel(), prq.getSlot());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YOUTUBE_IMMEDIATE:
|
case YOUTUBE_IMMEDIATE:
|
||||||
sched.queue(track, request.getAuthorId(), request.getRequestChannel(), 1);
|
sched.queue(request.getType(), track, request.getAuthorId(), request.getRequestChannel(), 1);
|
||||||
if(!sched.getQueue().isEmpty()) {
|
if(!sched.getQueue().isEmpty()) {
|
||||||
sched.startPlaying();
|
sched.startPlaying();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client;
|
package com.fpghoti.biscuit.commands.discord;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,8 +1,13 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.audio.PlayCommandUtil;
|
import com.fpghoti.biscuit.audio.PlayCommandUtil;
|
||||||
|
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
|
import com.fpghoti.biscuit.audio.request.soundcloud.SCRequest;
|
||||||
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.result.ResultHandler;
|
||||||
|
import com.fpghoti.biscuit.audio.result.SCResultHandler;
|
||||||
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
|
@ -15,7 +20,7 @@ public class PlayCommand extends MusicClientCommand{
|
||||||
public PlayCommand() {
|
public PlayCommand() {
|
||||||
name = "Play";
|
name = "Play";
|
||||||
description = "Plays the specified song or plays a song found using search parameters.";
|
description = "Plays the specified song or plays a song found using search parameters.";
|
||||||
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "play <YouTube link OR Search Phrase>";
|
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "play [-sc] <Link OR Search Phrase>";
|
||||||
minArgs = 1;
|
minArgs = 1;
|
||||||
maxArgs = 2000;
|
maxArgs = 2000;
|
||||||
identifiers.add("play");
|
identifiers.add("play");
|
||||||
|
@ -26,7 +31,15 @@ public class PlayCommand extends MusicClientCommand{
|
||||||
Guild guild = event.getGuild();
|
Guild guild = event.getGuild();
|
||||||
Biscuit b = Biscuit.getBiscuit(guild);
|
Biscuit b = Biscuit.getBiscuit(guild);
|
||||||
|
|
||||||
String searchPhrase = PlayCommandUtil.getSearchPhrase(args);
|
int searchArg = 0;
|
||||||
|
boolean scSearch = false;
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("-sc")) {
|
||||||
|
scSearch = true;
|
||||||
|
searchArg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String searchPhrase = PlayCommandUtil.getSearchPhrase(args, searchArg);
|
||||||
|
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -play " + searchPhrase);
|
b.log(event.getAuthor().getName() + " issued a command: -play " + searchPhrase);
|
||||||
|
|
||||||
|
@ -35,8 +48,18 @@ public class PlayCommand extends MusicClientCommand{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
YTRequest request = new YTRequest(event.getMessage(), searchPhrase);
|
PlayRequest request;
|
||||||
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), new YTResultHandler(request));
|
ResultHandler handler;
|
||||||
|
|
||||||
|
if(scSearch) {
|
||||||
|
request = PlayRequest.createPlayRequest(RequestType.SOUNDCLOUD, event.getMessage(), searchPhrase);
|
||||||
|
handler = new SCResultHandler((SCRequest)request);
|
||||||
|
}else {
|
||||||
|
request = PlayRequest.createPlayRequest(event.getMessage(), searchPhrase);
|
||||||
|
handler = new YTResultHandler((YTRequest)request);
|
||||||
|
}
|
||||||
|
|
||||||
|
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,9 +1,13 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.audio.PlayCommandUtil;
|
import com.fpghoti.biscuit.audio.PlayCommandUtil;
|
||||||
import com.fpghoti.biscuit.audio.request.youtube.YTPriorityRequest;
|
import com.fpghoti.biscuit.audio.request.PlayRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||||
|
import com.fpghoti.biscuit.audio.request.soundcloud.SCRequest;
|
||||||
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
||||||
|
import com.fpghoti.biscuit.audio.result.ResultHandler;
|
||||||
|
import com.fpghoti.biscuit.audio.result.SCResultHandler;
|
||||||
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
import com.fpghoti.biscuit.audio.result.YTResultHandler;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||||
|
@ -19,7 +23,7 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||||
public PlayFirstCommand() {
|
public PlayFirstCommand() {
|
||||||
name = "Play First";
|
name = "Play First";
|
||||||
description = "Places specified song at the front of the queue.";
|
description = "Places specified song at the front of the queue.";
|
||||||
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "playfirst <YouTube link OR Search Phrase>";
|
usage = Main.getMainBiscuit().getProperties().getCommandSignifier() + "playfirst <Link OR Search Phrase>";
|
||||||
minArgs = 1;
|
minArgs = 1;
|
||||||
maxArgs = 2000;
|
maxArgs = 2000;
|
||||||
identifiers.add("playfirst");
|
identifiers.add("playfirst");
|
||||||
|
@ -31,7 +35,15 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||||
Biscuit b = Biscuit.getBiscuit(guild);
|
Biscuit b = Biscuit.getBiscuit(guild);
|
||||||
TextChannel tchannel = event.getChannel();
|
TextChannel tchannel = event.getChannel();
|
||||||
|
|
||||||
String searchPhrase = PlayCommandUtil.getSearchPhrase(args);
|
int searchArg = 0;
|
||||||
|
boolean scSearch = false;
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("-sc")) {
|
||||||
|
scSearch = true;
|
||||||
|
searchArg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String searchPhrase = PlayCommandUtil.getSearchPhrase(args, searchArg);
|
||||||
|
|
||||||
b.log(event.getAuthor().getName() + " issued a command: -playfirst " + searchPhrase);
|
b.log(event.getAuthor().getName() + " issued a command: -playfirst " + searchPhrase);
|
||||||
|
|
||||||
|
@ -45,8 +57,18 @@ public class PlayFirstCommand extends MusicClientCommand{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
YTRequest request = new YTPriorityRequest(event.getMessage(), searchPhrase, 1);
|
PlayRequest request;
|
||||||
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), new YTResultHandler(request));
|
ResultHandler handler;
|
||||||
|
|
||||||
|
if(scSearch) {
|
||||||
|
request = PlayRequest.createPlayRequest(RequestType.SOUNDCLOUD_PRIORITY, event.getMessage(), searchPhrase, 1);
|
||||||
|
handler = new SCResultHandler((SCRequest)request);
|
||||||
|
}else {
|
||||||
|
request = PlayRequest.createPlayRequest(event.getMessage(), searchPhrase, 1);
|
||||||
|
handler = new YTResultHandler((YTRequest)request);
|
||||||
|
}
|
||||||
|
|
||||||
|
Main.getPlayerManager().loadItemOrdered(guild, PlayCommandUtil.getID(event), handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
import com.fpghoti.biscuit.audio.queue.AudioQueue;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.fpghoti.biscuit.commands.client.music;
|
package com.fpghoti.biscuit.commands.discord.music;
|
||||||
|
|
||||||
import com.fpghoti.biscuit.Main;
|
import com.fpghoti.biscuit.Main;
|
||||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.fpghoti.biscuit.plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.pf4j.Plugin;
|
||||||
|
import org.pf4j.PluginWrapper;
|
||||||
|
|
||||||
|
import com.fpghoti.biscuit.Main;
|
||||||
|
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||||
|
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||||
|
import com.github.cage.Cage;
|
||||||
|
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||||
|
|
||||||
|
public abstract class BiscuitPlugin extends Plugin {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String version;
|
||||||
|
private String author;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public BiscuitPlugin(PluginWrapper wrapper) {
|
||||||
|
super(wrapper);
|
||||||
|
this.id = wrapper.getPluginId();
|
||||||
|
this.version = wrapper.getDescriptor().getVersion();
|
||||||
|
this.author = wrapper.getDescriptor().getProvider();
|
||||||
|
this.description = wrapper.getDescriptor().getPluginDescription();
|
||||||
|
Main.getPluginController().registerPlugin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BiscuitPlugin getPlugin() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Biscuit> getBiscuits() {
|
||||||
|
return Main.getBiscuits();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cage getCage() {
|
||||||
|
return Main.getCage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AudioPlayerManager getPlayerManager() {
|
||||||
|
return Main.getPlayerManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BiscuitLog getLogger() {
|
||||||
|
return Main.getLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.fpghoti.biscuit.plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.pf4j.DefaultPluginManager;
|
||||||
|
import org.pf4j.PluginManager;
|
||||||
|
|
||||||
|
public class PluginController implements Iterable<BiscuitPlugin>{
|
||||||
|
|
||||||
|
private PluginManager pluginManager;
|
||||||
|
private ArrayList<BiscuitPlugin> plugins;
|
||||||
|
|
||||||
|
public PluginController() {
|
||||||
|
pluginManager = new DefaultPluginManager();
|
||||||
|
plugins = new ArrayList<BiscuitPlugin>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<BiscuitPlugin> iterator() {
|
||||||
|
return new ArrayList<BiscuitPlugin>(plugins).iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerPlugin(BiscuitPlugin plugin) {
|
||||||
|
if(!contains(plugin)) {
|
||||||
|
plugins.add(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadPlugins() {
|
||||||
|
pluginManager.loadPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startPlugins() {
|
||||||
|
pluginManager.startPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopPlugins() {
|
||||||
|
pluginManager.stopPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unloadPlugins() {
|
||||||
|
pluginManager.unloadPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdownPlugins() {
|
||||||
|
stopPlugins();
|
||||||
|
unloadPlugins();
|
||||||
|
plugins.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(BiscuitPlugin plugin) {
|
||||||
|
for(BiscuitPlugin pl : plugins) {
|
||||||
|
if(plugin.getID().equals(pl.getID())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue