From 4c55f25c9ca27c71a4d4e7e6788d5d71c459dca8 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Thu, 8 Feb 2018 19:16:08 +0100 Subject: [PATCH] Optionally log InitialHandler connections (#206) --- ...nally-log-InitialHandler-connections.patch | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 BungeeCord-Patches/0046-Optionally-log-InitialHandler-connections.patch diff --git a/BungeeCord-Patches/0046-Optionally-log-InitialHandler-connections.patch b/BungeeCord-Patches/0046-Optionally-log-InitialHandler-connections.patch new file mode 100644 index 0000000..3511cdd --- /dev/null +++ b/BungeeCord-Patches/0046-Optionally-log-InitialHandler-connections.patch @@ -0,0 +1,76 @@ +From 376a7248540252d37977f324e15bd394dc67825b Mon Sep 17 00:00:00 2001 +From: Gabriele C +Date: Thu, 8 Feb 2018 19:10:52 +0100 +Subject: [PATCH] Optionally log InitialHandler connections + + +diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java +index 43519ce1..2631d6bb 100644 +--- a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java ++++ b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java +@@ -168,6 +168,11 @@ public interface ProxyConfig + */ + boolean isLogServerListPing(); + ++ /** ++ * Whether we log InitialHandler connections ++ */ ++ boolean isLogInitialHandlerConnections(); ++ + /** + * The supported versions + */ +diff --git a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java +index 7dc3c2d9..5ba15771 100644 +--- a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java ++++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java +@@ -26,6 +26,13 @@ public class WaterfallConfiguration extends Configuration { + */ + private boolean logServerListPing = false; + ++ /** ++ * Whether we log InitialHandler connections ++ *

++ * Default is true ++ */ ++ private boolean logInitialHandlerConnections = true; ++ + /** + * The supported versions displayed to the client + *

Default is a comma seperated list of supported versions. For example 1.8.x, 1.9.x, 1.10.x

+@@ -60,6 +67,7 @@ public class WaterfallConfiguration extends Configuration { + config.load(false); // Load, but no permissions + metrics = config.getBoolean("metrics", metrics); + logServerListPing = config.getBoolean( "log_server_list_ping", logServerListPing ); ++ logInitialHandlerConnections = config.getBoolean( "log_initial_handler_connections", logInitialHandlerConnections ); + // Throttling options + tabThrottle = config.getInt("throttling.tab_complete", tabThrottle); + gameVersion = config.getString("game_version", "").isEmpty() ? Joiner.on(", ").join(ProtocolConstants.SUPPORTED_VERSIONS) : config.getString("game_version", ""); +@@ -80,4 +88,9 @@ public class WaterfallConfiguration extends Configuration { + public boolean isLogServerListPing() { + return logServerListPing; + } ++ ++ @Override ++ public boolean isLogInitialHandlerConnections() { ++ return logInitialHandlerConnections; ++ } + } +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 c7a4bd2a..10f6001b 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 +@@ -300,7 +300,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection + break; + case 2: + // Login +- bungee.getLogger().log( Level.INFO, "{0} has connected", this ); ++ if (BungeeCord.getInstance().getConfig().isLogInitialHandlerConnections()) { ++ bungee.getLogger().log( Level.INFO, "{0} has connected", this ); ++ } + thisState = State.USERNAME; + ch.setProtocol( Protocol.LOGIN ); + +-- +2.16.1 +