From 3bf13e6dba6635d27a61b17729affe9a81edc7ec Mon Sep 17 00:00:00 2001 From: Troy Frew Date: Fri, 1 Jul 2016 00:28:19 -0500 Subject: [PATCH] Configurable server version in ping patch (#45) --- ...able-server-version-in-ping-response.patch | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 BungeeCord-Patches/0040-Configurable-server-version-in-ping-response.patch diff --git a/BungeeCord-Patches/0040-Configurable-server-version-in-ping-response.patch b/BungeeCord-Patches/0040-Configurable-server-version-in-ping-response.patch new file mode 100644 index 0000000..b0df6c3 --- /dev/null +++ b/BungeeCord-Patches/0040-Configurable-server-version-in-ping-response.patch @@ -0,0 +1,76 @@ +From 1bd07f8815ec9d4435b66a2fe8ad5489c7491fb7 Mon Sep 17 00:00:00 2001 +From: Troy Frew +Date: Wed, 29 Jun 2016 13:56:57 -0500 +Subject: [PATCH] Configurable server version in ping response + + +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 f04e2bf..a443614 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(); + ++ /** ++ * The supported versions ++ */ ++ String getGameVersion(); ++ + // Throttling options + + /** +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 114961d..7c84fea 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 +@@ -5,8 +5,11 @@ import lombok.*; + + import java.io.File; + ++import com.google.common.base.Joiner; ++ + import net.md_5.bungee.conf.Configuration; + import net.md_5.bungee.conf.YamlConfig; ++import net.md_5.bungee.protocol.ProtocolConstants; + + public class WaterfallConfiguration extends Configuration { + +@@ -24,6 +27,13 @@ public class WaterfallConfiguration extends Configuration { + */ + private boolean logServerListPing = false; + ++ /** ++ * 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

++ */ ++ @Getter ++ private String gameVersion; ++ + /* + * Throttling options + * Helps prevent players from overloading the servers behind us +@@ -46,6 +56,7 @@ public class WaterfallConfiguration extends Configuration { + logServerListPing = config.getBoolean( "log_server_list_ping", logServerListPing ); + // 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", ""); + } + + @Override +diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +index 92ea9b5..b1b959d 100644 +--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java ++++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +@@ -608,7 +608,7 @@ public class BungeeCord extends ProxyServer + @Override + public String getGameVersion() + { +- return Joiner.on( ", " ).join( ProtocolConstants.SUPPORTED_VERSIONS ); ++ return getConfig().getGameVersion(); // Waterfall + } + + @Override +-- +2.7.4 (Apple Git-66) +