diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index ac8b00d0..6b15dfc8 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -1167,9 +1167,9 @@ public abstract class Disguise { }, 2); if (isHidePlayer() && getEntity() instanceof Player) { - PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO); - addTab.getPlayerInfoAction().write(0, PlayerInfoAction.REMOVE_PLAYER); - addTab.getPlayerInfoDataLists().write(0, Collections.singletonList( + PacketContainer removeTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO); + removeTab.getPlayerInfoAction().write(0, PlayerInfoAction.REMOVE_PLAYER); + removeTab.getPlayerInfoDataLists().write(0, Collections.singletonList( new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0, NativeGameMode.SURVIVAL, WrappedChatComponent.fromText("")))); try { @@ -1178,7 +1178,7 @@ public abstract class Disguise { continue; } - ProtocolLibrary.getProtocolManager().sendServerPacket(player, addTab); + ProtocolLibrary.getProtocolManager().sendServerPacket(player, removeTab); } } catch (InvocationTargetException e) { e.printStackTrace(); diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 85bb1715..80cae6b2 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -30,7 +30,7 @@ public class PlayerDisguise extends TargetedDisguise { * Has someone set name visible explicitly? */ private boolean explicitNameVisible = false; - private final UUID uuid = UUID.randomUUID(); + private final UUID uuid = ReflectionManager.getRandomUUID(); private transient DisguiseUtilities.DScoreTeam scoreboardName; @Getter private boolean deadmau5Ears; @@ -147,7 +147,8 @@ public class PlayerDisguise extends TargetedDisguise { * The actual name that'll be sent in the game profile, not the name that they're known as */ public String getProfileName() { - return isUpsideDown() ? "Dinnerbone" : isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName(); + return isUpsideDown() ? "Dinnerbone" : + isDeadmau5Ears() ? "deadmau5" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName().isEmpty() ? "§r" : getName(); } public UUID getUUID() { diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 25d3fcd8..a756528a 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -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"); } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java index ebc226b7..b8800ad5 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java @@ -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()); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java index 01fd933a..57ed2eb1 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ReflectionManager.java @@ -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) {