Class SelectList.Builder

Enclosing class:
SelectList

public static final class SelectList.Builder extends Entry.Builder<SelectList.Builder>
Builds a SelectList; from SelectList.builder(String). Also has the options every entry has (Entry.Builder).
  • Method Details

    • rows

      The rows, in display order; re-read on every refresh. Required. Return a fresh list each time; it is copied. Row ids must be unique.
      Parameters:
      rows - supplies the current rows
      Returns:
      this builder
    • onSelect

      public SelectList.Builder onSelect(Consumer<String> onSelect)
      Called when the player selects a row (or SelectList.select(String) is called), on the main thread. Optional: actions can read SelectList.selected() instead.
      Parameters:
      onSelect - receives the selected row's id, or null when the selection was cleared
      Returns:
      this builder
    • build

      public SelectList build()
      Builds the list. Nothing is selected at first.
      Returns:
      the list
      Throws:
      IllegalStateException - if rows is missing