Search in sources :

Example 1 with WrappedPEPacket

use of org.dragonet.protocol.WrappedPEPacket in project DragonProxy by DragonetMC.

the class PCPluginMessagePacketTranslator method translate.

@Override
public PEPacket[] translate(UpstreamSession session, ServerPluginMessagePacket packet) {
    if (packet.getChannel().equals("DragonProxy")) {
        BinaryStream bis = new BinaryStream(packet.getData());
        String command = bis.getString();
        if (command.equals("PacketForward")) {
            boolean enabled = bis.getBoolean();
            session.getPacketProcessor().setPacketForwardMode(enabled);
        } else if (command.equals("SendPacket")) {
            WrappedPEPacket wrapped = new WrappedPEPacket(bis.getByteArray());
            session.sendPacket(wrapped);
        }
        return null;
    }
    return null;
}
Also used : BinaryStream(org.dragonet.common.utilities.BinaryStream) WrappedPEPacket(org.dragonet.protocol.WrappedPEPacket)

Aggregations

BinaryStream (org.dragonet.common.utilities.BinaryStream)1 WrappedPEPacket (org.dragonet.protocol.WrappedPEPacket)1