From 8e390b57147c7f569f71a5709bb7da81c77f07b7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 5 Nov 2013 18:16:33 +1100 Subject: [PATCH] Proper replacement for #701, closes #691 --- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 7 ++++++- .../java/net/md_5/bungee/connection/DownstreamBridge.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 436051c3..ae028983 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -255,11 +255,16 @@ public final class UserConnection implements ProxiedPlayer @Override public synchronized void disconnect(String reason) + { + disconnect0( Util.stupify( reason ) ); + } + + public synchronized void disconnect0(String reason) { if ( ch.getHandle().isActive() ) { bungee.getLogger().log( Level.INFO, "[" + getName() + "] disconnected with: " + reason ); - unsafe().sendPacket( new Kick( Util.stupify( reason ) ) ); + unsafe().sendPacket( new Kick(reason) ); ch.close(); if ( server != null ) { diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index 25f73c30..41a6e16a 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -342,7 +342,7 @@ public class DownstreamBridge extends PacketHandler con.connectNow( event.getCancelServer() ); } else { - con.disconnect( bungee.getTranslation( "server_kick" ) + event.getKickReason() ); + con.disconnect0( "[" + Util.stupify( bungee.getTranslation( "server_kick" ) ) + "," + event.getKickReason() + "]" ); // TODO: Json concat util method } server.setObsolete( true ); throw new CancelSendSignal();