mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 11:35:18 +01:00
Only soft fail CUSTOM_PAYLOAD content reading (#3873)
Reading of the channel shouldn't be soft failed as the game code only try catches content reading
This commit is contained in:
parent
01589b3c49
commit
9b1c97919c
@ -81,10 +81,14 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol<ClientboundPack
|
|||||||
registerClientbound(ClientboundPackets1_19_4.CUSTOM_PAYLOAD, new PacketHandlers() {
|
registerClientbound(ClientboundPackets1_19_4.CUSTOM_PAYLOAD, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
protected void register() {
|
protected void register() {
|
||||||
|
map(Types.STRING); // Channel
|
||||||
handlerSoftFail(Protocol1_20To1_20_2::sanitizeCustomPayload);
|
handlerSoftFail(Protocol1_20To1_20_2::sanitizeCustomPayload);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerServerbound(ServerboundPackets1_20_2.CUSTOM_PAYLOAD, Protocol1_20To1_20_2::sanitizeCustomPayload);
|
registerServerbound(ServerboundPackets1_20_2.CUSTOM_PAYLOAD, wrapper -> {
|
||||||
|
wrapper.passthrough(Types.STRING); // Channel
|
||||||
|
sanitizeCustomPayload(wrapper);
|
||||||
|
});
|
||||||
|
|
||||||
registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> {
|
registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> {
|
||||||
final String url = wrapper.passthrough(Types.STRING);
|
final String url = wrapper.passthrough(Types.STRING);
|
||||||
@ -205,7 +209,7 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol<ClientboundPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void sanitizeCustomPayload(final PacketWrapper wrapper) {
|
private static void sanitizeCustomPayload(final PacketWrapper wrapper) {
|
||||||
final String channel = Key.namespaced(wrapper.passthrough(Types.STRING));
|
final String channel = Key.namespaced(wrapper.get(Types.STRING, 0));
|
||||||
if (channel.equals("minecraft:brand")) {
|
if (channel.equals("minecraft:brand")) {
|
||||||
wrapper.passthrough(Types.STRING);
|
wrapper.passthrough(Types.STRING);
|
||||||
wrapper.clearInputBuffer();
|
wrapper.clearInputBuffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user