From 304ad677594775c11412181cc55b88e019d3d7df Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 28 Dec 2010 21:52:08 +0000 Subject: [PATCH] Tweak to PlayerChatEvent, allow plugins to set the player that the chat/command executes as By: Dinnerbone --- .../src/org/bukkit/event/player/PlayerChatEvent.java | 10 ++++++++++ paper-api/src/org/bukkit/event/player/PlayerEvent.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java b/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java index 0f358f550f..d924b5e335 100644 --- a/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java +++ b/paper-api/src/org/bukkit/event/player/PlayerChatEvent.java @@ -52,4 +52,14 @@ public class PlayerChatEvent extends PlayerEvent { public void setMessage(String 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; + } } diff --git a/paper-api/src/org/bukkit/event/player/PlayerEvent.java b/paper-api/src/org/bukkit/event/player/PlayerEvent.java index 87012ea574..2e4ea068a0 100644 --- a/paper-api/src/org/bukkit/event/player/PlayerEvent.java +++ b/paper-api/src/org/bukkit/event/player/PlayerEvent.java @@ -8,7 +8,7 @@ import org.bukkit.event.Event; * Represents a player related event */ public class PlayerEvent extends Event { - private final Player player; + protected Player player; public PlayerEvent(final Event.Type type, final Player who) { super(type);