From 07a525be7f90f1f3ccd515f7c196824d12ed0fff Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 30 Nov 2023 23:02:43 +0000 Subject: [PATCH] Correct writing of brand string --- .../proxy/connection/client/ClientConfigSessionHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java index 484b1cd81..8281b40e9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java @@ -23,6 +23,7 @@ import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.protocol.MinecraftPacket; +import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.protocol.packet.KeepAlive; @@ -33,7 +34,6 @@ import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdate; import com.velocitypowered.proxy.protocol.util.PluginMessageUtil; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import java.nio.charset.StandardCharsets; import java.util.concurrent.CompletableFuture; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -189,7 +189,7 @@ public class ClientConfigSessionHandler implements MinecraftSessionHandler { String brand = serverConn.getPlayer().getClientBrand(); if (brand != null && brandChannel != null) { ByteBuf buf = Unpooled.buffer(); - buf.writeCharSequence(brand, StandardCharsets.UTF_8); + ProtocolUtils.writeString(buf, brand); PluginMessage brandPacket = new PluginMessage(brandChannel, buf); serverConn.ensureConnected().write(brandPacket); }