Skip to content

Commit

Permalink
Always unregister events before interrupting
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCdry committed Sep 9, 2024
1 parent 7ef17ca commit c73f60b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public void update(User user) {
} else if (oldStatus == BotStatus.READY && newStatus != BotStatus.READY) {
this.unregisterMinecraftListeners();
if (newStatus != BotStatus.NOT_CONNECTED) {
this.unregisterBotListeners();
new InterruptSystemTask(this.plugin).run();
}
}
Expand Down Expand Up @@ -139,7 +138,7 @@ public void registerBotListeners() {
);
}

private void unregisterBotListeners() {
public void unregisterBotListeners() {
this.plugin.getBot().getJDA().removeEventListener(
this.guildVoiceGuildMuteListener,
this.guildVoiceUpdateListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public InterruptSystemTask(Skoice plugin) {
public void run() {
ThreadUtil.ensureNotMainThread(true);

this.plugin.getListenerManager().unregisterBotListeners();
this.plugin.getUpdateNetworksTask().interrupt();

Guild guild = this.plugin.getBot().getGuild();

if (guild != null
&& guild.getSelfMember().hasPermission(Permission.ADMINISTRATOR)
&& (guild.getRequiredMFALevel() != Guild.MFALevel.TWO_FACTOR_AUTH
Expand Down

0 comments on commit c73f60b

Please sign in to comment.