diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs
index 21d2a488..8f8a8723 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol16.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs
@@ -696,7 +696,8 @@ namespace MinecraftClient.Protocol.Handlers
public int GetMaxChatMessageLength()
{
- return 100;
+ int configOverride = Settings.MainConfigHelper.Config.Advanced.MaxChatMessageLength;
+ return configOverride > 0 ? configOverride : 100;
}
public int GetProtocolVersion()
diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs
index 31ae3394..29fbc601 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol18.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs
@@ -3636,9 +3636,13 @@ namespace MinecraftClient.Protocol.Handlers
/// Get max length for chat messages
///
/// Max length, in characters
- public int GetMaxChatMessageLength() => protocolVersion > MC_1_10_Version
- ? 256
- : 100;
+ public int GetMaxChatMessageLength()
+ {
+ int configOverride = Settings.MainConfigHelper.Config.Advanced.MaxChatMessageLength;
+ if (configOverride > 0)
+ return configOverride;
+ return protocolVersion > MC_1_10_Version ? 256 : 100;
+ }
///
/// Get the current protocol version.
diff --git a/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs b/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs
index 91cd1cb1..43d81d95 100644
--- a/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs
+++ b/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs
@@ -1703,6 +1703,15 @@ namespace MinecraftClient {
}
}
+ ///
+ /// Looks up a localized string similar to Override the maximum chat message length. Set to 0 to use the default (100 for 1.10 and below, 256 for 1.11+). WARNING: Setting this incorrectly may cause you to be kicked from the server..
+ ///
+ internal static string Main_Advanced_max_chat_message_length {
+ get {
+ return ResourceManager.GetString("Main.Advanced.max_chat_message_length", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Enable support for joining Minecraft Realms worlds..
///
diff --git a/MinecraftClient/Resources/ConfigComments/ConfigComments.resx b/MinecraftClient/Resources/ConfigComments/ConfigComments.resx
index edbfc7af..454f78de 100644
--- a/MinecraftClient/Resources/ConfigComments/ConfigComments.resx
+++ b/MinecraftClient/Resources/ConfigComments/ConfigComments.resx
@@ -655,6 +655,9 @@ Usage examples: "/tell <mybot> reco Player2", "/connect <serverip> P
Controls the minimum interval (in seconds) between sending each message to the server.
+
+ Override the maximum chat message length. Set to 0 to use the default (100 for 1.10 and below, 256 for 1.11+). WARNING: Setting this incorrectly may cause you to be kicked from the server.
+
Enable support for joining Minecraft Realms worlds.
diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs
index 2b11637e..5dd1f4c5 100644
--- a/MinecraftClient/Settings.cs
+++ b/MinecraftClient/Settings.cs
@@ -422,6 +422,14 @@ namespace MinecraftClient
if (Advanced.MessageCooldown < 0)
Advanced.MessageCooldown = 0;
+ if (Advanced.MaxChatMessageLength < 0)
+ Advanced.MaxChatMessageLength = 0;
+ else if (Advanced.MaxChatMessageLength > 32767)
+ Advanced.MaxChatMessageLength = 32767;
+
+ if (Advanced.MaxChatMessageLength > 0)
+ ConsoleIO.WriteLineFormatted("§e[Settings] MaxChatMessageLength is set to " + Advanced.MaxChatMessageLength + ". Setting this incorrectly may cause you to be kicked from the server.");
+
if (Advanced.TcpTimeout < 1)
Advanced.TcpTimeout = 1;
@@ -529,6 +537,9 @@ namespace MinecraftClient
[TomlInlineComment("$Main.Advanced.message_cooldown$")]
public double MessageCooldown = 1.0;
+ [TomlInlineComment("$Main.Advanced.max_chat_message_length$")]
+ public int MaxChatMessageLength = 0;
+
[TomlInlineComment("$Main.Advanced.bot_owners$")]
public List BotOwners = new() { "Player1", "Player2" };