Package com.comphenix.protocol.events
Class NetworkMarker
java.lang.Object
com.comphenix.protocol.events.NetworkMarker
Marker containing the serialized packet data seen from the network, or output handlers that will serialize the
current packet.
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkMarker(ConnectionSide side, PacketType type) Construct a new network marker. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPostListener(PacketPostListener listener) Add a listener that is invoked after a packet has been successfully sent to the client, or received by the server.static NetworkMarkergetNetworkMarker(PacketEvent event) Retrieve the network marker of a particular event without creating it.Retrieve an immutable view of all the listeners that will be invoked once the packet has been sent or received.Retrieve a modifiable queue of packets that will be schedule (in-order) when the current packet has been successfully transmitted.getSide()Retrieve whether or not this marker belongs to a client or a server side packet.getType()static booleanhasPostListeners(NetworkMarker marker) Determine if the given marker has any post listeners.static Deque<ScheduledPacket> readScheduledPackets(NetworkMarker marker) Retrieve the scheduled packets of a particular network marker without constructing the list.booleanremovePostListener(PacketPostListener listener) Remove the first instance of the given listener.
-
Constructor Details
-
NetworkMarker
Construct a new network marker.The input buffer is only non-null for client-side packets.
- Parameters:
side- - which side this marker belongs to.type- - packet type
-
-
Method Details
-
hasPostListeners
Determine if the given marker has any post listeners.- Parameters:
marker- - the marker to check.- Returns:
- TRUE if it does, FALSE otherwise.
-
getNetworkMarker
Retrieve the network marker of a particular event without creating it.This is an internal method that should not be used by API users.
- Parameters:
event- - the event.- Returns:
- The network marker.
-
readScheduledPackets
Retrieve the scheduled packets of a particular network marker without constructing the list.This is an internal method that should not be used by API users.
- Parameters:
marker- - the marker.- Returns:
- The list, or NULL if not found or initialized.
-
getSide
Retrieve whether or not this marker belongs to a client or a server side packet.- Returns:
- The side the parent packet belongs to.
-
getType
-
addPostListener
Add a listener that is invoked after a packet has been successfully sent to the client, or received by the server.Received packets are not guarenteed to have been fully processed, but packets passed to
PacketStream.receiveClientPacket(Player, PacketContainer)will be processed after the current packet event.Note that post listeners will be executed asynchronously off the main thread. They are not executed in any defined order.
- Parameters:
listener- - the listener that will be invoked.- Returns:
- TRUE if it was added.
-
removePostListener
Remove the first instance of the given listener.- Parameters:
listener- - listener to remove.- Returns:
- TRUE if it was removed, FALSE otherwise.
-
getPostListeners
Retrieve an immutable view of all the listeners that will be invoked once the packet has been sent or received.- Returns:
- Every post packet listener. Never NULL.
-
getScheduledPackets
Retrieve a modifiable queue of packets that will be schedule (in-order) when the current packet has been successfully transmitted.- Returns:
- the queue of packets to schedule after this packet, in order.
-