mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-20 07:19:29 +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:
@@ -67,6 +67,12 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
|
|||||||
session.ensureInEventLoop(() -> {
|
session.ensureInEventLoop(() -> {
|
||||||
byte[] data = packet.getData();
|
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
|
// 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
|
// respond: first and second byte id, remaining is form response data
|
||||||
|
|
||||||
@@ -96,7 +102,6 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
|
|||||||
});
|
});
|
||||||
session.sendForm(form);
|
session.sendForm(form);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (channel.equals(PluginMessageChannels.TRANSFER)) {
|
} else if (channel.equals(PluginMessageChannels.TRANSFER)) {
|
||||||
session.ensureInEventLoop(() -> {
|
session.ensureInEventLoop(() -> {
|
||||||
byte[] data = packet.getData();
|
byte[] data = packet.getData();
|
||||||
|
|||||||
Reference in New Issue
Block a user