diff --git a/src/main/java/com/viaversion/aas/codec/MinecraftCodec.java b/src/main/java/com/viaversion/aas/codec/MinecraftCodec.java index 68e92c6..11dd4a7 100644 --- a/src/main/java/com/viaversion/aas/codec/MinecraftCodec.java +++ b/src/main/java/com/viaversion/aas/codec/MinecraftCodec.java @@ -25,10 +25,12 @@ public class MinecraftCodec extends MessageToMessageCodec { try { var handler = ctx.pipeline().get(MinecraftHandler.class); + var version = handler.getData().getFrontVer(); + if (version == null) version = ProtocolVersion.unknown; PacketRegistry.INSTANCE.encode( msg, buf, - handler.getData().getFrontVer(), + version, handler.getFrontEnd() ? Direction.CLIENTBOUND : Direction.SERVERBOUND ); out.add(buf.retain()); diff --git a/src/main/java/com/viaversion/aas/handler/state/ConfigurationState.java b/src/main/java/com/viaversion/aas/handler/state/ConfigurationState.java index 5cd49c0..df1d480 100644 --- a/src/main/java/com/viaversion/aas/handler/state/ConfigurationState.java +++ b/src/main/java/com/viaversion/aas/handler/state/ConfigurationState.java @@ -54,7 +54,7 @@ public class ConfigurationState implements ConnectionState { public void disconnect(@NotNull MinecraftHandler handler, @NotNull String msg) { ConnectionState.DefaultImpls.disconnect(this, handler, msg); var packet = new ConfigurationDisconnect(); - packet.setMsgForVersion(new JsonPrimitive("[VIAaaS] §c$msg"), handler.getData().getFrontVer()); + packet.setMsgForVersion(new JsonPrimitive("[VIAaaS] §c" + msg), handler.getData().getFrontVer()); UtilKt.writeFlushClose(handler.getData().getFrontChannel(), packet, false); }