Skip to content

Commit

Permalink
Fixed sending empty messages
Browse files Browse the repository at this point in the history
  • Loading branch information
18107 committed Apr 29, 2021
1 parent db6a460 commit d901d41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PulsarPluginLoader/Chat/Extensions/HarmonyNetworkUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void Prefix(PLNetworkManager __instance)
}
}
}
else if (c == Environment.NewLine[0] || c == "\r"[0])
else if (c == '\n' || c == '\r')
{
//Do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ class HarmonyProcessCurrentChatText
private static readonly char[] newline = { '\n', '\r' };
static void Prefix(PLNetworkManager __instance)
{
__instance.CurrentChatText = __instance.CurrentChatText.TrimEnd(newline);

if (string.IsNullOrWhiteSpace(__instance.CurrentChatText))
{
return;
}

LinkedListNode<string> lastMessage = ChatHelper.chatHistory.FindLast(__instance.CurrentChatText.TrimEnd(newline));
LinkedListNode<string> lastMessage = ChatHelper.chatHistory.FindLast(__instance.CurrentChatText);
if (lastMessage != null)
{
ChatHelper.chatHistory.Remove(lastMessage);
}
ChatHelper.chatHistory.AddLast(__instance.CurrentChatText.TrimEnd(newline));
ChatHelper.chatHistory.AddLast(__instance.CurrentChatText);
if (ChatHelper.chatHistory.Count > 100)
{
ChatHelper.chatHistory.RemoveFirst();
Expand Down

0 comments on commit d901d41

Please sign in to comment.