mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-06-26 14:35:05 +02:00
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Do note that OSX natives are now compiled for Apple Silicon, Long Live ARM BungeeCord Changes: 6f70b15e Minecraft 1.20.5 support b30499e2 #3667: Bump org.apache.maven.plugins:maven-jar-plugin from 3.4.0 to 3.4.1 5079181c Minecraft 1.20.5-rc3 support ee02d98c Minecraft 1.20.5-rc2 support c7ff3b8a #3654: Update year in README.md de60af0d #3659: Cleanup command packets for 1.20.5 a9218a7a #3660: Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.3 to 3.2.4 67c65e04 #3658: Minecraft 1.20.5-rc1 support 1be25b6c #3656: Improve online mode support where IP forwarding is disabled 8525b449 Minecraft 1.20.5-pre3 support 1fca510a #3655: Fix 1.20.5-pre1 view distance packet ID 33841852 #3652: Bump org.apache.maven.plugins:maven-jar-plugin from 3.3.0 to 3.4.0 3075d2c1 #3651: Bump io.netty:netty-bom from 4.1.108.Final to 4.1.109.Final bc528d5d Update native libraries 25cf8d68 #3617: Don't go further if connection is disconnected during handshake event 17e23d5c #3628: Convert PostLoginEvent to AsyncEvent and expose target server d6c5197c #3599: Bump com.mysql:mysql-connector-j from 8.2.0 to 8.3.0 dd96f0f8 #3647: Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.2 to 3.2.3 8a9501ff Minecraft 1.20.5-pre1 support
106 lines
4.6 KiB
Diff
106 lines
4.6 KiB
Diff
From 6603022d84bbaf4302d6e65fe79282924cbe8679 Mon Sep 17 00:00:00 2001
|
|
From: FivePB <admin@fivepb.me>
|
|
Date: Tue, 16 Nov 2021 21:15:32 +0100
|
|
Subject: [PATCH] Configurable plugin messaging limits
|
|
|
|
This patch makes the maximum number of registered plugin channels as well
|
|
as their name length limit configurable. This is required for some modded
|
|
servers and clients to work
|
|
|
|
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 d69463f0..469fe0e1 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
|
|
@@ -261,4 +261,18 @@ public interface ProxyConfig
|
|
* @return {@code true} if tablist rewriting is disabled, {@code false} otherwise
|
|
*/
|
|
boolean isDisableTabListRewrite();
|
|
+
|
|
+ /**
|
|
+ * Gets the maximum number of registered plugin channels for any connection.
|
|
+ *
|
|
+ * @return the configured limit
|
|
+ */
|
|
+ int getPluginChannelLimit();
|
|
+
|
|
+ /**
|
|
+ * Gets the maximum length for any plugin message channel identifier.
|
|
+ *
|
|
+ * @return the configured limit
|
|
+ */
|
|
+ int getPluginChannelNameLimit();
|
|
}
|
|
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 b88e3c8a..da0efa36 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
|
|
@@ -45,6 +45,23 @@ public class WaterfallConfiguration extends Configuration {
|
|
private boolean disableEntityMetadataRewrite = false;
|
|
private boolean disableTabListRewrite = true;
|
|
|
|
+ /*
|
|
+ * Plugin Message limiting options
|
|
+ * Allows for more control over server-client communication
|
|
+ */
|
|
+
|
|
+ /**
|
|
+ * How many channels there can be between server and player,
|
|
+ * typically used by mods or some plugins.
|
|
+ */
|
|
+ private int pluginChannelLimit = 128;
|
|
+
|
|
+ /**
|
|
+ * How long the maximum channel name can be,
|
|
+ * only reason to change it would be broken mods.
|
|
+ */
|
|
+ private int pluginChannelNameLimit = 128;
|
|
+
|
|
@Override
|
|
public void load() {
|
|
super.load();
|
|
@@ -58,6 +75,8 @@ public class WaterfallConfiguration extends Configuration {
|
|
disableModernTabLimiter = config.getBoolean("disable_modern_tab_limiter", disableModernTabLimiter);
|
|
disableEntityMetadataRewrite = config.getBoolean("disable_entity_metadata_rewrite", disableEntityMetadataRewrite);
|
|
disableTabListRewrite = config.getBoolean("disable_tab_list_rewrite", disableTabListRewrite);
|
|
+ pluginChannelLimit = config.getInt("registered_plugin_channels_limit", pluginChannelLimit);
|
|
+ pluginChannelNameLimit = config.getInt("plugin_channel_name_limit", pluginChannelNameLimit);
|
|
}
|
|
|
|
@Override
|
|
@@ -94,4 +113,14 @@ public class WaterfallConfiguration extends Configuration {
|
|
public boolean isDisableTabListRewrite() {
|
|
return disableTabListRewrite;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public int getPluginChannelLimit() {
|
|
+ return pluginChannelLimit;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getPluginChannelNameLimit() {
|
|
+ return pluginChannelNameLimit;
|
|
+ }
|
|
}
|
|
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 d095e5f9..864cb119 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
|
|
@@ -848,9 +848,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|
|
|
for ( String id : content.split( "\0" ) )
|
|
{
|
|
- Preconditions.checkState( registeredChannels.size() < 128, "Too many registered channels" );
|
|
- Preconditions.checkArgument( id.length() < 128, "Channel name too long" );
|
|
-
|
|
+ // Waterfall start: Add configurable limits for plugin messaging
|
|
+ Preconditions.checkState( !(registeredChannels.size() > bungee.getConfig().getPluginChannelLimit()), "Too many registered channels. This limit can be configured in the waterfall.yml" );
|
|
+ Preconditions.checkArgument( !(id.length() > bungee.getConfig().getPluginChannelNameLimit()), "Channel name too long. This limit can be configured in the waterfall.yml" );
|
|
+ // Waterfall end
|
|
registeredChannels.add( id );
|
|
}
|
|
} else if ( input.getTag().equals( "UNREGISTER" ) || input.getTag().equals( "minecraft:unregister" ) )
|
|
--
|
|
2.44.0
|
|
|