From dcaeb7a3c5dfeab24377f7556c793ea5c3d5c686 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 18 May 2024 02:58:03 +0200 Subject: code cleanup --- .../skyhanni/features/nether/VolcanoExplosivityDisplay.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt index d5a518e67..4565e6803 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/VolcanoExplosivityDisplay.kt @@ -4,11 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent -import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.StringUtils.matches +import at.hannibal2.skyhanni.utils.StringUtils.matchFirst import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -16,6 +14,10 @@ class VolcanoExplosivityDisplay { private val config get() = SkyHanniMod.feature.crimsonIsle private val patternGroup = RepoPattern.group("crimson.volcano") + + /** + * REGEX-TEST: Volcano: §r§8INACTIVE + */ private val statusPattern by patternGroup.pattern( "tablistline", " *Volcano: (?(?:§.)*\\S+)" @@ -25,11 +27,8 @@ class VolcanoExplosivityDisplay { @SubscribeEvent fun onTabListUpdate(event: TabListUpdateEvent) { if (!isEnabled()) return - for (line in event.tabList) { - statusPattern.matchMatcher(line) { - display = "§bVolcano Explosivity§7: ${group("status")}" - break - } + event.tabList.matchFirst(statusPattern) { + display = "§bVolcano Explosivity§7: ${group("status")}" } } -- cgit