diff --git a/proxy/src/main/java/net/md_5/bungee/config/Configuration.java b/proxy/src/main/java/net/md_5/bungee/config/Configuration.java index b1b8b816..df744d58 100644 --- a/proxy/src/main/java/net/md_5/bungee/config/Configuration.java +++ b/proxy/src/main/java/net/md_5/bungee/config/Configuration.java @@ -44,6 +44,7 @@ public class Configuration private int playerLimit = -1; private Collection disabledCommands; private int throttle = 4000; + private boolean ipFoward; public void load() { @@ -56,6 +57,7 @@ public class Configuration onlineMode = adapter.getBoolean( "online_mode", onlineMode ); playerLimit = adapter.getInt( "player_limit", playerLimit ); throttle = adapter.getInt( "connection_throttle", throttle ); + ipFoward = adapter.getBoolean( "ip_forward", ipFoward); disabledCommands = new CaseInsensitiveSet( (Collection) adapter.getList( "disabled_commands", Arrays.asList( "find" ) ) ); 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 8190d6c8..1d0145ef 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 @@ -189,6 +189,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection this.vHost = new InetSocketAddress( handshake.getHost(), handshake.getPort() ); bungee.getLogger().log( Level.INFO, "{0} has connected", this ); + if ( BungeeCord.getInstance().config.isIpFoward() ) + { + handshake.setHost( handshake.getHost() + "\00" + getAddress().getHostString() ); + } + bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); switch ( handshake.getRequestedProtocol() )