Record Class ViaDialogOpener

java.lang.Object
java.lang.Record
io.github.projectunified.unidialog.viaversion.opener.ViaDialogOpener
All Implemented Interfaces:
DialogOpener

public record ViaDialogOpener(ViaDialog<?> dialog) extends Record implements DialogOpener
A ViaVersion-based implementation of DialogOpener for opening dialogs.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for ViaDialogOpener
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    clearDialog(com.viaversion.viaversion.api.connection.UserConnection connection)
    Clear the dialog for a user connection, automatically determining the phase from the connection state
    static boolean
    clearDialog(com.viaversion.viaversion.api.connection.UserConnection connection, boolean configuration)
    Clear the dialog for a user connection
    Get the dialog held by this opener
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    open(com.viaversion.viaversion.api.connection.UserConnection connection)
    Open the dialog for a user connection, automatically determining the phase from the connection state
    boolean
    open(com.viaversion.viaversion.api.connection.UserConnection connection, boolean configuration, com.viaversion.viaversion.api.protocol.version.ProtocolVersion baseVersion, com.viaversion.viaversion.api.protocol.version.ProtocolVersion targetVersion)
    Open the dialog for a user connection, using the given base and target versions
    boolean
    open(com.viaversion.viaversion.api.connection.UserConnection connection, com.viaversion.viaversion.api.protocol.version.ProtocolVersion baseVersion, com.viaversion.viaversion.api.protocol.version.ProtocolVersion targetVersion)
    Open the dialog for a user connection, using the given base and target versions and automatically determining the phase from the connection state
    boolean
    open(UUID uuid)
    Open the dialog for the given player UUID
    boolean
    open(UUID uuid, com.viaversion.viaversion.api.protocol.version.ProtocolVersion baseVersion, com.viaversion.viaversion.api.protocol.version.ProtocolVersion targetVersion)
    Open the dialog for the given player, using the given base and target versions
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • ViaDialogOpener

      public ViaDialogOpener(ViaDialog<?> dialog)
      Constructor for ViaDialogOpener
      Parameters:
      dialog - the dialog to open
  • Method Details

    • clearDialog

      public static boolean clearDialog(com.viaversion.viaversion.api.connection.UserConnection connection, boolean configuration)
      Clear the dialog for a user connection
      Parameters:
      connection - the user connection
      configuration - if true, clears the configuration-phase dialog; if false, the play-phase dialog
      Returns:
      true if the clear packet was sent, false otherwise
    • clearDialog

      public static boolean clearDialog(com.viaversion.viaversion.api.connection.UserConnection connection)
      Clear the dialog for a user connection, automatically determining the phase from the connection state
      Parameters:
      connection - the user connection
      Returns:
      true if the clear packet was sent, false otherwise
    • dialog

      public ViaDialog<?> dialog()
      Get the dialog held by this opener
      Returns:
      the dialog
    • open

      public boolean open(com.viaversion.viaversion.api.connection.UserConnection connection, boolean configuration, com.viaversion.viaversion.api.protocol.version.ProtocolVersion baseVersion, com.viaversion.viaversion.api.protocol.version.ProtocolVersion targetVersion)
      Open the dialog for a user connection, using the given base and target versions
      Parameters:
      connection - the user connection
      configuration - if true, sends the configuration-phase dialog; if false, the play-phase dialog
      baseVersion - the protocol version of the server the dialog is created for
      targetVersion - the protocol version of the player the dialog is sent to
      Returns:
      true if the dialog was sent, false otherwise
    • open

      public boolean open(com.viaversion.viaversion.api.connection.UserConnection connection, com.viaversion.viaversion.api.protocol.version.ProtocolVersion baseVersion, com.viaversion.viaversion.api.protocol.version.ProtocolVersion targetVersion)
      Open the dialog for a user connection, using the given base and target versions and automatically determining the phase from the connection state
      Parameters:
      connection - the user connection
      baseVersion - the protocol version of the server the dialog is created for
      targetVersion - the protocol version of the player the dialog is sent to
      Returns:
      true if the dialog was sent, false otherwise
    • open

      public boolean open(UUID uuid, com.viaversion.viaversion.api.protocol.version.ProtocolVersion baseVersion, com.viaversion.viaversion.api.protocol.version.ProtocolVersion targetVersion)
      Open the dialog for the given player, using the given base and target versions
      Parameters:
      uuid - the UUID of the player to open the dialog for
      baseVersion - the protocol version of the server the dialog is created for
      targetVersion - the protocol version of the player the dialog is sent to
      Returns:
      true if the dialog was sent, false otherwise
    • open

      public boolean open(com.viaversion.viaversion.api.connection.UserConnection connection)
      Open the dialog for a user connection, automatically determining the phase from the connection state
      Parameters:
      connection - the user connection
      Returns:
      true if the dialog was sent, false otherwise
    • open

      public boolean open(UUID uuid)
      Description copied from interface: DialogOpener
      Open the dialog for the given player UUID
      Specified by:
      open in interface DialogOpener
      Parameters:
      uuid - the UUID of the player to open the dialog for
      Returns:
      true if the dialog was opened successfully, false otherwise
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.