summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-07 22:10:11 +1000
committerGitHub <noreply@github.com>2024-06-07 14:10:11 +0200
commit79d0cd3af5b2acf11fc63bc3aa6743f784a3a0f6 (patch)
tree9a8507e4d7fe308dd4a228149f5a864301cfcce9 /src/main/java/at/hannibal2/skyhanni/features/misc
parentcfb12e7e3bbaf820f9402c286cba6bb0a33671fa (diff)
downloadskyhanni-79d0cd3af5b2acf11fc63bc3aa6743f784a3a0f6.tar.gz
skyhanni-79d0cd3af5b2acf11fc63bc3aa6743f784a3a0f6.tar.bz2
skyhanni-79d0cd3af5b2acf11fc63bc3aa6743f784a3a0f6.zip
Backend: Change Java to Kotlin for repo files (#1543)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt2
2 files changed, 10 insertions, 14 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 85d06060d..e0045ba76 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/InGameDateDisplay.kt
@@ -2,9 +2,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.ScoreboardData
-import at.hannibal2.skyhanni.data.jsonobjects.repo.TabListJson
import at.hannibal2.skyhanni.events.GuiRenderEvent
-import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.events.SecondPassedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -21,19 +19,17 @@ object InGameDateDisplay {
private val config get() = SkyHanniMod.feature.gui.inGameDate
- private val monthAndDatePattern by RepoPattern.pattern(
- "misc.ingametime.date",
+ private val patternGroup = RepoPattern.group("misc.ingametime")
+ private val monthAndDatePattern by patternGroup.pattern(
+ "date",
".*((Early|Late) )?(Winter|Spring|Summer|Autumn) [0-9]{1,2}(nd|rd|th|st)?.*"
)
- private var display = ""
-
- // sun, moon, spooky
- private var sunMoonIcons = emptyList<String>()
+ private val timeSymbolsPattern by patternGroup.pattern(
+ "symbols",
+ "([☀☽࿇])"
+ )
- @SubscribeEvent
- fun onRepoReload(event: RepositoryReloadEvent) {
- sunMoonIcons = event.getConstant<TabListJson>("TabList").sun_moon_symbols
- }
+ private var display = ""
@SubscribeEvent
fun onSecondPassed(event: SecondPassedEvent) {
@@ -57,7 +53,7 @@ object InGameDateDisplay {
val time = list.find { it.lowercase().contains("am ") || it.lowercase().contains("pm ") } ?: "??"
theBaseString = "$monthAndDate, $year ${time.trim()}".removeColor()
if (!config.includeSunMoon) {
- sunMoonIcons.forEach { theBaseString = theBaseString.replace(it, "") }
+ theBaseString = timeSymbolsPattern.matcher(theBaseString).replaceAll("")
}
} else {
theBaseString = date.formatted()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index 8fb37ee6e..d0e198765 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -61,7 +61,7 @@ object EstimatedItemValue {
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
val data = event.getConstant<ItemsJson>("Items")
- bookBundleAmount = data.book_bundle_amount ?: error("book_bundle_amount is missing")
+ bookBundleAmount = data.bookBundleAmount
}
@SubscribeEvent