2023-11-04 02:12:26 +01:00
|
|
|
From 754e416935ecdc215c4e049819bf1948c3d22eb1 Mon Sep 17 00:00:00 2001
|
2018-02-08 19:16:08 +01:00
|
|
|
From: Gabriele C <sgdc3.mail@gmail.com>
|
|
|
|
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
|
2020-02-01 16:39:53 +01:00
|
|
|
index 6141128b..e0baca9c 100644
|
2018-02-08 19:16:08 +01:00
|
|
|
--- a/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
|
|
|
+++ b/api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
|
2020-02-01 16:39:53 +01:00
|
|
|
@@ -214,6 +214,13 @@ public interface ProxyConfig
|
2019-03-30 19:01:17 +01:00
|
|
|
// Waterfall Options
|
|
|
|
//
|
2018-02-08 19:16:08 +01:00
|
|
|
|
2018-07-22 18:40:31 +02:00
|
|
|
+ /**
|
2018-02-08 19:16:08 +01:00
|
|
|
+ * Whether we log InitialHandler connections
|
2019-03-30 17:09:06 +01:00
|
|
|
+ *
|
|
|
|
+ * @return whether we log InitialHandler connections
|
2018-02-08 19:16:08 +01:00
|
|
|
+ */
|
|
|
|
+ boolean isLogInitialHandlerConnections();
|
|
|
|
+
|
2018-07-22 18:40:31 +02:00
|
|
|
/**
|
2018-02-08 19:16:08 +01:00
|
|
|
* The supported versions
|
2019-03-30 17:09:06 +01:00
|
|
|
*
|
2018-02-08 19:16:08 +01:00
|
|
|
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
|
2019-03-30 19:01:17 +01:00
|
|
|
index ef44d334..4ff8da6d 100644
|
2018-02-08 19:16:08 +01:00
|
|
|
--- a/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
|
|
|
+++ b/proxy/src/main/java/io/github/waterfallmc/waterfall/conf/WaterfallConfiguration.java
|
2019-03-30 19:01:17 +01:00
|
|
|
@@ -9,6 +9,13 @@ import java.io.File;
|
|
|
|
|
|
|
|
public class WaterfallConfiguration extends Configuration {
|
2018-02-08 19:16:08 +01:00
|
|
|
|
2018-07-22 18:40:31 +02:00
|
|
|
+ /**
|
2018-02-08 19:16:08 +01:00
|
|
|
+ * Whether we log InitialHandler connections
|
|
|
|
+ * <p>
|
|
|
|
+ * Default is true
|
|
|
|
+ */
|
|
|
|
+ private boolean logInitialHandlerConnections = true;
|
|
|
|
+
|
2018-07-22 18:40:31 +02:00
|
|
|
/**
|
2018-02-08 19:16:08 +01:00
|
|
|
* The supported versions displayed to the client
|
2018-07-22 18:40:31 +02:00
|
|
|
* <p>Default is a comma separated list of supported versions. For example 1.8.x, 1.9.x, 1.10.x</p>
|
2019-03-30 19:01:17 +01:00
|
|
|
@@ -40,6 +47,7 @@ public class WaterfallConfiguration extends Configuration {
|
|
|
|
super.load();
|
2018-07-22 18:40:31 +02:00
|
|
|
YamlConfig config = new YamlConfig(new File("waterfall.yml"));
|
2018-02-08 19:16:08 +01:00
|
|
|
config.load(false); // Load, but no permissions
|
|
|
|
+ logInitialHandlerConnections = config.getBoolean( "log_initial_handler_connections", logInitialHandlerConnections );
|
|
|
|
gameVersion = config.getString("game_version", "").isEmpty() ? Joiner.on(", ").join(ProtocolConstants.SUPPORTED_VERSIONS) : config.getString("game_version", "");
|
2018-07-22 18:40:31 +02:00
|
|
|
useNettyDnsResolver = config.getBoolean("use_netty_dns_resolver", useNettyDnsResolver);
|
|
|
|
// Throttling options
|
2019-03-30 19:01:17 +01:00
|
|
|
@@ -47,6 +55,11 @@ public class WaterfallConfiguration extends Configuration {
|
|
|
|
disableModernTabLimiter = config.getBoolean("disable_modern_tab_limiter", disableModernTabLimiter);
|
2018-02-08 19:16:08 +01:00
|
|
|
}
|
2018-07-22 18:40:31 +02:00
|
|
|
|
2018-02-08 19:16:08 +01:00
|
|
|
+ @Override
|
|
|
|
+ public boolean isLogInitialHandlerConnections() {
|
|
|
|
+ return logInitialHandlerConnections;
|
|
|
|
+ }
|
2018-07-22 18:40:31 +02:00
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public String getGameVersion() {
|
|
|
|
return gameVersion;
|
2018-02-08 19:16:08 +01:00
|
|
|
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
|
2023-11-04 02:12:26 +01:00
|
|
|
index bc98b6b1..460a79a1 100644
|
2018-02-08 19:16:08 +01:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
2023-11-04 02:12:26 +01:00
|
|
|
@@ -354,7 +354,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
2018-02-08 19:16:08 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Login
|
2020-01-06 20:43:23 +01:00
|
|
|
- bungee.getLogger().log( Level.INFO, "{0} has connected", this );
|
2018-09-04 04:12:52 +02:00
|
|
|
+ if (BungeeCord.getInstance().getConfig().isLogInitialHandlerConnections() ) // Waterfall
|
2020-01-06 20:43:23 +01:00
|
|
|
+ {
|
|
|
|
+ bungee.getLogger().log( Level.INFO, "{0} has connected", this );
|
|
|
|
+ }
|
|
|
|
thisState = State.USERNAME;
|
|
|
|
ch.setProtocol( Protocol.LOGIN );
|
|
|
|
|
2018-02-08 19:16:08 +01:00
|
|
|
--
|
2023-11-04 02:12:26 +01:00
|
|
|
2.42.1
|
2018-02-08 19:16:08 +01:00
|
|
|
|