Skip to content

Commit

Permalink
Fixed issue#2
Browse files Browse the repository at this point in the history
  • Loading branch information
abc123me committed Dec 7, 2022
1 parent c14976b commit 0089e8b
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0089e8b

Please sign in to comment.