Create emote bool only once

This commit is contained in:
Infi
2024-05-13 01:45:29 +02:00
parent 638d462732
commit 23ba24314b
+2 -2
View File
@@ -181,6 +181,7 @@ internal class Message
} }
} }
var checkForEmotes = Code.IsPlayerMessage() && Plugin.Config.ShowEmotes;
foreach (var chunk in oldChunks) foreach (var chunk in oldChunks)
{ {
// Use as is if it's not a text chunk or it already has a payload. // Use as is if it's not a text chunk or it already has a payload.
@@ -192,11 +193,10 @@ internal class Message
continue; continue;
} }
var checkForEmotes = Code.IsPlayerMessage();
var builder = new StringBuilder(); var builder = new StringBuilder();
foreach (var word in text.Content.Split(" ")) foreach (var word in text.Content.Split(" "))
{ {
if (checkForEmotes && Plugin.Config.ShowEmotes && EmoteCache.Exists(word) && !Plugin.Config.BlockedEmotes.Contains(word)) if (checkForEmotes && EmoteCache.Exists(word) && !Plugin.Config.BlockedEmotes.Contains(word))
{ {
// We add all the previous collected text parts // We add all the previous collected text parts
AddContentAfterURLCheck(builder.ToString(), text, chunk); AddContentAfterURLCheck(builder.ToString(), text, chunk);