Archiviert
13
0

Adding desperately needed async/sync documentation.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-09-19 03:48:46 +02:00
Ursprung 77376a2fa3
Commit bc7b395889
3 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -31,6 +31,8 @@ public interface PacketListener {
* Invoked right before a packet is transmitted from the server to the client. * Invoked right before a packet is transmitted from the server to the client.
* <p> * <p>
* Note that the packet may be replaced, if needed. * 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. * @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. * 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. * @param event - the packet that has been recieved.
*/ */
public void onPacketReceiving(PacketEvent event); public void onPacketReceiving(PacketEvent event);

Datei anzeigen

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