Search in sources :

Example 1 with BatchPacket

use of org.dragonet.protocol.packets.BatchPacket in project DragonProxy by DragonetMC.

the class UpstreamSession method sendAllPackets.

public void sendAllPackets(PEPacket[] packets, boolean high_priority) {
    if (// <- this disable batched packets
    packets.length < 5 || true)
        for (PEPacket packet : packets) sendPacket(packet, high_priority);
    else {
        BatchPacket batchPacket = new BatchPacket();
        // System.out.println("BatchPacket :");
        for (PEPacket packet : packets) // System.out.println(" - " + packet.getClass().getSimpleName());
        if (high_priority) {
            batchPacket.packets.add(packet);
            break;
        }
        sendPacket(batchPacket, high_priority);
    }
}
Also used : BatchPacket(org.dragonet.protocol.packets.BatchPacket) PEPacket(org.dragonet.protocol.PEPacket)

Aggregations

PEPacket (org.dragonet.protocol.PEPacket)1 BatchPacket (org.dragonet.protocol.packets.BatchPacket)1