Search in sources :

Example 1 with CommandMapping

use of org.spongepowered.api.command.manager.CommandMapping in project SpongeCommon by SpongePowered.

the class SpongeCommandDispatcher method getCompletionSuggestions.

@Override
public CompletableFuture<Suggestions> getCompletionSuggestions(final ParseResults<CommandSourceStack> parse, final int cursor) {
    final CommandContextBuilder<CommandSourceStack> context = parse.getContext();
    // Sponge Start - redirect if this actually represents a non-Brig command
    final CommandContextBuilder<CommandSourceStack> child = context.getLastChild();
    if (child instanceof SpongeCommandContextBuilder) {
        final SpongeCommandContextBuilder spongeChild = (SpongeCommandContextBuilder) child;
        if (((SpongeCommandContextBuilder) child).representsNonBrigCommand()) {
            // special handling!
            final String rawCommand = parse.getReader().getString();
            final String[] command = spongeChild.nonBrigCommand();
            // we know this will exist.
            final CommandMapping mapping = this.commandManager.commandMapping(command[0]).get();
            return CommandUtil.createSuggestionsForRawCommand(rawCommand, spongeChild.nonBrigCommand(), spongeChild.cause(), mapping).buildFuture();
        }
    }
    // Sponge End
    final SuggestionContext<CommandSourceStack> nodeBeforeCursor = context.findSuggestionContext(cursor);
    final CommandNode<CommandSourceStack> parent = nodeBeforeCursor.parent;
    final int start = Math.min(nodeBeforeCursor.startPos, cursor);
    final String fullInput = parse.getReader().getString();
    final String truncatedInput = fullInput.substring(0, cursor);
    // Sponge Start: the collection might be different.
    final Collection<CommandNode<CommandSourceStack>> children;
    if (parent instanceof SpongeNode) {
        children = ((SpongeNode) parent).getChildrenForSuggestions();
    } else {
        children = parent.getChildren();
    }
    // @SuppressWarnings("unchecked") final CompletableFuture<Suggestions>[] futures = new CompletableFuture[parent.getChildren().size()];
    @SuppressWarnings("unchecked") final CompletableFuture<Suggestions>[] futures = new CompletableFuture[children.size()];
    // Sponge End
    int i = 0;
    for (final CommandNode<CommandSourceStack> node : children) {
        // Sponge: parent.getChildren() -> children
        CompletableFuture<Suggestions> future = Suggestions.empty();
        try {
            future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, start));
        } catch (final CommandSyntaxException ignored) {
        }
        futures[i++] = future;
    }
    // See https://github.com/Mojang/brigadier/pull/81
    return CompletableFuture.allOf(futures).handle((voidResult, exception) -> {
        final List<Suggestions> suggestions = new ArrayList<>();
        for (final CompletableFuture<Suggestions> future : futures) {
            if (!future.isCompletedExceptionally()) {
                suggestions.add(future.join());
            }
        }
        return Suggestions.merge(fullInput, suggestions);
    });
// Sponge End
}
Also used : LiteralCommandNode(com.mojang.brigadier.tree.LiteralCommandNode) DummyCommandNode(org.spongepowered.common.command.brigadier.tree.DummyCommandNode) SpongeRootCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeRootCommandNode) RootCommandNode(com.mojang.brigadier.tree.RootCommandNode) SpongeArgumentCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeArgumentCommandNode) CommandNode(com.mojang.brigadier.tree.CommandNode) ArrayList(java.util.ArrayList) CommandSourceStack(net.minecraft.commands.CommandSourceStack) SpongeCommandContextBuilder(org.spongepowered.common.command.brigadier.context.SpongeCommandContextBuilder) Suggestions(com.mojang.brigadier.suggestion.Suggestions) CompletableFuture(java.util.concurrent.CompletableFuture) CommandMapping(org.spongepowered.api.command.manager.CommandMapping) SpongeNode(org.spongepowered.common.command.brigadier.tree.SpongeNode) SuggestionsBuilder(com.mojang.brigadier.suggestion.SuggestionsBuilder) SpongeCommandSyntaxException(org.spongepowered.common.command.exception.SpongeCommandSyntaxException) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException)

Example 2 with CommandMapping

use of org.spongepowered.api.command.manager.CommandMapping in project SpongeCommon by SpongePowered.

