13
0
geforkt von Mirrors/Velocity

Correct writing of brand string

Dieser Commit ist enthalten in:
Shane Freeder 2023-11-30 23:02:43 +00:00
Ursprung e5176717a9
Commit 07a525be7f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C

Datei anzeigen

@ -23,6 +23,7 @@ import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection; import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.StateRegistry;
import com.velocitypowered.proxy.protocol.packet.ClientSettings; import com.velocitypowered.proxy.protocol.packet.ClientSettings;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; 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 com.velocitypowered.proxy.protocol.util.PluginMessageUtil;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
@ -189,7 +189,7 @@ public class ClientConfigSessionHandler implements MinecraftSessionHandler {
String brand = serverConn.getPlayer().getClientBrand(); String brand = serverConn.getPlayer().getClientBrand();
if (brand != null && brandChannel != null) { if (brand != null && brandChannel != null) {
ByteBuf buf = Unpooled.buffer(); ByteBuf buf = Unpooled.buffer();
buf.writeCharSequence(brand, StandardCharsets.UTF_8); ProtocolUtils.writeString(buf, brand);
PluginMessage brandPacket = new PluginMessage(brandChannel, buf); PluginMessage brandPacket = new PluginMessage(brandChannel, buf);
serverConn.ensureConnected().write(brandPacket); serverConn.ensureConnected().write(brandPacket);
} }