mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 14:13:47 +01:00
Make 1.13 command injection normal functionality
This commit is contained in:
parent
28c82238d0
commit
0d6f3ee374
@ -180,13 +180,10 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x1B ),
|
map( ProtocolConstants.MINECRAFT_1_12, 0x1B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x1C )
|
map( ProtocolConstants.MINECRAFT_1_13, 0x1C )
|
||||||
);
|
);
|
||||||
if ( Boolean.getBoolean( "net.md-5.bungee.protocol.register_commands" ) )
|
|
||||||
{
|
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Commands.class,
|
Commands.class,
|
||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x11 )
|
map( ProtocolConstants.MINECRAFT_1_13, 0x11 )
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
KeepAlive.class,
|
KeepAlive.class,
|
||||||
|
@ -61,7 +61,6 @@ public class Configuration implements ProxyConfig
|
|||||||
private int compressionThreshold = 256;
|
private int compressionThreshold = 256;
|
||||||
private boolean preventProxyConnections;
|
private boolean preventProxyConnections;
|
||||||
private boolean forgeSupport;
|
private boolean forgeSupport;
|
||||||
private boolean injectCommands;
|
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
@ -93,11 +92,6 @@ public class Configuration implements ProxyConfig
|
|||||||
compressionThreshold = adapter.getInt( "network_compression_threshold", compressionThreshold );
|
compressionThreshold = adapter.getInt( "network_compression_threshold", compressionThreshold );
|
||||||
preventProxyConnections = adapter.getBoolean( "prevent_proxy_connections", preventProxyConnections );
|
preventProxyConnections = adapter.getBoolean( "prevent_proxy_connections", preventProxyConnections );
|
||||||
forgeSupport = adapter.getBoolean( "forge_support", forgeSupport );
|
forgeSupport = adapter.getBoolean( "forge_support", forgeSupport );
|
||||||
injectCommands = adapter.getBoolean( "inject_commands", injectCommands );
|
|
||||||
if ( injectCommands )
|
|
||||||
{
|
|
||||||
System.setProperty( "net.md-5.bungee.protocol.register_commands", "true" );
|
|
||||||
}
|
|
||||||
|
|
||||||
disabledCommands = new CaseInsensitiveSet( (Collection<String>) adapter.getList( "disabled_commands", Arrays.asList( "disabledcommandhere" ) ) );
|
disabledCommands = new CaseInsensitiveSet( (Collection<String>) adapter.getList( "disabled_commands", Arrays.asList( "disabledcommandhere" ) ) );
|
||||||
|
|
||||||
|
@ -575,8 +575,6 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
{
|
{
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
|
|
||||||
if ( BungeeCord.getInstance().config.isInjectCommands() )
|
|
||||||
{
|
|
||||||
for ( Map.Entry<String, Command> command : bungee.getPluginManager().getCommands() )
|
for ( Map.Entry<String, Command> command : bungee.getPluginManager().getCommands() )
|
||||||
{
|
{
|
||||||
if ( !bungee.getDisabledCommands().contains( command.getKey() ) && commands.getRoot().getChild( command.getKey() ) == null && command.getValue().hasPermission( con ) )
|
if ( !bungee.getDisabledCommands().contains( command.getKey() ) && commands.getRoot().getChild( command.getKey() ) == null && command.getValue().hasPermission( con ) )
|
||||||
@ -590,7 +588,6 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( modified )
|
if ( modified )
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ public class UpstreamBridge extends PacketHandler
|
|||||||
if ( con.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_13 )
|
if ( con.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_13 )
|
||||||
{
|
{
|
||||||
con.unsafe().sendPacket( new TabCompleteResponse( results ) );
|
con.unsafe().sendPacket( new TabCompleteResponse( results ) );
|
||||||
} else if ( BungeeCord.getInstance().config.isInjectCommands() )
|
} else
|
||||||
{
|
{
|
||||||
int start = tabComplete.getCursor().lastIndexOf( ' ' ) + 1;
|
int start = tabComplete.getCursor().lastIndexOf( ' ' ) + 1;
|
||||||
int end = tabComplete.getCursor().length();
|
int end = tabComplete.getCursor().length();
|
||||||
|
Loading…
Reference in New Issue
Block a user