Skip to content

Commit

Permalink
Implemented a way to close forms from floodgate (#5247)
Browse files Browse the repository at this point in the history
* feat: send close form packet when receiving empty form data

* use session#closeForm

---------

Co-authored-by: Roch Blonndiaux <contact@roch-blondiaux.com>
Co-authored-by: onebeastchris <github@onechris.mozmail.com>
  • Loading branch information
3 people authored Feb 11, 2025
1 parent b96f915 commit c98796a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public void translate(GeyserSession session, ClientboundCustomPayloadPacket pack
session.ensureInEventLoop(() -> {
byte[] data = packet.getData();

// If the data is empty, we just need to close the form
if (data.length == 0) {
session.closeForm();
return;
}

// receive: first byte is form type, second and third are the id, remaining is the form data
// respond: first and second byte id, remaining is form response data

Expand Down Expand Up @@ -96,7 +102,6 @@ public void translate(GeyserSession session, ClientboundCustomPayloadPacket pack
});
session.sendForm(form);
});

} else if (channel.equals(PluginMessageChannels.TRANSFER)) {
session.ensureInEventLoop(() -> {
byte[] data = packet.getData();
Expand Down

0 comments on commit c98796a

Please # to comment.