mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Minecraft 1.11: Raise chat message max length to 256
This commit is contained in:
parent
8ec2b2e570
commit
609b939159
4 changed files with 30 additions and 6 deletions
|
|
@ -538,21 +538,22 @@ namespace MinecraftClient
|
|||
/// <returns>True if the text was sent with no error</returns>
|
||||
public bool SendText(string text)
|
||||
{
|
||||
if (text.Length > 100) //Message is too long?
|
||||
int maxLength = handler.GetMaxChatMessageLength();
|
||||
if (text.Length > maxLength) //Message is too long?
|
||||
{
|
||||
if (text[0] == '/')
|
||||
{
|
||||
//Send the first 100 chars of the command
|
||||
text = text.Substring(0, 100);
|
||||
//Send the first 100/256 chars of the command
|
||||
text = text.Substring(0, maxLength);
|
||||
return handler.SendChatMessage(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Send the message splitted into several messages
|
||||
while (text.Length > 100)
|
||||
while (text.Length > maxLength)
|
||||
{
|
||||
handler.SendChatMessage(text.Substring(0, 100));
|
||||
text = text.Substring(100, text.Length - 100);
|
||||
handler.SendChatMessage(text.Substring(0, maxLength));
|
||||
text = text.Substring(maxLength, text.Length - maxLength);
|
||||
if (Settings.splitMessageDelay.TotalSeconds > 0)
|
||||
Thread.Sleep(Settings.splitMessageDelay);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue