Interface PacketInjector
- All Known Implementing Classes:
AbstractPacketInjector
public interface PacketInjector
Represents an incoming packet injector.
- Author:
- Kristian
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPacketHandler(PacketType type, Set<ListenerOptions> options)Start intercepting packets with the given packet type.voidPerform any necessary cleanup before unloading ProtocolLib.Retrieve every intercepted packet type.booleanhasPacketHandler(PacketType type)Determine if packets with the given packet type is being intercepted.voidinputBuffersChanged(Set<PacketType> set)Invoked when input buffers have changed.booleanisCancelled(Object packet)Determine if a packet is cancelled or not.packetRecieved(PacketContainer packet, org.bukkit.entity.Player client, byte[] buffered)Let the packet listeners process the given packet.booleanremovePacketHandler(PacketType type)Stop intercepting packets with the given packet type.voidsetCancelled(Object packet, boolean cancelled)Set whether or not a packet is cancelled.
-
Method Details
-
isCancelled
Determine if a packet is cancelled or not.- Parameters:
packet- - the packet to check.- Returns:
- TRUE if it is, FALSE otherwise.
-
setCancelled
Set whether or not a packet is cancelled.- Parameters:
packet- - the packet to set.cancelled- - TRUE to cancel the packet, FALSE otherwise.
-
addPacketHandler
Start intercepting packets with the given packet type.- Parameters:
type- - the type of the packets to start intercepting.options- - any listener options.- Returns:
- TRUE if we didn't already intercept these packets, FALSE otherwise.
-
removePacketHandler
Stop intercepting packets with the given packet type.- Parameters:
type- - the type of the packets to stop intercepting.- Returns:
- TRUE if we successfuly stopped intercepting a given packet ID, FALSE otherwise.
-
hasPacketHandler
Determine if packets with the given packet type is being intercepted.- Parameters:
type- - the packet type to lookup.- Returns:
- TRUE if we do, FALSE otherwise.
-
inputBuffersChanged
Invoked when input buffers have changed.- Parameters:
set- - the new set of packets that require the read buffer.
-
getPacketHandlers
Set<PacketType> getPacketHandlers()Retrieve every intercepted packet type.- Returns:
- Every intercepted packet type.
-
packetRecieved
PacketEvent packetRecieved(PacketContainer packet, org.bukkit.entity.Player client, byte[] buffered)Let the packet listeners process the given packet.- Parameters:
packet- - a packet to process.client- - the client that sent the packet.buffered- - a buffer containing the data that had to be read in order to construct the packet.- Returns:
- The resulting packet event.
-
cleanupAll
void cleanupAll()Perform any necessary cleanup before unloading ProtocolLib.
-