diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt index b14bf4b4a..9b5430b93 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt @@ -9,9 +9,12 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent +import java.util.regex.Pattern class DungeonData { + private val pattern = Pattern.compile(" §7⏣ §cThe Catacombs §7\\((.*)\\)") + companion object { var dungeonFloor: String? = null var inBossRoom = false @@ -63,13 +66,12 @@ class DungeonData { fun onTick(event: TickEvent.ClientTickEvent) { if (event.phase != TickEvent.Phase.START) return if (dungeonFloor == null) { - for (line in ScoreboardData.sidebarLines) { - //TODO mixins - if (line.contains("The Catacombs (")) { - val floor = line.substringAfter("(").substringBefore(")") + for (line in ScoreboardData.sidebarLinesFormatted) { + val matcher = pattern.matcher(line) + if (matcher.matches()) { + val floor = matcher.group(1) dungeonFloor = floor DungeonEnterEvent(floor).postAndCatch() - break } } } |