public class AsyncMarker extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<AsyncMarker>
Asynchronous listeners can use this to set packet timeout or transmission order.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SENDING_DELTA
Default number of packets to skip.
|
static int |
DEFAULT_TIMEOUT_DELTA
Default number of milliseconds until a packet will rejected.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(AsyncMarker o) |
long |
getInitialTime()
Retrieve the time the packet was initially queued for asynchronous processing.
|
java.util.Iterator<PrioritizedListener<AsyncListenerHandler>> |
getListenerTraversal()
Retrieve iterator for the next listener in line.
|
long |
getNewSendingIndex()
Retrieve the desired sending order after processing has completed.
|
long |
getOriginalSendingIndex()
Retrieve the order the packet was originally transmitted.
|
PacketStream |
getPacketStream()
Retrieve the packet stream responsible for transmitting this packet.
|
long |
getTimeout()
Retrieve the time the packet will be forcefully rejected.
|
boolean |
hasExpired()
Determine if this packet has expired.
|
boolean |
hasExpired(long currentTime)
Determine if this packet has expired given this time.
|
boolean |
isAsyncCancelled()
Determine if the asynchronous handling should be cancelled.
|
boolean |
isMinecraftAsync(PacketEvent event)
Determine if Minecraft allows asynchronous processing of this packet.
|
boolean |
isProcessed()
Retrieve whether or not this packet has been processed by the async listeners.
|
boolean |
isTransmitted()
Retrieve whether or not this packet has already been sent.
|
void |
sendPacket(PacketEvent event)
Transmit a given packet to the current packet stream.
|
void |
setAsyncCancelled(boolean asyncCancelled)
Set whether or not the asynchronous handling should be cancelled.
|
void |
setNewSendingIndex(long newSendingIndex)
Sets the desired sending order after processing has completed.
|
void |
setPacketStream(PacketStream packetStream)
Sets the output packet stream responsible for transmitting this packet.
|
void |
setTimeout(long timeout)
Set the time the packet will be forcefully rejected.
|
public static final int DEFAULT_TIMEOUT_DELTA
public static final int DEFAULT_SENDING_DELTA
public long getInitialTime()
public long getTimeout()
public void setTimeout(long timeout)
timeout
- - time to reject the packet, in milliseconds since 01.01.1970 00:00.public long getOriginalSendingIndex()
public long getNewSendingIndex()
Higher sending order means lower priority.
public void setNewSendingIndex(long newSendingIndex)
Higher sending order means lower priority.
newSendingIndex
- - new packet send index.public PacketStream getPacketStream()
public void setPacketStream(PacketStream packetStream)
packetStream
- - new output packet stream.public boolean isProcessed()
public boolean isTransmitted()
public boolean hasExpired()
public boolean hasExpired(long currentTime)
currentTime
- - the current time in milliseconds since 01.01.1970 00:00.public boolean isAsyncCancelled()
public void setAsyncCancelled(boolean asyncCancelled)
asyncCancelled
- - TRUE to cancel it, FALSE otherwise.public java.util.Iterator<PrioritizedListener<AsyncListenerHandler>> getListenerTraversal()
public void sendPacket(PacketEvent event) throws java.io.IOException
event
- - the packet to send.java.io.IOException
- If the packet couldn't be sent.public boolean isMinecraftAsync(PacketEvent event) throws FieldAccessException
FieldAccessException
public int compareTo(AsyncMarker o)
compareTo
in interface java.lang.Comparable<AsyncMarker>