public interface AsynchronousManager
Modifier and Type | Method and Description |
---|---|
void |
cleanupAll()
Remove listeners, close threads and transmit every delayed packet.
|
java.util.Set<PacketListener> |
getAsyncHandlers()
Get an immutable set of every registered asynchronous packet listener.
|
ErrorReporter |
getErrorReporter()
Retrieve the default error reporter.
|
PacketStream |
getPacketStream()
Retrieve the default packet stream.
|
java.util.Set<java.lang.Integer> |
getReceivingFilters()
Deprecated.
|
java.util.Set<PacketType> |
getReceivingTypes()
Retrieves a immutable set containing the types of the received client packets that will be
observed by the asynchronous listeners.
|
java.util.Set<java.lang.Integer> |
getSendingFilters()
Deprecated.
|
java.util.Set<PacketType> |
getSendingTypes()
Retrieves a immutable set containing the types of the sent server packets that will be
observed by the asynchronous listeners.
|
java.util.Set<PacketListener> |
getTimeoutHandlers()
Get a immutable set 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 receive these asynchronous events.void unregisterAsyncHandler(AsyncListenerHandler handler)
handler
- - asynchronous handler.void unregisterAsyncHandlers(org.bukkit.plugin.Plugin plugin)
plugin
- - the original plugin.@Deprecated java.util.Set<java.lang.Integer> getSendingFilters()
Deprecated: Use getSendingTypes()
instead.
java.util.Set<PacketType> getSendingTypes()
@Deprecated java.util.Set<java.lang.Integer> getReceivingFilters()
Deprecated: Use getReceivingTypes()
instead.
observed by the asynchronous listeners.
java.util.Set<PacketType> getReceivingTypes()
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()
java.util.Set<PacketListener> getAsyncHandlers()