aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/chat
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-28 17:28:52 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-28 17:28:52 +0200
commitf20726ed77f21aead51ec3da2e90411c57aaf5f5 (patch)
tree97743044183b480c1c949be7fe381f8839e092d2 /src/main/java/at/hannibal2/skyhanni/features/chat
parent7c618552f30fdb717219c348b9f24dcacc651442 (diff)
downloadskyhanni-f20726ed77f21aead51ec3da2e90411c57aaf5f5.tar.gz
skyhanni-f20726ed77f21aead51ec3da2e90411c57aaf5f5.tar.bz2
skyhanni-f20726ed77f21aead51ec3da2e90411c57aaf5f5.zip
Fixed exploit that lets the game crash.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/chat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt31
1 files changed, 16 insertions, 15 deletions
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 b5927d31f..15eff6a85 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
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.chat.playerchat
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.features.dungeon.DungeonMilestonesDisplay
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import net.minecraft.util.ChatComponentText
import net.minecraft.util.IChatComponent
@@ -13,8 +14,8 @@ class PlayerChatModifier {
init {
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 )?§7((?:\\w+){2,16})§7§r".toRegex()) // nons user chat
+ patterns.add("§(?:7|a|b|6)((?:\\w){2,16})§r(?!§7x)".toRegex()) // nons in notification message
+ patterns.add("(?:§7 )?§7((?:\\w){2,16})§7§r".toRegex()) // nons user chat
}
@SubscribeEvent
@@ -68,19 +69,19 @@ class PlayerChatModifier {
}
}
-// if (SkyHanniMod.feature.chat.playerRankHider) {
-// for (pattern in patterns) {
-// string = string.replace(pattern, "§b$1")
-// }
-// string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16})'s", "§b$1's")
-// string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16}) (§.)", "§b$1 $2")
-//
-// // TODO remove workaround
-// if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) {
-// //all players same color in chat
-// string = string.replace("§r§7: ", "§r§f: ")
-// }
-// }
+ if (SkyHanniMod.feature.chat.playerRankHider) {
+ for (pattern in patterns) {
+ string = string.replace(pattern, "§b$1")
+ }
+ string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16})'s", "§b$1's")
+ string = string.replace("§(?:7|a|b|6)((?:\\w+){2,16}) (§.)", "§b$1 $2")
+
+ // TODO remove workaround
+ if (!DungeonMilestonesDisplay.isMilestoneMessage(input)) {
+ //all players same color in chat
+ string = string.replace("§r§7: ", "§r§f: ")
+ }
+ }
if (SkyHanniMod.feature.markedPlayers.highlightInChat) {
for (markedPlayer in MarkedPlayerManager.playerNamesToMark) {