Class ViaSingleOptionInput

java.lang.Object
io.github.projectunified.unidialog.viaversion.input.ViaDialogInput
io.github.projectunified.unidialog.viaversion.input.ViaSingleOptionInput
All Implemented Interfaces:
SingleOptionInput<ViaSingleOptionInput>

public class ViaSingleOptionInput extends ViaDialogInput implements SingleOptionInput<ViaSingleOptionInput>
A ViaVersion-based implementation of SingleOptionInput for single option inputs.
  • Constructor Details

    • ViaSingleOptionInput

      public ViaSingleOptionInput(Function<String,com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer)
      Constructor for ViaSingleOptionInput
      Parameters:
      componentDeserializer - the function to deserialize components from strings
  • Method Details

    • width

      public ViaSingleOptionInput width(int width)
      Description copied from interface: SingleOptionInput
      Set the width of the input
      Specified by:
      width in interface SingleOptionInput<ViaSingleOptionInput>
      Parameters:
      width - the width
      Returns:
      the current instance for method chaining
    • label

      public ViaSingleOptionInput label(@Nullable @Nullable com.viaversion.viaversion.libs.mcstructs.text.TextComponent label)
      Set the label for the input
      Parameters:
      label - the label
      Returns:
      the input itself for method chaining
    • label

      public ViaSingleOptionInput label(@Nullable @Nullable String label)
      Description copied from interface: SingleOptionInput
      Set the label for the input
      Specified by:
      label in interface SingleOptionInput<ViaSingleOptionInput>
      Parameters:
      label - the label text
      Returns:
      the current instance for method chaining
    • option

      public ViaSingleOptionInput option(String id, com.viaversion.viaversion.libs.mcstructs.text.TextComponent display, boolean isDefault)
      Add an option to the input
      Parameters:
      id - the identifier for the option
      display - the display text for the option
      isDefault - whether this option is the default selection
      Returns:
      the input itself for method chaining
    • option

      public ViaSingleOptionInput option(String id, String display, boolean isDefault)
      Description copied from interface: SingleOptionInput
      Add an option to the input
      Specified by:
      option in interface SingleOptionInput<ViaSingleOptionInput>
      Parameters:
      id - the identifier for the option
      display - the display text for the option
      isDefault - whether this option is the default selection
      Returns:
      the current instance for method chaining
    • write

      public void write(com.viaversion.nbt.tag.CompoundTag tag, com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion)
      Description copied from class: ViaDialogInput
      Write the type-specific fields of this input into the given tag
      Specified by:
      write in class ViaDialogInput
      Parameters:
      tag - the tag to write into
      baseVersion - the serializer of the server version the dialog is created for
      targetVersion - the serializer of the version the dialog is sent to