Add new ip forward method, must be manually enabled

This commit is contained in:
md_5 2013-10-27 12:06:17 +11:00
parent 4dff25f880
commit e1f7b7b126
2 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,7 @@ public class Configuration
private int playerLimit = -1;
private Collection<String> 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<String>) adapter.getList( "disabled_commands", Arrays.asList( "find" ) ) );

View File

@ -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() )