Change nametag visibility to use &r and fix an issue where the tablist packet was wrong

This commit is contained in:
libraryaddict
2021-02-11 17:56:20 +13:00
parent ef4539a3a1
commit 1790032f75
5 changed files with 14 additions and 15 deletions

View File

@@ -1775,9 +1775,9 @@ public class DisguiseUtilities {
if (mainTeam == null) {
mainTeam = scoreboard.registerNewTeam("LD_NoName");
mainTeam.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.NEVER);
mainTeam.addEntry("");
} else if (!mainTeam.hasEntry("")) {
mainTeam.addEntry("");
mainTeam.addEntry("§r");
} else if (!mainTeam.hasEntry("§r")) {
mainTeam.addEntry("§r");
}
}

View File

@@ -165,9 +165,6 @@ public class PacketHandlerSpawn implements IPacketHandler {
PlayerDisguise playerDisguise = (PlayerDisguise) disguise;
boolean visibleOrNewCompat = playerDisguise.isNameVisible() || DisguiseConfig.isScoreboardNames();
WrappedGameProfile spawnProfile = visibleOrNewCompat ? playerDisguise.getGameProfile() : ReflectionManager
.getGameProfileWithThisSkin(UUID.randomUUID(), playerDisguise.isNameVisible() ? playerDisguise.getName() : "", playerDisguise.getGameProfile());
int entityId = disguisedEntity.getEntityId();
PlayerSkinHandler.PlayerSkin skin;
@@ -178,7 +175,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
// Add player to the list, necessary to spawn them
sendTab.getModifier().write(0, ReflectionManager.getEnumPlayerInfoAction(0));
List playerList = Collections.singletonList(ReflectionManager.getPlayerInfoData(sendTab.getHandle(), spawnProfile));
List playerList = Collections.singletonList(ReflectionManager.getPlayerInfoData(sendTab.getHandle(), ReflectionManager
.getGameProfileWithThisSkin(playerDisguise.getUUID(), playerDisguise.getProfileName(), playerDisguise.getGameProfile())));
sendTab.getModifier().write(1, playerList);
packets.addPacket(sendTab);
@@ -201,7 +199,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
PacketContainer spawnPlayer = new PacketContainer(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
spawnPlayer.getIntegers().write(0, entityId); // Id
spawnPlayer.getModifier().write(1, spawnProfile.getUUID());
spawnPlayer.getModifier().write(1, playerDisguise.getUUID());
double dist = observer.getLocation().distanceSquared(disguisedEntity.getLocation());

View File

@@ -720,7 +720,7 @@ public class ReflectionManager {
/**
* Used for generating a UUID with a custom version instead of the default 4. Workaround for China's NetEase servers
*/
private static UUID getRandomUUID() {
public static UUID getRandomUUID() {
UUID uuid = UUID.randomUUID();
if (DisguiseConfig.getUUIDGeneratedVersion() == 4) {