Record Class DialogOption

java.lang.Object
java.lang.Record
com.botwithus.bot.api.dialog.DialogOption
Record Components:
index - 1-based option number as shown in-game (the "N." cell, or the row's position when no number cell is present)
text - the visible option label, color tags intact
row - the option-row component the selection targets

public record DialogOption(int index, String text, ComponentNode row) extends Record
One selectable line of the multi-choice dialog (interface DIALOG_OPTIONS).

The label is read from a TEXT leaf deep in the row's subtree, but row() is the LAYER container the game keys the selection on — the component the server expects. Selecting an option targets row() via the DIALOGUE action, never the text leaf. See Dialog for how the correlation is derived.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DialogOption(int index, String text, ComponentNode row)
    Creates an instance of a DialogOption record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The component id the server expects for this option (the row, not the label).
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the index record component.
    int
    The interface the row lives on.
    row()
    Returns the value of the row record component.
    void
    Queue the selection of this option.
    Returns the value of the text record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DialogOption

      public DialogOption(int index, String text, ComponentNode row)
      Creates an instance of a DialogOption record class.
      Parameters:
      index - the value for the index record component
      text - the value for the text record component
      row - the value for the row record component
  • Method Details

    • componentId

      public int componentId()
      The component id the server expects for this option (the row, not the label).
    • interfaceId

      public int interfaceId()
      The interface the row lives on.
    • select

      public void select()
      Queue the selection of this option. Targets row() via the DIALOGUE action (type 30) — see ComponentNode.selectDialogOption() for why a plain component click doesn't advance the dialogue.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • row

      public ComponentNode row()
      Returns the value of the row record component.
      Returns:
      the value of the row record component