diff --git a/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java b/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java index 2d63700b..87062685 100644 --- a/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java +++ b/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java @@ -138,6 +138,9 @@ public interface ProtocolManager { /** * Completely refresh all clients about an entity. + *

+ * Note that this method is NOT thread safe. If you call this method from anything + * but the main thread, it will throw an exception. * @param entity - entity to refresh. * @param observers - the clients to update. */ diff --git a/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java b/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java index 7594686b..f20b05c4 100644 --- a/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java +++ b/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java @@ -31,6 +31,8 @@ public interface PacketListener { * Invoked right before a packet is transmitted from the server to the client. *

* Note that the packet may be replaced, if needed. + *

+ * This method is executed on the main thread, and thus the Bukkit API is safe to use. * * @param event - the packet that should be sent. */ @@ -38,6 +40,11 @@ public interface PacketListener { /** * Invoked right before a recieved packet from a client is being processed. + *

+ * WARNING:
+ * This method will be called asynchronously! You should synchronize with the main + * thread using {@link org.bukkit.scheduler.BukkitScheduler#scheduleSyncDelayedTask(Plugin, Runnable, long) scheduleSyncDelayedTask} + * if you need to call the Bukkit API. * @param event - the packet that has been recieved. */ public void onPacketReceiving(PacketEvent event); diff --git a/ProtocolLib/src/com/comphenix/protocol/injector/PacketFilterManager.java b/ProtocolLib/src/com/comphenix/protocol/injector/PacketFilterManager.java index 8b331ddb..cd380899 100644 --- a/ProtocolLib/src/com/comphenix/protocol/injector/PacketFilterManager.java +++ b/ProtocolLib/src/com/comphenix/protocol/injector/PacketFilterManager.java @@ -343,6 +343,8 @@ public final class PacketFilterManager implements ProtocolManager { @Override public void updateEntity(Entity entity, List observers) throws FieldAccessException { + + EntityUtilities.updateEntity(entity, observers); }