From 8a048f0505b0034e848b2995192f1dd4695b0857 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 <62206933+EpicPlayerA10@users.noreply.github.com> Date: Fri, 13 Jan 2023 23:43:50 +0100 Subject: [PATCH 1/2] Fix sendPluginMessage (#926) --- .../proxy/server/VelocityRegisteredServer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java b/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java index dc671414d..fe28ae00e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/server/VelocityRegisteredServer.java @@ -155,9 +155,10 @@ public class VelocityRegisteredServer implements RegisteredServer, ForwardingAud */ public boolean sendPluginMessage(ChannelIdentifier identifier, ByteBuf data) { for (ConnectedPlayer player : players.values()) { - VelocityServerConnection connection = player.getConnectedServer(); - if (connection != null && connection.getServer() == this) { - return connection.sendPluginMessage(identifier, data); + VelocityServerConnection serverConnection = player.getConnectedServer(); + if (serverConnection != null && serverConnection.getConnection() != null + && serverConnection.getServer() == this) { + return serverConnection.sendPluginMessage(identifier, data); } } From 50acf17f3fda4f05cbca51313a5be52c137ca2e7 Mon Sep 17 00:00:00 2001 From: Outfluencer <48880402+Outfluencer@users.noreply.github.com> Date: Sun, 22 Jan 2023 00:14:49 +0100 Subject: [PATCH 2/2] Username can be 16 * 3 bytes (#936) see my pr #843 --- .../com/velocitypowered/proxy/protocol/packet/ServerLogin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java index 33febbe94..0cd589ee9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java @@ -143,7 +143,7 @@ public class ServerLogin implements MinecraftPacket { public int expectedMaxLength(ByteBuf buf, Direction direction, ProtocolVersion version) { // Accommodate the rare (but likely malicious) use of UTF-8 usernames, since it is technically // legal on the protocol level. - int base = 1 + (16 * 4); + int base = 1 + (16 * 3); // Adjustments for Key-authentication if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_3) < 0) {