diff options
author | Erymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> | 2023-11-11 07:15:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-11 13:15:23 +0100 |
commit | f4b649b7ff6a0773283f7f8d8462f49d3f81550d (patch) | |
tree | 539cd767b232340ad05acb1704da3703f046edc8 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | cc673d9b40b0f4819342bd9530f3b0c38fa7a7ae (diff) | |
download | skyhanni-f4b649b7ff6a0773283f7f8d8462f49d3f81550d.tar.gz skyhanni-f4b649b7ff6a0773283f7f8d8462f49d3f81550d.tar.bz2 skyhanni-f4b649b7ff6a0773283f7f8d8462f49d3f81550d.zip |
Fixed scoreboard date number suffix missing (#684)
Fixed scoreboard date number suffix missing sometimes. #684
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt index 1b08e7ebd..29462b92c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt @@ -17,7 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class InGameDateDisplay { private val config get() = SkyHanniMod.feature.gui.inGameDate private val monthAndDatePattern = - ".*((Early|Late) )?(Winter|Spring|Summer|Autumn) [0-9]{1,2}(nd|rd|th|st).*".toPattern() + ".*((Early|Late) )?(Winter|Spring|Summer|Autumn) [0-9]{1,2}((nd|rd|th|st)?).*".toPattern() private var display = "" // sun, moon, spooky @@ -43,7 +43,10 @@ class InGameDateDisplay { if (config.useScoreboard) { val list = ScoreboardData.sidebarLinesFormatted //we need this to grab the moon/sun symbol val year = "Year ${date.year}" - val monthAndDate = list.find { monthAndDatePattern.matches(it) } ?: "??" + var monthAndDate = (list.find { monthAndDatePattern.matches(it) } ?: "??").trim() + if (monthAndDate.last().isDigit()) { + monthAndDate = "${monthAndDate}${SkyBlockTime.daySuffix(monthAndDate.takeLast(2).trim().toInt())}" + } val time = list.find { it.lowercase().contains("am ") || it.lowercase().contains("pm ") } ?: "??" theBaseString = "$monthAndDate, $year ${time.trim()}".removeColor() if (!config.includeSunMoon) { @@ -56,6 +59,7 @@ class InGameDateDisplay { else "$theBaseString ☽" } } + if (!config.includeOrdinal) theBaseString = theBaseString.replace("nd", "").replace("rd", "").replace("st", "").replace("th", "") display = theBaseString } |