From 898947156b64e45cc5a0133c12aa73811d3e16f5 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 27 Dec 2022 20:02:43 +0100 Subject: more chat stuff --- src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt | 8 +++----- .../java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt | 11 ++++++----- .../skyhanni/features/chat/playerchat/PlayerChatModifier.kt | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt index de0cafead..95d9aff04 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/ChatManager.kt @@ -54,15 +54,13 @@ class ChatManager { } val modified = chatEvent.chatComponent - if (modified.formattedText == original.formattedText) { - loggerAllowed.log(message) - loggerAll.log("[allowed] $message") - } else { + loggerAllowed.log("[allowed] $message") + loggerAll.log("[allowed] $message") + if (modified.formattedText != original.formattedText) { event.message = chatEvent.chatComponent loggerModified.log(" ") loggerModified.log("[original] " + original.formattedText) loggerModified.log("[modified] " + modified.formattedText) - loggerAll.log("[modified] " + modified.formattedText) } } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt index 963095215..6e26fd187 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt @@ -260,13 +260,14 @@ class ChatFilter { private fun lobby(message: String): Boolean = when { //player join - message.matchRegex("(.*) §6joined the lobby!") -> true - message.matchRegex("(.*) §6slid into the lobby!") -> true - message.matchRegex(" §b>§c>§a>§r (.*) §6joined the lobby!§r §a<§c<§b<") -> true + message.matchRegex(".* §6joined the lobby!") -> true + message.matchRegex(" §b>§c>§a>§r §r.*§f §6slid into the lobby!§r §a<§c<§b<") -> true + message.matchRegex(".* §6slid into the lobby!") -> true + message.matchRegex(" §b>§c>§a>§r .* §6joined the lobby!§r §a<§c<§b<") -> true //mystery box - message.matchRegex("§b✦ §r(.*) §r§7found a §r§e(.*) §r§bMystery Box§r§7!") -> true - message.matchRegex("§b✦ §r(.*) §r§7found (a|an) §r(.*) §r§7in a §r§aMystery Box§r§7!") -> true + message.matchRegex("§b✦ §r.* §r§7found a §r§e.* §r§bMystery Box§r§7!") -> true + message.matchRegex("§b✦ §r.* §r§7found (a|an) §r.* §r§7in a §r§aMystery Box§r§7!") -> true //prototype message.contains("§r§6§lWelcome to the Prototype Lobby§r") -> true diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index 347066ac2..5072152a7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -12,9 +12,9 @@ class PlayerChatModifier { private val patterns = mutableListOf() init { - patterns.add("§(?:a|b|6)\\[(?:VIP|MVP)(?:(?:§.|\\+)*)] (\\w{2,16})".toRegex()) // ranked player everywhere + patterns.add("§(?:a|b|6)\\[(?:VIP|MVP)(?:(?:§.|\\+)*)](?: {1,2})(?:§[7ab6])?(\\w{2,16})".toRegex()) // ranked player everywhere patterns.add("§(?:7|a|b|6)((?:\\w+){2,16})§r(?!§7x)".toRegex()) // nons in notification message - patterns.add("§7((?:\\w+){2,16})§7§r".toRegex()) // nons user chat + patterns.add("(?:§7 )?§7((?:\\w+){2,16})§7§r".toRegex()) // nons user chat } @SubscribeEvent -- cgit