the class ServerGamePacketListenerImplMixin method impl$getSuggestionsFromNonBrigCommand.

@Inject(method = "handleCustomCommandSuggestions", at = @At(value = "NEW", target = "com/mojang/brigadier/StringReader", remap = false), cancellable = true)
private void impl$getSuggestionsFromNonBrigCommand(final ServerboundCommandSuggestionPacket packet, final CallbackInfo ci) {
    final String rawCommand = packet.getCommand();
    final String[] command = CommandUtil.extractCommandString(rawCommand);
    final CommandCause cause = CommandCause.create();
    final SpongeCommandManager manager = SpongeCommandManager.get(this.server);
    if (!rawCommand.contains(" ")) {
        final SuggestionsBuilder builder = new SuggestionsBuilder(command[0], 0);
        if (command[0].isEmpty()) {
            manager.getAliasesForCause(cause).forEach(builder::suggest);
        } else {
            manager.getAliasesThatStartWithForCause(cause, command[0]).forEach(builder::suggest);
        }
        this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.build()));
        ci.cancel();
    } else {
        final Optional<CommandMapping> mappingOptional = manager.commandMapping(command[0].toLowerCase(Locale.ROOT)).filter(x -> !(x.registrar() instanceof BrigadierBasedRegistrar));
        if (mappingOptional.isPresent()) {
            final CommandMapping mapping = mappingOptional.get();
            if (mapping.registrar().canExecute(cause, mapping)) {
                final SuggestionsBuilder builder = CommandUtil.createSuggestionsForRawCommand(rawCommand, command, cause, mapping);
                this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.build()));
            } else {
                this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), Suggestions.empty().join()));
            }
            ci.cancel();
        }
    }
}
Also used : CommandMapping(org.spongepowered.api.command.manager.CommandMapping) SpongeCommandManager(org.spongepowered.common.command.manager.SpongeCommandManager) CommandCause(org.spongepowered.api.command.CommandCause) SuggestionsBuilder(com.mojang.brigadier.suggestion.SuggestionsBuilder) ClientboundCommandSuggestionsPacket(net.minecraft.network.protocol.game.ClientboundCommandSuggestionsPacket) BrigadierBasedRegistrar(org.spongepowered.common.command.registrar.BrigadierBasedRegistrar) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with CommandMapping

use of org.spongepowered.api.command.manager.CommandMapping 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;
}
Also used : CommandMapping(org.spongepowered.api.command.manager.CommandMapping) SpongeParameterizedCommand(org.spongepowered.common.command.SpongeParameterizedCommand) ArrayList(java.util.ArrayList) NonNull(org.checkerframework.checker.nullness.qual.NonNull)

Example 4 with CommandMapping

use of org.spongepowered.api.command.manager.CommandMapping in project SpongeCommon by SpongePowered.

the class SpongeCommandDispatcher method parseNodes.

