Class CommandSyntax<S>

java.lang.Object
io.github.mqzn.commands.base.syntax.CommandSyntax<S>
All Implemented Interfaces:
TextConvertible<S>, Comparable<CommandSyntax<S>>
Direct Known Subclasses:
SubCommandSyntax

public class CommandSyntax<S> extends Object implements TextConvertible<S>, Comparable<CommandSyntax<S>>
  • Field Details

    • arguments

      @NotNull protected final @NotNull List<Argument<?>> arguments
    • execution

      @Nullable protected final @Nullable CommandExecution<S,?> execution
    • senderClass

      @NotNull protected final @NotNull Class<?> senderClass
    • commandLabel

      @NotNull protected final @NotNull String commandLabel
    • flags

      @NotNull protected final @NotNull SyntaxFlags flags
    • info

      @Nullable protected @Nullable Information info
  • Method Details

    • getArguments

      public static <S> List<Argument<?>> getArguments(io.github.mqzn.commands.base.syntax.tree.CommandTree<S> tree, CommandSyntax<S> syntax)
    • getSenderClass

      @NotNull public @NotNull Class<?> getSenderClass()
    • getExecution

      @Nullable public @Nullable CommandExecution<S,?> getExecution()
    • getInfo

      @Nullable public @Nullable Information getInfo()
    • setInfo

      public void setInfo(@Nullable @Nullable Information info)
    • getFlags

      @NotNull public @NotNull SyntaxFlags getFlags()
    • getCommandLabel

      @NotNull public @NotNull String getCommandLabel()
    • getArgument

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

      public void addFlag(String flag)
    • length

      public int length()
    • matchesContext

      public boolean matchesContext(@NotNull @NotNull DelegateCommandContext<S> commandContext)
      Checks if the syntax matches the context input
      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()
    • hasArg

      public boolean hasArg(Argument<?> argument)
    • execute

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

      @NotNull public @NotNull net.kyori.adventure.text.TextComponent toText(@NotNull @NotNull CommandManager<?,S> manager, @NotNull S sender)
      Specified by:
      toText in interface TextConvertible<S>
    • isSubCommand

      public boolean isSubCommand()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(@NotNull @NotNull CommandSyntax<S> other)
      Specified by:
      compareTo in interface Comparable<S>