1.19.1-pre6

This commit is contained in:
Nassim Jahnke 2022-07-20 18:45:09 +02:00
parent fb334c6c14
commit 941bb91be8
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
7 changed files with 28 additions and 15 deletions

View File

@ -5,7 +5,7 @@ plugins {
allprojects { allprojects {
group = "com.viaversion" group = "com.viaversion"
version = "4.4.0-1.19.1-pre5-SNAPSHOT" version = "4.4.0-1.19.1-pre6-SNAPSHOT"
description = "Allow older clients to join newer server versions." description = "Allow older clients to join newer server versions."
} }

View File

@ -50,6 +50,11 @@ public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
} }
private void onServerLoaded() { private void onServerLoaded() {
if (isOutdatedPostLoad()) {
disable();
return;
}
BukkitViaLoader loader = (BukkitViaLoader) Via.getManager().getLoader(); BukkitViaLoader loader = (BukkitViaLoader) Via.getManager().getLoader();
int protocolVersion = Via.getAPI().getServerVersion().highestSupportedVersion(); int protocolVersion = Via.getAPI().getServerVersion().highestSupportedVersion();
if (protocolVersion >= ProtocolVersion.v1_16.getVersion()) { if (protocolVersion >= ProtocolVersion.v1_16.getVersion()) {

View File

@ -70,7 +70,10 @@ public interface ViaBackwardsPlatform {
ViaBackwards.init(this, config); ViaBackwards.init(this, config);
if (isOutdated()) return; if (isOutdated()) {
disable();
return;
}
Via.getManager().getSubPlatforms().add(IMPL_VERSION); Via.getManager().getSubPlatforms().add(IMPL_VERSION);
@ -133,11 +136,16 @@ public interface ViaBackwardsPlatform {
getLogger().severe("LINK: https://ci.viaversion.com/"); getLogger().severe("LINK: https://ci.viaversion.com/");
getLogger().severe("VIABACKWARDS WILL NOW DISABLE"); getLogger().severe("VIABACKWARDS WILL NOW DISABLE");
getLogger().severe("================================"); getLogger().severe("================================");
disable();
return true; return true;
} }
return false;
}
default boolean isOutdatedPostLoad() {
if (!Via.getPlatform().isProxy() && Via.getAPI().getServerVersion().highestSupportedVersion() == ProtocolVersion.v1_19.getVersion()) {
// Print a warning but still allow it
getLogger().warning("This version of ViaBackwards does not fully support 1.19 servers. Please downgrade to ViaBackwards 4.3.1 for better support of that version.");
}
return false; return false;
} }

View File

@ -208,7 +208,7 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
final PlayerMessageSignature signature = wrapper.read(Type.PLAYER_MESSAGE_SIGNATURE); final PlayerMessageSignature signature = wrapper.read(Type.PLAYER_MESSAGE_SIGNATURE);
// Store message signature for last seen // Store message signature for last seen
if (!signature.uuid().equals(ZERO_UUID)) { if (!signature.uuid().equals(ZERO_UUID) && signature.signatureBytes().length != 0) {
final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class); final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class);
messagesStorage.add(signature); messagesStorage.add(signature);
if (messagesStorage.tickUnacknowledged() > 64) { if (messagesStorage.tickUnacknowledged() > 64) {
@ -223,7 +223,8 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
} }
// Send the unsigned message if present, otherwise the signed message // Send the unsigned message if present, otherwise the signed message
JsonElement message = wrapper.read(Type.COMPONENT); // Plain message String plainMessage = wrapper.read(Type.STRING); // Plain message
JsonElement message = null;
JsonElement decoratedMessage = wrapper.read(Type.OPTIONAL_COMPONENT); JsonElement decoratedMessage = wrapper.read(Type.OPTIONAL_COMPONENT);
if (decoratedMessage != null) { if (decoratedMessage != null) {
message = decoratedMessage; message = decoratedMessage;
@ -238,6 +239,11 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
if (unsignedMessage != null) { if (unsignedMessage != null) {
message = unsignedMessage; message = unsignedMessage;
} }
if (message == null) {
// If no decorated or unsigned message is given, use the plain one
message = GsonComponentSerializer.gson().serializeToTree(Component.text(plainMessage));
}
wrapper.write(Type.COMPONENT, message); wrapper.write(Type.COMPONENT, message);
final int chatTypeId = wrapper.read(Type.VAR_INT); final int chatTypeId = wrapper.read(Type.VAR_INT);
@ -285,8 +291,6 @@ public final class Protocol1_18_2To1_19_1 extends BackwardsProtocol<ClientboundP
} }
wrapper.write(Type.BOOLEAN, false); // No signed preview wrapper.write(Type.BOOLEAN, false); // No signed preview
// Write last seen messages - even though we don't actually need to send them since everything will be unsigned,
// we'll try and play nice with sending them anyway.
final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class); final ReceivedMessagesStorage messagesStorage = wrapper.user().get(ReceivedMessagesStorage.class);
messagesStorage.resetUnacknowledgedCount(); messagesStorage.resetUnacknowledgedCount();
wrapper.write(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY, messagesStorage.lastSignatures()); wrapper.write(Type.PLAYER_MESSAGE_SIGNATURE_ARRAY, messagesStorage.lastSignatures());

View File

@ -231,11 +231,7 @@ public final class EntityPackets1_19 extends EntityRewriter<Protocol1_18_2To1_19
} }
// Remove public profile signature // Remove public profile signature
if (wrapper.read(Type.BOOLEAN)) { wrapper.read(Type.OPTIONAL_PROFILE_KEY);
wrapper.read(Type.LONG); // Timestamp
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Key
wrapper.read(Type.BYTE_ARRAY_PRIMITIVE); // Signature
}
} else if (action == 1 || action == 2) { // Update gamemode/update latency } else if (action == 1 || action == 2) { // Update gamemode/update latency
wrapper.passthrough(Type.VAR_INT); wrapper.passthrough(Type.VAR_INT);
} else if (action == 3) { // Update display name } else if (action == 3) { // Update display name

View File

@ -1,5 +1,5 @@
{ {
"1.19": { "1.19.1": {
"selectWorld.loading_list": "Loading world list", "selectWorld.loading_list": "Loading world list",
"flat_world_preset.unknown": "???", "flat_world_preset.unknown": "???",
"flat_world_preset.minecraft.classic_flat": "Classic Flat", "flat_world_preset.minecraft.classic_flat": "Classic Flat",

View File

@ -3,7 +3,7 @@ metadata.format.version = "1.1"
[versions] [versions]
# ViaVersion # ViaVersion
viaver = "4.4.0-1.19.1-pre5-SNAPSHOT" viaver = "4.4.0-1.19.1-pre6-SNAPSHOT"
# Common provided # Common provided
netty = "4.0.20.Final" netty = "4.0.20.Final"