private ParseResults<CommandSourceStack> parseNodes(// Sponge: used in permission checks
final boolean isRoot, // Sponge: needed for handling what we do with defaults.
final boolean isSuggestion, final CommandNode<CommandSourceStack> node, final SpongeStringReader originalReader, final SpongeCommandContextBuilder contextSoFar) {
    final CommandSourceStack source = contextSoFar.getSource();
    // Sponge Start
    Map<CommandNode<CommandSourceStack>, CommandSyntaxException> errors = null;
    List<ParseResults<CommandSourceStack>> potentials = null;
    // Sponge End
    final int cursor = originalReader.getCursor();
    // Sponge Start: get relevant nodes if we're completing
    final Collection<? extends CommandNode<CommandSourceStack>> nodes;
    if (isSuggestion && node instanceof SpongeNode) {
        nodes = ((SpongeNode) node).getRelevantNodesForSuggestions(originalReader);
    } else if (originalReader.canRead()) {
        nodes = node.getRelevantNodes(originalReader);
    } else {
        // Reader cannot read anymore so ONLY nodes with parsers that do not read can be processed
        nodes = node.getChildren().stream().filter(n -> n instanceof SpongeArgumentCommandNode && (((SpongeArgumentCommandNode<?>) n).getParser().doesNotRead())).collect(Collectors.toList());
    }
    for (final CommandNode<CommandSourceStack> child : nodes) {
        final boolean doesNotRead = child instanceof SpongeArgumentCommandNode && ((SpongeArgumentCommandNode<?>) child).getParser().doesNotRead();
        // if (!child.canUse(source)) {
        if (!SpongeNodePermissionCache.canUse(isRoot, this, child, source)) {
            // Sponge End
            continue;
        }
        // Sponge Start
        final SpongeCommandContextBuilder context = contextSoFar.copy();
        final SpongeStringReader reader = new SpongeStringReader(originalReader);
        // Sponge End
        try {
            try {
                child.parse(reader, context);
            } catch (final RuntimeException ex) {
                throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherParseException().createWithContext(reader, ex.getMessage());
            }
            // Sponge Start: if we didn't consume anything we don't want Brig to complain at us.
            if (reader.getCursor() == cursor) {
                // of suggestions.
                if (isSuggestion && !reader.canRead()) {
                    throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherExpectedArgumentSeparator().createWithContext(reader);
                }
                reader.unskipWhitespace();
            } else if (reader.canRead()) {
                // Sponge End
                if (reader.peek() != CommandDispatcher.ARGUMENT_SEPARATOR_CHAR) {
                    throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherExpectedArgumentSeparator().createWithContext(reader);
                }
            }
        } catch (final CommandSyntaxException ex) {
            if (errors == null) {
                errors = new LinkedHashMap<>();
            }
            errors.put(child, ex);
            reader.setCursor(cursor);
            continue;
        }
        context.withCommand(child.getCommand());
        // must let it do so.
        if (this.shouldContinueTraversing(reader, child)) {
            // if (reader.canRead(child.getRedirect() == null ? 2 : 1)) {
            // Sponge End
            reader.skip();
            // Sponge Start: redirect is now in a local variable as we use it a fair bit
            final CommandNode<CommandSourceStack> redirect = child.getRedirect();
            if (redirect != null) {
                // If we've redirected to the root node, we may need to head back to our command
                // manager - so we should check to see if that's going to actually be the case.
                final boolean redirectingToRoot = redirect == this.getRoot();
                final SpongeCommandContextBuilder childContext = new SpongeCommandContextBuilder(this, source, child.getRedirect(), reader.getCursor());
                // For a redirect, we want to ensure all of our currently parsed information is available.
                context.applySpongeElementsTo(childContext, false);
                ParseResults<CommandSourceStack> parse = null;
                if (redirectingToRoot) {
                    // check to see if we can get an element
                    final ArgumentReader.Immutable snapshot = reader.immutable();
                    try {
                        final String commandToAttempt = reader.peekString();
                        final int offset = reader.cursor();
                        if (redirect.getChild(commandToAttempt) == null) {
                            // The redirect fails, so we intercept here, and reroute to our command
                            // manager with the rest of the string and the new context.
                            reader.parseString();
                            final boolean hasMore = reader.canRead();
                            reader.skipWhitespace();
                            final Optional<CommandMapping> optionalMapping = this.commandManager.commandMapping(commandToAttempt);
                            if (optionalMapping.isPresent()) {
                                final CommandMapping mapping = optionalMapping.get();
                                final String remaining = reader.remaining();
                                childContext.withCommand(commandContext -> {
                                    final SpongeCommandContext spongeContext = (SpongeCommandContext) commandContext;
                                    try {
                                        return mapping.registrar().process(spongeContext.cause(), mapping, commandToAttempt, remaining).result();
                                    } catch (final CommandException e) {
                                        throw new SpongeCommandSyntaxException(e, spongeContext);
                                    }
                                });
                                childContext.withNode(new DummyCommandNode(childContext.getCommand()), StringRange.between(offset, reader.totalLength()));
                                childContext.setNonBrigCommand(hasMore ? new String[] { commandToAttempt, remaining } : new String[] { commandToAttempt });
                                reader.setCursor(reader.totalLength());
                                parse = new ParseResults<>(childContext, reader, Collections.emptyMap());
                            } else {
                                // We'll just let this parser fail as normal.
                                reader.setState(snapshot);
                            }
                        }
                    } catch (final ArgumentParseException ignored) {
                        // ignore it, it'll handle it later.
                        reader.setState(snapshot);
                    }
                }
                if (parse == null) {
                    parse = this.parseNodes(redirect instanceof RootCommandNode, isSuggestion, child.getRedirect(), reader, childContext);
                }
                // It worked out, so let's apply it back. We clear and reapply, it's simpler than comparing and conditional adding.
                childContext.applySpongeElementsTo(context, true);
                // Sponge End
                context.withChild(parse.getContext());
                final ParseResults<CommandSourceStack> parse2 = new ParseResults<>(context, parse.getReader(), parse.getExceptions());
                if (doesNotRead && potentials != null) {
                    // If this is a optional or default parameter we only add the redirect as a potential option
                    potentials.add(parse2);
                    continue;
                }
                return parse2;
            } else {
                final ParseResults<CommandSourceStack> parse = this.parseNodes(false, isSuggestion, child, reader, context);
                if (potentials == null) {
                    potentials = new ArrayList<>(1);
                }
                potentials.add(parse);
            }
        } else {
            if (potentials == null) {
                potentials = new ArrayList<>(1);
            }
            potentials.add(new ParseResults<>(context, reader, Collections.emptyMap()));
        }
    }
    if (potentials != null) {
        if (potentials.size() > 1) {
            potentials.sort((a, b) -> {
                if (!a.getReader().canRead() && b.getReader().canRead()) {
                    return -1;
                }
                if (a.getReader().canRead() && !b.getReader().canRead()) {
                    return 1;
                }
                if (a.getExceptions().isEmpty() && !b.getExceptions().isEmpty()) {
                    return -1;
                }
                if (!a.getExceptions().isEmpty() && b.getExceptions().isEmpty()) {
                    return 1;
                }
                // If we get here both potentials parsed everything and there was no exception
                // BUT if parsing stopped at a non-terminal node this will cause an error later
                // see at the end of #execute() where !foundCommand
                // Instead we attempt to sort commands before that happens
                final Command<CommandSourceStack> aCommand = SpongeCommandDispatcher.getCommand(a.getContext());
                final Command<CommandSourceStack> bCommand = SpongeCommandDispatcher.getCommand(b.getContext());
                if (aCommand == null && bCommand != null) {
                    return 1;
                } else if (aCommand != null && bCommand == null) {
                    return -1;
                }
                return 0;
            });
        }
        return potentials.get(0);
    }
    return new ParseResults<>(contextSoFar, originalReader, errors == null ? Collections.emptyMap() : errors);
}
Also used : LiteralCommandNode(com.mojang.brigadier.tree.LiteralCommandNode) CommandDispatcher(com.mojang.brigadier.CommandDispatcher) EventContextKeys(org.spongepowered.api.event.EventContextKeys) CommandSourceStack(net.minecraft.commands.CommandSourceStack) Command(com.mojang.brigadier.Command) CommandContextBuilder(com.mojang.brigadier.context.CommandContextBuilder) CompletableFuture(java.util.concurrent.CompletableFuture) SpongeAdventure(org.spongepowered.common.adventure.SpongeAdventure) RedirectModifier(com.mojang.brigadier.RedirectModifier) SuggestionContext(com.mojang.brigadier.context.SuggestionContext) SpongeCommandContextBuilder(org.spongepowered.common.command.brigadier.context.SpongeCommandContextBuilder) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) CommandSourceStackBridge(org.spongepowered.common.bridge.commands.CommandSourceStackBridge) Map(java.util.Map) DummyCommandNode(org.spongepowered.common.command.brigadier.tree.DummyCommandNode) StringReader(com.mojang.brigadier.StringReader) SpongeRootCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeRootCommandNode) CauseStackManager(org.spongepowered.api.event.CauseStackManager) SuggestionsBuilder(com.mojang.brigadier.suggestion.SuggestionsBuilder) RootCommandNode(com.mojang.brigadier.tree.RootCommandNode) SpongeCommandSyntaxException(org.spongepowered.common.command.exception.SpongeCommandSyntaxException) Suggestions(com.mojang.brigadier.suggestion.Suggestions) CommandContext(com.mojang.brigadier.context.CommandContext) CommandUtil(org.spongepowered.common.util.CommandUtil) Collection(java.util.Collection) ArgumentReader(org.spongepowered.api.command.parameter.ArgumentReader) PhaseTracker(org.spongepowered.common.event.tracking.PhaseTracker) Collectors(java.util.stream.Collectors) CommandMapping(org.spongepowered.api.command.manager.CommandMapping) AmbiguityConsumer(com.mojang.brigadier.AmbiguityConsumer) List(java.util.List) SpongeStringReader(org.spongepowered.common.command.brigadier.SpongeStringReader) ArgumentParseException(org.spongepowered.api.command.exception.ArgumentParseException) SpongeCommandContext(org.spongepowered.common.command.brigadier.context.SpongeCommandContext) ParseResults(com.mojang.brigadier.ParseResults) SpongeArgumentCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeArgumentCommandNode) CommandNode(com.mojang.brigadier.tree.CommandNode) Optional(java.util.Optional) ResultConsumer(com.mojang.brigadier.ResultConsumer) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) CommandManager(org.spongepowered.api.command.manager.CommandManager) SpongeNode(org.spongepowered.common.command.brigadier.tree.SpongeNode) Collections(java.util.Collections) StringRange(com.mojang.brigadier.context.StringRange) CommandException(org.spongepowered.api.command.exception.CommandException) SpongeCommandManager(org.spongepowered.common.command.manager.SpongeCommandManager) DummyCommandNode(org.spongepowered.common.command.brigadier.tree.DummyCommandNode) LiteralCommandNode(com.mojang.brigadier.tree.LiteralCommandNode) DummyCommandNode(org.spongepowered.common.command.brigadier.tree.DummyCommandNode) SpongeRootCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeRootCommandNode) RootCommandNode(com.mojang.brigadier.tree.RootCommandNode) SpongeArgumentCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeArgumentCommandNode) CommandNode(com.mojang.brigadier.tree.CommandNode) SpongeRootCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeRootCommandNode) RootCommandNode(com.mojang.brigadier.tree.RootCommandNode) ArgumentParseException(org.spongepowered.api.command.exception.ArgumentParseException) CommandSourceStack(net.minecraft.commands.CommandSourceStack) SpongeCommandContextBuilder(org.spongepowered.common.command.brigadier.context.SpongeCommandContextBuilder) LinkedHashMap(java.util.LinkedHashMap) SpongeStringReader(org.spongepowered.common.command.brigadier.SpongeStringReader) CommandMapping(org.spongepowered.api.command.manager.CommandMapping) SpongeNode(org.spongepowered.common.command.brigadier.tree.SpongeNode) SpongeCommandSyntaxException(org.spongepowered.common.command.exception.SpongeCommandSyntaxException) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) SpongeArgumentCommandNode(org.spongepowered.common.command.brigadier.tree.SpongeArgumentCommandNode) ArgumentReader(org.spongepowered.api.command.parameter.ArgumentReader) CommandException(org.spongepowered.api.command.exception.CommandException) SpongeCommandSyntaxException(org.spongepowered.common.command.exception.SpongeCommandSyntaxException) ParseResults(com.mojang.brigadier.ParseResults) SpongeCommandContext(org.spongepowered.common.command.brigadier.context.SpongeCommandContext)

