Record Class ChatMessageEvent
java.lang.Object
java.lang.Record
com.botwithus.bot.api.event.ChatMessageEvent
- Record Components:
message- the chat message payloadtimestamp- event creation time in milliseconds since epoch
- All Implemented Interfaces:
GameEvent
public record ChatMessageEvent(ChatMessage message, long timestamp)
extends Record
implements GameEvent
Event fired when a chat message is received in the game.
Subscribe to this event via the EventBus to react to chat messages:
eventBus.subscribe(ChatMessageEvent.class, event -> {
ChatMessage msg = event.message();
log.info("{}: {}", msg.playerName(), msg.text());
});
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChatMessageEvent(ChatMessage message) ChatMessageEvent(ChatMessage message, long timestamp) Creates an instance of aChatMessageEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.message()Returns the value of themessagerecord component.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
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. -
message
-
timestamp
-