From 8392ec3fe96214ebb289c403a2b408889f8b3f15 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:38:32 +0200 Subject: Improvement: Date in Custom Scoreboard!! (#2802) --- .../features/gui/customscoreboard/DisplayConfig.java | 5 +++++ .../elements/ScoreboardElementLobbyCode.kt | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java index 39d8c09bf..b54d7519d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java @@ -149,6 +149,11 @@ public class DisplayConfig { @ConfigEditorDropdown public RenderUtils.HorizontalAlignment textAlignment = RenderUtils.HorizontalAlignment.LEFT; + @Expose + @ConfigOption(name = "Date in Lobby Code", desc = "Show the current date infront of the server name, like Hypixel does.") + @ConfigEditorBoolean + public boolean dateInLobbyCode = true; + @Expose @ConfigOption( name = "Cache Scoreboard on Island Switch", diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/elements/ScoreboardElementLobbyCode.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/elements/ScoreboardElementLobbyCode.kt index a3b2b7c1f..f4f64ed17 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/elements/ScoreboardElementLobbyCode.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/elements/ScoreboardElementLobbyCode.kt @@ -2,15 +2,20 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard.elements import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard +import java.time.LocalDate +import java.time.format.DateTimeFormatter // internal // update on island change and every second while in dungeons object ScoreboardElementLobbyCode : ScoreboardElement() { - override fun getDisplay(): String? { - val lobbyCode = HypixelData.serverId ?: return null - val roomId = DungeonAPI.getRoomID()?.let { " §8$it" }.orEmpty() - return "§8$lobbyCode$roomId" + private val formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy") + + override fun getDisplay() = buildString { + if (CustomScoreboard.displayConfig.dateInLobbyCode) append("§7${LocalDate.now().format(formatter)} ") + append(HypixelData.serverId?.let { "§8$it" }) + append(DungeonAPI.getRoomID()?.let { " §8$it" }) } - override val configLine = "§8mega77CK" + override val configLine = "§710/23/2024 §8mega77CK" } -- cgit