From 887a879eb65e02788056368f0bd2d04ee430ed08 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Sun, 4 Oct 2015 17:50:42 +0200 Subject: [PATCH] Created a method in Packet for getting boolean arrays from a ByteBuffer --- src/network/packets/Packet.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/network/packets/Packet.java b/src/network/packets/Packet.java index e7a67e5ee..938f4e0e7 100644 --- a/src/network/packets/Packet.java +++ b/src/network/packets/Packet.java @@ -260,7 +260,15 @@ public class Packet { ints[i] = bb.getInt(); return ints; } - + + public static boolean[] getBooleanArray(ByteBuffer bb) { + bb.order(ByteOrder.LITTLE_ENDIAN); + boolean[] booleans = new boolean[bb.getInt()]; + for(int i = 0; i < booleans.length; i++) + booleans[i] = getBoolean(bb); + return booleans; + } + /** * Decodes the ByteBuffer stream into the passed List using the given listType instance for creating elements * for the list from the buffer.