#3133: Directly disconnect on illegal chars

This commit is contained in:
Outfluencer 2021-06-26 10:08:18 +10:00 committed by md_5
parent f9583a7652
commit 15b39887c5
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
2 changed files with 7 additions and 1 deletions

View File

@ -147,7 +147,12 @@ public class UpstreamBridge extends PacketHandler
for ( int index = 0, length = chat.getMessage().length(); index < length; index++ )
{
char c = chat.getMessage().charAt( index );
Preconditions.checkArgument( c != '\u00A7' && c >= ' ' && c != 127, "illegal characters in chat" ); // Section symbol, control sequences, and delete
// Section symbol, control sequences, and delete
if ( c == '\u00A7' || c < ' ' || c == 127 )
{
con.disconnect( bungee.getTranslation( "illegal_chat_characters", String.format( "\\u%04x", (int) c ) ) );
throw CancelSendSignal.INSTANCE;
}
}
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() );

View File

@ -39,3 +39,4 @@ you_got_summoned=\u00a76Summoned to {0} by {1}
command_perms_groups=\u00a76You have the following groups: {0}
command_perms_permission=\u00a79- {0}
command_ip=\u00a79IP of {0} is {1}
illegal_chat_characters=\u00a7cillegal characters in chat ({0})