Class ListArgumentBuilder<T>

java.lang.Object
dev.jorel.commandapi.arguments.ListArgumentBuilder<T>
Type Parameters:
T - the type that the list argument generates a list of.

public class ListArgumentBuilder<T> extends Object
A builder to create a ListArgument
  • Constructor Details

    • ListArgumentBuilder

      public ListArgumentBuilder(String nodeName)
      Creates a new ListArgumentBuilder with a specified node name. Defaults the delimiter for each element in the list to a space
      Parameters:
      nodeName - the name of the node for this argument
    • ListArgumentBuilder

      public ListArgumentBuilder(String nodeName, String delimiter)
      Creates a new ListArgumentBuilder with a specified node name
      Parameters:
      nodeName - the name of the node for this argument
      delimiter - the separator for each element in the list (for example, a space or a comma)
  • Method Details

    • allowDuplicates

      public ListArgumentBuilder<T> allowDuplicates(boolean allowDuplicates)
      Whether duplicates are allowed in the provided list. By default, duplicates are not allowed.
      Parameters:
      allowDuplicates - whether to enable duplicates or not
      Returns:
      this list argument builder
    • withList

      public ListArgumentBuilder<T>.ListArgumentBuilderSuggests withList(Function<SuggestionInfo<org.bukkit.command.CommandSender>,Collection<T>> list)
      Specifies the list to use to generate suggestions for the list argument
      Parameters:
      list - a function that accepts a SuggestionInfo and returns a collection of elements to suggest for this list argument
      Returns:
      this list argument builder
    • withList

      Specifies the list to use to generate suggestions for the list argument
      Parameters:
      list - a supplier that returns a collection of elements to suggest for this list argument
      Returns:
      this list argument builder
    • withList

      Specifies the list to use to generate suggestions for the list argument
      Parameters:
      list - a collection of elements to suggest for this list argument
      Returns:
      this list argument builder
    • withList

      @SafeVarargs public final ListArgumentBuilder<T>.ListArgumentBuilderSuggests withList(T... array)
      Specifies the list to use to generate suggestions for the list argument
      Parameters:
      array - an array of elements to suggest for this list argument
      Returns:
      this list argument builder