Allow non-PluginCommand's to be unloaded

This commit is contained in:
Frank van der Heijden 2021-03-25 16:29:38 +01:00
parent b51ff445dd
commit b83da96cac
No known key found for this signature in database
GPG key ID: 26DA56488D314D11
2 changed files with 32 additions and 8 deletions

View file

@ -306,6 +306,16 @@ public class BukkitPluginManager extends AbstractPluginManager<Plugin> {
RCraftServer.syncCommands();
}
/**
* Unregisters all specified commands exactly.
* @param commands The commands to unregister.
*/
public static void unregisterExactCommands(Collection<? extends Command> commands) {
Map<String, Command> knownCommands = getKnownCommands();
if (knownCommands == null) return;
knownCommands.values().removeAll(commands);
}
/**
* Retrieves a command from the command map.
* @param command The command string.