Class CommandParser

java.lang.Object
net.minestom.server.command.builder.parser.CommandParser

public final class CommandParser extends Object
Class used to parse complete command inputs.
  • Constructor Details

    • CommandParser

      public CommandParser()
  • Method Details

    • findCommand

      @Nullable public static @Nullable CommandQueryResult findCommand(@NotNull @NotNull CommandDispatcher dispatcher, @NotNull @NotNull String input)
    • parse

      public static void parse(@NotNull @NotNull CommandSender sender, @Nullable @Nullable CommandSyntax syntax, @NotNull @NotNull Argument<?>[] commandArguments, @NotNull @NotNull String[] inputArguments, @NotNull @NotNull String commandString, @Nullable @Nullable List<ValidSyntaxHolder> validSyntaxes, @Nullable @Nullable it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap<CommandSuggestionHolder> syntaxesSuggestions)
    • findMostCorrectSyntax

      @Nullable public static @Nullable ValidSyntaxHolder findMostCorrectSyntax(@NotNull @NotNull List<ValidSyntaxHolder> validSyntaxes, @NotNull @NotNull CommandContext context)
      Retrieves from the valid syntax map the arguments condition result and get the one with the most valid arguments.
      Parameters:
      validSyntaxes - the list containing all the valid syntaxes
      context - the recipient of the argument parsed values
      Returns:
      the command syntax with all of its arguments correct and with the most arguments count, null if not any
    • findEligibleArgument

      @Nullable public static @Nullable ArgumentQueryResult findEligibleArgument(@NotNull @NotNull CommandSender sender, @NotNull @NotNull Command command, String[] args, String commandString, boolean trailingSpace, boolean forceCorrect, Predicate<CommandSyntax> syntaxPredicate, Predicate<Argument<?>> argumentPredicate)