new: audiochecks system! according to reperak it sucks but hey im kinda happy with it

This commit is contained in:
ZtereoHYPE 2021-11-27 02:05:25 +01:00
parent 7276ff91a0
commit 77785bc44f
4 changed files with 103 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import net.dv8tion.jda.api.entities.VoiceChannel;
import java.util.Objects;
public class TrackManagers {
//todo: change to a statement that only returns a trackmanager if it exists and overload it to accept various things eg guild but also vc or infoMessage channel
public static TrackManager getGuildTrackManager(Guild guild) {
long guildId = guild.getIdLong();
@ -23,11 +24,13 @@ public class TrackManagers {
return trackManager;
}
//todo: rename to getOrCreateGuildTrackManager
public static TrackManager getGuildTrackManager(Guild guild, MessageChannel infoChannel, VoiceChannel connectedChannel, VoiceChannel requestedChannel) {
long guildId = guild.getIdLong();
boolean isInSameVC = Objects.equals(connectedChannel, requestedChannel);
// If I get called in a different vc I delete the old manager
//todo: move this check to the audio micropermissions and handle it there
if (!isInSameVC) {
ZtereoMUSIC.getInstance().getGuildTrackManagerMap().remove(guildId);
}