1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-19 14:59:27 +00:00

Implemented a way to close forms from floodgate (#5247)

* 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>
This commit is contained in:
Roch Blondiaux
2025-02-11 18:03:31 +01:00
committed by GitHub
parent b96f9157e9
commit c98796aeb6

View File

@@ -67,6 +67,12 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
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
@@ -96,7 +102,6 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
});
session.sendForm(form);
});
} else if (channel.equals(PluginMessageChannels.TRANSFER)) {
session.ensureInEventLoop(() -> {
byte[] data = packet.getData();