use of net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent in project toby-bot by ml404.
the class Handler method onGuildVoiceMove.
@Override
public void onGuildVoiceMove(GuildVoiceMoveEvent event) {
Guild guild = event.getGuild();
AudioManager audioManager = guild.getAudioManager();
String volumePropertyName = ConfigDto.Configurations.VOLUME.getConfigValue();
ConfigDto databaseConfig = configService.getConfigByName(volumePropertyName, event.getGuild().getId());
int defaultVolume = databaseConfig != null ? Integer.parseInt(databaseConfig.getValue()) : 100;
List<Member> nonBotConnectedMembersInOldChannel = event.getChannelLeft().getMembers().stream().filter(member -> !member.getUser().isBot()).collect(Collectors.toList());
if (Objects.equals(audioManager.getConnectedChannel(), event.getChannelLeft()) && nonBotConnectedMembersInOldChannel.isEmpty()) {
closeAudioPlayer(guild, audioManager, defaultVolume);
}
List<Member> nonBotConnectedMembers = event.getChannelJoined().getMembers().stream().filter(member -> !member.getUser().isBot()).collect(Collectors.toList());
if (!nonBotConnectedMembers.isEmpty() && !audioManager.isConnected()) {
PlayerManager.getInstance().getMusicManager(guild).getAudioPlayer().setVolume(defaultVolume);
audioManager.openAudioConnection(event.getChannelJoined());
}
}
use of net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent in project DiscordSRV by DiscordSRV.
the class VoiceModule method onGuildVoiceMove.
@Override
public void onGuildVoiceMove(GuildVoiceMoveEvent event) {
if (event.getChannelJoined().getParent() != null && !event.getChannelJoined().getParent().equals(getCategory()) && event.getChannelLeft().getParent() != null && event.getChannelLeft().getParent().equals(getCategory())) {
UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getUser().getId());
if (uuid == null)
return;
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
if (player.isOnline()) {
networks.stream().filter(network -> network.contains(player.getPlayer().getUniqueId())).forEach(network -> network.remove(player.getPlayer()));
}
}
checkMutedUser(event.getChannelJoined(), event.getMember());
}
use of net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent in project skoice by carlodrift.
the class Main method onGuildVoiceMove.
@Override
public void onGuildVoiceMove(GuildVoiceMoveEvent event) {
if (event.getChannelJoined().getParent() != null && !event.getChannelJoined().getParent().equals(getCategory()) && event.getChannelLeft().getParent() != null && event.getChannelLeft().getParent().equals(getCategory())) {
UUID uuid = getUniqueId(event.getMember());
if (uuid == null)
return;
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
if (player.isOnline()) {
networks.stream().filter(network -> network.contains(player.getPlayer().getUniqueId())).forEach(network -> network.remove(player.getPlayer()));
}
}
checkMutedUser(event.getChannelJoined(), event.getMember());
}
use of net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent in project DiscordSRV by Scarsz.
the class VoiceModule method onGuildVoiceMove.
@Override
public void onGuildVoiceMove(GuildVoiceMoveEvent event) {
if (event.getChannelJoined().getParent() != null && !event.getChannelJoined().getParent().equals(getCategory()) && event.getChannelLeft().getParent() != null && event.getChannelLeft().getParent().equals(getCategory())) {
UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getUser().getId());
if (uuid == null)
return;
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
if (player.isOnline()) {
networks.stream().filter(network -> network.contains(player.getPlayer().getUniqueId())).forEach(network -> network.remove(player.getPlayer()));
}
}
checkMutedUser(event.getChannelJoined(), event.getMember());
}
Aggregations