aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/minion
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-28 20:43:18 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-28 20:43:29 +0200
commitbd6a0bb93ed6c0499cc3c5e044b7554481825bb5 (patch)
treebe2eea214952108ae8acd658f4646403129a3e28 /src/main/java/at/hannibal2/skyhanni/features/minion
parent9df04ac5aaa5e9897324af306dc73b8b1e67f600 (diff)
downloadskyhanni-bd6a0bb93ed6c0499cc3c5e044b7554481825bb5.tar.gz
skyhanni-bd6a0bb93ed6c0499cc3c5e044b7554481825bb5.tar.bz2
skyhanni-bd6a0bb93ed6c0499cc3c5e044b7554481825bb5.zip
REGEX
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/minion')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index 382a3d8ed..4c0cd3937 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import net.minecraft.client.Minecraft
import net.minecraft.entity.EntityLivingBase
@@ -38,7 +39,7 @@ class MinionFeatures {
private var lastCoinsRecived = 0L
private var lastMinionPickedUp = 0L
private var coinsPerDay = ""
- private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (.*)".toPattern()
+ private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (?<tier>.*)".toPattern()
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
@@ -199,9 +200,8 @@ class MinionFeatures {
lastMinionPickedUp = System.currentTimeMillis()
}
- val matcher = minionUpgradePattern.matcher(message)
- if (matcher.matches()) {
- val newTier = matcher.group(1).romanToDecimalIfNeeded()
+ minionUpgradePattern.matchMatcher(message) {
+ val newTier = group("tier").romanToDecimalIfNeeded()
minions[lastMinion]?.let {
val minionName = getMinionName(it.displayName, newTier)
it.displayName = minionName