From e09936d4a6aa2ad405848c57deee60bcddb4ca7c Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 11 Nov 2023 13:17:35 +0100 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit