diff options
author | Cow <cow@volloeko.de> | 2023-07-23 10:02:31 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2023-07-23 10:02:31 +0200 |
commit | e23fb71a2f30864fd055befd5cd934f8082aeb0d (patch) | |
tree | 9d225be6b519f3808af349865b71f33350a1a554 | |
parent | c4a4eebe2d322b59638720760e1ff45f64b2fa5e (diff) | |
download | Cowlection-e23fb71a2f30864fd055befd5cd934f8082aeb0d.tar.gz Cowlection-e23fb71a2f30864fd055befd5cd934f8082aeb0d.tar.bz2 Cowlection-e23fb71a2f30864fd055befd5cd934f8082aeb0d.zip |
Fixed some players being erroneously displayed as 'never joined the server'
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java b/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java index 01c1fc8..3e13e1c 100644 --- a/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java +++ b/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java @@ -1,11 +1,13 @@ package de.cowtipper.cowlection.data; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; import java.util.Map; @SuppressWarnings("unused") public class HyPlayerData { + private String playername; private String displayname; private String rank; private String prefix; @@ -30,7 +32,7 @@ public class HyPlayerData { } public String getPlayerNameFormatted() { - return getRankFormatted() + " " + displayname; + return getRankFormatted() + displayname; } public long getLastLogin() { @@ -54,7 +56,7 @@ public class HyPlayerData { public boolean hasNeverJoinedHypixel() { // example player that has never joined Hypixel (as of April 2020): Joe - return rank == null && lastLogin == 0; + return rank == null && lastLogin == 0 && StringUtils.isNullOrEmpty(playername); } public boolean hasNeverLoggedOut() { @@ -79,15 +81,15 @@ public class HyPlayerData { if (rank != null) { switch (rank) { case "HELPER": - return EnumChatFormatting.BLUE + "[HELPER]"; + return EnumChatFormatting.BLUE + "[HELPER] "; case "MODERATOR": - return EnumChatFormatting.DARK_GREEN + "[MOD]"; + return EnumChatFormatting.DARK_GREEN + "[MOD] "; case "GAME_MASTER": - return EnumChatFormatting.DARK_GREEN + "[GM]"; + return EnumChatFormatting.DARK_GREEN + "[GM] "; case "ADMIN": - return EnumChatFormatting.RED + "[ADMIN]"; + return EnumChatFormatting.RED + "[ADMIN] "; case "YOUTUBER": - return EnumChatFormatting.RED + "[" + EnumChatFormatting.WHITE + "YOUTUBE" + EnumChatFormatting.RED + "]"; + return EnumChatFormatting.RED + "[" + EnumChatFormatting.WHITE + "YOUTUBE" + EnumChatFormatting.RED + "] "; default: // unknown rank, fall-through break; @@ -99,18 +101,18 @@ public class HyPlayerData { if (monthlyPackageRank != null && monthlyPackageRank.equals("SUPERSTAR")) { // MVP++ EnumChatFormatting rankPlusPlusColor = monthlyRankColor != null ? EnumChatFormatting.getValueByName(monthlyRankColor) : EnumChatFormatting.GOLD; - return rankPlusPlusColor + "[MVP" + EnumChatFormatting.getValueByName(rankPlusColor) + "++" + rankPlusPlusColor + "]"; + return rankPlusPlusColor + "[MVP" + EnumChatFormatting.getValueByName(rankPlusColor) + "++" + rankPlusPlusColor + "] "; } if (newPackageRank != null) { switch (newPackageRank) { case "VIP": - return EnumChatFormatting.GREEN + "[VIP]"; + return EnumChatFormatting.GREEN + "[VIP] "; case "VIP_PLUS": - return EnumChatFormatting.GREEN + "[VIP" + EnumChatFormatting.GOLD + "+" + EnumChatFormatting.GREEN + "]"; + return EnumChatFormatting.GREEN + "[VIP" + EnumChatFormatting.GOLD + "+" + EnumChatFormatting.GREEN + "] "; case "MVP": - return EnumChatFormatting.AQUA + "[MVP]"; + return EnumChatFormatting.AQUA + "[MVP] "; case "MVP_PLUS": - return EnumChatFormatting.AQUA + "[MVP" + EnumChatFormatting.getValueByName(rankPlusColor) + "+" + EnumChatFormatting.AQUA + "]"; + return EnumChatFormatting.AQUA + "[MVP" + EnumChatFormatting.getValueByName(rankPlusColor) + "+" + EnumChatFormatting.AQUA + "] "; default: return EnumChatFormatting.GRAY.toString(); } |