From d2cd79185b56bab1adbd45acb1caf0ea7f24d84e Mon Sep 17 00:00:00 2001 From: Aaron <71191102+RealBauHD@users.noreply.github.com> Date: Thu, 27 Mar 2025 15:56:15 +0100 Subject: [PATCH] Minecraft 1.21.5 (#1489) Missing adventure component changes, so entity and item hovers from the API may not work for 1.21.5 clients Co-authored-by: Gero Co-authored-by: Shane Freeder --- .../api/network/ProtocolVersion.java | 3 +- .../proxy/protocol/StateRegistry.java | 73 +++++++++++++------ .../packet/brigadier/ArgumentIdentifier.java | 7 ++ .../brigadier/ArgumentPropertyRegistry.java | 18 +++-- .../brigadier/RegistryKeyArgumentList.java | 14 ++-- .../proxy/protocol/packet/chat/ChatQueue.java | 2 +- .../packet/chat/LastSeenMessages.java | 32 +++++--- .../chat/session/SessionPlayerChatPacket.java | 4 +- .../session/SessionPlayerCommandPacket.java | 4 +- 9 files changed, 102 insertions(+), 55 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java index d1eaa389..346a43c7 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -89,7 +89,8 @@ public enum ProtocolVersion implements Ordered { MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), MINECRAFT_1_21(767, "1.21", "1.21.1"), MINECRAFT_1_21_2(768, "1.21.2", "1.21.3"), - MINECRAFT_1_21_4(769, "1.21.4"); + MINECRAFT_1_21_4(769, "1.21.4"), + MINECRAFT_1_21_5(770, /*1073742067,*/ "1.21.5"); private static final int SNAPSHOT_BIT = 30; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java index 5a2fb8b8..e3539424 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -39,6 +39,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_5; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_2; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_4; +import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_5; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_7_2; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9; @@ -376,7 +377,8 @@ public enum StateRegistry { map(0x0D, MINECRAFT_1_17, false), map(0x0A, MINECRAFT_1_19, false), map(0x0B, MINECRAFT_1_19_4, false), - map(0x0A, MINECRAFT_1_20_2, false)); + map(0x0A, MINECRAFT_1_20_2, false), + map(0x09, MINECRAFT_1_21_5, false)); clientbound.register( LegacyChatPacket.class, LegacyChatPacket::new, @@ -397,7 +399,8 @@ public enum StateRegistry { map(0x0E, MINECRAFT_1_19, false), map(0x0D, MINECRAFT_1_19_3, false), map(0x0F, MINECRAFT_1_19_4, false), - map(0x10, MINECRAFT_1_20_2, false)); + map(0x10, MINECRAFT_1_20_2, false), + map(0x0F, MINECRAFT_1_21_5, false)); clientbound.register( AvailableCommandsPacket.class, AvailableCommandsPacket::new, @@ -409,10 +412,12 @@ public enum StateRegistry { map(0x0F, MINECRAFT_1_19, false), map(0x0E, MINECRAFT_1_19_3, false), map(0x10, MINECRAFT_1_19_4, false), - map(0x11, MINECRAFT_1_20_2, false)); + map(0x11, MINECRAFT_1_20_2, false), + map(0x10, MINECRAFT_1_21_5, false)); clientbound.register( ClientboundCookieRequestPacket.class, ClientboundCookieRequestPacket::new, - map(0x16, MINECRAFT_1_20_5, false)); + map(0x16, MINECRAFT_1_20_5, false), + map(0x15, MINECRAFT_1_21_5, false)); clientbound.register( PluginMessagePacket.class, PluginMessagePacket::new, @@ -429,7 +434,8 @@ public enum StateRegistry { map(0x15, MINECRAFT_1_19_3, false), map(0x17, MINECRAFT_1_19_4, false), map(0x18, MINECRAFT_1_20_2, false), - map(0x19, MINECRAFT_1_20_5, false)); + map(0x19, MINECRAFT_1_20_5, false), + map(0x18, MINECRAFT_1_21_5, false)); clientbound.register( DisconnectPacket.class, () -> new DisconnectPacket(this), @@ -446,7 +452,8 @@ public enum StateRegistry { map(0x17, MINECRAFT_1_19_3, false), map(0x1A, MINECRAFT_1_19_4, false), map(0x1B, MINECRAFT_1_20_2, false), - map(0x1D, MINECRAFT_1_20_5, false)); + map(0x1D, MINECRAFT_1_20_5, false), + map(0x1C, MINECRAFT_1_21_5, false)); clientbound.register( KeepAlivePacket.class, KeepAlivePacket::new, @@ -464,7 +471,8 @@ public enum StateRegistry { map(0x23, MINECRAFT_1_19_4, false), map(0x24, MINECRAFT_1_20_2, false), map(0x26, MINECRAFT_1_20_5, false), - map(0x27, MINECRAFT_1_21_2, false)); + map(0x27, MINECRAFT_1_21_2, false), + map(0x26, MINECRAFT_1_21_5, false)); clientbound.register( JoinGamePacket.class, JoinGamePacket::new, @@ -482,7 +490,8 @@ public enum StateRegistry { map(0x28, MINECRAFT_1_19_4, false), map(0x29, MINECRAFT_1_20_2, false), map(0x2B, MINECRAFT_1_20_5, false), - map(0x2C, MINECRAFT_1_21_2, false)); + map(0x2C, MINECRAFT_1_21_2, false), + map(0x2B, MINECRAFT_1_21_5, false)); clientbound.register( RespawnPacket.class, RespawnPacket::new, @@ -503,13 +512,15 @@ public enum StateRegistry { map(0x43, MINECRAFT_1_20_2, true), map(0x45, MINECRAFT_1_20_3, true), map(0x47, MINECRAFT_1_20_5, true), - map(0x4C, MINECRAFT_1_21_2, true)); + map(0x4C, MINECRAFT_1_21_2, true), + map(0x4B, MINECRAFT_1_21_5, true)); clientbound.register( RemoveResourcePackPacket.class, RemoveResourcePackPacket::new, map(0x43, MINECRAFT_1_20_3, false), map(0x45, MINECRAFT_1_20_5, false), - map(0x4A, MINECRAFT_1_21_2, false)); + map(0x4A, MINECRAFT_1_21_2, false), + map(0x49, MINECRAFT_1_21_5, false)); clientbound.register( ResourcePackRequestPacket.class, ResourcePackRequestPacket::new, @@ -530,7 +541,8 @@ public enum StateRegistry { map(0x42, MINECRAFT_1_20_2, false), map(0x44, MINECRAFT_1_20_3, false), map(0x46, MINECRAFT_1_20_5, false), - map(0x4B, MINECRAFT_1_21_2, false)); + map(0x4B, MINECRAFT_1_21_2, false), + map(0x4A, MINECRAFT_1_21_5, false)); clientbound.register( HeaderAndFooterPacket.class, HeaderAndFooterPacket::new, @@ -552,7 +564,8 @@ public enum StateRegistry { map(0x68, MINECRAFT_1_20_2, true), map(0x6A, MINECRAFT_1_20_3, true), map(0x6D, MINECRAFT_1_20_5, true), - map(0x74, MINECRAFT_1_21_2, true)); + map(0x74, MINECRAFT_1_21_2, true), + map(0x73, MINECRAFT_1_21_5, true)); clientbound.register( LegacyTitlePacket.class, LegacyTitlePacket::new, @@ -573,7 +586,8 @@ public enum StateRegistry { map(0x5F, MINECRAFT_1_20_2, true), map(0x61, MINECRAFT_1_20_3, true), map(0x63, MINECRAFT_1_20_5, true), - map(0x6A, MINECRAFT_1_21_2, true)); + map(0x6A, MINECRAFT_1_21_2, true), + map(0x69, MINECRAFT_1_21_5, true)); clientbound.register( TitleTextPacket.class, TitleTextPacket::new, @@ -585,7 +599,8 @@ public enum StateRegistry { map(0x61, MINECRAFT_1_20_2, true), map(0x63, MINECRAFT_1_20_3, true), map(0x65, MINECRAFT_1_20_5, true), - map(0x6C, MINECRAFT_1_21_2, true)); + map(0x6C, MINECRAFT_1_21_2, true), + map(0x6B, MINECRAFT_1_21_5, true)); clientbound.register( TitleActionbarPacket.class, TitleActionbarPacket::new, @@ -597,7 +612,8 @@ public enum StateRegistry { map(0x48, MINECRAFT_1_20_2, true), map(0x4A, MINECRAFT_1_20_3, true), map(0x4C, MINECRAFT_1_20_5, true), - map(0x51, MINECRAFT_1_21_2, true)); + map(0x51, MINECRAFT_1_21_2, true), + map(0x50, MINECRAFT_1_21_5, true)); clientbound.register( TitleTimesPacket.class, TitleTimesPacket::new, @@ -609,7 +625,8 @@ public enum StateRegistry { map(0x62, MINECRAFT_1_20_2, true), map(0x64, MINECRAFT_1_20_3, true), map(0x66, MINECRAFT_1_20_5, true), - map(0x6D, MINECRAFT_1_21_2, true)); + map(0x6D, MINECRAFT_1_21_2, true), + map(0x6C, MINECRAFT_1_21_5, true)); clientbound.register( TitleClearPacket.class, TitleClearPacket::new, @@ -617,7 +634,8 @@ public enum StateRegistry { map(0x0D, MINECRAFT_1_19, true), map(0x0C, MINECRAFT_1_19_3, true), map(0x0E, MINECRAFT_1_19_4, true), - map(0x0F, MINECRAFT_1_20_2, true)); + map(0x0F, MINECRAFT_1_20_2, true), + map(0x0E, MINECRAFT_1_21_5, true)); clientbound.register( LegacyPlayerListItemPacket.class, LegacyPlayerListItemPacket::new, @@ -637,7 +655,8 @@ public enum StateRegistry { map(0x39, MINECRAFT_1_19_4, false), map(0x3B, MINECRAFT_1_20_2, false), map(0x3D, MINECRAFT_1_20_5, false), - map(0x3F, MINECRAFT_1_21_2, false)); + map(0x3F, MINECRAFT_1_21_2, false), + map(0x3E, MINECRAFT_1_21_5, false)); clientbound.register( UpsertPlayerInfoPacket.class, UpsertPlayerInfoPacket::new, @@ -645,11 +664,13 @@ public enum StateRegistry { map(0x3A, MINECRAFT_1_19_4, false), map(0x3C, MINECRAFT_1_20_2, false), map(0x3E, MINECRAFT_1_20_5, false), - map(0x40, MINECRAFT_1_21_2, false)); + map(0x40, MINECRAFT_1_21_2, false), + map(0x3F, MINECRAFT_1_21_5, false)); clientbound.register( ClientboundStoreCookiePacket.class, ClientboundStoreCookiePacket::new, map(0x6B, MINECRAFT_1_20_5, false), - map(0x72, MINECRAFT_1_21_2, false)); + map(0x72, MINECRAFT_1_21_2, false), + map(0x71, MINECRAFT_1_21_5, false)); clientbound.register( SystemChatPacket.class, SystemChatPacket::new, @@ -660,7 +681,8 @@ public enum StateRegistry { map(0x67, MINECRAFT_1_20_2, true), map(0x69, MINECRAFT_1_20_3, true), map(0x6C, MINECRAFT_1_20_5, true), - map(0x73, MINECRAFT_1_21_2, true)); + map(0x73, MINECRAFT_1_21_2, true), + map(0x72, MINECRAFT_1_21_5, true)); clientbound.register( PlayerChatCompletionPacket.class, PlayerChatCompletionPacket::new, @@ -668,7 +690,8 @@ public enum StateRegistry { map(0x14, MINECRAFT_1_19_3, true), map(0x16, MINECRAFT_1_19_4, true), map(0x17, MINECRAFT_1_20_2, true), - map(0x18, MINECRAFT_1_20_5, true)); + map(0x18, MINECRAFT_1_20_5, true), + map(0x17, MINECRAFT_1_21_5, true)); clientbound.register( ServerDataPacket.class, ServerDataPacket::new, @@ -679,14 +702,16 @@ public enum StateRegistry { map(0x47, MINECRAFT_1_20_2, false), map(0x49, MINECRAFT_1_20_3, false), map(0x4B, MINECRAFT_1_20_5, false), - map(0x50, MINECRAFT_1_21_2, false)); + map(0x50, MINECRAFT_1_21_2, false), + map(0x4F, MINECRAFT_1_21_5, false)); clientbound.register( StartUpdatePacket.class, () -> StartUpdatePacket.INSTANCE, map(0x65, MINECRAFT_1_20_2, false), map(0x67, MINECRAFT_1_20_3, false), map(0x69, MINECRAFT_1_20_5, false), - map(0x70, MINECRAFT_1_21_2, false)); + map(0x70, MINECRAFT_1_21_2, false), + map(0x6F, MINECRAFT_1_21_5, false)); clientbound.register( BundleDelimiterPacket.class, () -> BundleDelimiterPacket.INSTANCE, diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentIdentifier.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentIdentifier.java index 271d0c50..6441f6f7 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentIdentifier.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentIdentifier.java @@ -58,6 +58,13 @@ public class ArgumentIdentifier { this.versionById = ImmutableMap.copyOf(temp); } + @Override + public String toString() { + return "ArgumentIdentifier{" + + "identifier='" + identifier + '\'' + + '}'; + } + public String getIdentifier() { return identifier; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java index 7c04c97b..065de7b4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java @@ -22,6 +22,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_3; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_4; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_5; +import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_5; import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.id; import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet; import static com.velocitypowered.proxy.protocol.packet.brigadier.DoubleArgumentPropertySerializer.DOUBLE; @@ -254,17 +255,20 @@ public class ArgumentPropertyRegistry { register(id("minecraft:resource_key", mapSet(MINECRAFT_1_20_5, 46), mapSet(MINECRAFT_1_20_3, 45), mapSet(MINECRAFT_1_19_3, 44)), RegistryKeyArgumentList.ResourceKey.class, RegistryKeyArgumentList.ResourceKey.Serializer.REGISTRY); + register(id("minecraft:resource_selector", mapSet(MINECRAFT_1_21_5, 47)), + RegistryKeyArgumentList.ResourceSelector.class, + RegistryKeyArgumentList.ResourceSelector.Serializer.REGISTRY); - empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_20_5, 47), mapSet(MINECRAFT_1_20_3, 46), mapSet(MINECRAFT_1_19, 45))); // 1.19 - empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_20_5, 48), mapSet(MINECRAFT_1_20_3, 47), mapSet(MINECRAFT_1_19, 46))); // 1.19 - empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_20_3, 49), mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4 + empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_21_5, 48), mapSet(MINECRAFT_1_20_5, 47), mapSet(MINECRAFT_1_20_3, 46), mapSet(MINECRAFT_1_19, 45))); // 1.19 + empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_21_5, 49), mapSet(MINECRAFT_1_20_5, 48), mapSet(MINECRAFT_1_20_3, 47), mapSet(MINECRAFT_1_19, 46))); // 1.19 + empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_21_5, 50), mapSet(MINECRAFT_1_20_3, 49), mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4 - empty(id("minecraft:uuid", mapSet(MINECRAFT_1_20_5, 53), mapSet(MINECRAFT_1_20_3, 48), mapSet(MINECRAFT_1_19_4, 48), + empty(id("minecraft:uuid", mapSet(MINECRAFT_1_21_5, 54),mapSet(MINECRAFT_1_20_5, 53), mapSet(MINECRAFT_1_20_3, 48), mapSet(MINECRAFT_1_19_4, 48), mapSet(MINECRAFT_1_19, 47))); // added in 1.16 - empty(id("minecraft:loot_table", mapSet(MINECRAFT_1_20_5, 50))); - empty(id("minecraft:loot_predicate", mapSet(MINECRAFT_1_20_5, 51))); - empty(id("minecraft:loot_modifier", mapSet(MINECRAFT_1_20_5, 52))); + empty(id("minecraft:loot_table", mapSet(MINECRAFT_1_21_5, 51), mapSet(MINECRAFT_1_20_5, 50))); + empty(id("minecraft:loot_predicate", mapSet(MINECRAFT_1_21_5, 52), mapSet(MINECRAFT_1_20_5, 51))); + empty(id("minecraft:loot_modifier", mapSet(MINECRAFT_1_21_5, 53), mapSet(MINECRAFT_1_20_5, 52))); // Crossstitch support register(id("crossstitch:mod_argument", mapSet(MINECRAFT_1_19, -256)), ModArgumentProperty.class, MOD); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentList.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentList.java index fbd0b623..2bf5f345 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentList.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentList.java @@ -67,23 +67,23 @@ public final class RegistryKeyArgumentList { } } - public static class Resource extends RegistryKeyArgument { + public static class ResourceSelector extends RegistryKeyArgument { - public Resource(String identifier) { + public ResourceSelector(String identifier) { super(identifier); } - public static class Serializer implements ArgumentPropertySerializer { + public static class Serializer implements ArgumentPropertySerializer { - static final Resource.Serializer REGISTRY = new Resource.Serializer(); + static final ResourceSelector.Serializer REGISTRY = new ResourceSelector.Serializer(); @Override - public Resource deserialize(ByteBuf buf, ProtocolVersion protocolVersion) { - return new Resource(ProtocolUtils.readString(buf)); + public ResourceSelector deserialize(ByteBuf buf, ProtocolVersion protocolVersion) { + return new ResourceSelector(ProtocolUtils.readString(buf)); } @Override - public void serialize(Resource object, ByteBuf buf, ProtocolVersion protocolVersion) { + public void serialize(ResourceSelector object, ByteBuf buf, ProtocolVersion protocolVersion) { ProtocolUtils.writeString(buf, object.getIdentifier()); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ChatQueue.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ChatQueue.java index 93ace258..14a56336 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ChatQueue.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ChatQueue.java @@ -187,7 +187,7 @@ public class ChatQueue implements AutoCloseable { } public LastSeenMessages createLastSeen() { - return new LastSeenMessages(0, lastSeenMessages); + return new LastSeenMessages(0, lastSeenMessages, (byte) 0); } } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/LastSeenMessages.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/LastSeenMessages.java index 18a743c8..c03e5f8c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/LastSeenMessages.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/LastSeenMessages.java @@ -17,6 +17,7 @@ package com.velocitypowered.proxy.protocol.packet.chat; +import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.Arrays; @@ -26,30 +27,38 @@ public class LastSeenMessages { public static final int WINDOW_SIZE = 20; private static final int DIV_FLOOR = -Math.floorDiv(-WINDOW_SIZE, 8); - private int offset; - private BitSet acknowledged; + private final int offset; + private final BitSet acknowledged; + private byte checksum; public LastSeenMessages() { - this.offset = 0; - this.acknowledged = new BitSet(); + this(0, new BitSet(), (byte) 0); } - public LastSeenMessages(int offset, BitSet acknowledged) { + public LastSeenMessages(int offset, BitSet acknowledged, byte checksum) { this.offset = offset; this.acknowledged = acknowledged; + this.checksum = checksum; } - public LastSeenMessages(ByteBuf buf) { + public LastSeenMessages(ByteBuf buf, ProtocolVersion protocolVersion) { this.offset = ProtocolUtils.readVarInt(buf); byte[] bytes = new byte[DIV_FLOOR]; buf.readBytes(bytes); this.acknowledged = BitSet.valueOf(bytes); + + if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_5)) { + this.checksum = buf.readByte(); + } } - public void encode(ByteBuf buf) { + public void encode(ByteBuf buf, ProtocolVersion protocolVersion) { ProtocolUtils.writeVarInt(buf, offset); buf.writeBytes(Arrays.copyOf(acknowledged.toByteArray(), DIV_FLOOR)); + if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_5)) { + buf.writeByte(this.checksum); + } } public int getOffset() { @@ -61,14 +70,15 @@ public class LastSeenMessages { } public LastSeenMessages offset(final int offset) { - return new LastSeenMessages(this.offset + offset, acknowledged); + return new LastSeenMessages(this.offset + offset, acknowledged, checksum); } @Override public String toString() { return "LastSeenMessages{" + - "offset=" + offset + - ", acknowledged=" + acknowledged + - '}'; + "offset=" + offset + + ", acknowledged=" + acknowledged + + ", checksum=" + checksum + + '}'; } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerChatPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerChatPacket.java index 41f37366..8a00452c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerChatPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerChatPacket.java @@ -73,7 +73,7 @@ public class SessionPlayerChatPacket implements MinecraftPacket { } else { this.signature = new byte[0]; } - this.lastSeenMessages = new LastSeenMessages(buf); + this.lastSeenMessages = new LastSeenMessages(buf, protocolVersion); } @Override @@ -86,7 +86,7 @@ public class SessionPlayerChatPacket implements MinecraftPacket { if (this.signed) { buf.writeBytes(this.signature); } - this.lastSeenMessages.encode(buf); + this.lastSeenMessages.encode(buf, protocolVersion); } @Override diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerCommandPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerCommandPacket.java index 9084f4b5..993587dc 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerCommandPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionPlayerCommandPacket.java @@ -45,7 +45,7 @@ public class SessionPlayerCommandPacket implements MinecraftPacket { this.timeStamp = Instant.ofEpochMilli(buf.readLong()); this.salt = buf.readLong(); this.argumentSignatures = new ArgumentSignatures(buf); - this.lastSeenMessages = new LastSeenMessages(buf); + this.lastSeenMessages = new LastSeenMessages(buf, protocolVersion); } @Override @@ -54,7 +54,7 @@ public class SessionPlayerCommandPacket implements MinecraftPacket { buf.writeLong(this.timeStamp.toEpochMilli()); buf.writeLong(this.salt); this.argumentSignatures.encode(buf); - this.lastSeenMessages.encode(buf); + this.lastSeenMessages.encode(buf, protocolVersion); } public String getCommand() {