mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 01:55:47 +01:00
Always throw on serverbound custom payload errors
Old server versions did suppress exceptions, but that doesn't matter for us
This commit is contained in:
parent
c5756fe45c
commit
01589b3c49
@ -224,7 +224,7 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.STRING); // Channel
|
||||
handlerSoftFail(wrapper -> {
|
||||
handler(wrapper -> {
|
||||
String channel = wrapper.get(Types.STRING, 0);
|
||||
String old = channel;
|
||||
channel = getOldPluginChannelId(channel);
|
||||
|
@ -165,7 +165,7 @@ public class Protocol1_15_2To1_16 extends AbstractProtocol<ClientboundPackets1_1
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.STRING); // Channel
|
||||
handlerSoftFail(wrapper -> {
|
||||
handler(wrapper -> {
|
||||
final String channel = wrapper.get(Types.STRING, 0);
|
||||
final String namespacedChannel = Key.namespaced(channel);
|
||||
if (channel.length() > 32) {
|
||||
|
@ -78,21 +78,13 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol<ClientboundPack
|
||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_19_4.SOUND);
|
||||
soundRewriter.registerSound1_19_3(ClientboundPackets1_19_4.SOUND_ENTITY);
|
||||
|
||||
final PacketHandlers sanitizeCustomPayload = new PacketHandlers() {
|
||||
registerClientbound(ClientboundPackets1_19_4.CUSTOM_PAYLOAD, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Types.STRING); // Channel
|
||||
handlerSoftFail(wrapper -> {
|
||||
final String channel = Key.namespaced(wrapper.get(Types.STRING, 0));
|
||||
if (channel.equals("minecraft:brand")) {
|
||||
wrapper.passthrough(Types.STRING);
|
||||
wrapper.clearInputBuffer();
|
||||
}
|
||||
});
|
||||
handlerSoftFail(Protocol1_20To1_20_2::sanitizeCustomPayload);
|
||||
}
|
||||
};
|
||||
registerClientbound(ClientboundPackets1_19_4.CUSTOM_PAYLOAD, sanitizeCustomPayload);
|
||||
registerServerbound(ServerboundPackets1_20_2.CUSTOM_PAYLOAD, sanitizeCustomPayload);
|
||||
});
|
||||
registerServerbound(ServerboundPackets1_20_2.CUSTOM_PAYLOAD, Protocol1_20To1_20_2::sanitizeCustomPayload);
|
||||
|
||||
registerClientbound(ClientboundPackets1_19_4.RESOURCE_PACK, wrapper -> {
|
||||
final String url = wrapper.passthrough(Types.STRING);
|
||||
@ -212,6 +204,14 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol<ClientboundPack
|
||||
});
|
||||
}
|
||||
|
||||
private static void sanitizeCustomPayload(final PacketWrapper wrapper) {
|
||||
final String channel = Key.namespaced(wrapper.passthrough(Types.STRING));
|
||||
if (channel.equals("minecraft:brand")) {
|
||||
wrapper.passthrough(Types.STRING);
|
||||
wrapper.clearInputBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final Direction direction, final State state, final PacketWrapper packetWrapper) throws InformativeException, CancelException {
|
||||
if (direction == Direction.SERVERBOUND) {
|
||||
|
@ -416,7 +416,7 @@ public class PlayerPacketRewriter1_9 {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Types.STRING); // 0 - Channel Name
|
||||
handlerSoftFail(wrapper -> {
|
||||
handler(wrapper -> {
|
||||
String name = wrapper.get(Types.STRING, 0);
|
||||
if (name.equals("MC|BSign")) {
|
||||
Item item = wrapper.passthrough(Types.ITEM1_8);
|
||||
|
Loading…
Reference in New Issue
Block a user