aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Chat.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/PlayerChatFilter.kt20
2 files changed, 20 insertions, 6 deletions
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