SpongeAPI icon indicating copy to clipboard operation
SpongeAPI copied to clipboard

Unregister an existing command registration

Open A248 opened this issue 3 years ago • 0 comments

Major SpongeAPI version

9

Is this likely to be a breaking change?

No

What are you requesting?

The ability to unregister a command at any time after registration. I suppose a method such as CommandRegistrar#unregister(CommandMapping) would be suitable; the exact API is of course open for discussion.

The motivation is to support plugins which dynamically register certain commands, and might wish to unregister some commands if their configuration has changed. The most compelling example is an alias plugin, the sort of plugin whose purpose it is to define command aliases. An alias plugin would need to unregister previously-configured aliases after its configuration is reloaded.

Command registration occurs during the CommandRegisterEvent. Unregistration should ideally be possible at any arbitrary time thereafter.

A248 avatar Jul 22 '22 21:07 A248