From ca5db43f70c6e0d1c5d5d8c5458f7902356a5cd8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 28 Apr 2013 10:07:23 +1000 Subject: [PATCH] Don't spew error about long usernames, just disconnect --- .../java/net/md_5/bungee/connection/InitialHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 55e75a10..6e436e23 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 @@ -115,7 +115,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection public void handle(Packet2Handshake handshake) throws Exception { Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" ); - Preconditions.checkArgument( handshake.username.length() <= 16, "Cannot have username longer than 16 characters" ); + if ( handshake.username.length() > 16 ) + { + disconnect( "Cannot have username longer than 16 characters" ); + return; + } int limit = BungeeCord.getInstance().config.getPlayerLimit(); Preconditions.checkState( limit <= 0 || bungee.getPlayers().size() < limit, "Server is full!" );