Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Fix sending forms with floodgate for 1.19.20 (#3217)
* Fix sending forms with floodgate * Comment about 1.19.20 * Swapped if-else Co-authored-by: Tim203 <mctim203@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
25a18a2e4f
Commit
ab2b79485b
@ -72,12 +72,19 @@ public class JavaCustomPayloadTranslator extends PacketTranslator<ClientboundCus
|
|||||||
String dataString = new String(data, 3, data.length - 3, Charsets.UTF_8);
|
String dataString = new String(data, 3, data.length - 3, Charsets.UTF_8);
|
||||||
|
|
||||||
Form form = Forms.fromJson(dataString, type, (ignored, response) -> {
|
Form form = Forms.fromJson(dataString, type, (ignored, response) -> {
|
||||||
|
byte[] finalData;
|
||||||
|
if (response == null) {
|
||||||
|
// Response data can be null as of 1.19.20 (same behaviour as empty response data)
|
||||||
|
// Only need to send the form id
|
||||||
|
finalData = new byte[]{data[1], data[2]};
|
||||||
|
} else {
|
||||||
byte[] raw = response.getBytes(StandardCharsets.UTF_8);
|
byte[] raw = response.getBytes(StandardCharsets.UTF_8);
|
||||||
byte[] finalData = new byte[raw.length + 2];
|
finalData = new byte[raw.length + 2];
|
||||||
|
|
||||||
finalData[0] = data[1];
|
finalData[0] = data[1];
|
||||||
finalData[1] = data[2];
|
finalData[1] = data[2];
|
||||||
System.arraycopy(raw, 0, finalData, 2, raw.length);
|
System.arraycopy(raw, 0, finalData, 2, raw.length);
|
||||||
|
}
|
||||||
|
|
||||||
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, finalData));
|
session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, finalData));
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren