Class CommandParser
java.lang.Object
net.minestom.server.command.builder.parser.CommandParser
Class used to parse complete command inputs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable CommandQueryResult
findCommand
(@NotNull CommandDispatcher dispatcher, @NotNull String input) static @Nullable ArgumentQueryResult
findEligibleArgument
(@NotNull CommandSender sender, @NotNull Command command, String[] args, String commandString, boolean trailingSpace, boolean forceCorrect, Predicate<CommandSyntax> syntaxPredicate, Predicate<Argument<?>> argumentPredicate) static @Nullable ValidSyntaxHolder
findMostCorrectSyntax
(@NotNull List<ValidSyntaxHolder> validSyntaxes, @NotNull CommandContext context) Retrieves from the valid syntax map the arguments condition result and get the one with the most valid arguments.static void
parse
(@NotNull CommandSender sender, @Nullable CommandSyntax syntax, @NotNull Argument<?>[] commandArguments, @NotNull String[] inputArguments, @NotNull String commandString, @Nullable List<ValidSyntaxHolder> validSyntaxes, @Nullable it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap<CommandSuggestionHolder> syntaxesSuggestions)
-
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 syntaxescontext
- 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)
-