diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index 195eb30a..ac8b00d0 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -368,8 +368,8 @@ public abstract class Disguise { if (isDynamicName()) { String name = getEntity().getCustomName(); - if (name == null || name.isEmpty()) { - name = isPlayerDisguise() ? "LD_NoName" : ""; + if (name == null) { + name = ""; } if (isPlayerDisguise()) { diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 3fd97f3e..d85a4cb5 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -331,8 +331,8 @@ public class FlagWatcher { if (!sendAllCustom && getDisguise().isPlayerDisguise() && index == MetaIndex.LIVING_HEALTH) { float health = ((Number) watch.getRawValue()).floatValue(); - String name = DisguiseConfig.isScoreboardNames() ? ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : - ((PlayerDisguise) getDisguise()).getName(); + String name = DisguiseConfig.isScoreboardNames() && ((PlayerDisguise) getDisguise()).hasScoreboardName() ? + ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : ((PlayerDisguise) getDisguise()).getName(); ReflectionManager.setScore(player.getScoreboard(), ReflectionManager.scoreboardCrtieriaHealth, name, (int) Math.ceil(health)); } @@ -371,8 +371,8 @@ public class FlagWatcher { health = MetaIndex.LIVING_HEALTH.getDefault(); } - String name = !DisguiseConfig.isScoreboardNames() ? ((PlayerDisguise) getDisguise()).getName() : - ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer(); + String name = !DisguiseConfig.isScoreboardNames() && ((PlayerDisguise) getDisguise()).hasScoreboardName() ? + ((PlayerDisguise) getDisguise()).getName() : ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer(); ReflectionManager.setScore(player.getScoreboard(), ReflectionManager.scoreboardCrtieriaHealth, name, (int) Math.ceil(health)); } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 336ec18f..e2f0cc7e 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -113,7 +113,7 @@ public class PlayerDisguise extends TargetedDisguise { } if (scoreboardName == null) { - if (isUpsideDown() || isDeadmau5Ears()) { + if (isUpsideDown() || isDeadmau5Ears() || !isNameVisible()) { scoreboardName = new DisguiseUtilities.DScoreTeam(this, new String[]{"", getProfileName(), ""}); } else { scoreboardName = DisguiseUtilities.createExtendedName(this); @@ -148,7 +148,7 @@ public class PlayerDisguise extends TargetedDisguise { */ public String getProfileName() { return isUpsideDown() ? "Dinnerbone" : isDeadmau5Ears() ? "deadmau5" : - hasScoreboardName() ? getScoreboardName().getPlayer() : DisguiseConfig.isScoreboardNames() && getName().isEmpty() ? "LD_NoName" : getName(); + !isNameVisible() || getName().isEmpty() ? "LD_NoName" : hasScoreboardName() ? getScoreboardName().getPlayer() : getName(); } public UUID getUUID() { @@ -307,10 +307,6 @@ public class PlayerDisguise extends TargetedDisguise { name = DisguiseUtilities.getDisplayName(name); } - if (name.equals("")) { - name = "LD_NoName"; - } - if (name.equals(playerName)) { return; } @@ -661,8 +657,8 @@ public class PlayerDisguise extends TargetedDisguise { if (isDynamicName()) { String name = getEntity().getCustomName(); - if (name == null || name.isEmpty()) { - name = "LD_NoName"; + if (name == null) { + name = ""; } if (!getName().equals(name)) { 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 02c11bb6..f336feaf 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 @@ -163,10 +163,11 @@ public class PacketHandlerSpawn implements IPacketHandler { mods.write(5, pitch); } else if (disguise.getType().isPlayer()) { PlayerDisguise playerDisguise = (PlayerDisguise) disguise; - boolean visibleOrNewCompat = playerDisguise.isNameVisible() || DisguiseConfig.isScoreboardNames(); + boolean visibleOrNewCompat = playerDisguise.isNameVisible() && DisguiseConfig.isScoreboardNames(); WrappedGameProfile spawnProfile = visibleOrNewCompat ? playerDisguise.getGameProfile() : ReflectionManager - .getGameProfileWithThisSkin(UUID.randomUUID(), visibleOrNewCompat ? playerDisguise.getName() : "LD_NoName", playerDisguise.getGameProfile()); + .getGameProfileWithThisSkin(UUID.randomUUID(), playerDisguise.isNameVisible() ? playerDisguise.getProfileName() : "LD_NoName", + playerDisguise.getGameProfile()); int entityId = disguisedEntity.getEntityId(); PlayerSkinHandler.PlayerSkin skin;