Skip to content

Class endstone::PlayerChatEvent

ClassList > endstone > PlayerChatEvent

Called when a player sends a chat message.

  • #include <endstone/event/player/player_chat_event.h>

Inherits the following classes: endstone::Cancellable

Public Functions

Type Name
ENDSTONE_EVENT (PlayerChatEvent)
PlayerChatEvent (Player & player, std::string message, std::optional< std::vector< Player * > > recipients, std::string format="<{0}> {1}")
std::string getFormat () const
Gets the format to use to display this chat message.
std::string getMessage () const
Gets the message that the player is attempting to send.
std::vector< Player * > getRecipients () const
Gets a set of recipients that this chat message will be displayed to.
void setFormat (std::string format)
Sets the format to use to display this chat message.
void setMessage (std::string message)
Sets the message that the player will send.
void setPlayer (Player & player)
Sets the player that this message will display as.

Public Functions inherited from endstone::Cancellable

See endstone::Cancellable

Type Name
virtual void cancel ()
Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
virtual bool isCancelled () override const
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
virtual void setCancelled (bool cancel) override
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Public Functions inherited from endstone::ICancellable

See endstone::ICancellable

Type Name
virtual void cancel () = 0
virtual bool isCancelled () const = 0
virtual void setCancelled (bool cancel) = 0
virtual ~ICancellable () = default

Public Functions Documentation

function ENDSTONE_EVENT

endstone::PlayerChatEvent::ENDSTONE_EVENT (
    PlayerChatEvent
) 

function PlayerChatEvent

inline explicit endstone::PlayerChatEvent::PlayerChatEvent (
    Player & player,
    std::string message,
    std::optional< std::vector< Player * > > recipients,
    std::string format="<{0}> {1}"
) 

function getFormat

Gets the format to use to display this chat message.

inline std::string endstone::PlayerChatEvent::getFormat () const

See the format string syntax

Returns:

format string


function getMessage

Gets the message that the player is attempting to send.

inline std::string endstone::PlayerChatEvent::getMessage () const

Returns:

Message the player is attempting to send


function getRecipients

Gets a set of recipients that this chat message will be displayed to.

inline std::vector< Player * > endstone::PlayerChatEvent::getRecipients () const

Returns:

All Players who will see this chat message


function setFormat

Sets the format to use to display this chat message.

inline void endstone::PlayerChatEvent::setFormat (
    std::string format
) 

Parameters:

  • format format string

function setMessage

Sets the message that the player will send.

inline void endstone::PlayerChatEvent::setMessage (
    std::string message
) 

Parameters:

  • message New message that the player will send

function setPlayer

Sets the player that this message will display as.

inline void endstone::PlayerChatEvent::setPlayer (
    Player & player
) 

Parameters:

  • player New player which this event will execute as


The documentation for this class was generated from the following file include/endstone/event/player/player_chat_event.h