Search in sources :

Example 1 with ModalFormRequestPacket

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

the class BedrockPlayer method sendForm.

// NOT SUPPORTED YET
/* public void setPacketSubscription(Class<? extends PEPacket> clazz, boolean sub) {
        if(clazz.equals(PEPacket.class)) throw new IllegalArgumentException();
        BinaryStream bis = new BinaryStream();
        bis.putString("PacketSubscription");
        bis.putString(clazz.getSimpleName());
        bis.putBoolean(sub);
        player.sendPluginMessage(DPAddonBukkit.getInstance(), "DragonProxy", bis.getBuffer());
    } */
public void sendForm(int formId, ModalFormComponent form) {
    String formData = form.serializeToJson().toString();
    ModalFormRequestPacket request = new ModalFormRequestPacket();
    request.formId = formId;
    request.formData = formData;
    request.encode();
    BinaryStream bis = new BinaryStream();
    bis.putString("SendPacket");
    bis.putByteArray(request.getBuffer());
    player.sendPluginMessage(DPAddonBukkit.getInstance(), "DragonProxy", bis.getBuffer());
}
Also used : BinaryStream(org.dragonet.common.utilities.BinaryStream) ModalFormRequestPacket(org.dragonet.protocol.packets.ModalFormRequestPacket)

Aggregations

BinaryStream (org.dragonet.common.utilities.BinaryStream)1 ModalFormRequestPacket (org.dragonet.protocol.packets.ModalFormRequestPacket)1