Package com.kraken.api.core.interceptor
Class PacketInterceptor
- java.lang.Object
-
- com.kraken.api.core.interceptor.PacketInterceptor
-
@Singleton public class PacketInterceptor extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPacketInterceptor.PacketHookAdviceThe Advice class injected directly into "addNode".
-
Field Summary
Fields Modifier and Type Field Description net.runelite.api.Clientclientstatic net.runelite.client.eventbus.EventBuseventBusbooleaninjectedstatic PacketInterceptorinstance
-
Constructor Summary
Constructors Constructor Description PacketInterceptor(net.runelite.api.Client client)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EncodedPacketanalyzePacket(java.lang.Object packetBufferNode)Extracts the encrypted Packet id (not opcode), size, and byte array payload from the PacketBufferNode.voidinjectHook()Modifies the bytecode of the "addNode" method within the client at runtime to invoke thePacketInterceptor.PacketHookAdviceclass whenever the method is called.
-
-
-
Field Detail
-
eventBus
public static final net.runelite.client.eventbus.EventBus eventBus
-
instance
public static PacketInterceptor instance
-
injected
public boolean injected
-
client
public net.runelite.api.Client client
-
-
Method Detail
-
injectHook
public void injectHook() throws java.lang.ExceptionModifies the bytecode of the "addNode" method within the client at runtime to invoke thePacketInterceptor.PacketHookAdviceclass whenever the method is called. This will publish thePacketSentevent to the eventbus which can beSubscribeto within plugins who need access to low level packets.- Throws:
java.lang.Exception- Throws an Illegal state exception if the hook is not able to be injected.
-
analyzePacket
public static EncodedPacket analyzePacket(java.lang.Object packetBufferNode)
Extracts the encrypted Packet id (not opcode), size, and byte array payload from the PacketBufferNode.- Parameters:
packetBufferNode- The packet buffer node object.- Returns:
- EncodedPacket The encoded packet, containing the id (not opcode), size, and byte array payload.
-
-