From 5b701e2933bea8d339031c7ed632bcc929f7bac5 Mon Sep 17 00:00:00 2001 From: Gero Date: Tue, 28 May 2024 11:11:44 +0200 Subject: [PATCH 1/8] 24w21b --- .../api/network/ProtocolVersion.java | 3 +- .../connection/MinecraftSessionHandler.java | 10 +++ .../backend/ConfigSessionHandler.java | 14 ++++ .../proxy/protocol/StateRegistry.java | 11 +++ .../config/CustomReportDetailsPacket.java | 56 ++++++++++++++ .../packet/config/ServerLinksPacket.java | 77 +++++++++++++++++++ 6 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java create mode 100644 proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java 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 8723d88840..e3b0e54d5b 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -86,7 +86,8 @@ public boolean isSupported() { MINECRAFT_1_20(763, "1.20", "1.20.1"), MINECRAFT_1_20_2(764, "1.20.2"), MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), - MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"); + MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), + MINECRAFT_1_21(767, 198, "1.21"); private static final int SNAPSHOT_BIT = 30; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java index 67cd9d11b3..17239346fe 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java @@ -62,9 +62,11 @@ import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChatPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket; +import com.velocitypowered.proxy.protocol.packet.config.CustomReportDetailsPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; +import com.velocitypowered.proxy.protocol.packet.config.ServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; @@ -339,4 +341,12 @@ default boolean handle(TransferPacket transfer) { default boolean handle(KnownPacksPacket packet) { return false; } + + default boolean handle(CustomReportDetailsPacket packet) { + return false; + } + + default boolean handle(ServerLinksPacket packet) { + return false; + } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java index 31d1dedb04..655f17ac1a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java @@ -40,8 +40,10 @@ import com.velocitypowered.proxy.protocol.packet.ResourcePackRequestPacket; import com.velocitypowered.proxy.protocol.packet.ResourcePackResponsePacket; import com.velocitypowered.proxy.protocol.packet.TransferPacket; +import com.velocitypowered.proxy.protocol.packet.config.CustomReportDetailsPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; +import com.velocitypowered.proxy.protocol.packet.config.ServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; @@ -111,6 +113,18 @@ public boolean handle(TagsUpdatePacket packet) { return true; } + @Override + public boolean handle(CustomReportDetailsPacket packet) { + serverConn.getPlayer().getConnection().write(packet); + return true; + } + + @Override + public boolean handle(ServerLinksPacket packet) { + serverConn.getPlayer().getConnection().write(packet); + return true; + } + @Override public boolean handle(KeepAlivePacket packet) { serverConn.ensureConnected().write(packet); 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 b0ee89f755..0ee5e184d3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -36,6 +36,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_2; 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; 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; @@ -91,9 +92,11 @@ import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.UnsignedPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket; +import com.velocitypowered.proxy.protocol.packet.config.CustomReportDetailsPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; +import com.velocitypowered.proxy.protocol.packet.config.ServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; @@ -214,6 +217,10 @@ public enum StateRegistry { map(0x0D, MINECRAFT_1_20_5, false)); clientbound.register(KnownPacksPacket.class, KnownPacksPacket::new, map(0x0E, MINECRAFT_1_20_5, false)); + clientbound.register(CustomReportDetailsPacket.class, CustomReportDetailsPacket::new, + map(0x0F, MINECRAFT_1_21, false)); + clientbound.register(ServerLinksPacket.class, ServerLinksPacket::new, + map(0x10, MINECRAFT_1_21, false)); } }, PLAY { @@ -638,6 +645,10 @@ public enum StateRegistry { TransferPacket::new, map(0x73, MINECRAFT_1_20_5, false) ); + clientbound.register(CustomReportDetailsPacket.class, CustomReportDetailsPacket::new, + map(0x7A, MINECRAFT_1_21, false)); + clientbound.register(ServerLinksPacket.class, ServerLinksPacket::new, + map(0x7B, MINECRAFT_1_21, false)); } }, LOGIN { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java new file mode 100644 index 0000000000..c59b754b0e --- /dev/null +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2024 Velocity Contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.velocitypowered.proxy.protocol.packet.config; + +import com.velocitypowered.api.network.ProtocolVersion; +import com.velocitypowered.proxy.connection.MinecraftSessionHandler; +import com.velocitypowered.proxy.protocol.MinecraftPacket; +import com.velocitypowered.proxy.protocol.ProtocolUtils; +import io.netty.buffer.ByteBuf; +import java.util.HashMap; +import java.util.Map; + +public class CustomReportDetailsPacket implements MinecraftPacket { + + private Map details; + + @Override + public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { + int detailsCount = ProtocolUtils.readVarInt(buf); + + this.details = new HashMap<>(detailsCount); + for (int i = 0; i < detailsCount; i++) { + details.put(ProtocolUtils.readString(buf), ProtocolUtils.readString(buf)); + } + } + + @Override + public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { + ProtocolUtils.writeVarInt(buf, details.size()); + + details.forEach((key, detail) -> { + ProtocolUtils.writeString(buf, key); + ProtocolUtils.writeString(buf, detail); + }); + } + + @Override + public boolean handle(MinecraftSessionHandler handler) { + return handler.handle(this); + } +} diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java new file mode 100644 index 0000000000..3939c019ea --- /dev/null +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Velocity Contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.velocitypowered.proxy.protocol.packet.config; + +import com.velocitypowered.api.network.ProtocolVersion; +import com.velocitypowered.proxy.connection.MinecraftSessionHandler; +import com.velocitypowered.proxy.protocol.MinecraftPacket; +import com.velocitypowered.proxy.protocol.ProtocolUtils; +import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; +import io.netty.buffer.ByteBuf; +import java.util.ArrayList; +import java.util.List; + +public class ServerLinksPacket implements MinecraftPacket { + + private List serverLinks; + + @Override + public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { + int linksCount = ProtocolUtils.readVarInt(buf); + + this.serverLinks = new ArrayList<>(linksCount); + for (int i = 0; i < linksCount; i++) { + serverLinks.add(ServerLink.read(buf, version)); + } + } + + @Override + public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { + ProtocolUtils.writeVarInt(buf, serverLinks.size()); + + for (ServerLink serverLink : serverLinks) { + serverLink.write(buf); + } + } + + @Override + public boolean handle(MinecraftSessionHandler handler) { + return handler.handle(this); + } + + public record ServerLink(int id, ComponentHolder displayName, String url) { + private static ServerLink read(ByteBuf buf, ProtocolVersion version) { + if (buf.readBoolean()) { + return new ServerLink(ProtocolUtils.readVarInt(buf), null, ProtocolUtils.readString(buf)); + } else { + return new ServerLink(-1, ComponentHolder.read(buf, version), ProtocolUtils.readString(buf)); + } + } + + private void write(ByteBuf buf) { + if (id >= 0) { + buf.writeBoolean(true); + ProtocolUtils.writeVarInt(buf, id); + } else { + buf.writeBoolean(false); + displayName.write(buf); + } + ProtocolUtils.writeString(buf, url); + } + } +} From d1ed9158a3b43681ea22b5e06a699e588f9482ed Mon Sep 17 00:00:00 2001 From: Gero Date: Thu, 30 May 2024 13:15:43 +0200 Subject: [PATCH 2/8] 1.21-pre1 --- .../java/com/velocitypowered/api/network/ProtocolVersion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e3b0e54d5b..c45521cf77 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -87,7 +87,7 @@ public boolean isSupported() { MINECRAFT_1_20_2(764, "1.20.2"), MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), - MINECRAFT_1_21(767, 198, "1.21"); + MINECRAFT_1_21(767, 199, "1.21"); private static final int SNAPSHOT_BIT = 30; From 7f64f9fd11a3110f894942730521decdb13c3100 Mon Sep 17 00:00:00 2001 From: Gero Date: Thu, 30 May 2024 13:31:47 +0200 Subject: [PATCH 3/8] sus --- .../proxy/protocol/packet/ServerLoginSuccessPacket.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccessPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccessPacket.java index f4fa6bc309..1e70568f63 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccessPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccessPacket.java @@ -92,7 +92,7 @@ public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersi if (version.noLessThan(ProtocolVersion.MINECRAFT_1_19)) { properties = ProtocolUtils.readProperties(buf); } - if (version == ProtocolVersion.MINECRAFT_1_20_5) { + if (version == ProtocolVersion.MINECRAFT_1_20_5 || version == ProtocolVersion.MINECRAFT_1_21) { buf.readBoolean(); } } @@ -123,7 +123,7 @@ public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersi ProtocolUtils.writeProperties(buf, properties); } } - if (version == ProtocolVersion.MINECRAFT_1_20_5) { + if (version == ProtocolVersion.MINECRAFT_1_20_5 || version == ProtocolVersion.MINECRAFT_1_21) { buf.writeBoolean(strictErrorHandling); } } From 60d38774fb9115de7588293cfbc8350e86c01ecf Mon Sep 17 00:00:00 2001 From: Gero Date: Thu, 30 May 2024 13:34:57 +0200 Subject: [PATCH 4/8] add constructors --- .../packet/config/CustomReportDetailsPacket.java | 11 +++++++++++ .../protocol/packet/config/ServerLinksPacket.java | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java index c59b754b0e..39a2d4dd38 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java @@ -29,6 +29,13 @@ public class CustomReportDetailsPacket implements MinecraftPacket { private Map details; + public CustomReportDetailsPacket() { + } + + public CustomReportDetailsPacket(Map details) { + this.details = details; + } + @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) { int detailsCount = ProtocolUtils.readVarInt(buf); @@ -53,4 +60,8 @@ public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersi public boolean handle(MinecraftSessionHandler handler) { return handler.handle(this); } + + public Map getDetails() { + return details; + } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java index 3939c019ea..9011bece09 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java @@ -30,6 +30,13 @@ public class ServerLinksPacket implements MinecraftPacket { private List serverLinks; + public ServerLinksPacket() { + } + + public ServerLinksPacket(List serverLinks) { + this.serverLinks = serverLinks; + } + @Override public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { int linksCount = ProtocolUtils.readVarInt(buf); @@ -54,6 +61,10 @@ public boolean handle(MinecraftSessionHandler handler) { return handler.handle(this); } + public List getServerLinks() { + return serverLinks; + } + public record ServerLink(int id, ComponentHolder displayName, String url) { private static ServerLink read(ByteBuf buf, ProtocolVersion version) { if (buf.readBoolean()) { From 8d46239fca317151eb901b949bafe323ff418f9b Mon Sep 17 00:00:00 2001 From: Gero Date: Thu, 30 May 2024 18:40:51 +0200 Subject: [PATCH 5/8] use mojang names for new packets --- .../proxy/connection/MinecraftSessionHandler.java | 8 ++++---- .../connection/backend/ConfigSessionHandler.java | 8 ++++---- .../proxy/protocol/StateRegistry.java | 12 ++++++------ ...ava => ClientboundCustomReportDetailsPacket.java} | 6 +++--- ...Packet.java => ClientboundServerLinksPacket.java} | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) rename proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/{CustomReportDetailsPacket.java => ClientboundCustomReportDetailsPacket.java} (90%) rename proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/{ServerLinksPacket.java => ClientboundServerLinksPacket.java} (93%) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java index 17239346fe..60ae1636da 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java @@ -62,11 +62,11 @@ import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerChatPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket; -import com.velocitypowered.proxy.protocol.packet.config.CustomReportDetailsPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; -import com.velocitypowered.proxy.protocol.packet.config.ServerLinksPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; @@ -342,11 +342,11 @@ default boolean handle(KnownPacksPacket packet) { return false; } - default boolean handle(CustomReportDetailsPacket packet) { + default boolean handle(ClientboundCustomReportDetailsPacket packet) { return false; } - default boolean handle(ServerLinksPacket packet) { + default boolean handle(ClientboundServerLinksPacket packet) { return false; } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java index 655f17ac1a..10f232da73 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java @@ -40,10 +40,10 @@ import com.velocitypowered.proxy.protocol.packet.ResourcePackRequestPacket; import com.velocitypowered.proxy.protocol.packet.ResourcePackResponsePacket; import com.velocitypowered.proxy.protocol.packet.TransferPacket; -import com.velocitypowered.proxy.protocol.packet.config.CustomReportDetailsPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; -import com.velocitypowered.proxy.protocol.packet.config.ServerLinksPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; @@ -114,13 +114,13 @@ public boolean handle(TagsUpdatePacket packet) { } @Override - public boolean handle(CustomReportDetailsPacket packet) { + public boolean handle(ClientboundCustomReportDetailsPacket packet) { serverConn.getPlayer().getConnection().write(packet); return true; } @Override - public boolean handle(ServerLinksPacket packet) { + public boolean handle(ClientboundServerLinksPacket packet) { serverConn.getPlayer().getConnection().write(packet); return true; } 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 0ee5e184d3..c4ca95c472 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -92,11 +92,11 @@ import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.chat.session.UnsignedPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket; -import com.velocitypowered.proxy.protocol.packet.config.CustomReportDetailsPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; -import com.velocitypowered.proxy.protocol.packet.config.ServerLinksPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; @@ -217,9 +217,9 @@ public enum StateRegistry { map(0x0D, MINECRAFT_1_20_5, false)); clientbound.register(KnownPacksPacket.class, KnownPacksPacket::new, map(0x0E, MINECRAFT_1_20_5, false)); - clientbound.register(CustomReportDetailsPacket.class, CustomReportDetailsPacket::new, + clientbound.register(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new, map(0x0F, MINECRAFT_1_21, false)); - clientbound.register(ServerLinksPacket.class, ServerLinksPacket::new, + clientbound.register(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new, map(0x10, MINECRAFT_1_21, false)); } }, @@ -645,9 +645,9 @@ public enum StateRegistry { TransferPacket::new, map(0x73, MINECRAFT_1_20_5, false) ); - clientbound.register(CustomReportDetailsPacket.class, CustomReportDetailsPacket::new, + clientbound.register(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new, map(0x7A, MINECRAFT_1_21, false)); - clientbound.register(ServerLinksPacket.class, ServerLinksPacket::new, + clientbound.register(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new, map(0x7B, MINECRAFT_1_21, false)); } }, diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ClientboundCustomReportDetailsPacket.java similarity index 90% rename from proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java rename to proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ClientboundCustomReportDetailsPacket.java index 39a2d4dd38..6a3618cb73 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/CustomReportDetailsPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ClientboundCustomReportDetailsPacket.java @@ -25,14 +25,14 @@ import java.util.HashMap; import java.util.Map; -public class CustomReportDetailsPacket implements MinecraftPacket { +public class ClientboundCustomReportDetailsPacket implements MinecraftPacket { private Map details; - public CustomReportDetailsPacket() { + public ClientboundCustomReportDetailsPacket() { } - public CustomReportDetailsPacket(Map details) { + public ClientboundCustomReportDetailsPacket(Map details) { this.details = details; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ClientboundServerLinksPacket.java similarity index 93% rename from proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java rename to proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ClientboundServerLinksPacket.java index 9011bece09..bee080ee82 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ServerLinksPacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/config/ClientboundServerLinksPacket.java @@ -26,14 +26,14 @@ import java.util.ArrayList; import java.util.List; -public class ServerLinksPacket implements MinecraftPacket { +public class ClientboundServerLinksPacket implements MinecraftPacket { private List serverLinks; - public ServerLinksPacket() { + public ClientboundServerLinksPacket() { } - public ServerLinksPacket(List serverLinks) { + public ClientboundServerLinksPacket(List serverLinks) { this.serverLinks = serverLinks; } From 42e0b85967ec65b33b3748c9333b1504e7ad44a6 Mon Sep 17 00:00:00 2001 From: Gero Date: Thu, 30 May 2024 18:43:03 +0200 Subject: [PATCH 6/8] fix checkstyle --- .../proxy/connection/MinecraftSessionHandler.java | 2 +- .../proxy/connection/backend/ConfigSessionHandler.java | 2 +- .../java/com/velocitypowered/proxy/protocol/StateRegistry.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java index 60ae1636da..aecc619994 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftSessionHandler.java @@ -63,10 +63,10 @@ import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket; import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; -import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java index 10f232da73..78fcec98c4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/ConfigSessionHandler.java @@ -41,9 +41,9 @@ import com.velocitypowered.proxy.protocol.packet.ResourcePackResponsePacket; import com.velocitypowered.proxy.protocol.packet.TransferPacket; import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; -import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; 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 c4ca95c472..44e9f93b70 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -93,10 +93,10 @@ import com.velocitypowered.proxy.protocol.packet.chat.session.UnsignedPlayerCommandPacket; import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket; import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket; +import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket; import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket; -import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket; import com.velocitypowered.proxy.protocol.packet.config.StartUpdatePacket; import com.velocitypowered.proxy.protocol.packet.config.TagsUpdatePacket; import com.velocitypowered.proxy.protocol.packet.title.LegacyTitlePacket; From 4b826c8faa7e9f61653b09b00536e08d3aa607ff Mon Sep 17 00:00:00 2001 From: Gero Date: Tue, 4 Jun 2024 20:27:16 +0200 Subject: [PATCH 7/8] 1.21-pre2 --- .../java/com/velocitypowered/api/network/ProtocolVersion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c45521cf77..978cd54942 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -87,7 +87,7 @@ public boolean isSupported() { MINECRAFT_1_20_2(764, "1.20.2"), MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), - MINECRAFT_1_21(767, 199, "1.21"); + MINECRAFT_1_21(767, 200, "1.21"); private static final int SNAPSHOT_BIT = 30; From c3490a195765d687f8b6b3d392726bf78f7181b3 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 12 Jun 2024 20:28:56 +0200 Subject: [PATCH 8/8] Update ProtocolVersion.java --- .../java/com/velocitypowered/api/network/ProtocolVersion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 978cd54942..e968b0255e 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -87,7 +87,7 @@ public boolean isSupported() { MINECRAFT_1_20_2(764, "1.20.2"), MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), - MINECRAFT_1_21(767, 200, "1.21"); + MINECRAFT_1_21(767, "1.21"); private static final int SNAPSHOT_BIT = 30;