ClaptrapBot/src/main/java/net/Broken/audio/GuildMusicManager.java

35 lines
985 B
Java
Raw Normal View History

2017-10-22 23:48:13 +02:00
package net.Broken.audio;
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);
}
}