From e1a0c4802f548a3066fc9a4216ca92e2396f3ec5 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 17 Dec 2023 21:57:41 +0100 Subject: [PATCH] Fix NPE --- .../steamwar/bungeecore/tablist/Tablist.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index 24f2031..9559007 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -222,9 +222,14 @@ public class Tablist extends MessageToMessageDecoder { item.setListed(false); } else if (item.getDisplayName() == null) { String color = "§f"; - UserPerm.Prefix prefix = SteamwarUser.get(item.getUuid()).prefix(); - if (prefix != UserPerm.emptyPrefix || !TablistServer.hasTeamColor(viewee, item.getUuid())) { - color = prefix.getChatPrefix(); + SteamwarUser steamwarUser = SteamwarUser.get(item.getUuid()); + if (steamwarUser == null) { + color = "§7"; + } else { + UserPerm.Prefix prefix = steamwarUser.prefix(); + if (prefix != UserPerm.emptyPrefix || !TablistServer.hasTeamColor(viewee, item.getUuid())) { + color = prefix.getChatPrefix(); + } } item.setDisplayName(TextComponent.fromLegacy(color + item.getUsername())); } @@ -283,9 +288,14 @@ public class Tablist extends MessageToMessageDecoder { item.setListed(false); } else if (item.getDisplayName() == null) { String color = "§f"; - UserPerm.Prefix prefix = SteamwarUser.get(item.getUuid()).prefix(); - if (prefix != UserPerm.emptyPrefix || !TablistServer.hasTeamColor(viewee, item.getUuid())) { - color = prefix.getChatPrefix(); + SteamwarUser steamwarUser = SteamwarUser.get(item.getUuid()); + if (steamwarUser == null) { + color = "§7"; + } else { + UserPerm.Prefix prefix = steamwarUser.prefix(); + if (prefix != UserPerm.emptyPrefix || !TablistServer.hasTeamColor(viewee, item.getUuid())) { + color = prefix.getChatPrefix(); + } } item.setDisplayName(TextComponent.fromLegacy(color + item.getUsername())); }