#2494: Add an option to disable pings in log

This commit is contained in:
NayXegp 2018-07-30 00:43:11 +02:00 committed by md_5
parent 16b3490576
commit ba0739798a
2 changed files with 10 additions and 1 deletions

View File

@ -51,6 +51,7 @@ public class Configuration implements ProxyConfig
* Whether we log proxy commands to the proxy log * Whether we log proxy commands to the proxy log
*/ */
private boolean logCommands; private boolean logCommands;
private boolean logPings = true;
private int playerLimit = -1; private int playerLimit = -1;
private Collection<String> disabledCommands; private Collection<String> disabledCommands;
private int throttle = 4000; private int throttle = 4000;
@ -82,6 +83,7 @@ public class Configuration implements ProxyConfig
uuid = adapter.getString( "stats", uuid ); uuid = adapter.getString( "stats", uuid );
onlineMode = adapter.getBoolean( "online_mode", onlineMode ); onlineMode = adapter.getBoolean( "online_mode", onlineMode );
logCommands = adapter.getBoolean( "log_commands", logCommands ); logCommands = adapter.getBoolean( "log_commands", logCommands );
logPings = adapter.getBoolean( "log_pings", logPings );
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 );

View File

@ -293,7 +293,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
} }
this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() ); this.virtualHost = InetSocketAddress.createUnresolved( handshake.getHost(), handshake.getPort() );
bungee.getLogger().log( Level.INFO, "{0} has connected", this ); if ( bungee.getConfig().isLogPings() )
{
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
}
bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) ); bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) );
@ -306,6 +309,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
break; break;
case 2: case 2:
// Login // Login
if ( !bungee.getConfig().isLogPings() )
{
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
}
thisState = State.USERNAME; thisState = State.USERNAME;
ch.setProtocol( Protocol.LOGIN ); ch.setProtocol( Protocol.LOGIN );