Record Class ProxyMessageEvent

java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.message.ProxyMessageEvent
Record Components:
cancelled - whether a listener vetoed handling
processed - whether a listener already handled it, so the default handling is skipped
sentByThisServer - whether this server is the origin, echoed back by the proxy
server - the originating server name
name - the module the message came from
sender - the entity that sent it
uuid - the id shared by every copy of this message
payload - the raw extra data written by the sender
All Implemented Interfaces:
Event

public record ProxyMessageEvent(boolean cancelled, boolean processed, boolean sentByThisServer, String server, ModuleName name, FEntity sender, UUID uuid, byte[] payload) extends Record implements Event
Fired when a message arrives from another server over the proxy channel.
  • Constructor Details

    • ProxyMessageEvent

      public ProxyMessageEvent(boolean sentByThisServer, String server, ModuleName name, FEntity sender, UUID uuid, byte[] payload)
      Creates an event that has been neither cancelled nor processed.
      Parameters:
      sentByThisServer - whether this server is the origin
      server - the originating server name
      name - the module the message came from
      sender - the entity that sent it
      uuid - the shared message id
      payload - the raw extra data
    • ProxyMessageEvent

      public ProxyMessageEvent(boolean cancelled, boolean processed, boolean sentByThisServer, String server, ModuleName name, FEntity sender, UUID uuid, byte[] payload)
      Creates an instance of a ProxyMessageEvent record class.
      Parameters:
      cancelled - the value for the cancelled record component
      processed - the value for the processed record component
      sentByThisServer - the value for the sentByThisServer record component
      server - the value for the server record component
      name - the value for the name record component
      sender - the value for the sender record component
      uuid - the value for the uuid record component
      payload - the value for the payload record component
  • Method Details

    • openPayload

      public ProxyPayload openPayload()
      Opens the extra data for reading, in the same order the sender wrote it.
      Returns:
      a reader over the payload
    • withCancelled

      public ProxyMessageEvent withCancelled(boolean cancelled)
      Description copied from interface: Event
      Returns a copy of this event with the cancelled flag set.
      Specified by:
      withCancelled in interface Event
      Parameters:
      cancelled - the new cancelled state
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withProcessed

      public ProxyMessageEvent withProcessed(boolean processed)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withSentByThisServer

      public ProxyMessageEvent withSentByThisServer(boolean sentByThisServer)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withServer

      public ProxyMessageEvent withServer(String server)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withName

      public ProxyMessageEvent withName(ModuleName name)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withSender

      public ProxyMessageEvent withSender(FEntity sender)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withUuid

      public ProxyMessageEvent withUuid(UUID uuid)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withPayload

      public ProxyMessageEvent withPayload(byte[] payload)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • 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.
    • cancelled

      public boolean cancelled()
      Returns the value of the cancelled record component.
      Specified by:
      cancelled in interface Event
      Returns:
      the value of the cancelled record component
    • processed

      public boolean processed()
      Returns the value of the processed record component.
      Returns:
      the value of the processed record component
    • sentByThisServer

      public boolean sentByThisServer()
      Returns the value of the sentByThisServer record component.
      Returns:
      the value of the sentByThisServer record component
    • server

      public String server()
      Returns the value of the server record component.
      Returns:
      the value of the server record component
    • name

      public ModuleName name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • sender

      public FEntity sender()
      Returns the value of the sender record component.
      Returns:
      the value of the sender record component
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • payload

      public byte[] payload()
      Returns the value of the payload record component.
      Returns:
      the value of the payload record component