use of org.dragonet.raknet.protocol.EncapsulatedPacket in project Dragonet-Legacy by DragonetMC.
the class RakNetInterface method sendPacket.
public void sendPacket(String identifier, PEPacket packet, boolean needACK, boolean immediate) {
packet.encode();
byte[] buffer = packet.getData();
if (buffer.length > 1024 && !BatchPacket.class.isAssignableFrom(packet.getClass())) {
BatchPacket batch = new BatchPacket();
batch.packets.add(packet);
sendPacket(identifier, batch, needACK, immediate);
return;
}
EncapsulatedPacket encapsulated = new EncapsulatedPacket();
encapsulated.buffer = buffer;
encapsulated.needACK = needACK;
encapsulated.reliability = needACK ? (byte) 2 : (byte) 3;
encapsulated.messageIndex = 0;
this.handler.sendEncapsulated(identifier, encapsulated, (needACK ? RakNet.FLAG_NEED_ACK : 0) | (immediate ? RakNet.PRIORITY_IMMEDIATE : RakNet.PRIORITY_NORMAL));
}
Aggregations