Interface PacketInjector
- All Known Implementing Classes:
AbstractPacketInjector
public interface PacketInjector
Represents an incoming packet injector.
-
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.booleanDetermine if we have packet listeners with the given type that must be executed on the main thread.booleanhasPacketHandler(PacketType type) Determine if packets with the given packet type is being intercepted.packetReceived(PacketContainer packet, org.bukkit.entity.Player client) Let the packet listeners process the given packet.booleanStop intercepting packets with the given packet type.
-
Method Details
-
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.
-
getPacketHandlers
Set<PacketType> getPacketHandlers()Retrieve every intercepted packet type.- Returns:
- Every intercepted packet type.
-
packetReceived
Let the packet listeners process the given packet.- Parameters:
packet- - a packet to process.client- - the client that sent the packet.- Returns:
- The resulting packet event.
-
hasMainThreadListener
Determine if we have packet listeners with the given type that must be executed on the main thread.- Parameters:
type- - the packet type.- Returns:
- TRUE if we do, FALSE otherwise.
-
cleanupAll
void cleanupAll()Perform any necessary cleanup before unloading ProtocolLib.
-