#3205: Don't forward tab completions if the root command is a bungee command

This commit is contained in:
Frank van der Heijden 2021-11-04 08:45:11 +01:00 committed by GitHub
parent 6613aaea95
commit c3fffbc919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,10 +171,11 @@ public class UpstreamBridge extends PacketHandler
public void handle(TabCompleteRequest tabComplete) throws Exception public void handle(TabCompleteRequest tabComplete) throws Exception
{ {
List<String> suggestions = new ArrayList<>(); List<String> suggestions = new ArrayList<>();
boolean isRegisteredCommand = false;
if ( tabComplete.getCursor().startsWith( "/" ) ) if ( tabComplete.getCursor().startsWith( "/" ) )
{ {
bungee.getPluginManager().dispatchCommand( con, tabComplete.getCursor().substring( 1 ), suggestions ); isRegisteredCommand = bungee.getPluginManager().dispatchCommand( con, tabComplete.getCursor().substring( 1 ), suggestions );
} }
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions ); TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions );
@ -209,6 +210,12 @@ public class UpstreamBridge extends PacketHandler
} }
throw CancelSendSignal.INSTANCE; throw CancelSendSignal.INSTANCE;
} }
// Don't forward tab completions if the command is a registered bungee command
if ( isRegisteredCommand )
{
throw CancelSendSignal.INSTANCE;
}
} }
@Override @Override