public interface AsynchronousManager
Modifier and Type | Method and Description |
---|---|
void |
cleanupAll()
Remove listeners, close threads and transmit every delayed packet.
|
ErrorReporter |
getErrorReporter()
Retrieve the default error reporter.
|
PacketStream |
getPacketStream()
Retrieve the default packet stream.
|
java.util.Set<java.lang.Integer> |
getReceivingFilters()
Retrieves a immutable set containing the ID of the recieved client packets that will be
observed by the asynchronous listeners.
|
java.util.Set<java.lang.Integer> |
getSendingFilters()
Retrieves a immutable set containing the ID of the sent server packets that will be
observed by the asynchronous listeners.
|
java.util.Set<PacketListener> |
getTimeoutHandlers()
Get a immutable list of every registered timeout handler.
|
boolean |
hasAsynchronousListeners(PacketEvent packet)
Determine if a given synchronous packet has asynchronous listeners.
|
AsyncListenerHandler |
registerAsyncHandler(PacketListener listener)
Registers an asynchronous packet handler.
|
void |
registerTimeoutHandler(PacketListener listener)
Register a synchronous listener that handles packets when they time out.
|
void |
signalPacketTransmission(PacketEvent packet)
Signal that a packet is ready to be transmitted.
|
void |
unregisterAsyncHandler(AsyncListenerHandler handler)
Unregisters and closes the given asynchronous handler.
|
void |
unregisterAsyncHandlers(org.bukkit.plugin.Plugin plugin)
Unregisters every asynchronous handler associated with this plugin.
|
void |
unregisterTimeoutHandler(PacketListener listener)
Unregisters a given timeout listener.
|
AsyncListenerHandler registerAsyncHandler(PacketListener listener)
Use AsyncMarker.incrementProcessingDelay()
to delay a packet until its ready to be transmitted.
To start listening asynchronously, pass the getListenerLoop() runnable to a different thread.
listener
- - the packet listener that will recieve these asynchronous events.void unregisterAsyncHandler(AsyncListenerHandler handler)
handler
- - asynchronous handler.void unregisterAsyncHandlers(org.bukkit.plugin.Plugin plugin)
plugin
- - the original plugin.java.util.Set<java.lang.Integer> getSendingFilters()
java.util.Set<java.lang.Integer> getReceivingFilters()
boolean hasAsynchronousListeners(PacketEvent packet)
packet
- - packet to test.PacketStream getPacketStream()
ErrorReporter getErrorReporter()
void cleanupAll()
void signalPacketTransmission(PacketEvent packet)
This should only be called if AsyncMarker.incrementProcessingDelay()
has been called previously.
packet
- - packet to signal.void registerTimeoutHandler(PacketListener listener)
listener
- - synchronous listener that will handle timed out packets.void unregisterTimeoutHandler(PacketListener listener)
listener
- - the timeout listener to unregister.java.util.Set<PacketListener> getTimeoutHandlers()