From 91319402f30018c1ba66f9c6c8f3908a5e2bc5b5 Mon Sep 17 00:00:00 2001 From: Thibaut Gautier Date: Sun, 17 Jan 2021 13:12:18 +0100 Subject: [PATCH] Fixed encoding not properly working with other packet reading libraries Injecting a message to byte encoder beforehand would break outbound packets in ViaVersion. This solution is a good fix which won't impact anything. --- .../myles/ViaVersion/bukkit/handlers/BukkitEncodeHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/handlers/BukkitEncodeHandler.java b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/handlers/BukkitEncodeHandler.java index 06bc19f20..63ee36b6d 100644 --- a/bukkit/src/main/java/us/myles/ViaVersion/bukkit/handlers/BukkitEncodeHandler.java +++ b/bukkit/src/main/java/us/myles/ViaVersion/bukkit/handlers/BukkitEncodeHandler.java @@ -54,8 +54,10 @@ public class BukkitEncodeHandler extends MessageToByteEncoder implements ViaHand throw (Error) e.getCause(); } } + + } else { + bytebuf.clear().writeBytes((ByteBuf) o); } - transform(bytebuf); }