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
|
|
@ -19,6 +19,11 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
string response = "";
|
||||
PerformInternalCommand(command, ref response);
|
||||
response = GetVerbatim(response);
|
||||
foreach (char disallowedChar in McClient.GetDisallowedChatCharacters())
|
||||
{
|
||||
response = response.Replace(disallowedChar.ToString(), String.Empty);
|
||||
}
|
||||
if (response.Length > 0)
|
||||
{
|
||||
SendPrivateMessage(sender, response);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue