use of org.spongepowered.common.command.SpongeParameterizedCommand in project SpongeCommon by SpongePowered.
the class SpongeParameterizedCommandRegistrar method register.
@Override
@NonNull
public CommandMapping register(@NonNull final PluginContainer container, final Command.@NonNull Parameterized command, @NonNull final String primaryAlias, @NonNull final String@NonNull ... secondaryAliases) throws CommandFailedRegistrationException {
// Get the builder and the first literal.
final String namespacedCommand = container.metadata().id() + ":" + primaryAlias.toLowerCase(Locale.ROOT);
final ArrayList<String> aliases = new ArrayList<>();
aliases.add(primaryAlias);
aliases.addAll(Arrays.asList(secondaryAliases));
// This will throw an error if there is an issue.
final CommandMapping mapping = this.commandManager().registerAliasWithNamespacing(this, container, namespacedCommand, aliases, null);
this.createNode(mapping, command).forEach(this.commandManager().getDispatcher()::register);
((SpongeParameterizedCommand) command).setCommandManager(this.commandManager());
this.commandMap.put(mapping, command);
return mapping;
}
Aggregations