Merge branch 'refs/heads/dev' into preview

This commit is contained in:
Nassim Jahnke 2024-06-16 10:19:43 +02:00
commit aa312f7332
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,13 @@ public interface ViaVersionCommand {
*/ */
void registerSubCommand(ViaSubCommand command); void registerSubCommand(ViaSubCommand command);
/**
* Removes a subcommand by name, can be used to unload default subcommands which are not supported
* on the platform.
* @param name Subcommand name
*/
void removeSubCommand(String name);
/** /**
* Check if a subcommand is registered. * Check if a subcommand is registered.
* *

View File

@ -57,6 +57,11 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
commandMap.put(command.name().toLowerCase(Locale.ROOT), command); commandMap.put(command.name().toLowerCase(Locale.ROOT), command);
} }
@Override
public void removeSubCommand(final String name) {
commandMap.remove(name.toLowerCase(Locale.ROOT));
}
@Override @Override
public boolean hasSubCommand(String name) { public boolean hasSubCommand(String name) {
return commandMap.containsKey(name.toLowerCase(Locale.ROOT)); return commandMap.containsKey(name.toLowerCase(Locale.ROOT));