aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-14 01:40:39 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-14 01:40:39 +0100
commit2aa92c8b1bc3d7185f8b15e8abd388cb17f68217 (patch)
treea43d2dc790215af444ac4efb606537e70cb8daeb /src
parent529be3695bad582d9a845d11dfba7fbe3ec235ee (diff)
downloadskyhanni-2aa92c8b1bc3d7185f8b15e8abd388cb17f68217.tar.gz
skyhanni-2aa92c8b1bc3d7185f8b15e8abd388cb17f68217.tar.bz2
skyhanni-2aa92c8b1bc3d7185f8b15e8abd388cb17f68217.zip
Using RepoPattern in GardenLevelDisplay
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
index 1d85443ca..d2772d837 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
@@ -13,16 +13,17 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.milliseconds
class GardenLevelDisplay {
private val config get() = GardenAPI.config.gardenLevels
- private val expToNextLevelPattern = ".* §e(?<nextLevelExp>.*)§6/.*".toPattern()
- private val overflowPattern = ".*§r §6(?<overflow>.*)".toPattern()
- private val namePattern = "Garden Level (?<currentLevel>.*)".toPattern()
+ private val expToNextLevelPattern by RepoPattern.pattern("garden.level.inventory.nextxp", ".* §e(?<nextLevelExp>.*)§6/.*")
+ private val overflowPattern by RepoPattern.pattern("garden.level.inventory.overflow", ".*§r §6(?<overflow>.*)")
+ private val currentLevelPattern by RepoPattern.pattern("garden.level.inventory.currentlevel", "Garden Level (?<currentLevel>.*)")
private var display = ""
- private var visitorRewardPattern = " {4}§r§8\\+§r§2(?<exp>.*) §r§7Garden Experience".toPattern()
+ private val visitorRewardPattern by RepoPattern.pattern("garden.level.chat.increase", " {4}§r§8\\+§r§2(?<exp>.*) §r§7Garden Experience")
@SubscribeEvent
fun onProfileJoin(event: ProfileJoinEvent) {
@@ -62,7 +63,7 @@ class GardenLevelDisplay {
if (event.inventoryName != "Desk") return
val item = event.inventoryItems[4]!!
- val currentLevel = namePattern.matchMatcher(item.name!!.removeColor()) {
+ val currentLevel = currentLevelPattern.matchMatcher(item.name!!.removeColor()) {
group("currentLevel").romanToDecimalIfNecessary()
} ?: return
var nextLevelExp = 0L