Remove commands with <plugin>:<cmd> syntax from tab complete


#1

Is there a way to remove commands containing colons from tab complete?

I’ve tried using the event but it doesn’t seem to work when I do /+tab

@EventHandler
    public void onTabComplete(TabCompleteEvent e) {
        e.getCompletions().removeIf((string) -> string.contains(":"));
    }

#2

You need to disable them in spigot.yml, namespaced something or other; Tab completion is handled client side now (with a “ask the server” mode available for commands too), however, spigot added a config option to stop commands with a : in them from being sent to the client


#3

Another thing to add to this, the command itself is not part of the tab complete event.
This event doesn’t fire until the player has finished writing the command out (ex: /fly) and then they hit space… at that point the event fires and things can then be changed and/or cancelled.

I have seen a few posts now regarding tab complete events, and it seems quite common that people are misinterpreting which part of the event is actually handled by the tab complete event.

As electronic boy stated, its handled client side.
All the commands that are available as per permissions for said player, will be sent to the player (client) and is all handled client side. That being said (in spigot.yml):

commands:
  log: true
  tab-complete: 0
  send-namespaced: false

if you set namespaces to false it won’t send commands with a colon, such as “bukkit:command”


#4

Thanks a lot :coffee:


#5

The confusion is caused because it used to be part of the tab completion, shamefully not all are really all that aware of the more technical side of stuff such as following changes in the server/client interaction itself


#6

Gotcha, makes sense now.


#7

:grinning: