Class StringArgument


public class StringArgument extends Argument<String>
An argument that represents a simple String
  • Field Details

    • executor

      protected CustomCommandExecutor<?> executor
      The CustomCommandExecutor for this executable implementation
  • Constructor Details

    • StringArgument

      public StringArgument(String nodeName)
      A string argument for one word
      Parameters:
      nodeName - the name of the node for this argument
  • Method Details

    • getPrimitiveType

      public Class<String> getPrimitiveType()
      Description copied from class: Argument
      Returns the primitive type of the current Argument. After executing a command, this argument should yield an object of this returned class.
      Specified by:
      getPrimitiveType in class Argument<String>
      Returns:
      the type that this argument yields when the command is run
    • getArgumentType

      public CommandAPIArgumentType getArgumentType()
      Description copied from class: Argument
      Returns the argument type for this argument.
      Specified by:
      getArgumentType in class Argument<String>
      Returns:
      the argument type for this argument
    • parseArgument

      public <CommandListenerWrapper> String parseArgument(NMS<CommandListenerWrapper> nms, com.mojang.brigadier.context.CommandContext<CommandListenerWrapper> cmdCtx, String key, Object[] previousArgs) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Description copied from class: Argument
      Parses an argument, returning the specific Bukkit object that the argument represents. This is intended for use by the internals of the CommandAPI and isn't expected to be used outside the CommandAPI
      Specified by:
      parseArgument in class Argument<String>
      Type Parameters:
      CommandListenerWrapper - the command source type
      Parameters:
      nms - an instance of NMS
      cmdCtx - the context which ran this command
      key - the name of the argument node
      previousArgs - an array of previously declared arguments
      Returns:
      the parsed object represented by this argument
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException - if parsing fails
    • executes

      public ArgumentTree executes(CommandExecutor executor, ExecutorType... types)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (CommandSender, Object[]) -> () that will be executed when the command is run
      types - A list of executor types to use this executes method for.
      Returns:
      this command builder
    • executes

      public ArgumentTree executes(ResultingCommandExecutor executor, ExecutorType... types)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (CommandSender, Object[]) -> int that will be executed when the command is run
      types - A list of executor types to use this executes method for.
      Returns:
      this command builder
    • executesPlayer

      public ArgumentTree executesPlayer(PlayerCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (Player, Object[]) -> () that will be executed when the command is run
      Returns:
      this command builder
    • executesPlayer

      public ArgumentTree executesPlayer(PlayerResultingCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (Player, Object[]) -> int that will be executed when the command is run
      Returns:
      this command builder
    • executesEntity

      public ArgumentTree executesEntity(EntityCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (Entity, Object[]) -> () that will be executed when the command is run
      Returns:
      this command builder
    • executesEntity

      public ArgumentTree executesEntity(EntityResultingCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (Entity, Object[]) -> int that will be executed when the command is run
      Returns:
      this command builder
    • executesProxy

      public ArgumentTree executesProxy(ProxyCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (Entity, Object[]) -> () that will be executed when the command is run
      Returns:
      this command builder
    • executesProxy

      public ArgumentTree executesProxy(ProxyResultingCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (Entity, Object[]) -> int that will be executed when the command is run
      Returns:
      this command builder
    • executesCommandBlock

      public ArgumentTree executesCommandBlock(CommandBlockCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (BlockCommandSender, Object[]) -> () that will be executed when the command is run
      Returns:
      this command builder
    • executesCommandBlock

      public ArgumentTree executesCommandBlock(CommandBlockResultingCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (BlockCommandSender, Object[]) -> int that will be executed when the command is run
      Returns:
      this command builder
    • executesConsole

      public ArgumentTree executesConsole(ConsoleCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (BlockCommandSender, Object[]) -> () that will be executed when the command is run
      Returns:
      this command builder
    • executesConsole

      public ArgumentTree executesConsole(ConsoleResultingCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (BlockCommandSender, Object[]) -> int that will be executed when the command is run
      Returns:
      this command builder
    • executesNative

      public ArgumentTree executesNative(NativeCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (NativeCommandExecutor, Object[]) -> () that will be executed when the command is run
      Returns:
      this command builder
    • executesNative

      public ArgumentTree executesNative(NativeResultingCommandExecutor executor)
      Adds an executor to the current command builder
      Parameters:
      executor - A lambda of type (NativeCommandExecutor, Object[]) -> int that will be executed when the command is run
      Returns:
      this command builder
    • getExecutor

      public CustomCommandExecutor<? extends org.bukkit.command.CommandSender> getExecutor()
      Returns the executors that this command has
      Returns:
      the executors that this command has
    • setExecutor

      public void setExecutor(CustomCommandExecutor<? extends org.bukkit.command.CommandSender> executor)
      Sets the executors for this command
      Parameters:
      executor - the executors for this command
    • clearExecutors

      public ArgumentTree clearExecutors()
      Clear all executors from the current command builder
      Returns:
      this command builder