diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-21 22:21:00 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-21 22:21:00 +0200 |
commit | 07df8a9cdc6fa9bbc4156c776e8863b1c1affbf1 (patch) | |
tree | a2741fd3dd23156c00d7b22845c3dd1f9a582ed0 /src/main | |
parent | 7aef79228e1acfbf6d2f6d73a1b5b18ec956eab4 (diff) | |
download | skyhanni-07df8a9cdc6fa9bbc4156c776e8863b1c1affbf1.tar.gz skyhanni-07df8a9cdc6fa9bbc4156c776e8863b1c1affbf1.tar.bz2 skyhanni-07df8a9cdc6fa9bbc4156c776e8863b1c1affbf1.zip |
fix replacing too many chat messages.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt index 6a1fb52f8..0e719c4e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/TestChatCommand.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import kotlinx.coroutines.launch import net.minecraft.util.ChatComponentText @@ -41,7 +42,7 @@ object TestChatCommand { ChatUtils.chat("§cChat blocked: ${event.blockedReason}") } else { val finalMessage = event.chatComponent.formattedText - if (finalMessage != message) { + if (LorenzUtils.stripVanillaMessage(finalMessage) != LorenzUtils.stripVanillaMessage(message)) { ChatUtils.chat("§eChat modified!") } ChatUtils.chat(finalMessage, false) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 2682c2973..433078b5f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -335,7 +335,9 @@ object StringUtils { return null } - if (LorenzUtils.stripVanillaMessage(original.formattedText) == newText) return null + val originalText = LorenzUtils.stripVanillaMessage(original.formattedText) + val newTextt = LorenzUtils.stripVanillaMessage(newText) + if (originalText == newTextt) return null val text = ChatComponentText(newText) if (size == 1) { |