Record Class MessageReceiveEvent
java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.message.MessageReceiveEvent
- Record Components:
cancelled- whether a listener suppressed the messageplayer- the receiving playercomponent- the messageoverlay- whether it is drawn over the hotbar instead of in chat
- All Implemented Interfaces:
Event
-
Nested Class Summary
Nested classes/interfaces inherited from interface Event
Event.Priority -
Constructor Summary
ConstructorsConstructorDescriptionMessageReceiveEvent(boolean cancelled, FPlayer player, net.kyori.adventure.text.Component component, boolean overlay) Creates an instance of aMessageReceiveEventrecord class.MessageReceiveEvent(FPlayer fPlayer, net.kyori.adventure.text.Component component, boolean overlay) Creates an event that has not been cancelled. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecancelledrecord component.net.kyori.adventure.text.ComponentReturns the value of thecomponentrecord component.final booleanIndicates whether some other object is "equal to" this one.net.kyori.adventure.text.TranslatableComponentThe message as a translatable component, which vanilla messages usually are.final inthashCode()Returns a hash code value for this object.booleanoverlay()Returns the value of theoverlayrecord component.player()Returns the value of theplayerrecord 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.withComponent(net.kyori.adventure.text.Component component) withOverlay(boolean overlay) withPlayer(FPlayer player)
-
Constructor Details
-
MessageReceiveEvent
public MessageReceiveEvent(FPlayer fPlayer, net.kyori.adventure.text.Component component, boolean overlay) Creates an event that has not been cancelled.- Parameters:
fPlayer- the receiving playercomponent- the messageoverlay- whether it is drawn over the hotbar
-
MessageReceiveEvent
public MessageReceiveEvent(boolean cancelled, FPlayer player, net.kyori.adventure.text.Component component, boolean overlay) Creates an instance of aMessageReceiveEventrecord class.
-
-
Method Details
-
getTranslatableComponent
public net.kyori.adventure.text.TranslatableComponent getTranslatableComponent()The message as a translatable component, which vanilla messages usually are.- Returns:
- the translatable component, or null if the message is not translatable
-
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).
-
withPlayer
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withComponent
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withOverlay
- 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
-
player
-
component
-
overlay
-