Class ListArgument

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

public class ListArgument extends AbstractArgument<String>
An argument that accepts a single string from a list.
  • Constructor Details

    • ListArgument

      public ListArgument(String name, String description, boolean isOptional, List<String> values)
      Parameters:
      name - this argument's name
      description - this argument's description
      isOptional - whether this argument will be displayed as optional
      values - a set of acceptable values for this argument
  • 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

      @Nullable public @Nullable 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