Implement new AsyncPlayerChatEvent. Addresses BUKKIT-2064

Added two utility collections for use with PlayerChatEvents allowing lazier
initialization of events and less need to synchronize against the player
list.

Provided a hidden queue system for similar logic to pre-1.3 chat. When a
plugin is listening for the deprecated PlayerChatEvent, all chat will be
delayed to be mirror executed from the main thread. All developers are
encouraged to immediately update to the developmental Bukkit chat API as a
minimum transition for server stability.

Additionally, changes were required to bring thread-safety to the flow
logic. CopyOnWriteArrayList is the only viable means to produce thread
safety with minimal diff; using a sane pre-implemented collection would
require reworking of sections of NMS logic.

As a minor change, implemented expected functionality for
PlayerCommandPreProcessEvent. Setting the player should now change the
player executing the command.

By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
CraftBukkit/Spigot
2012-08-03 06:24:55 -05:00
parent a1a672d052
commit 7383d52df7
3 changed files with 124 additions and 1 deletions

View File

@@ -229,7 +229,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void chat(String msg) {
if (getHandle().netServerHandler == null) return;
getHandle().netServerHandler.chat(msg);
getHandle().netServerHandler.chat(msg, false);
}
public boolean performCommand(String command) {