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 1a0a2db8..042a8734 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 @@ -193,14 +193,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); - if ( handshake.getProtocolVersion() > bungee.getProtocolVersion() ) - { - disconnect( bungee.getTranslation( "outdated_server" ) ); - } else if ( handshake.getProtocolVersion() < bungee.getProtocolVersion() ) - { - disconnect( bungee.getTranslation( "outdated_client" ) ); - } - switch ( handshake.getRequestedProtocol() ) { case 1: @@ -224,6 +216,16 @@ public class InitialHandler extends PacketHandler implements PendingConnection Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" ); this.loginRequest = loginRequest; + if ( handshake.getProtocolVersion() > bungee.getProtocolVersion() ) + { + disconnect( bungee.getTranslation( "outdated_server" ) ); + return; + } else if ( handshake.getProtocolVersion() < bungee.getProtocolVersion() ) + { + disconnect( bungee.getTranslation( "outdated_client" ) ); + return; + } + if ( getName().length() > 16 ) { disconnect( "Cannot have username longer than 16 characters" );