From 71c86f9f904c6cb2af01310868d9c7fcfe6eea52 Mon Sep 17 00:00:00 2001 From: vemacs Date: Fri, 18 Apr 2014 10:12:34 -0600 Subject: [PATCH 1/2] Add ServerIP subchannel --- .../java/net/md_5/bungee/connection/DownstreamBridge.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 b5c3c5ab..a8ec6b25 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,6 +342,13 @@ public class DownstreamBridge extends PacketHandler out.writeUTF( player.getUUID() ); } } + if ( subChannel.equals( "ServerIP" ) ) + { + ServerInfo info = bungee.getServerInfo( in.readUTF() ); + out.writeUTF( "ServerIP" ); + out.writeUTF( info.getAddress().getAddress().getHostAddress() ); + out.writeShort( info.getAddress().getPort() ); + } // Check we haven't set out to null, and we have written data, if so reply back back along the BungeeCord channel if ( out != null ) From e4e01ccb5577ed9e72c62d14e87812cc1f30d686 Mon Sep 17 00:00:00 2001 From: vemacs Date: Sat, 26 Apr 2014 11:24:57 -0600 Subject: [PATCH 2/2] Null check --- .../net/md_5/bungee/connection/DownstreamBridge.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 a8ec6b25..6ae424bc 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 @@ -345,9 +345,12 @@ public class DownstreamBridge extends PacketHandler if ( subChannel.equals( "ServerIP" ) ) { ServerInfo info = bungee.getServerInfo( in.readUTF() ); - out.writeUTF( "ServerIP" ); - out.writeUTF( info.getAddress().getAddress().getHostAddress() ); - out.writeShort( info.getAddress().getPort() ); + if ( info != null ) + { + out.writeUTF( "ServerIP" ); + out.writeUTF( info.getAddress().getAddress().getHostAddress() ); + out.writeShort( info.getAddress().getPort() ); + } } // Check we haven't set out to null, and we have written data, if so reply back back along the BungeeCord channel