mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-09-30 07:27:28 +02:00
dc0595653d
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 BungeeCord Changes: c92581d0 #3556: Deserialize arrays to single components e442c3da #3546: Add string length checks to isValidName f903c54d #3554: Bump org.apache.maven.plugins:maven-checkstyle-plugin 0d453789 #3540: Add TextComponent#fromLegacy() as an array-free alternative to #fromLegacyText() 0f5f09b6 Minecraft 23w43b support e5c80d00 Fix code formatting 9cdb2ba3 Deprecate exposed scoreboard API d0e5cf7c #3549: Bump io.netty:netty-bom from 4.1.99.Final to 4.1.100.Final c8568764 Fix writing non-compound root NBT tags
106 lines
4.6 KiB
Diff
106 lines
4.6 KiB
Diff
From d4a6ec0de8dc598da0bf5e8025112f62a4c5a26a 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 73aa532e..40ed5ab0 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
|
|
@@ -760,9 +760,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.42.0
|
|
|