Record Class TextPromptSpec

java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.dialog.TextPromptSpec
Record Components:
title - heading shown above the prompt; empty when null
prompt - the question itself; empty when null
initialValue - text the field starts with; empty when null
maxLength - longest accepted input; 32 when not positive

public record TextPromptSpec(Component title, Component prompt, String initialValue, int maxLength) extends Record
Parameters for a text-input prompt opened via DialogService.promptText(org.bukkit.entity.Player, de.Keyle.MyPet.api.dialog.TextPromptSpec, java.util.function.Consumer<java.lang.String>, java.lang.Runnable). The compact constructor supplies defaults so callers can pass null for any optional field.
  • Constructor Details

    • TextPromptSpec

      public TextPromptSpec(Component title, Component prompt, String initialValue, int maxLength)
      Substitutes a default for every field left null or out of range.
  • Method Details

    • 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 '=='.
      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.
    • title

      public Component title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • prompt

      public Component prompt()
      Returns the value of the prompt record component.
      Returns:
      the value of the prompt record component
    • initialValue

      public String initialValue()
      Returns the value of the initialValue record component.
      Returns:
      the value of the initialValue record component
    • maxLength

      public int maxLength()
      Returns the value of the maxLength record component.
      Returns:
      the value of the maxLength record component