Fix bossbars so they send correctly, credits to @jollyolbrits for detailed reporting of where the issue may take place.

This commit is contained in:
Myles 2016-04-19 22:53:27 +01:00
parent a496b2d3a8
commit 0ae9d9dbbf

View File

@ -153,14 +153,16 @@ public class ViaBossBar implements BossBar {
} }
private void sendPacket(UpdateAction action) { 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); sendPacket(uuid, buf);
}
} }
private void sendPacket(UUID uuid, ByteBuf buf) { private void sendPacket(UUID uuid, ByteBuf buf) {
if (!ViaVersion.getInstance().isPorted(uuid) || !(ViaVersion.getInstance().getPlayerVersion(uuid) >= ProtocolVersion.v1_9.getId())) { if (!ViaVersion.getInstance().isPorted(uuid) || !(ViaVersion.getInstance().getPlayerVersion(uuid) >= ProtocolVersion.v1_9.getId())) {
players.remove(uuid); players.remove(uuid);
buf.release();
return; return;
} }
ViaVersion.getInstance().sendRawPacket(uuid, buf); ViaVersion.getInstance().sendRawPacket(uuid, buf);