mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Remove illegal characters in chat messages before sending (#1587)
Sending illegal character will cause server to kick the client. This happens when using remote control to execute some command that contains color output. Message checking applies to remote control only.
This commit is contained in:
parent
b15c3a8e46
commit
3b5488a7bf
2 changed files with 16 additions and 0 deletions
|
|
@ -735,6 +735,15 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of disallowed characters in chat
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static char[] GetDisallowedChatCharacters()
|
||||
{
|
||||
return new char[] { (char)167, (char)127 }; // Minecraft color code and ASCII code DEL
|
||||
}
|
||||
|
||||
#region Management: Load/Unload ChatBots and Enable/Disable settings
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1021,6 +1030,8 @@ namespace MinecraftClient
|
|||
{
|
||||
lock (chatQueue)
|
||||
{
|
||||
if (String.IsNullOrEmpty(text))
|
||||
return;
|
||||
int maxLength = handler.GetMaxChatMessageLength();
|
||||
if (text.Length > maxLength) //Message is too long?
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue