Skip to content

Commit

Permalink
fixing stage chat event
Browse files Browse the repository at this point in the history
  • Loading branch information
yaansz committed Jan 11, 2025
1 parent 291b61f commit 900ba85
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main/java/com/softawii/capivara/events/VoiceEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.dv8tion.jda.api.entities.channel.concrete.Category;
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import net.dv8tion.jda.api.entities.channel.unions.AudioChannelUnion;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.events.channel.ChannelDeleteEvent;
import net.dv8tion.jda.api.events.channel.update.ChannelUpdateParentEvent;
Expand Down Expand Up @@ -51,23 +52,23 @@ public VoiceEvents(JDA jda, VoiceManager voiceManager, DroneManager droneManager
@Override
public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) {
try {
VoiceChannel joined = (VoiceChannel) event.getChannelJoined();
VoiceChannel left = (VoiceChannel) event.getChannelLeft();
Member member = event.getMember();
AudioChannelUnion joined = event.getChannelJoined();
AudioChannelUnion left = event.getChannelLeft();
Member member = event.getMember();

if (joined != null) {
if (joined != null && joined.getType() == ChannelType.VOICE) {
// Check to Delete!
droneManager.checkToCreateTemporary(joined, member);
droneManager.checkToCreateTemporary((VoiceChannel) joined, member);
// Check to Add Permissions!
droneManager.checkToChangeChatAccess(joined, member, true);
droneManager.checkToChangeChatAccess((VoiceChannel) joined, member, true);
// Check to Remove Claim Message!
droneManager.checkToRemoveClaimMessage(joined, member);
droneManager.checkToRemoveClaimMessage((VoiceChannel) joined, member);
}
if (left != null) {
if (left != null && left.getType() == ChannelType.VOICE) {
// Check to Remove Permissions!
droneManager.checkToChangeChatAccess(left, member, false);
droneManager.checkToChangeChatAccess((VoiceChannel) left, member, false);
// Check to Delete!
droneManager.checkToDeleteTemporary(left, member, false);
droneManager.checkToDeleteTemporary((VoiceChannel) left, member, false);
}
} catch (Exception e) {
LOGGER.error("Error on onGuildVoiceUpdate", e);
Expand Down

0 comments on commit 900ba85

Please sign in to comment.