Interface RawArgument<T>

Type Parameters:
T - - The object type of the command argument.
All Superinterfaces:
DataSerializable

public interface RawArgument<T> extends DataSerializable
The interface is designed to simplify the creation of RawSettings type commands.
You can use it to create arguments for this commands, just like you do for Command.Parameterized commands.
Unlike Command.Parameterized commands, RawSettings commands have no problem with the availability of game objects, which are registered after the commands are registered.
However, adding autocomplete to RawSettings commands and then checking the arguments is very time-consuming.
Using this interface together with the RawCommand interface saves you from having to do such time-consuming work.
  • Method Details

    • builder

      static <T> RawArgument.Builder<T> builder()
    • of

      static <T, C extends CommandTreeNode<C>> RawArgument<T> of(@NotNull @NotNull Class<T> clazz, CommandTreeNode.Argument<C> argumentNodeType, @NotNull @NotNull RawCompleterSupplier<Stream<String>> plainVariants, @NotNull @NotNull RawResultSupplier<T> result, @NotNull @NotNull String key, boolean optional, boolean optionalForConsole, int cursor, String permission, @NotNull @NotNull Object... localesPath)
    • of

      @Deprecated static <T> RawArgument<T> of(Class<T> clazz, RawCompleterSupplier<Stream<String>> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, Object... localesPath)
      Deprecated.
    • of

      @Deprecated static <T> RawArgument<T> of(Class<T> clazz, RawCompleterSupplier<Stream<String>> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, String permission, Object... localesPath)
      Deprecated.
    • of

      @Deprecated static <T> RawArgument<T> of(Class<T> clazz, Stream<String> variants, RawResultSupplier<T> result, boolean optional, boolean optionalForConsole, int cursor, String permission, Object... localesPath)
      Deprecated.
    • getArgumentType

      CommandTreeNode.Argument<?> getArgumentType()
      Specifies the argument type.
      See the CommandTreeNodeTypes class for available variants.
      The specified type defines what the player can enter as an argument.
      This is not controlled by the plugin, but the player will see an error message if the value type is not appropriate.
    • getTreeKey

      String getTreeKey()
      The identifier of the argument in the argument tree.
      It is also displayed to the player above the input line as a hint.
    • getVariants

      Stream<String> getVariants(CommandCause cause, String[] args)
      Autocomplete variants.
    • getResult

      Optional<T> getResult(Class<T> clazz, String[] args)
      Converts a string argument to a specified class. If the specified class does not match the argument class, the return will be empty.
    • getResult

      Optional<T> getResult(Class<T> clazz, CommandCause cause, String[] args)
      Converts a string argument to a specified class. If the specified class does not match the argument class, the return will be empty.
    • getResultUnknownType

      Optional<?> getResultUnknownType(CommandCause cause, String[] args)
      Retrieves an object from the command's argument string without converting it to a specific type.
    • isOptional

      boolean isOptional()
      Whether the argument is optional.
    • isOptionalForConsole

      boolean isOptionalForConsole()
      Is the argument optional for non-players.
    • getCursor

      int getCursor()
      Argument number. The numbering starts with 0.
    • getLocalesPath

      Object[] getLocalesPath()
      Path to find the message that there is no matching command argument in the localization configuration.
    • getClazz

      Class<?> getClazz()
      Class of argument.
    • getPermision

      Optional<String> getPermision()
    • hasPermission

      boolean hasPermission(CommandCause cause)