mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-26 03:55:28 +01:00
Fix auto-team not sending in the right order, #699
This commit is contained in:
parent
634f92b5cd
commit
4d58c717cd
@ -136,15 +136,11 @@ public class PlayerPackets {
|
|||||||
if (entityTracker.isAutoTeam() && player.equalsIgnoreCase(myName)) {
|
if (entityTracker.isAutoTeam() && player.equalsIgnoreCase(myName)) {
|
||||||
if (mode == 4) {
|
if (mode == 4) {
|
||||||
// since removing add to auto team
|
// since removing add to auto team
|
||||||
Via.getPlatform().runSync(new Runnable() {
|
entityTracker.sendTeamPacket(true, false);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
entityTracker.sendTeamPacket(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// since adding remove from auto team
|
// since adding remove from auto team
|
||||||
entityTracker.sendTeamPacket(false);
|
entityTracker.sendTeamPacket(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public class WorldPackets {
|
|||||||
if (Via.getConfig().isAutoTeam()) {
|
if (Via.getConfig().isAutoTeam()) {
|
||||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||||
entityTracker.setAutoTeam(true);
|
entityTracker.setAutoTeam(true);
|
||||||
entityTracker.sendTeamPacket(true);
|
entityTracker.sendTeamPacket(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -241,10 +241,10 @@ public class EntityTracker extends StoredObject {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendTeamPacket(boolean b) {
|
public void sendTeamPacket(boolean add, boolean now) {
|
||||||
PacketWrapper wrapper = new PacketWrapper(0x41, null, getUser());
|
PacketWrapper wrapper = new PacketWrapper(0x41, null, getUser());
|
||||||
wrapper.write(Type.STRING, "viaversion"); // Use viaversion as name
|
wrapper.write(Type.STRING, "viaversion"); // Use viaversion as name
|
||||||
if (b) {
|
if (add) {
|
||||||
// add
|
// add
|
||||||
if (!teamExists) {
|
if (!teamExists) {
|
||||||
wrapper.write(Type.BYTE, (byte) 0); // make team
|
wrapper.write(Type.BYTE, (byte) 0); // make team
|
||||||
@ -263,9 +263,9 @@ public class EntityTracker extends StoredObject {
|
|||||||
} else {
|
} else {
|
||||||
wrapper.write(Type.BYTE, (byte) 1); // remove team
|
wrapper.write(Type.BYTE, (byte) 1); // remove team
|
||||||
}
|
}
|
||||||
teamExists = b;
|
teamExists = add;
|
||||||
try {
|
try {
|
||||||
wrapper.send(Protocol1_9TO1_8.class);
|
wrapper.send(Protocol1_9TO1_8.class, true, now);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user