Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.player.PlayerChatEvent Class Reference
Inheritance diagram for org.bukkit.event.player.PlayerChatEvent:
org.bukkit.event.player.PlayerEvent org.bukkit.event.Cancellable org.bukkit.event.Event

Public Member Functions

 PlayerChatEvent (final Player player, final String message)
 
 PlayerChatEvent (final Player player, final String message, final String format, final Set< Player > recipients)
 
boolean isCancelled ()
 
void setCancelled (boolean cancel)
 
String getMessage ()
 
void setMessage (String message)
 
void setPlayer (final Player player)
 
String getFormat ()
 
void setFormat (final String format)
 
Set< PlayergetRecipients ()
 
HandlerList getHandlers ()
 
- Public Member Functions inherited from org.bukkit.event.player.PlayerEvent
 PlayerEvent (final Player who)
 
final Player getPlayer ()
 
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Static Public Member Functions

static HandlerList getHandlerList ()
 

Additional Inherited Members

- Protected Attributes inherited from org.bukkit.event.player.PlayerEvent
Player player
 

Detailed Description

Holds information for player chat and commands

Deprecated:
This event will fire from the main thread and allows the use of all of the Bukkit API, unlike the AsyncPlayerChatEvent.

Listening to this event forces chat to wait for the main thread which causes delays for chat. AsyncPlayerChatEvent is the encouraged alternative for thread safe implementations.

Definition at line 25 of file PlayerChatEvent.java.

Member Function Documentation

String org.bukkit.event.player.PlayerChatEvent.getFormat ( )

Gets the format to use to display this chat message

Returns
String.Format compatible format string

Definition at line 88 of file PlayerChatEvent.java.

88  {
89  return format;
90  }
String org.bukkit.event.player.PlayerChatEvent.getMessage ( )

Gets the message that the player is attempting to send

Returns
Message the player is attempting to send

Definition at line 59 of file PlayerChatEvent.java.

59  {
60  return message;
61  }
Set<Player> org.bukkit.event.player.PlayerChatEvent.getRecipients ( )

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

Returns
All Players who will see this chat message

Definition at line 114 of file PlayerChatEvent.java.

114  {
115  return recipients;
116  }
boolean org.bukkit.event.player.PlayerChatEvent.isCancelled ( )

Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Returns
true if this event is cancelled

Implements org.bukkit.event.Cancellable.

Definition at line 46 of file PlayerChatEvent.java.

46  {
47  return cancel;
48  }
void org.bukkit.event.player.PlayerChatEvent.setCancelled ( boolean  cancel)

Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Parameters
canceltrue if you wish to cancel this event

Implements org.bukkit.event.Cancellable.

Definition at line 50 of file PlayerChatEvent.java.

50  {
51  this.cancel = cancel;
52  }
void org.bukkit.event.player.PlayerChatEvent.setFormat ( final String  format)

Sets the format to use to display this chat message

Parameters
formatString.Format compatible format string

Definition at line 97 of file PlayerChatEvent.java.

97  {
98  // Oh for a better way to do this!
99  try {
100  String.format(format, player, message);
101  } catch (RuntimeException ex) {
102  ex.fillInStackTrace();
103  throw ex;
104  }
105 
106  this.format = format;
107  }
void org.bukkit.event.player.PlayerChatEvent.setMessage ( String  message)

Sets the message that the player will send

Parameters
messageNew message that the player will send

Definition at line 68 of file PlayerChatEvent.java.

68  {
69  this.message = message;
70  }
void org.bukkit.event.player.PlayerChatEvent.setPlayer ( final Player  player)

Sets the player that this message will display as, or command will be executed as

Parameters
playerNew player which this event will execute as

Definition at line 78 of file PlayerChatEvent.java.

78  {
79  Validate.notNull(player, "Player cannot be null");
80  this.player = player;
81  }

The documentation for this class was generated from the following file: