From 699346f1ceca2a542937c6c3a8083363e5d0fbb4 Mon Sep 17 00:00:00 2001 From: SebClem Date: Wed, 22 Jun 2022 18:53:28 +0200 Subject: [PATCH] :hammer: Change interact condition --- .../java/net/Broken/Api/Services/AudioService.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/Broken/Api/Services/AudioService.java b/src/main/java/net/Broken/Api/Services/AudioService.java index 8857e08..310db68 100644 --- a/src/main/java/net/Broken/Api/Services/AudioService.java +++ b/src/main/java/net/Broken/Api/Services/AudioService.java @@ -28,15 +28,18 @@ public class AudioService { // -> He can view the voice channel // -> OR He can *not* view the voice channel, but he is connected to this voice channel boolean canView = member.hasPermission(channel, Permission.VIEW_CHANNEL) - || (member.getVoiceState() != null && member.getVoiceState().getChannel() == channel); + || (member.getVoiceState() != null + && member.getVoiceState().getChannel() == channel); if (canView) { // The user can interact with the audio if: // -> He can connect to this voice channel +// -> OR he is connected to this voice channel // -> AND He can speak in this voice channel -// -> AND He is connected to this voice channel - boolean canInteract = member.hasPermission(channel, Permission.VOICE_CONNECT, Permission.VOICE_SPEAK) - && member.getVoiceState() != null - && member.getVoiceState().getChannel() == channel; + boolean canInteract = (member.hasPermission(channel, Permission.VOICE_CONNECT) + || member.getVoiceState() != null + || member.getVoiceState().getChannel() == channel) + && member.hasPermission(channel, Permission.VOICE_SPEAK); + AudioM audioM = AudioM.getInstance(guild); boolean stopped = audioM.getGuildAudioPlayer().player.getPlayingTrack() == null; PlayBackInfo playBackInfo;