diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 31de087cd..42a4c8850 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -13,6 +13,7 @@ import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.hasGroup import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -34,12 +35,13 @@ object InquisitorWaypointShare { private val config get() = SkyHanniMod.feature.event.diana.inquisitorSharing private val patternGroup = RepoPattern.group("diana.waypoints") + /** * REGEX-TEST: §9Party §8> User Name§f: §rx: 2.3, y: 4.5, z: 6.7 */ private val partyOnlyCoordsPattern by patternGroup.pattern( "party.onlycoords", - "§9Party §8> (?<playerName>.+)§f: §rx: (?<x>[^ ]+),? y: (?<y>[^ ]+),? z: (?<z>[^ ]+)" + "(?<party>§9Party §8> )?(?<playerName>.+)§f: §rx: (?<x>[^ ]+),? y: (?<y>[^ ]+),? z: (?<z>[^ ]+)" ) //Support for https://www.chattriggers.com/modules/v/inquisitorchecker @@ -48,11 +50,11 @@ object InquisitorWaypointShare { */ private val partyInquisitorCheckerPattern by patternGroup.pattern( "party.inquisitorchecker", - "§9Party §8> (?<playerName>.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?<area>.*)] at Coords (?<x>[^ ]+) (?<y>[^ ]+) (?<z>[^ ]+)" + "(?<party>§9Party §8> )?(?<playerName>.+)§f: §rA MINOS INQUISITOR has spawned near \\[(?<area>.*)] at Coords (?<x>[^ ]+) (?<y>[^ ]+) (?<z>[^ ]+)" ) private val diedPattern by patternGroup.pattern( "died", - "§9Party §8> (?<playerName>.*)§f: §rInquisitor dead!" + "(?<party>§9Party §8> )?(?<playerName>.*)§f: §rInquisitor dead!" ) private var time = 0L @@ -258,6 +260,7 @@ object InquisitorWaypointShare { } } diedPattern.matchMatcher(message) { + if (block()) return val rawName = group("playerName") val name = rawName.cleanPlayerName() val displayName = rawName.cleanPlayerName(displayName = true) @@ -267,7 +270,10 @@ object InquisitorWaypointShare { } } + private fun Matcher.block(): Boolean = !hasGroup("party") && !config.globalChat + private fun Matcher.detectFromChat(): Boolean { + if (block()) return false val rawName = group("playerName") val x = group("x").trim().toDoubleOrNull() ?: return false val y = group("y").trim().toDoubleOrNull() ?: return false |