How to fully unregister a bukkit command and its aliases, and remove it from tabcomplete?

Discussion in 'Plugin Development' started by reyzerm, May 23, 2020.

  1. Offline

    reyzerm

    Hi! Im creating a plugin for spigot. Its intention is to create and delete custom commands while in runtime, by commands. The problem is, I can only register them, and any unregister action is not working or break the server command usage... What Im doing is creating separate classes for BukkitCommands and registering when the plugin is enabled and when the player types a command. So far it works fine. As said before, the problem starts as im unregistering the command.
    Already tried unregistering PluginCommands, but my commands are BukkitCommands so this method does not work? Also tried finding knowncommands, but cmd doesnt seem to recognize. And tried to find a way to remove a single command from a CommandMap, but dont know how. I did unregister a lot of commands clearing the commandmap, but it wont remove commands from TabComplete too.

    How can I unregister a command in a commandmap and its aliases, while also removing it from tabcomplete while in runtime? (Please ask me if you need more information, i will put the codes for my main class, and the command classes if needed)
     
  2. Offline

    caderapee

    @reyzerm
    Loop the values instanceOf Command and check the name of the command.

    If this doesn't work, u may have to listen on playerPreprocessCommandEvent ans block commands name and alias. But that will not block tabComplete
     

Share This Page