PlayerChatEvent

Called when a player sends a chat message

Constructors

this
this(Player player, string message)
Undocumented in source.

Members

Mixins

__anonymous
mixin Cancellable.Implementation
Undocumented in source.
__anonymous
mixin PlayerEvent.Implementation
Undocumented in source.

Variables

format
string delegate(string, string) format;
Undocumented in source.
message
string message;
Undocumented in source.

Mixed In Members

From mixin Cancellable.Implementation

cancel
void cancel()
Undocumented in source. Be warned that the author may not have intended to support it.
cancelled
bool cancelled [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

From mixin PlayerEvent.Implementation

player
Player player [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
world
World world [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From PlayerEvent

player
Player player [@property getter]
Undocumented in source.
Implementation
mixintemplate Implementation()
Undocumented in source.

From Cancellable

cancel
void cancel()

Cancels the event. A cancelled event is not propagated further to the next listeners, if there's any.

cancelled
bool cancelled [@property getter]
canceled
alias canceled = cancelled

Indicates whether the event has been cancelled. A cancelled event cannot be uncancelled.

Implementation
mixintemplate Implementation()
Undocumented in source.
FinalImplementation
mixintemplate FinalImplementation()
Undocumented in source.

Examples

public @event void chat(PlayerChatEvent event) {

   // <player> message
   event.format = (string name, string message){ return "<" ~ name ~ "> " ~ message; };

   // player: message
   event.format = (string name, string message){ return name ~ ": " ~ message; };

   // replace bad words
   event.message = event.message.replaceAll(ctRegex!("fuck", "i"), "f**k");
   
}

Meta