diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-28 20:43:18 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-28 20:43:29 +0200 |
| commit | bd6a0bb93ed6c0499cc3c5e044b7554481825bb5 (patch) | |
| tree | be2eea214952108ae8acd658f4646403129a3e28 /src/main/java/at/hannibal2/skyhanni/features/nether | |
| parent | 9df04ac5aaa5e9897324af306dc73b8b1e67f600 (diff) | |
| download | skyhanni-bd6a0bb93ed6c0499cc3c5e044b7554481825bb5.tar.gz skyhanni-bd6a0bb93ed6c0499cc3c5e044b7554481825bb5.tar.bz2 skyhanni-bd6a0bb93ed6c0499cc3c5e044b7554481825bb5.zip | |
REGEX
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/nether')
3 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt index c6bb2d7bc..6b8da38e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt @@ -12,12 +12,13 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) { val kuudraTiers = mutableListOf<KuudraTier>() - private val pattern = " Kuudra's Hollow \\(T(.*)\\)".toPattern() + private val pattern = " Kuudra's Hollow \\(T(?<tier>.*)\\)".toPattern() private var kuudraLocation: LorenzVec? = null private var allKuudraDone = true @@ -46,9 +47,8 @@ class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationH if (message != " §r§6§lKUUDRA DOWN!") return for (line in ScoreboardData.sidebarLines) { - val matcher = pattern.matcher(line) - if (matcher.matches()) { - val tier = matcher.group(1).toInt() + pattern.matchMatcher(line) { + val tier = group("tier").toInt() val kuudraTier = getByTier(tier)!! finished(kuudraTier) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index 82b83105a..22b1523d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -33,6 +33,7 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { val amount: Int val name: String + // TODO use regex if (text.contains(" §r§8x")) { val split = text.split(" §r§8x") name = split[0] diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index 23c704811..56ba49a4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -29,7 +30,7 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel val message = event.message for (miniBoss in miniBosses) { - if (miniBoss.pattern.matcher(message).matches()) { + miniBoss.pattern.matchMatcher(message) { finished(miniBoss) } } |
