From d41bb58fac07425676ea44118505b2db85dd4703 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 16 Sep 2021 22:21:36 +0200 Subject: [PATCH] Fix null Issues Signed-off-by: Chaoscaot --- src/de/steamwar/bungeecore/bot/AuthManager.java | 1 - src/de/steamwar/bungeecore/sql/SteamwarUser.java | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/bot/AuthManager.java b/src/de/steamwar/bungeecore/bot/AuthManager.java index a2facf0..ac4f553 100644 --- a/src/de/steamwar/bungeecore/bot/AuthManager.java +++ b/src/de/steamwar/bungeecore/bot/AuthManager.java @@ -27,7 +27,6 @@ import net.dv8tion.jda.api.entities.Emoji; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.interactions.components.ActionRow; import net.dv8tion.jda.api.interactions.components.Button; -import net.md_5.bungee.api.scheduler.ScheduledTask; import java.util.*; import java.util.concurrent.TimeUnit; diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index e09bbc8..2643d62 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -94,11 +94,15 @@ public class SteamwarUser { team = rs.getInt("Team"); leader = rs.getBoolean("Leader"); discordId = rs.getLong("DiscordId"); + if(rs.wasNull()) { + discordId = null; + } usersById.put(id, this); usersByName.put(userName.toLowerCase(), this); usersByUUID.put(uuid, this); - if(discordId != null) + if(discordId != null) { usersByDiscord.put(discordId, this); + } punishments = Punishment.getPunishmentsOfPlayer(id); }