aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>2023-11-11 07:15:23 -0500
committerGitHub <noreply@github.com>2023-11-11 13:15:23 +0100
commitf4b649b7ff6a0773283f7f8d8462f49d3f81550d (patch)
tree539cd767b232340ad05acb1704da3703f046edc8
parentcc673d9b40b0f4819342bd9530f3b0c38fa7a7ae (diff)
downloadskyhanni-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
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt8
2 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
index 79df5cdd8..992ef03d9 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
@@ -135,6 +135,15 @@ public class GUIConfig {
@Expose
@ConfigOption(
+ name = "Show Date Ordinal",
+ desc = "Show the date's ordinal suffix. Ex: (1st <-> 1, 22nd <-> 22, 23rd <-> 3, 24th <-> 24, etc.)"
+ )
+ @ConfigEditorBoolean
+ //@FeatureToggle
+ public boolean includeOrdinal = false;
+
+ @Expose
+ @ConfigOption(
name = "Refresh Rate",
desc = "Change the time in seconds you would like to refresh the In-Game Date Display." +
"\n§eNOTE: If \"Use Scoreboard for Date\" is enabled, this setting is ignored."
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
}