Add configurable MaxChatMessageLength to override default limits for older versions

Adds a MaxChatMessageLength config option under [Main.Advanced] that allows
users to override the protocol-defined maximum chat message length. Default is
0 (auto: 100 for MC 1.10 and below, 256 for MC 1.11+). Some servers like
Hypixel support longer messages on older versions, so this lets users set a
custom limit (e.g. 256 on 1.8.9). Includes a warning about potential kicks
if set incorrectly.

Closes #2947

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/39c78e6a-f748-4f41-a905-2f5d27f99eff
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 18:50:01 +00:00
parent f15c000868
commit db5faa22b1
5 changed files with 32 additions and 4 deletions

View file

@ -3636,9 +3636,13 @@ namespace MinecraftClient.Protocol.Handlers
/// Get max length for chat messages
/// </summary>
/// <returns>Max length, in characters</returns>
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;
}
/// <summary>
/// Get the current protocol version.