From db8e3640e8f9c14b7027c9e92b810ed127391ced Mon Sep 17 00:00:00 2001 From: nea Date: Sun, 11 Jun 2023 02:50:01 +0200 Subject: Fix name being lowercased by HyPixel --- src/main/kotlin/moe/nea/firmament/apis/Profiles.kt | 6 +++--- .../kotlin/moe/nea/firmament/gui/profileviewer/ProfileViewer.kt | 3 ++- src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/moe/nea/firmament/apis/Profiles.kt b/src/main/kotlin/moe/nea/firmament/apis/Profiles.kt index ae23349..553fd9f 100644 --- a/src/main/kotlin/moe/nea/firmament/apis/Profiles.kt +++ b/src/main/kotlin/moe/nea/firmament/apis/Profiles.kt @@ -167,10 +167,10 @@ data class PlayerData( ) { val rankPlusDyeColor = LegacyFormattingCode.values().find { it.name == rankPlusColor } ?: LegacyFormattingCode.GOLD val rankData get() = RepoManager.neuRepo.constants.misc.ranks[if (monthlyPackageRank == "NONE" || monthlyPackageRank == null) packageRank else monthlyPackageRank] - fun getDisplayName() = rankData?.let { + fun getDisplayName(name: String = playerName) = rankData?.let { ("§${it.color}[${it.tag}${rankPlusDyeColor.modern}" + - "${it.plus ?: ""}§${it.color}] $playerName") - } ?: "${Formatting.GRAY}${playerName}" + "${it.plus ?: ""}§${it.color}] $name") + } ?: "${Formatting.GRAY}$name" } diff --git a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/ProfileViewer.kt b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/ProfileViewer.kt index c22fd39..8093df3 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/ProfileViewer.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/ProfileViewer.kt @@ -46,7 +46,8 @@ class ProfileViewer( source.sendError(Text.translatable("firmament.pv.noplayer", name)) return@launch } - val names = mapOf(uuid to (Routes.getPlayerNameForUUID(uuid) ?: name)) + val name = Routes.getPlayerNameForUUID(uuid) ?: name + val names = mapOf(uuid to (name)) val data = Routes.getAccountData(uuid) if (data == null) { source.sendError(Text.translatable("firmament.pv.noprofile", name)) diff --git a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt index 2de217e..8dc606c 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt @@ -126,7 +126,7 @@ object SkillPage : ProfilePage { return WBox(Axis.HORIZONTAL).also { it.insets = Insets.ROOT_PANEL it.add(WGridPanel().also { - it.add(WText(Text.literal(profileViewer.account.getDisplayName())), 0, 0, 8, 1) + it.add(WText(Text.literal(profileViewer.account.getDisplayName(profileViewer.primaryName))), 0, 0, 8, 1) for ((i, skill) in Skill.values().withIndex()) { it.add(WText(Text.translatable("firmament.pv.skills.${skill.name.lowercase()}")), 0, i + 1, 4, 1) it.add(skillBar(profileViewer, skill), 4, i + 1, 4, 1) -- cgit