#2420: Disable forge support by default
This commit is contained in:
parent
fde2c3fadf
commit
e93323ddbc
@ -268,9 +268,14 @@ public class BungeeCord extends ProxyServer
|
||||
pluginManager.loadPlugins();
|
||||
config.load();
|
||||
|
||||
registerChannel( ForgeConstants.FML_TAG );
|
||||
registerChannel( ForgeConstants.FML_HANDSHAKE_TAG );
|
||||
registerChannel( ForgeConstants.FORGE_REGISTER );
|
||||
if ( config.isForgeSupport() )
|
||||
{
|
||||
registerChannel( ForgeConstants.FML_TAG );
|
||||
registerChannel( ForgeConstants.FML_HANDSHAKE_TAG );
|
||||
registerChannel( ForgeConstants.FORGE_REGISTER );
|
||||
|
||||
getLogger().warning( "MinecraftForge support is currently unmaintained and may have unresolved issues. Please use at your own risk." );
|
||||
}
|
||||
|
||||
isRunning = true;
|
||||
|
||||
|
@ -311,47 +311,49 @@ public class ServerConnector extends PacketHandler
|
||||
@Override
|
||||
public void handle(PluginMessage pluginMessage) throws Exception
|
||||
{
|
||||
if ( pluginMessage.getTag().equals( ForgeConstants.FML_REGISTER ) )
|
||||
if ( BungeeCord.getInstance().config.isForgeSupport() )
|
||||
{
|
||||
Set<String> channels = ForgeUtils.readRegisteredChannels( pluginMessage );
|
||||
boolean isForgeServer = false;
|
||||
for ( String channel : channels )
|
||||
if ( pluginMessage.getTag().equals( ForgeConstants.FML_REGISTER ) )
|
||||
{
|
||||
if ( channel.equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
|
||||
Set<String> channels = ForgeUtils.readRegisteredChannels( pluginMessage );
|
||||
boolean isForgeServer = false;
|
||||
for ( String channel : channels )
|
||||
{
|
||||
// If we have a completed handshake and we have been asked to register a FML|HS
|
||||
// packet, let's send the reset packet now. Then, we can continue the message sending.
|
||||
// The handshake will not be complete if we reset this earlier.
|
||||
if ( user.getServer() != null && user.getForgeClientHandler().isHandshakeComplete() )
|
||||
if ( channel.equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
|
||||
{
|
||||
user.getForgeClientHandler().resetHandshake();
|
||||
}
|
||||
// If we have a completed handshake and we have been asked to register a FML|HS
|
||||
// packet, let's send the reset packet now. Then, we can continue the message sending.
|
||||
// The handshake will not be complete if we reset this earlier.
|
||||
if ( user.getServer() != null && user.getForgeClientHandler().isHandshakeComplete() )
|
||||
{
|
||||
user.getForgeClientHandler().resetHandshake();
|
||||
}
|
||||
|
||||
isForgeServer = true;
|
||||
break;
|
||||
isForgeServer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isForgeServer && !this.handshakeHandler.isServerForge() )
|
||||
{
|
||||
// We now set the server-side handshake handler for the client to this.
|
||||
handshakeHandler.setServerAsForgeServer();
|
||||
user.setForgeServerHandler( handshakeHandler );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isForgeServer && !this.handshakeHandler.isServerForge() )
|
||||
if ( pluginMessage.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) || pluginMessage.getTag().equals( ForgeConstants.FORGE_REGISTER ) )
|
||||
{
|
||||
// We now set the server-side handshake handler for the client to this.
|
||||
handshakeHandler.setServerAsForgeServer();
|
||||
user.setForgeServerHandler( handshakeHandler );
|
||||
this.handshakeHandler.handle( pluginMessage );
|
||||
|
||||
// We send the message as part of the handler, so don't send it here.
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pluginMessage.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) || pluginMessage.getTag().equals( ForgeConstants.FORGE_REGISTER ) )
|
||||
{
|
||||
this.handshakeHandler.handle( pluginMessage );
|
||||
|
||||
// We send the message as part of the handler, so don't send it here.
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
} else
|
||||
{
|
||||
// We have to forward these to the user, especially with Forge as stuff might break
|
||||
// This includes any REGISTER messages we intercepted earlier.
|
||||
user.unsafe().sendPacket( pluginMessage );
|
||||
}
|
||||
// We have to forward these to the user, especially with Forge as stuff might break
|
||||
// This includes any REGISTER messages we intercepted earlier.
|
||||
user.unsafe().sendPacket( pluginMessage );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,6 +58,7 @@ public class Configuration implements ProxyConfig
|
||||
private Favicon favicon;
|
||||
private int compressionThreshold = 256;
|
||||
private boolean preventProxyConnections;
|
||||
private boolean forgeSupport;
|
||||
|
||||
public void load()
|
||||
{
|
||||
@ -86,6 +87,7 @@ public class Configuration implements ProxyConfig
|
||||
ipForward = adapter.getBoolean( "ip_forward", ipForward );
|
||||
compressionThreshold = adapter.getInt( "network_compression_threshold", compressionThreshold );
|
||||
preventProxyConnections = adapter.getBoolean( "prevent_proxy_connections", preventProxyConnections );
|
||||
forgeSupport = adapter.getBoolean( "forge_support", forgeSupport );
|
||||
|
||||
disabledCommands = new CaseInsensitiveSet( (Collection<String>) adapter.getList( "disabled_commands", Arrays.asList( "disabledcommandhere" ) ) );
|
||||
|
||||
|
@ -188,25 +188,29 @@ public class UpstreamBridge extends PacketHandler
|
||||
{
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
// Hack around Forge race conditions
|
||||
if ( pluginMessage.getTag().equals( "FML" ) && pluginMessage.getStream().readUnsignedByte() == 1 )
|
||||
{
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
|
||||
// We handle forge handshake messages if forge support is enabled.
|
||||
if ( pluginMessage.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
|
||||
if ( BungeeCord.getInstance().config.isForgeSupport() )
|
||||
{
|
||||
// Let our forge client handler deal with this packet.
|
||||
con.getForgeClientHandler().handle( pluginMessage );
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
// Hack around Forge race conditions
|
||||
if ( pluginMessage.getTag().equals( "FML" ) && pluginMessage.getStream().readUnsignedByte() == 1 )
|
||||
{
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
|
||||
if ( con.getServer() != null && !con.getServer().isForgeServer() && pluginMessage.getData().length > Short.MAX_VALUE )
|
||||
{
|
||||
// Drop the packet if the server is not a Forge server and the message was > 32kiB (as suggested by @jk-5)
|
||||
// Do this AFTER the mod list, so we get that even if the intial server isn't modded.
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
// We handle forge handshake messages if forge support is enabled.
|
||||
if ( pluginMessage.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
|
||||
{
|
||||
// Let our forge client handler deal with this packet.
|
||||
con.getForgeClientHandler().handle( pluginMessage );
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
|
||||
if ( con.getServer() != null && !con.getServer().isForgeServer() && pluginMessage.getData().length > Short.MAX_VALUE )
|
||||
{
|
||||
// Drop the packet if the server is not a Forge server and the message was > 32kiB (as suggested by @jk-5)
|
||||
// Do this AFTER the mod list, so we get that even if the intial server isn't modded.
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
PluginMessageEvent event = new PluginMessageEvent( con, con.getServer(), pluginMessage.getTag(), pluginMessage.getData().clone() );
|
||||
|
Loading…
Reference in New Issue
Block a user