diff --git a/src/main/java/net/clementraynaud/skoice/system/ListenerManager.java b/src/main/java/net/clementraynaud/skoice/system/ListenerManager.java index 6f6a3522..29da3b6e 100644 --- a/src/main/java/net/clementraynaud/skoice/system/ListenerManager.java +++ b/src/main/java/net/clementraynaud/skoice/system/ListenerManager.java @@ -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(); } } @@ -139,7 +138,7 @@ public void registerBotListeners() { ); } - private void unregisterBotListeners() { + public void unregisterBotListeners() { this.plugin.getBot().getJDA().removeEventListener( this.guildVoiceGuildMuteListener, this.guildVoiceUpdateListener, diff --git a/src/main/java/net/clementraynaud/skoice/tasks/InterruptSystemTask.java b/src/main/java/net/clementraynaud/skoice/tasks/InterruptSystemTask.java index a27e1d72..d0031bcd 100644 --- a/src/main/java/net/clementraynaud/skoice/tasks/InterruptSystemTask.java +++ b/src/main/java/net/clementraynaud/skoice/tasks/InterruptSystemTask.java @@ -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