diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-09-08 19:32:27 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-09-08 19:32:27 +0200 |
commit | 4eea94b0459760053819ddae136e7db109aea464 (patch) | |
tree | e519cef2dad7496cb6091175aa4b3ce2a79fe93a | |
parent | 63d23eff40d6014a5014d8bef85560af38cf39b0 (diff) | |
download | skyhanni-4eea94b0459760053819ddae136e7db109aea464.tar.gz skyhanni-4eea94b0459760053819ddae136e7db109aea464.tar.bz2 skyhanni-4eea94b0459760053819ddae136e7db109aea464.zip |
Added msg support to fancy chat format.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Chat.java | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt | 20 |
3 files changed, 21 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e692180e..0cdb31600 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Small Changes - Changed the ashfang gravity orb highlight from square to cylinder +- added msg support to fancy chat format ### Fixes - Fixed enchanted books in bazaar diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java index a0d61e86a..b1ccc4a7c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Chat.java @@ -87,10 +87,4 @@ public class Chat { "except for players who are close to the player, inside dungeon or during a Kuudra fight.") @ConfigEditorBoolean public boolean hideFarDeathMessages = false; - - @Expose - @ConfigOption(name = "Hide Far Deaths 2", desc = "Hide the death messages of other players, " + - "except for players who are close to the player, inside dungeon or during a Kuudra fight.") - @ConfigEditorBoolean - public boolean hideFarDeathMessages2 = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt index a96997ba6..a6b5e0bf9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt @@ -16,6 +16,9 @@ class PlayerChatFilter { //§8[§9109§8] §b[MVP§c+§b] 4Apex§f§r§f: omg selling private val patternSkyBlockLevel = Pattern.compile("§8\\[§(.)(\\d+)§8] (.+)") + //§dTo §r§b[MVP§r§3+§r§b] Skyfall55§r§7: §r§7hello :) + var patternPrivateMessage: Pattern = Pattern.compile("§d(To|From) §r(.+)§r§7: §r§7(.+)") + @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.isOnHypixel) return @@ -26,6 +29,8 @@ class PlayerChatFilter { } private fun shouldBlock(originalMessage: String): Boolean { + if (handlePrivateMessage(originalMessage)) return true + //since hypixel sends own chat messages really weird " §r§8[§r§d205§r§8] §r§6[MVP§r§c++§r§6] hannibal2" var rawMessage = originalMessage.replace("§r", "").trim() @@ -62,6 +67,21 @@ class PlayerChatFilter { return true } + private fun handlePrivateMessage(originalMessage: String): Boolean { + if (!SkyHanniMod.feature.chat.playerMessagesFormat) return false + + val matcher = patternPrivateMessage.matcher(originalMessage) + if (!matcher.matches()) return false + val direction = matcher.group(1) + val rawName = matcher.group(2) + val name = grabName(rawName) ?: return false + + val message = matcher.group(3) + LorenzUtils.chat("§d$direction §b$name §f$message") + loggerPlayerChat.log("[Msg_$direction] $name: $message") + return true + } + private fun grabChannel(name: String): PlayerMessageChannel { return PlayerMessageChannel.values() .find { it != PlayerMessageChannel.ALL && name.startsWith(it.originalPrefix) } ?: PlayerMessageChannel.ALL |