mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-23 02:25:19 +01:00
workaround packet order for team packets
This commit is contained in:
parent
b26d2ef906
commit
d962ef09ff
@ -22,6 +22,7 @@ import us.myles.ViaVersion.bungee.storage.BungeeStorage;
|
|||||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.Protocol1_9TO1_8;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_9to1_8.storage.EntityTracker;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -95,6 +96,7 @@ public class BungeeServerHandler implements Listener {
|
|||||||
|
|
||||||
if (e.getServer() != null) {
|
if (e.getServer() != null) {
|
||||||
if (!e.getServer().getInfo().getName().equals(storage.getCurrentServer())) {
|
if (!e.getServer().getInfo().getName().equals(storage.getCurrentServer())) {
|
||||||
|
EntityTracker oldEntityTracker = user.get(EntityTracker.class);
|
||||||
String serverName = e.getServer().getInfo().getName();
|
String serverName = e.getServer().getInfo().getName();
|
||||||
|
|
||||||
storage.setCurrentServer(serverName);
|
storage.setCurrentServer(serverName);
|
||||||
@ -174,6 +176,12 @@ public class BungeeServerHandler implements Listener {
|
|||||||
protocol.init(user);
|
protocol.init(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityTracker newTracker = user.get(EntityTracker.class);
|
||||||
|
if (newTracker != null && oldEntityTracker != null) {
|
||||||
|
newTracker.setAutoTeam(oldEntityTracker.isAutoTeam());
|
||||||
|
newTracker.setCurrentTeam(oldEntityTracker.getCurrentTeam());
|
||||||
|
}
|
||||||
|
|
||||||
Object wrapper = channelWrapper.get(player);
|
Object wrapper = channelWrapper.get(player);
|
||||||
setVersion.invoke(wrapper, protocolId);
|
setVersion.invoke(wrapper, protocolId);
|
||||||
|
|
||||||
|
@ -137,7 +137,9 @@ 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
|
||||||
entityTracker.sendTeamPacket(true, false);
|
wrapper.send(Protocol1_9TO1_8.class, true, true);
|
||||||
|
wrapper.cancel();
|
||||||
|
entityTracker.sendTeamPacket(true, true);
|
||||||
entityTracker.setCurrentTeam("viaversion");
|
entityTracker.setCurrentTeam("viaversion");
|
||||||
} else {
|
} else {
|
||||||
// since adding remove from auto team
|
// since adding remove from auto team
|
||||||
@ -155,7 +157,9 @@ public class PlayerPackets {
|
|||||||
if (entityTracker.isAutoTeam()
|
if (entityTracker.isAutoTeam()
|
||||||
&& teamName.equals(entityTracker.getCurrentTeam())) {
|
&& teamName.equals(entityTracker.getCurrentTeam())) {
|
||||||
// team was removed
|
// team was removed
|
||||||
entityTracker.sendTeamPacket(true, false);
|
wrapper.send(Protocol1_9TO1_8.class, true, true);
|
||||||
|
wrapper.cancel();
|
||||||
|
entityTracker.sendTeamPacket(true, true);
|
||||||
entityTracker.setCurrentTeam("viaversion");
|
entityTracker.setCurrentTeam("viaversion");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +215,9 @@ public class PlayerPackets {
|
|||||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||||
if (Via.getConfig().isAutoTeam()) {
|
if (Via.getConfig().isAutoTeam()) {
|
||||||
entityTracker.setAutoTeam(true);
|
entityTracker.setAutoTeam(true);
|
||||||
entityTracker.sendTeamPacket(true, false);
|
wrapper.send(Protocol1_9TO1_8.class, true, true);
|
||||||
|
wrapper.cancel();
|
||||||
|
entityTracker.sendTeamPacket(true, true);
|
||||||
entityTracker.setCurrentTeam("viaversion");
|
entityTracker.setCurrentTeam("viaversion");
|
||||||
} else {
|
} else {
|
||||||
entityTracker.setAutoTeam(false);
|
entityTracker.setAutoTeam(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user