Reduce merge conflicts

This commit is contained in:
BruceChen 2022-09-02 09:29:24 +08:00
parent 290ec9cc79
commit 4538095d74
2 changed files with 155 additions and 151 deletions

View file

@ -1131,17 +1131,19 @@ namespace MinecraftClient
/// <param name="text">Text to send to the server</param>
public void SendText(string text)
{
if (String.IsNullOrEmpty(text))
return;
int maxLength = handler.GetMaxChatMessageLength();
lock (chatQueue)
{
if (String.IsNullOrEmpty(text))
return;
int maxLength = handler.GetMaxChatMessageLength();
if (text.Length > maxLength) //Message is too long?
{
if (text[0] == '/')
{
//Send the first 100/256 chars of the command
text = text.Substring(0, maxLength);
text = text[..maxLength];
chatQueue.Enqueue(text);
}
else
@ -1149,13 +1151,15 @@ namespace MinecraftClient
//Split the message into several messages
while (text.Length > maxLength)
{
chatQueue.Enqueue(text.Substring(0, maxLength));
text = text.Substring(maxLength, text.Length - maxLength);
chatQueue.Enqueue(text[..maxLength]);
text = text[maxLength..];
}
chatQueue.Enqueue(text);
}
}
else chatQueue.Enqueue(text);
else
chatQueue.Enqueue(text);
TrySendMessageToServer();
}
}