3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +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.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.storage.EntityTracker;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@ -95,6 +96,7 @@ public class BungeeServerHandler implements Listener {
if (e.getServer() != null) {
if (!e.getServer().getInfo().getName().equals(storage.getCurrentServer())) {
EntityTracker oldEntityTracker = user.get(EntityTracker.class);
String serverName = e.getServer().getInfo().getName();
storage.setCurrentServer(serverName);
@ -174,6 +176,12 @@ public class BungeeServerHandler implements Listener {
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);
setVersion.invoke(wrapper, protocolId);

Datei anzeigen

@ -137,7 +137,9 @@ public class PlayerPackets {
if (entityTracker.isAutoTeam() && player.equalsIgnoreCase(myName)) {
if (mode == 4) {
// 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");
} else {
// since adding remove from auto team
@ -155,7 +157,9 @@ public class PlayerPackets {
if (entityTracker.isAutoTeam()
&& teamName.equals(entityTracker.getCurrentTeam())) {
// team was removed
entityTracker.sendTeamPacket(true, false);
wrapper.send(Protocol1_9TO1_8.class, true, true);
wrapper.cancel();
entityTracker.sendTeamPacket(true, true);
entityTracker.setCurrentTeam("viaversion");
}
}
@ -211,7 +215,9 @@ public class PlayerPackets {
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
if (Via.getConfig().isAutoTeam()) {
entityTracker.setAutoTeam(true);
entityTracker.sendTeamPacket(true, false);
wrapper.send(Protocol1_9TO1_8.class, true, true);
wrapper.cancel();
entityTracker.sendTeamPacket(true, true);
entityTracker.setCurrentTeam("viaversion");
} else {
entityTracker.setAutoTeam(false);