Merge pull request #191 from Matsv/master

Fix Bungeecord "Team viaversion already exists in this scoreboard" and might fix #172
This commit is contained in:
Myles 2016-03-10 19:47:43 +00:00
commit e3f7493616

View File

@ -47,6 +47,7 @@ public class OutgoingTransformer {
private final Set<Integer> knownHolograms = new HashSet<>();
private final Map<Integer, BossBar> bossBarMap = new HashMap<>();
private boolean autoTeam = false;
private boolean teamExists = false;
public OutgoingTransformer(ConnectionInfo info) {
this.info = info;
@ -817,6 +818,7 @@ public class OutgoingTransformer {
PacketUtil.writeString("viaversion", buf); // Use viaversion as name
if (b) {
// add
if (!teamExists) {
buf.writeByte(0); // make team
PacketUtil.writeString("viaversion", buf);
PacketUtil.writeString("", buf); // prefix
@ -825,11 +827,14 @@ public class OutgoingTransformer {
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);
}