From acd45ce4aebe5d6a33299bf2ac917a1fbf24ad33 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 11 Sep 2019 15:30:07 +0200 Subject: [PATCH] Hopefully fixed the issue of multiple ready events #107 --- .../java/buttondevteam/discordplugin/DiscordPlugin.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java b/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java index ab63ebe..38afecc 100755 --- a/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java +++ b/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java @@ -141,6 +141,10 @@ public class DiscordPlugin extends ButtonPlugin { private void handleReady(List event) { try { + if(!SafeMode) { + getLogger().info("Ready again, already enabled."); //TODO: It should probably handle disconnections + return; + } mainServer = mainServer().get().orElse(null); //Shouldn't change afterwards getCommand2MC().registerCommand(new DiscordMCCommand()); //Register so that the reset command works if (mainServer == null) { @@ -264,8 +268,8 @@ public class DiscordPlugin extends ButtonPlugin { try { SafeMode = true; // Stop interacting with Discord ChromaBot.delete(); - timings.printElapsed("Updating presence..."); - dc.updatePresence(Presence.idle(Activity.playing("Chromacraft"))).block(); //No longer using the same account for testing + //timings.printElapsed("Updating presence..."); + //dc.updatePresence(Presence.idle(Activity.playing("logging out"))).block(); //No longer using the same account for testing timings.printElapsed("Logging out..."); dc.logout().block(); //Configs are emptied so channels and servers are fetched again