From 1d751eb0877660a7b1727d2792e6eba1de5fae3c Mon Sep 17 00:00:00 2001 From: johnfriedrich Date: Sun, 12 Dec 2021 21:26:13 +0100 Subject: [PATCH] Add channel limit config --- proxy/src/main/java/net/md_5/bungee/conf/Configuration.java | 2 ++ .../main/java/net/md_5/bungee/connection/InitialHandler.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java index fffa145bb5..7b91be085f 100644 --- a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java +++ b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java @@ -66,6 +66,7 @@ public class Configuration implements ProxyConfig private boolean alwaysHandlePackets = false; private boolean preventProxyConnections; private boolean forgeSupport; + private int pluginChannelLimit = 128; public void load() { @@ -102,6 +103,7 @@ public void load() alwaysHandlePackets = adapter.getBoolean( "always_handle_packets", false ); preventProxyConnections = adapter.getBoolean( "prevent_proxy_connections", preventProxyConnections ); forgeSupport = adapter.getBoolean( "forge_support", forgeSupport ); + pluginChannelLimit = adapter.getInt( "registered_plugin_channels_limit", pluginChannelLimit ); disabledCommands = new CaseInsensitiveSet( (Collection) adapter.getList( "disabled_commands", Arrays.asList( "disabledcommandhere" ) ) ); 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 693b0c596e..a45ac49312 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 @@ -677,7 +677,7 @@ public void relayMessage(PluginMessage input) throws Exception for ( String id : content.split( "\0" ) ) { - Preconditions.checkState( registeredChannels.size() < 128, "Too many registered channels" ); + Preconditions.checkState( registeredChannels.size() < bungee.getConfig().getPluginChannelLimit(), "Too many registered channels" ); Preconditions.checkArgument( id.length() < 128, "Channel name too long" ); registeredChannels.add( id );