diff --git a/src/main/java/net/minestom/server/utils/binary/BinaryWriter.java b/src/main/java/net/minestom/server/utils/binary/BinaryWriter.java index 4ef846483..c45f5ee8b 100644 --- a/src/main/java/net/minestom/server/utils/binary/BinaryWriter.java +++ b/src/main/java/net/minestom/server/utils/binary/BinaryWriter.java @@ -317,6 +317,7 @@ public class BinaryWriter extends OutputStream { * @return the byte array containing all the {@link BinaryWriter} data */ public byte[] toByteArray() { + buffer.flip(); byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes); return bytes;