Class SingleWordArgument

java.lang.Object
net.lucypoulton.squirtgun.command.argument.AbstractArgument<String>
net.lucypoulton.squirtgun.command.argument.SingleWordArgument
All Implemented Interfaces:
CommandArgument<String>

public final class SingleWordArgument extends AbstractArgument<String>
An argument that accepts a single word.
  • Constructor Details

    • SingleWordArgument

      public SingleWordArgument(String name, String description, boolean isOptional)
      Parameters:
      name - the argument's name
      description - the argument's description
      isOptional - whether the argument is optional
  • Method Details

    • getValue

      public String getValue(Queue<String> args, CommandContext ctx)
      Description copied from interface: CommandArgument
      Reads from a queue to get the value for this argument.
      Parameters:
      args - a queue of strings containing the raw arguments. Pop as many as needed and no more.
      ctx - the context that this command has been executed in. Be aware that arguments may not yet be populated.
      Returns:
      the parsed string value of this argument.
    • tabComplete

      @NotNull public @NotNull List<String> tabComplete(Queue<String> value, CommandContext ctx)
      Description copied from interface: CommandArgument
      Tab-completes this node.
      Parameters:
      value - a queue of strings containing the raw arguments. Pop as many as needed and no more.
      ctx - the context that this command has been executed in. Be aware that arguments may not yet be populated.
      Returns:
      the tabcompleted value of this node, or if not applicable, null