Closed gamerover98 closed 1 year ago
commandFramework.unregister(commandClassInstance);
is fine but the first method you suggested is just useless because the framework is initialized with only one instance so it won't make a difference.
Secondly, org.bukkit.command.Command#unregister
method won't delete the command from server-side. (just want to inform you in this case you won't see unknown command message if you execute the deleted command because all registered commands are stored in a different map object in SimpleCommandMap
class even they're unregistered.)
I'm going to add some new methods tomorrow, thank you for the idea.
Description of the new feature
The current API provides methods to register commands but no one to do the opposite.
Scenario
A plugin that uses CommandFramework is unloaded using a plugin like PlugMan: what happens? Commands still exist in the server.
What to do
Add a new method called
CommandFramework#unregister(...)
that calls theorg.bukkit.command.Command#unregister(CommandMap commandMap)
method.How this should be used
Two ways:
commandFramework.unregister(plugin);
commandFramework.unregister(commandClassInstance);
Looking forward to your feedback and collaboration on this enhancement. Thank you