Example 5 with CommandMapping

use of org.spongepowered.api.command.manager.CommandMapping in project SpongeCommon by SpongePowered.

the class SpongeCommand method whichExecutor.

@NonNull
private CommandResult whichExecutor(final CommandContext context) {
    final CommandMapping mapping = context.requireOne(this.commandMappingKey);
    context.sendMessage(Identity.nil(), Component.text().append(this.title("Aliases: "), Component.join(JoinConfiguration.separator(Component.text(", ")), mapping.allAliases().stream().map(x -> Component.text(x, NamedTextColor.YELLOW)).collect(Collectors.toList())), Component.newline(), this.title("Owned by: "), this.hl(mapping.plugin().map(x -> x.metadata().name().orElseGet(() -> x.metadata().id())).orElse("unknown"))).build());
    return CommandResult.success();
}
Also used : RefreshGameEvent(org.spongepowered.api.event.lifecycle.RefreshGameEvent) ServerLevelBridge(org.spongepowered.common.bridge.server.level.ServerLevelBridge) Command(org.spongepowered.api.command.Command) URL(java.net.URL) SpongeGameConfigs(org.spongepowered.common.config.SpongeGameConfigs) ItemStack(org.spongepowered.api.item.inventory.ItemStack) PluginMetadata(org.spongepowered.plugin.metadata.PluginMetadata) Method(java.lang.reflect.Method) LinearComponents(net.kyori.adventure.text.LinearComponents) TextComponent(net.kyori.adventure.text.TextComponent) TextColor(net.kyori.adventure.text.format.TextColor) LocatableBlock(org.spongepowered.api.world.LocatableBlock) Collection(java.util.Collection) Launch(org.spongepowered.common.launch.Launch) Sponge(org.spongepowered.api.Sponge) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) NamedTextColor(net.kyori.adventure.text.format.NamedTextColor) Keys(org.spongepowered.api.data.Keys) List(java.util.List) Optional(java.util.Optional) JoinConfiguration(net.kyori.adventure.text.JoinConfiguration) Player(org.spongepowered.api.entity.living.player.Player) HoverEvent(net.kyori.adventure.text.event.HoverEvent) ServerLocation(org.spongepowered.api.world.server.ServerLocation) PluginContributor(org.spongepowered.plugin.metadata.model.PluginContributor) Timings(co.aikar.timings.Timings) NonNull(org.checkerframework.checker.nullness.qual.NonNull) ServerWorld(org.spongepowered.api.world.server.ServerWorld) LocalDateTime(java.time.LocalDateTime) CompletableFuture(java.util.concurrent.CompletableFuture) ClickEvent(net.kyori.adventure.text.event.ClickEvent) ServerLevel(net.minecraft.server.level.ServerLevel) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Style(net.kyori.adventure.text.format.Style) SpongeEventManager(org.spongepowered.common.event.manager.SpongeEventManager) Parameter(org.spongepowered.api.command.parameter.Parameter) Component(net.kyori.adventure.text.Component) MBeanServer(javax.management.MBeanServer) ResourceKey(org.spongepowered.api.ResourceKey) RayTrace(org.spongepowered.api.util.blockray.RayTrace) ManagementFactory(java.lang.management.ManagementFactory) Nullable(org.checkerframework.checker.nullness.qual.Nullable) CommonParameters(org.spongepowered.api.command.parameter.CommonParameters) CommandResult(org.spongepowered.api.command.CommandResult) LevelBridge(org.spongepowered.common.bridge.world.level.LevelBridge) Identity(net.kyori.adventure.identity.Identity) TextDecoration(net.kyori.adventure.text.format.TextDecoration) SpongeEventFactory(org.spongepowered.api.event.SpongeEventFactory) DecimalFormat(java.text.DecimalFormat) SpongeCommon(org.spongepowered.common.SpongeCommon) PhaseTracker(org.spongepowered.common.event.tracking.PhaseTracker) File(java.io.File) SpongeTimingsFactory(co.aikar.timings.sponge.SpongeTimingsFactory) CommandMapping(org.spongepowered.api.command.manager.CommandMapping) Entity(net.minecraft.world.entity.Entity) PluginContainer(org.spongepowered.plugin.PluginContainer) DateTimeFormatter(java.time.format.DateTimeFormatter) SpongeConfigs(org.spongepowered.common.applaunch.config.core.SpongeConfigs) CommandContext(org.spongepowered.api.command.parameter.CommandContext) SpongeComponents(org.spongepowered.api.adventure.SpongeComponents) Mth(net.minecraft.util.Mth) CommandMapping(org.spongepowered.api.command.manager.CommandMapping) NonNull(org.checkerframework.checker.nullness.qual.NonNull)

Aggregations

CommandMapping (org.spongepowered.api.command.manager.CommandMapping)7 ArrayList (java.util.ArrayList)4 SuggestionsBuilder (com.mojang.brigadier.suggestion.SuggestionsBuilder)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 CommandSourceStack (net.minecraft.commands.CommandSourceStack)3 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)2 Suggestions (com.mojang.brigadier.suggestion.Suggestions)2 CommandNode (com.mojang.brigadier.tree.CommandNode)2 LiteralCommandNode (com.mojang.brigadier.tree.LiteralCommandNode)2 RootCommandNode (com.mojang.brigadier.tree.RootCommandNode)2 Collection (java.util.Collection)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 PhaseTracker (org.spongepowered.common.event.tracking.PhaseTracker)2 Timings (co.aikar.timings.Timings)1 SpongeTimingsFactory (co.aikar.timings.sponge.SpongeTimingsFactory)1 AmbiguityConsumer (com.mojang.brigadier.AmbiguityConsumer)1 Command (com.mojang.brigadier.Command)1 CommandDispatcher (com.mojang.brigadier.CommandDispatcher)1