Class PacketClient


  • @Singleton
    public class PacketClient
    extends java.lang.Object
    PacketClient is an instance-based RuneLite client packet sending utility which uses reflection to construct and send low level packets directly to the game servers. Generally you should not use this class directly as it functions at a low level when sending packets.

    Instead, it's recommended to use the higher level API's like MousePackets, WidgetPackets, or NpcPackets for sending game packets to the server based on your specific entity interaction needs (clicking interfaces, NPC's, GameObjects, etc...

    • Constructor Summary

      Constructors 
      Constructor Description
      PacketClient​(net.runelite.api.Client client)
      Creates a new PacketSender.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void sendPacket​(PacketDefinition def, java.lang.Object... objects)
      Constructs and sends a packet to the game server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PacketClient

        @Inject
        public PacketClient​(net.runelite.api.Client client)
        Creates a new PacketSender. This constructor initializes packet queueing functionality by either loading the client packet sending method from the cached json file or running an analysis on the RuneLite injected client to determine the packet sending method.
        Parameters:
        client - The RuneLite Client instance.
    • Method Detail

      • sendPacket

        public void sendPacket​(PacketDefinition def,
                               java.lang.Object... objects)
        Constructs and sends a packet to the game server. This is the primary public method of this class.
        Parameters:
        def - The PacketDefinition enumeration defining the packet structure.
        objects - The data (payload) for the packet, in the order defined by the PacketDefinition.