diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-11 13:17:35 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-11 13:17:35 +0100 |
commit | e09936d4a6aa2ad405848c57deee60bcddb4ca7c (patch) | |
tree | 21f4e05c16e675b0da61acf56e382b576137f389 /src | |
parent | f4b649b7ff6a0773283f7f8d8462f49d3f81550d (diff) | |
download | skyhanni-e09936d4a6aa2ad405848c57deee60bcddb4ca7c.tar.gz skyhanni-e09936d4a6aa2ad405848c57deee60bcddb4ca7c.tar.bz2 skyhanni-e09936d4a6aa2ad405848c57deee60bcddb4ca7c.zip |
code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt | 6 |
1 files changed, 4 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 29462b92c..5bacfd047 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 @@ -59,10 +59,12 @@ class InGameDateDisplay { else "$theBaseString ☽" } } - if (!config.includeOrdinal) theBaseString = theBaseString.replace("nd", "").replace("rd", "").replace("st", "").replace("th", "") + if (!config.includeOrdinal) theBaseString = theBaseString.removeOrdinal() display = theBaseString } + private fun String.removeOrdinal() = replace("nd", "").replace("rd", "").replace("st", "").replace("th", "") + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isEnabled()) return |