From 0ae9d9dbbfa9ace21f7ea72721680ea5c17fdc2f Mon Sep 17 00:00:00 2001 From: Myles Date: Tue, 19 Apr 2016 22:53:27 +0100 Subject: [PATCH] Fix bossbars so they send correctly, credits to @jollyolbrits for detailed reporting of where the issue may take place. --- src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java b/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java index 83e5c8aa3..619214e08 100644 --- a/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java +++ b/src/main/java/us/myles/ViaVersion/boss/ViaBossBar.java @@ -153,14 +153,16 @@ public class ViaBossBar implements BossBar { } private void sendPacket(UpdateAction action) { - ByteBuf buf = getPacket(action); - for (UUID uuid : new ArrayList<>(players)) + for (UUID uuid : new ArrayList<>(players)) { + ByteBuf buf = getPacket(action); sendPacket(uuid, buf); + } } private void sendPacket(UUID uuid, ByteBuf buf) { if (!ViaVersion.getInstance().isPorted(uuid) || !(ViaVersion.getInstance().getPlayerVersion(uuid) >= ProtocolVersion.v1_9.getId())) { players.remove(uuid); + buf.release(); return; } ViaVersion.getInstance().sendRawPacket(uuid, buf);