Record Class MessageContext

java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.message.context.MessageContext

public record MessageContext(@NonNull Map<MessageFlag, Boolean> flags, @NonNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver, @NonNull FEntity sender, @NonNull FPlayer receiver, @NonNull UUID messageUUID, @NonNull String message, @Nullable String userMessage) extends Record
  • Constructor Details

    • MessageContext

      public MessageContext(@NonNull Map<MessageFlag, Boolean> flags, @NonNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver, @NonNull FEntity sender, @NonNull FPlayer receiver, @NonNull UUID messageUUID, @NonNull String message, @Nullable String userMessage)
      Creates an instance of a MessageContext record class.
      Parameters:
      flags - the value for the flags record component
      tagResolver - the value for the tagResolver record component
      sender - the value for the sender record component
      receiver - the value for the receiver record component
      messageUUID - the value for the messageUUID record component
      message - the value for the message record component
      userMessage - the value for the userMessage record component
  • Method Details

    • addFlag

      @CheckReturnValue public MessageContext addFlag(@NonNull MessageFlag flag, boolean value)
    • addFlags

      @CheckReturnValue public MessageContext addFlags(MessageFlag @NonNull [] flags, boolean @NonNull [] values)
    • addTagResolver

      @CheckReturnValue public MessageContext addTagResolver(@Nullable net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver)
    • addTagResolvers

      @CheckReturnValue public MessageContext addTagResolvers(@NonNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver... resolvers)
    • isFlag

      public boolean isFlag(MessageFlag flag)
    • builder

      public static MessageContext.MessageContextBuilder builder()
    • toBuilder

    • withFlags

      public MessageContext withFlags(@NonNull Map<MessageFlag, Boolean> flags)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withTagResolver

      public MessageContext withTagResolver(@NonNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withSender

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

      public MessageContext withReceiver(@NonNull FPlayer receiver)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withMessageUUID

      public MessageContext withMessageUUID(@NonNull UUID messageUUID)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withMessage

      public MessageContext withMessage(@NonNull String message)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withUserMessage

      public MessageContext withUserMessage(@Nullable String userMessage)
      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. 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.
    • flags

      public @NonNull Map<MessageFlag, Boolean> flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • tagResolver

      public @NonNull net.kyori.adventure.text.minimessage.tag.resolver.TagResolver tagResolver()
      Returns the value of the tagResolver record component.
      Returns:
      the value of the tagResolver record component
    • sender

      public @NonNull FEntity sender()
      Returns the value of the sender record component.
      Returns:
      the value of the sender record component
    • receiver

      public @NonNull FPlayer receiver()
      Returns the value of the receiver record component.
      Returns:
      the value of the receiver record component
    • messageUUID

      public @NonNull UUID messageUUID()
      Returns the value of the messageUUID record component.
      Returns:
      the value of the messageUUID record component
    • message

      public @NonNull String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • userMessage

      public @Nullable String userMessage()
      Returns the value of the userMessage record component.
      Returns:
      the value of the userMessage record component