EssentialsX

EssentialsX

2M Downloads

Allow people to completely disable a command

jvdoorn opened this issue ยท 3 comments

commented

Feature request

Feature description:
Currently disabling an essentials command only disables the execution of the command. My suggestion is to change this (or if desired create a new config option) that completely disables the command (aka don't register it). This allows native commands, normally overwritten by Essentials, to support command completion again.

An example of how this currently can be done is by removing the command from plugin.yml in the Essentials source. My feature could possibly be implemented by ignoring the entry in plugin.yml if it has been disabled in the config. I'd be willing to implement this myself if someone points me in the right direction.

How the feature is useful:
The advantage of this feature is that it gives users more fine-grained control over command execution and completion. The advantage of enabling this feature through the config is that people don't have to build Essentials themselves or have to rebuild it when they want to disable/enable a command. If it is implemented using a new config variable then it won't affect current installations, thus users who are used to the old disabling behaviour won't experience any issues.

Related issues:
This is a list of issues that are somewhat related to this issue. They can serve as an example for additional use-cases and I furthermore listed them for easy reference.

#2708
#1458
#2297

commented

Removing commands from plugin.yml and registering them later would risk breaking existing redirection setups

Sorry to re-open an old thread. Why is this true?

commented

You can already do this with commands.yml, which is the intended place to register/disable commands for any plugin.

commented

While this is possible, it would be an unnecessary complication, and I don't believe this will fix issues for many people. EssentialsX already hands over command execution where the current Bukkit API permits, and even if we implemented this, other plugins with their own implementations of commands will continue to override vanilla commands, and aliases to vanilla commands still won't work predictably.

Spigot has had a long-standing open issue to fix tab-complete redirection to command aliases in commands.yml, but they haven't addressed this issue in a long time and don't appear to have any interest in doing so. It may be worth looking into a patch for Spigot or Paper to tab complete aliases to single commands properly, as this is what commands.yml should already do, but I don't think this is something we are looking to work around within EssentialsX at this time.

Edit:

My feature could possibly be implemented by ignoring the entry in plugin.yml if it has been disabled in the config. I'd be willing to implement this myself if someone points me in the right direction.

I don't believe this fixes the issue - Bukkit is what registers the commands from plugin.yml, and plugins only register an executor and tab completer after Bukkit has registered the commands from this file. Removing commands from plugin.yml and registering them later would risk breaking existing redirection setups, so the only way to do this would be to modify the command map after the config has loaded to remove the registration, and there's no guarantee that this would work properly either.