From a769599448497963970c259d7f17111249118b64 Mon Sep 17 00:00:00 2001 From: Mats Date: Thu, 10 Mar 2016 20:33:32 +0100 Subject: [PATCH] Fix Bungeecord "Team viaversion already exists in this scoreboard" and might fix #86 --- .../transformers/OutgoingTransformer.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java index aad67d78e..549afc97e 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java @@ -47,6 +47,7 @@ public class OutgoingTransformer { private final Set knownHolograms = new HashSet<>(); private final Map bossBarMap = new HashMap<>(); private boolean autoTeam = false; + private boolean teamExists = false; public OutgoingTransformer(ConnectionInfo info) { this.info = info; @@ -817,19 +818,23 @@ public class OutgoingTransformer { PacketUtil.writeString("viaversion", buf); // Use viaversion as name if (b) { // add - buf.writeByte(0); // make team - PacketUtil.writeString("viaversion", buf); - PacketUtil.writeString("", buf); // prefix - PacketUtil.writeString("", buf); // suffix - buf.writeByte(0); // friendly fire - PacketUtil.writeString("", buf); // nametags - PacketUtil.writeString("never", buf); // collision rule :) - buf.writeByte(0); // color + if (!teamExists) { + buf.writeByte(0); // make team + PacketUtil.writeString("viaversion", buf); + PacketUtil.writeString("", buf); // prefix + PacketUtil.writeString("", buf); // suffix + buf.writeByte(0); // friendly fire + PacketUtil.writeString("", buf); // nametags + PacketUtil.writeString("never", buf); // collision rule :) + buf.writeByte(0); // color + } else + buf.writeByte(3); PacketUtil.writeVarInt(1, buf); // player count PacketUtil.writeString(info.getUsername(), buf); // us } else { buf.writeByte(1); // remove team } + teamExists = b; info.sendRawPacket(buf); }