Sending/Intercepting Packets

SimplePacketOperations.java
@name("Simple Packet Operations")
@author("Author")
@description("Simple Packet Operations Addon")

public void onPacketEvent(StitchPacketEvent event) {
    // modify the C0FPacketConfirmTransaction before the client sends it to the server
    // additionally send a C03PacketPlayer to the server
    if (event.getPacket() instanceof C0FPacketConfirmTransaction packet) {
        packet.uid = 0;
        packet.windowId = 0;
        packet.accepted = false;
    
        mc.getNetHandler().addToSendQueue(new C03PacketPlayer(true));
    }
    
    // cancel C00PacketKeepAlive from being sent
    if (event.getPacket() instanceof C00PacketKeepAlive) {
        event.cancel();
    }
}

Last updated