Record Class MessagePrepareEvent
java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.message.MessagePrepareEvent
- Record Components:
cancelled- whether a listener vetoed the messagemoduleName- the module the message came fromeventMetadata- how the message will be deliveredmessageContext- the message itselfintegrationMessageFormat- the format used when mirroring, or null if not mirroredreceivers- the resolved audience
- All Implemented Interfaces:
Event
public record MessagePrepareEvent(boolean cancelled, @NonNull ModuleName moduleName, @NonNull EventMetadata eventMetadata, @NonNull MessageContext messageContext, @Nullable IntegrationMessageFormat integrationMessageFormat, @NonNull Set<FPlayer> receivers)
extends Record
implements Event
Fired once the receivers are known but before anything is sent, so listeners can still
change the audience, the metadata or the wording.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Event
Event.Priority -
Constructor Summary
ConstructorsConstructorDescriptionMessagePrepareEvent(boolean cancelled, @NonNull ModuleName moduleName, @NonNull EventMetadata eventMetadata, @NonNull MessageContext messageContext, @Nullable IntegrationMessageFormat integrationMessageFormat, @NonNull Set<FPlayer> receivers) Creates an instance of aMessagePrepareEventrecord class.MessagePrepareEvent(ModuleName moduleName, EventMetadata eventMetadata) Creates an event whose context and mirroring format are resolved from the metadata.MessagePrepareEvent(ModuleName moduleName, EventMetadata eventMetadata, MessageContext messageContext, IntegrationMessageFormat integrationMessageFormat) Creates an event that has not been cancelled and whose audience is not resolved yet. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecancelledrecord component.final booleanIndicates whether some other object is "equal to" this one.@NonNull EventMetadataReturns the value of theeventMetadatarecord component.final inthashCode()Returns a hash code value for this object.@Nullable IntegrationMessageFormatReturns the value of theintegrationMessageFormatrecord component.@NonNull MessageContextReturns the value of themessageContextrecord component.@NonNull ModuleNameReturns the value of themoduleNamerecord component.Returns the value of thereceiversrecord component.final StringtoString()Returns a string representation of this record class.withCancelled(boolean cancelled) Returns a copy of this event with the cancelled flag set.withEventMetadata(@NonNull EventMetadata eventMetadata) withIntegrationMessageFormat(@Nullable IntegrationMessageFormat integrationMessageFormat) withMessageContext(@NonNull MessageContext messageContext) withModuleName(@NonNull ModuleName moduleName) withReceivers(@NonNull Set<FPlayer> receivers)
-
Constructor Details
-
MessagePrepareEvent
public MessagePrepareEvent(ModuleName moduleName, EventMetadata eventMetadata, MessageContext messageContext, IntegrationMessageFormat integrationMessageFormat) Creates an event that has not been cancelled and whose audience is not resolved yet.- Parameters:
moduleName- the module the message came fromeventMetadata- how the message will be deliveredmessageContext- the message itselfintegrationMessageFormat- the mirroring format, or null
-
MessagePrepareEvent
Creates an event whose context and mirroring format are resolved from the metadata.- Parameters:
moduleName- the module the message came fromeventMetadata- how the message will be delivered
-
MessagePrepareEvent
public MessagePrepareEvent(boolean cancelled, @NonNull ModuleName moduleName, @NonNull EventMetadata eventMetadata, @NonNull MessageContext messageContext, @Nullable IntegrationMessageFormat integrationMessageFormat, @NonNull Set<FPlayer> receivers) Creates an instance of aMessagePrepareEventrecord class.- Parameters:
cancelled- the value for thecancelledrecord componentmoduleName- the value for themoduleNamerecord componenteventMetadata- the value for theeventMetadatarecord componentmessageContext- the value for themessageContextrecord componentintegrationMessageFormat- the value for theintegrationMessageFormatrecord componentreceivers- the value for thereceiversrecord component
-
-
Method Details
-
withCancelled
Description copied from interface:EventReturns a copy of this event with the cancelled flag set.- Specified by:
withCancelledin interfaceEvent- Parameters:
cancelled- the new cancelled state- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withModuleName
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withEventMetadata
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withMessageContext
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withIntegrationMessageFormat
public MessagePrepareEvent withIntegrationMessageFormat(@Nullable IntegrationMessageFormat integrationMessageFormat) - Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withReceivers
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
cancelled
-
moduleName
Returns the value of themoduleNamerecord component.- Returns:
- the value of the
moduleNamerecord component
-
eventMetadata
Returns the value of theeventMetadatarecord component.- Returns:
- the value of the
eventMetadatarecord component
-
messageContext
Returns the value of themessageContextrecord component.- Returns:
- the value of the
messageContextrecord component
-
integrationMessageFormat
Returns the value of theintegrationMessageFormatrecord component.- Returns:
- the value of the
integrationMessageFormatrecord component
-
receivers
-