Class PlayerChatEvent
java.lang.Object
com.velocitypowered.api.event.player.PlayerChatEvent
- All Implemented Interfaces:
ResultedEvent<PlayerChatEvent.ChatResult>
@AwaitingEvent
public final class PlayerChatEvent
extends Object
implements ResultedEvent<PlayerChatEvent.ChatResult>
This event is fired when a player types in a chat message. Velocity will wait on this event
to finish firing before forwarding it to the server, if the result allows it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents the result of thePlayerChatEvent.Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result -
Constructor Summary
ConstructorsConstructorDescriptionPlayerChatEvent(Player player, String message) Constructs a PlayerChatEvent. -
Method Summary
Modifier and TypeMethodDescriptionGets the (possibly modified) chat message to be sent.Gets the player who sent the chat message.Returns the result associated with this event.voidsetResult(PlayerChatEvent.ChatResult result) Deprecated.for 1.19.1 and newer, set this as denied will kick userstoString()
-
Constructor Details
-
PlayerChatEvent
Constructs a PlayerChatEvent.- Parameters:
player- the player sending the messagemessage- the message being sent
-
-
Method Details
-
getPlayer
Gets the player who sent the chat message.- Returns:
- the player who sent the message
-
getMessage
Gets the (possibly modified) chat message to be sent.- Returns:
- an
Optionalcontaining the message, or empty if none
-
getResult
Description copied from interface:ResultedEventReturns the result associated with this event.- Specified by:
getResultin interfaceResultedEvent<PlayerChatEvent.ChatResult>- Returns:
- the result of this event
-
setResult
Deprecated.for 1.19.1 and newer, set this as denied will kick usersSet result for the event.- Specified by:
setResultin interfaceResultedEvent<PlayerChatEvent.ChatResult>- Parameters:
result- the result of event
-
toString
-