From f20726ed77f21aead51ec3da2e90411c57aaf5f5 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 28 Mar 2023 17:28:52 +0200 Subject: Fixed exploit that lets the game crash. --- .../features/chat/playerchat/PlayerChatModifier.kt | 31 +++++++++++----------- 1 file 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) { -- cgit