Adding desperately needed async/sync documentation.

This commit is contained in:
Kristian S. Stangeland 2012-09-19 03:48:46 +02:00
parent 77376a2fa3
commit bc7b395889
3 changed files with 12 additions and 0 deletions

View File

@ -138,6 +138,9 @@ public interface ProtocolManager {
/**
* Completely refresh all clients about an entity.
* <p>
* 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.
*/

View File

@ -31,6 +31,8 @@ public interface PacketListener {
* Invoked right before a packet is transmitted from the server to the client.
* <p>
* Note that the packet may be replaced, if needed.
* <p>
* 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.
* <p>
* <b>WARNING</b>: </br>
* This method will be called <i>asynchronously</i>! 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);

View File

@ -343,6 +343,8 @@ public final class PacketFilterManager implements ProtocolManager {
@Override
public void updateEntity(Entity entity, List<Player> observers) throws FieldAccessException {
EntityUtilities.updateEntity(entity, observers);
}