Record Class VanishBridgeMessage

java.lang.Object
java.lang.Record
dev.plex.network.VanishBridgeMessage
Record Components:
action - requested action or reported state
playerId - player UUID
silent - whether the action must not send a join or leave message

public record VanishBridgeMessage(VanishBridgeMessage.Action action, UUID playerId, boolean silent) extends Record
A vanish message sent between Plex servers and proxies.
  • Field Details

  • Constructor Details

    • VanishBridgeMessage

      public VanishBridgeMessage(VanishBridgeMessage.Action action, UUID playerId, boolean silent)
      Creates and validates a vanish message.
  • Method Details

    • query

      public static VanishBridgeMessage query(UUID playerId)
      Creates a request for the player's current vanish state.
      Parameters:
      playerId - player UUID
      Returns:
      query message
    • state

      public static VanishBridgeMessage state(UUID playerId, boolean vanished)
      Creates a message that reports the player's vanish state.
      Parameters:
      playerId - player UUID
      vanished - whether the player is vanished
      Returns:
      state message
    • hide

      public static VanishBridgeMessage hide(UUID playerId, boolean silent)
      Creates a request to hide a player.
      Parameters:
      playerId - player UUID
      silent - whether to hide the player without a leave message
      Returns:
      hide message
    • show

      public static VanishBridgeMessage show(UUID playerId, boolean silent)
      Creates a request to show a player.
      Parameters:
      playerId - player UUID
      silent - whether to show the player without a join message
      Returns:
      show message
    • encode

      public byte[] encode()
      Encodes this message for the plugin message channel.
      Returns:
      encoded message
    • decode

      public static VanishBridgeMessage decode(byte[] data) throws IOException
      Decodes a message from the plugin message channel.
      Parameters:
      data - encoded message
      Returns:
      decoded message
      Throws:
      IOException - if the message is invalid or uses an unsupported version
    • 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.
    • action

      public VanishBridgeMessage.Action action()
      Returns the value of the action record component.
      Returns:
      the value of the action record component
    • playerId

      public UUID playerId()
      Returns the value of the playerId record component.
      Returns:
      the value of the playerId record component
    • silent

      public boolean silent()
      Returns the value of the silent record component.
      Returns:
      the value of the silent record component