summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/summonings
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-02-16 21:21:43 +1100
committerGitHub <noreply@github.com>2024-02-16 11:21:43 +0100
commitf91973d60948d449cc45a4add901e6fe43aebd62 (patch)
tree4c8c77ec4a9585a821651a034ebe5bed3308a6af /src/main/java/at/hannibal2/skyhanni/features/summonings
parent26fe548fa9a5cfe29b130a0a5585278df3429ee9 (diff)
downloadskyhanni-f91973d60948d449cc45a4add901e6fe43aebd62.tar.gz
skyhanni-f91973d60948d449cc45a4add901e6fe43aebd62.tar.bz2
skyhanni-f91973d60948d449cc45a4add901e6fe43aebd62.zip
Moved many regex patterns in the repo and code cleanup. #871
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/summonings')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
index 06bb39d28..dc971cd5b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
@@ -19,6 +19,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.getLorenzVec
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.entity.EntityLiving
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
@@ -36,16 +37,23 @@ class SummoningMobManager {
private var searchArmorStands = false
private var searchMobs = false
- // TODO repo
- //§aYou have spawned your Tank Zombie §r§asoul! §r§d(249 Mana)
- private val spawnPattern = "§aYou have spawned your (.+) §r§asoul! §r§d\\((\\d+) Mana\\)".toPattern()
- private val despawnPattern = "§cYou have despawned your (monster|monsters)!".toPattern()
-
- //§a§ohannibal2's Tank Zombie§r §a160k§c❤
- private val healthPattern = "§a§o(.+)'s (.+)§r §[ae]([\\dkm]+)§c❤".toPattern()
-
- //§cThe Seraph recalled your 3 summoned allies!
- private val seraphRecallPattern = "§cThe Seraph recalled your (\\d) summoned allies!".toPattern()
+ private val patternGroup = RepoPattern.group("summoning.mobs")
+ private val spawnPattern by patternGroup.pattern( //§aYou have spawned your Tank Zombie §r§asoul! §r§d(249 Mana)
+ "spawn",
+ "§aYou have spawned your (.+) §r§asoul! §r§d\\((\\d+) Mana\\)"
+ )
+ private val despawnPattern by patternGroup.pattern(
+ "despawn",
+ "§cYou have despawned your (monster|monsters)!"
+ )
+ private val healthPattern by patternGroup.pattern( //§a§ohannibal2's Tank Zombie§r §a160k§c❤
+ "health",
+ "§a§o(.+)'s (.+)§r §[ae]([\\dkm]+)§c❤"
+ )
+ private val seraphRecallPattern by patternGroup.pattern( //§cThe Seraph recalled your 3 summoned allies!
+ "seraphrecall",
+ "§cThe Seraph recalled your (\\d) summoned allies!"
+ )
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {