java.lang.Object
io.github.projectunified.unidialog.viaversion.body.ViaTextBody
All Implemented Interfaces:
TextBody<ViaTextBody>, ViaDialogBody

public class ViaTextBody extends Object implements TextBody<ViaTextBody>, ViaDialogBody
A ViaVersion-based implementation of TextBody for building text bodies.
  • Field Summary

    Fields inherited from interface io.github.projectunified.unidialog.core.body.TextBody

    DEFAULT_WIDTH
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViaTextBody(Function<String,com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer)
    Constructor for ViaTextBody
  • Method Summary

    Modifier and Type
    Method
    Description
    text(com.viaversion.viaversion.libs.mcstructs.text.TextComponent text)
    Set the text for the body
    text(String text)
    Set the text for the body
    com.viaversion.nbt.tag.CompoundTag
    toTag(com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion)
    Serialize this body for the given base and target serializers
    width(int width)
    Set the width of the text body

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ViaTextBody

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

    • text

      public ViaTextBody text(com.viaversion.viaversion.libs.mcstructs.text.TextComponent text)
      Set the text for the body
      Parameters:
      text - the text
      Returns:
      the text body itself for method chaining
    • text

      public ViaTextBody text(String text)
      Description copied from interface: TextBody
      Set the text for the body
      Specified by:
      text in interface TextBody<ViaTextBody>
      Parameters:
      text - the text to set
      Returns:
      the instance of the text body for method chaining
    • width

      public ViaTextBody width(int width)
      Description copied from interface: TextBody
      Set the width of the text body
      Specified by:
      width in interface TextBody<ViaTextBody>
      Parameters:
      width - the width to set
      Returns:
      the instance of the text body for method chaining
    • toTag

      public com.viaversion.nbt.tag.CompoundTag toTag(com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion)
      Description copied from interface: ViaDialogBody
      Serialize this body for the given base and target serializers
      Specified by:
      toTag in interface ViaDialogBody
      Parameters:
      baseVersion - the serializer of the server version the dialog is created for
      targetVersion - the serializer of the version the dialog is sent to
      Returns:
      the dialog body tag