From 532a94382bf256754f806b2972d4237e3f64a3b6 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 8 Nov 2014 10:04:59 +1100 Subject: [PATCH] Block really wrong offline mode names, see #1270 --- .../java/net/md_5/bungee/connection/InitialHandler.java | 6 ++++++ proxy/src/main/resources/messages.properties | 1 + 2 files changed, 7 insertions(+) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index 42137ad03..cdf00ecff 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -268,6 +268,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection return; } + if ( getName().contains( "." ) ) + { + disconnect( bungee.getTranslation( "name_invalid" ) ); + return; + } + if ( getName().length() > 16 ) { disconnect( bungee.getTranslation( "name_too_long" ) ); diff --git a/proxy/src/main/resources/messages.properties b/proxy/src/main/resources/messages.properties index c01a052b2..2e613ea2a 100644 --- a/proxy/src/main/resources/messages.properties +++ b/proxy/src/main/resources/messages.properties @@ -21,4 +21,5 @@ server_list=\u00a76You may connect to the following servers at this time: server_went_down=\u00a7cThe server you were previously on went down, you have been connected to the lobby total_players=Total players online: {0} name_too_long=Cannot have username longer than 16 characters +name_invalid=Username contains invalid characters. ping_cannot_connect=\u00a7c[Bungee] Can't connect to server.