From a3d768b1f101af92b334fd016ed8f82a1184d558 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 1 Oct 2021 10:55:29 +0200 Subject: [PATCH] Making listener stuff volatile to fix NPE's with multiple threads accessing them --- src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java index 3a4c2b39..e614c5ee 100644 --- a/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java +++ b/src/de/steamwar/bungeecore/bot/SteamwarDiscordBot.java @@ -55,13 +55,13 @@ public class SteamwarDiscordBot { } @Getter - private AnnouncementListener announcementListener; + private volatile AnnouncementListener announcementListener; @Getter - private IngameChatListener ingameChatListener; + private volatile IngameChatListener ingameChatListener; @Getter - private ServerTeamChatListener serverTeamChatListener; + private volatile ServerTeamChatListener serverTeamChatListener; @Getter private final JDA jda; @@ -100,7 +100,6 @@ public class SteamwarDiscordBot { DiscordRolesMessage.sendMessage(); DiscordRulesMessage.sendMessage(); DiscordTicketMessage.sendMessage(); - new RolesInteractionButtonListener(); new DiscordTicketListener(); new DiscordAuthListener(); @@ -109,7 +108,6 @@ public class SteamwarDiscordBot { ingameChatListener = new IngameChatListener(); serverTeamChatListener = new ServerTeamChatListener(); new SlashCommandListener(); - jda.retrieveCommands().complete().forEach(command -> jda.deleteCommandById(command.getId()).queue()); Guild guild = jda.getGuildById(SteamwarDiscordBotConfig.GUILD);