Class CommandSyntax<S>

java.lang.Object
io.github.mqzn.commands.base.syntax.CommandSyntax<S>
All Implemented Interfaces:
TextConvertible<S>

public final class CommandSyntax<S> extends Object implements TextConvertible<S>
  • Method Details

    • of

      @NotNull public static <S> @NotNull CommandSyntax<S> of(@NotNull @NotNull CommandManager<?,S> manager, @NotNull @NotNull String commandLabel, @NotNull @NotNull CommandExecution<S> execution, @NotNull @NotNull Argument<?>... args)
    • of

      @NotNull public static <S> @NotNull CommandSyntax<S> of(@NotNull @NotNull CommandManager<?,S> manager, @NotNull @NotNull String commandLabel, @NotNull @NotNull CommandExecution<S> execution, @NotNull @NotNull SyntaxFlags flags, @NotNull @NotNull Argument<?>... args)
    • isArgRequired

      public static boolean isArgRequired(String argSyntax)
    • isArgOptional

      public static boolean isArgOptional(String argSyntax)
    • isArgLiteral

      public static boolean isArgLiteral(String argSyntax)
    • fetchArgId

      public static String fetchArgId(String argSyntax)
    • getArgument

      @Nullable public @Nullable Argument<?> getArgument(int index)
    • withInfo

      public CommandSyntax<S> withInfo(@NotNull @NotNull String permission, @NotNull @NotNull String description)
    • withFlag

      public CommandSyntax<S> withFlag(String flag)
    • length

      public int length()
    • withoutOptionalLength

      public int withoutOptionalLength()
    • withoutFlagsOrOptionalArgumentsLength

      public int withoutFlagsOrOptionalArgumentsLength()
    • matchesContext

      public boolean matchesContext(@NotNull @NotNull DelegateCommandContext<S> commandContext)
      Checks if the syntax matches the context input Here are some examples:
      Parameters:
      commandContext - the input
      Returns:
      whether the syntax is suitable for the context used !
    • useSpace

      public boolean useSpace()
    • getArguments

      @NotNull public @NotNull List<Argument<?>> getArguments()
    • execute

      public void execute(S sender, CommandContext<S> commandContext)
    • debug

      public void debug()
    • formatted

      public String formatted()
    • toText

      @NonNull public @NonNull net.kyori.adventure.text.TextComponent toText(@NotNull S sender)
      Specified by:
      toText in interface TextConvertible<S>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object