From 7eeb97fc307257290acfbf6ecbb055cdc5788c2b Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 7 Apr 2018 17:09:12 -0400 Subject: Rename main, add properties loading --- src/main/java/soundchan/GuildMusicManager.java | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/java/soundchan/GuildMusicManager.java (limited to 'src/main/java/soundchan/GuildMusicManager.java') diff --git a/src/main/java/soundchan/GuildMusicManager.java b/src/main/java/soundchan/GuildMusicManager.java new file mode 100644 index 0000000..40a0258 --- /dev/null +++ b/src/main/java/soundchan/GuildMusicManager.java @@ -0,0 +1,35 @@ +package soundchan; + +import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; +import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; + +/** + * Holder for both the player and a track scheduler for one guild. + */ +public class GuildMusicManager { + /** + * Audio player for the guild. + */ + public final AudioPlayer player; + /** + * Track scheduler for the player. + */ + public final TrackScheduler scheduler; + + /** + * Creates a player and a track scheduler. + * @param manager Audio player manager to use for creating the player. + */ + public GuildMusicManager(AudioPlayerManager manager) { + player = manager.createPlayer(); + scheduler = new TrackScheduler(player); + player.addListener(scheduler); + } + + /** + * @return Wrapper around AudioPlayer to use it as an AudioSendHandler. + */ + public AudioPlayerSendHandler getSendHandler() { + return new AudioPlayerSendHandler(player); + } +} -- cgit v1.2.3