3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

workaround packet order for team packets

Dieser Commit ist enthalten in:
creeper123123321 2019-02-23 13:44:41 -03:00
Ursprung b26d2ef906
Commit d962ef09ff
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
2 geänderte Dateien mit 17 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -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);

Datei anzeigen

@ -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);