Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-24 23:30:17 +01:00
1.19.1-pre4
Dieser Commit ist enthalten in:
Ursprung
81a737886a
Commit
90460ee99f
@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.viaversion"
|
group = "com.viaversion"
|
||||||
version = "4.4.0-1.19.1-pre3-SNAPSHOT"
|
version = "4.4.0-1.19.1-pre4-SNAPSHOT"
|
||||||
description = "Allow older clients to join newer server versions."
|
description = "Allow older clients to join newer server versions."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,28 +198,44 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
|
|||||||
@Override
|
@Override
|
||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
|
if (wrapper.read(Type.BOOLEAN)) {
|
||||||
|
// Previous signature
|
||||||
|
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
final UUID sender = wrapper.read(Type.UUID);
|
||||||
|
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Header signature
|
||||||
|
|
||||||
// Send the unsigned message if present, otherwise the signed message
|
// Send the unsigned message if present, otherwise the signed message
|
||||||
final JsonElement message = wrapper.read(Type.COMPONENT);
|
final JsonElement message = wrapper.read(Type.COMPONENT);
|
||||||
|
|
||||||
|
wrapper.read(Type.LONG); // Timestamp
|
||||||
|
wrapper.read(Type.LONG); // Salt
|
||||||
|
|
||||||
|
final int lastSeenPlayers = wrapper.read(Type.VAR_INT);
|
||||||
|
for (int i = 0; i < lastSeenPlayers; i++) {
|
||||||
|
wrapper.read(Type.UUID); // Profile uuid
|
||||||
|
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Last signature
|
||||||
|
}
|
||||||
|
|
||||||
final JsonElement unsignedMessage = wrapper.read(Type.OPTIONAL_COMPONENT);
|
final JsonElement unsignedMessage = wrapper.read(Type.OPTIONAL_COMPONENT);
|
||||||
wrapper.write(Type.COMPONENT, unsignedMessage != null ? unsignedMessage : message);
|
final JsonElement chatMessage = unsignedMessage != null ? unsignedMessage : message;
|
||||||
});
|
wrapper.write(Type.COMPONENT, chatMessage);
|
||||||
handler(wrapper -> {
|
|
||||||
final int chatTypeId = wrapper.read(Type.VAR_INT);
|
final int chatTypeId = wrapper.read(Type.VAR_INT);
|
||||||
wrapper.write(Type.BYTE, (byte) 1);
|
wrapper.write(Type.BYTE, (byte) 1);
|
||||||
wrapper.passthrough(Type.UUID);
|
wrapper.write(Type.UUID, sender);
|
||||||
|
|
||||||
final JsonElement senderName = wrapper.read(Type.COMPONENT);
|
final JsonElement senderName = wrapper.read(Type.COMPONENT);
|
||||||
final JsonElement targetName = wrapper.read(Type.OPTIONAL_COMPONENT);
|
final JsonElement targetName = wrapper.read(Type.OPTIONAL_COMPONENT);
|
||||||
final JsonElement element = wrapper.get(Type.COMPONENT, 0);
|
final JsonElement decoratedMessage = decorateChatMessage(wrapper, chatTypeId, senderName, targetName, chatMessage);
|
||||||
final JsonElement decoratedMessage = decorateChatMessage(wrapper, chatTypeId, senderName, targetName, element);
|
|
||||||
if (decoratedMessage == null) {
|
if (decoratedMessage == null) {
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
} else {
|
} else {
|
||||||
wrapper.set(Type.COMPONENT, 0, decoratedMessage);
|
wrapper.set(Type.COMPONENT, 0, decoratedMessage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
read(Type.LONG); // Timestamp
|
|
||||||
read(Type.LONG); // Salt
|
|
||||||
read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -293,8 +309,9 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Can't do anything with them unless we add clutter clients with fake player profiles
|
cancelClientbound(ClientboundPackets1_19_1.CUSTOM_CHAT_COMPLETIONS); // Can't do anything with them unless we add clutter clients with fake player profiles
|
||||||
cancelClientbound(ClientboundPackets1_19_1.CUSTOM_CHAT_COMPLETIONS);
|
cancelClientbound(ClientboundPackets1_19_1.DELETE_CHAT_MESSAGE); // Can't do without the old "send 50 empty lines and then resend previous messages" trick
|
||||||
|
cancelClientbound(ClientboundPackets1_19_1.PLAYER_CHAT_HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -327,7 +344,7 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
|
|||||||
return TextReplacementConfig.builder().matchLiteral("%s").replacement(GsonComponentSerializer.gson().deserializeFromTree(replacement)).once().build();
|
return TextReplacementConfig.builder().matchLiteral("%s").replacement(GsonComponentSerializer.gson().deserializeFromTree(replacement)).once().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsonElement decorateChatMessage(final PacketWrapper wrapper, final int chatTypeId, final JsonElement senderName, final JsonElement targetName, final JsonElement message) throws Exception {
|
private JsonElement decorateChatMessage(final PacketWrapper wrapper, final int chatTypeId, final JsonElement senderName, final JsonElement targetName, final JsonElement message) {
|
||||||
translatableRewriter.processText(message);
|
translatableRewriter.processText(message);
|
||||||
|
|
||||||
CompoundTag chatType = wrapper.user().get(DimensionRegistryStorage.class).chatType(chatTypeId);
|
CompoundTag chatType = wrapper.user().get(DimensionRegistryStorage.class).chatType(chatTypeId);
|
||||||
|
@ -3,7 +3,7 @@ metadata.format.version = "1.1"
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
# ViaVersion
|
# ViaVersion
|
||||||
viaver = "4.4.0-1.19.1-pre3-SNAPSHOT"
|
viaver = "4.4.0-1.19.1-pre4-SNAPSHOT"
|
||||||
|
|
||||||
# Common provided
|
# Common provided
|
||||||
netty = "4.0.20.Final"
|
netty = "4.0.20.Final"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren