Tweak to PlayerChatEvent, allow plugins to set the player that the chat/command executes as

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2010-12-28 21:52:08 +00:00
parent b63f46250a
commit 304ad67759
2 changed files with 11 additions and 1 deletions

View file

@ -52,4 +52,14 @@ public class PlayerChatEvent extends PlayerEvent {
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;
} }
/**
* Sets the player that this message will display as, or command will be
* executed as
*
* @param player New player which this event will execute as
*/
public void setPlayer(final Player player) {
this.player = player;
}
} }

View file

@ -8,7 +8,7 @@ import org.bukkit.event.Event;
* Represents a player related event * Represents a player related event
*/ */
public class PlayerEvent extends Event { public class PlayerEvent extends Event {
private final Player player; protected Player player;
public PlayerEvent(final Event.Type type, final Player who) { public PlayerEvent(final Event.Type type, final Player who) {
super(type); super(type);