[#1567] Let BungeeCord dictate the network compression threshold.
This commit is contained in:
parent
06ad0f9310
commit
4e94c278da
@ -52,6 +52,7 @@ public class Configuration implements ProxyConfig
|
|||||||
private int throttle = 4000;
|
private int throttle = 4000;
|
||||||
private boolean ipForward;
|
private boolean ipForward;
|
||||||
private Favicon favicon;
|
private Favicon favicon;
|
||||||
|
private int compressionThreshold = 256;
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
@ -77,6 +78,7 @@ public class Configuration implements ProxyConfig
|
|||||||
playerLimit = adapter.getInt( "player_limit", playerLimit );
|
playerLimit = adapter.getInt( "player_limit", playerLimit );
|
||||||
throttle = adapter.getInt( "connection_throttle", throttle );
|
throttle = adapter.getInt( "connection_throttle", throttle );
|
||||||
ipForward = adapter.getBoolean( "ip_forward", ipForward );
|
ipForward = adapter.getBoolean( "ip_forward", ipForward );
|
||||||
|
compressionThreshold = adapter.getInt( "network_compression_threshold", compressionThreshold );
|
||||||
|
|
||||||
disabledCommands = new CaseInsensitiveSet( (Collection<String>) adapter.getList( "disabled_commands", Arrays.asList( "disabledcommandhere" ) ) );
|
disabledCommands = new CaseInsensitiveSet( (Collection<String>) adapter.getList( "disabled_commands", Arrays.asList( "disabledcommandhere" ) ) );
|
||||||
|
|
||||||
|
@ -433,7 +433,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
// TODO See #1218
|
// TODO See #1218
|
||||||
oldID.disconnect( bungee.getTranslation( "already_connected" ) );
|
oldID.disconnect( bungee.getTranslation( "already_connected" ) );
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
// In offline mode the existing user stays and we kick the new one
|
// In offline mode the existing user stays and we kick the new one
|
||||||
ProxiedPlayer oldName = bungee.getPlayer( getName() );
|
ProxiedPlayer oldName = bungee.getPlayer( getName() );
|
||||||
if ( oldName != null )
|
if ( oldName != null )
|
||||||
@ -473,6 +474,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
{
|
{
|
||||||
if ( ch.getHandle().isActive() )
|
if ( ch.getHandle().isActive() )
|
||||||
{
|
{
|
||||||
|
UserConnection userCon = new UserConnection( bungee, ch, getName(), InitialHandler.this );
|
||||||
|
userCon.setCompressionThreshold( BungeeCord.getInstance().config.getCompressionThreshold() );
|
||||||
|
userCon.init();
|
||||||
|
|
||||||
if ( getVersion() >= ProtocolConstants.MINECRAFT_1_7_6 )
|
if ( getVersion() >= ProtocolConstants.MINECRAFT_1_7_6 )
|
||||||
{
|
{
|
||||||
unsafe.sendPacket( new LoginSuccess( getUniqueId().toString(), getName() ) ); // With dashes in between
|
unsafe.sendPacket( new LoginSuccess( getUniqueId().toString(), getName() ) ); // With dashes in between
|
||||||
@ -482,9 +487,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
}
|
}
|
||||||
ch.setProtocol( Protocol.GAME );
|
ch.setProtocol( Protocol.GAME );
|
||||||
|
|
||||||
UserConnection userCon = new UserConnection( bungee, ch, getName(), InitialHandler.this );
|
|
||||||
userCon.init();
|
|
||||||
|
|
||||||
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );
|
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new UpstreamBridge( bungee, userCon ) );
|
||||||
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );
|
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );
|
||||||
ServerInfo server;
|
ServerInfo server;
|
||||||
@ -535,7 +537,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (thisState != State.STATUS && thisState != State.PING)
|
if ( thisState != State.STATUS && thisState != State.PING )
|
||||||
{
|
{
|
||||||
unsafe().sendPacket( new Kick( ComponentSerializer.toString( reason ) ) );
|
unsafe().sendPacket( new Kick( ComponentSerializer.toString( reason ) ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user