ClaptrapBot/src/main/java/net/Broken/audio/GuildMusicManager.java
2022-05-15 16:54:34 +02:00

40 lines
1.1 KiB
Java

package net.Broken.audio;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import net.dv8tion.jda.api.entities.Guild;
/**
* 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;
public final Guild guild;
/**
* Creates a player and a track scheduler.
*
* @param manager Audio player manager to use for creating the player.
*/
public GuildMusicManager(AudioPlayerManager manager, Guild guild) {
player = manager.createPlayer();
scheduler = new TrackScheduler(player, guild);
player.addListener(scheduler);
this.guild = guild;
}
/**
* @return Wrapper around AudioPlayer to use it as an AudioSendHandler.
*/
public AudioPlayerSendHandler getSendHandler() {
return new AudioPlayerSendHandler(player);
}
}