diff options
author | syeyoung <cyoung06@naver.com> | 2023-01-24 15:32:19 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-01-24 15:32:19 +0900 |
commit | 28346e1185e3a8c10aedb3d375b897968ee36935 (patch) | |
tree | 1a928a2a0f8e406014f3c27ab77876283db8c356 /mod | |
parent | 7b54bf2ff34b8119451b59da79776d33c29061c8 (diff) | |
download | Skyblock-Dungeons-Guide-28346e1185e3a8c10aedb3d375b897968ee36935.tar.gz Skyblock-Dungeons-Guide-28346e1185e3a8c10aedb3d375b897968ee36935.tar.bz2 Skyblock-Dungeons-Guide-28346e1185e3a8c10aedb3d375b897968ee36935.zip |
- Fixes #259
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
-rw-r--r-- | mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java index a92cd094..0aecc157 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java @@ -42,7 +42,7 @@ public class CustomNetworkPlayerInfo extends NetworkPlayerInfo { private IChatComponent displayName; - private String unformattedDisplayText; + private String formatted; private String playerNameWithoutColor; public IChatComponent getOriginalDisplayName() { @@ -53,15 +53,15 @@ public class CustomNetworkPlayerInfo extends NetworkPlayerInfo { public void setDisplayName(IChatComponent displayNameIn) { displayName = displayNameIn; if (displayName == null) { - unformattedDisplayText = null; + formatted = null; return; } - unformattedDisplayText = displayName.getUnformattedTextForChat(); + formatted = displayName.getFormattedText(); playerNameWithoutColor = ""; - for (String s : unformattedDisplayText.split(" ")) { + for (String s : formatted.split(" ")) { String strippped = TextUtils.stripColor(s); if (strippped.startsWith("[")) { continue; @@ -75,28 +75,19 @@ public class CustomNetworkPlayerInfo extends NetworkPlayerInfo { public IChatComponent getDisplayName() { - String rawPlayerString; - String actualName; + String rawPlayerString = + formatted != null ? formatted : ScorePlayerTeam.formatPlayerName(super.getPlayerTeam(), super.getGameProfile().getName());; + String actualName = null; List<ActiveCosmetic> activeCosmetics; - - // in case that the set player name is not called we do this - if (playerNameWithoutColor != null) { - activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayerNameLowerCase().get(playerNameWithoutColor.toLowerCase()); - rawPlayerString = unformattedDisplayText; - actualName = this.playerNameWithoutColor; - } else { - rawPlayerString = ScorePlayerTeam.formatPlayerName(super.getPlayerTeam(), super.getGameProfile().getName()); - actualName = ""; - for (String s : rawPlayerString.split(" ")) { - String strippped = TextUtils.stripColor(s); - if (strippped.startsWith("[")) continue; - actualName = strippped; - break; - } - activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayerNameLowerCase().get(actualName.toLowerCase()); + for (String s : rawPlayerString.split(" ")) { + String strippped = TextUtils.stripColor(s); + if (strippped.startsWith("[")) continue; + actualName = strippped; + break; } - - + // in case that the set player name is not called we do this + if (actualName == null) return displayName; + activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayerNameLowerCase().get(actualName.toLowerCase()); if (activeCosmetics == null) return displayName; CosmeticData color=null; for (ActiveCosmetic activeCosmetic : activeCosmetics) { |