diff --git a/src/main/java/com/jeremiahbl/bfcmod/utils/BetterForgeChatUtilities.java b/src/main/java/com/jeremiahbl/bfcmod/utils/BetterForgeChatUtilities.java index 3d7a289..0d1dad4 100644 --- a/src/main/java/com/jeremiahbl/bfcmod/utils/BetterForgeChatUtilities.java +++ b/src/main/java/com/jeremiahbl/bfcmod/utils/BetterForgeChatUtilities.java @@ -16,11 +16,18 @@ public static String getRawPreferredPlayerName(ServerPlayer player, boolean enab String pfx = "", sfx = ""; if(enableMetadata && BetterForgeChat.instance.metadataProvider != null) { String[] dat = BetterForgeChat.instance.metadataProvider.getPlayerPrefixAndSuffix(player); - pfx = dat[0]; - sfx = dat[1]; + pfx = dat[0] != null ? dat[0] : ""; + sfx = dat[1] != null ? dat[1] : ""; } String fmat = ConfigHandler.config.playerNameFormat.get(); - return fmat.replace("$prefix", pfx).replace("$name", name).replace("$suffix", sfx); + if(name == null) { + BetterForgeChat.LOGGER.info("NicknameProvider (FTB Essentials) returned a null nickname, please post issue on GitHub!"); + name = player.getGameProfile().getName(); + } + if(fmat == null) { + BetterForgeChat.LOGGER.warn("Could not get playerNameFormat from configuration file, please post issue on GitHub!"); + return player.getGameProfile().getName(); + } else return fmat.replace("$prefix", pfx).replace("$name", name).replace("$suffix", sfx); } public static TextComponent getFormattedPlayerName(ServerPlayer player) { return TextFormatter.stringToFormattedText(getRawPreferredPlayerName(player));