Name visibilities

This commit is contained in:
libraryaddict 2021-02-06 17:15:49 +13:00
parent a06268adb4
commit 76d3228b51
4 changed files with 13 additions and 16 deletions

@ -368,8 +368,8 @@ public abstract class Disguise {
if (isDynamicName()) { if (isDynamicName()) {
String name = getEntity().getCustomName(); String name = getEntity().getCustomName();
if (name == null || name.isEmpty()) { if (name == null) {
name = isPlayerDisguise() ? "LD_NoName" : ""; name = "";
} }
if (isPlayerDisguise()) { if (isPlayerDisguise()) {

@ -331,8 +331,8 @@ public class FlagWatcher {
if (!sendAllCustom && getDisguise().isPlayerDisguise() && index == MetaIndex.LIVING_HEALTH) { if (!sendAllCustom && getDisguise().isPlayerDisguise() && index == MetaIndex.LIVING_HEALTH) {
float health = ((Number) watch.getRawValue()).floatValue(); float health = ((Number) watch.getRawValue()).floatValue();
String name = DisguiseConfig.isScoreboardNames() ? ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : String name = DisguiseConfig.isScoreboardNames() && ((PlayerDisguise) getDisguise()).hasScoreboardName() ?
((PlayerDisguise) getDisguise()).getName(); ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer() : ((PlayerDisguise) getDisguise()).getName();
ReflectionManager.setScore(player.getScoreboard(), ReflectionManager.scoreboardCrtieriaHealth, name, (int) Math.ceil(health)); ReflectionManager.setScore(player.getScoreboard(), ReflectionManager.scoreboardCrtieriaHealth, name, (int) Math.ceil(health));
} }
@ -371,8 +371,8 @@ public class FlagWatcher {
health = MetaIndex.LIVING_HEALTH.getDefault(); health = MetaIndex.LIVING_HEALTH.getDefault();
} }
String name = !DisguiseConfig.isScoreboardNames() ? ((PlayerDisguise) getDisguise()).getName() : String name = !DisguiseConfig.isScoreboardNames() && ((PlayerDisguise) getDisguise()).hasScoreboardName() ?
((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer(); ((PlayerDisguise) getDisguise()).getName() : ((PlayerDisguise) getDisguise()).getScoreboardName().getPlayer();
ReflectionManager.setScore(player.getScoreboard(), ReflectionManager.scoreboardCrtieriaHealth, name, (int) Math.ceil(health)); ReflectionManager.setScore(player.getScoreboard(), ReflectionManager.scoreboardCrtieriaHealth, name, (int) Math.ceil(health));
} }

@ -113,7 +113,7 @@ public class PlayerDisguise extends TargetedDisguise {
} }
if (scoreboardName == null) { if (scoreboardName == null) {
if (isUpsideDown() || isDeadmau5Ears()) { if (isUpsideDown() || isDeadmau5Ears() || !isNameVisible()) {
scoreboardName = new DisguiseUtilities.DScoreTeam(this, new String[]{"", getProfileName(), ""}); scoreboardName = new DisguiseUtilities.DScoreTeam(this, new String[]{"", getProfileName(), ""});
} else { } else {
scoreboardName = DisguiseUtilities.createExtendedName(this); scoreboardName = DisguiseUtilities.createExtendedName(this);
@ -148,7 +148,7 @@ public class PlayerDisguise extends TargetedDisguise {
*/ */
public String getProfileName() { public String getProfileName() {
return isUpsideDown() ? "Dinnerbone" : isDeadmau5Ears() ? "deadmau5" : 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() { public UUID getUUID() {
@ -307,10 +307,6 @@ public class PlayerDisguise extends TargetedDisguise {
name = DisguiseUtilities.getDisplayName(name); name = DisguiseUtilities.getDisplayName(name);
} }
if (name.equals("")) {
name = "LD_NoName";
}
if (name.equals(playerName)) { if (name.equals(playerName)) {
return; return;
} }
@ -661,8 +657,8 @@ public class PlayerDisguise extends TargetedDisguise {
if (isDynamicName()) { if (isDynamicName()) {
String name = getEntity().getCustomName(); String name = getEntity().getCustomName();
if (name == null || name.isEmpty()) { if (name == null) {
name = "LD_NoName"; name = "";
} }
if (!getName().equals(name)) { if (!getName().equals(name)) {

@ -163,10 +163,11 @@ public class PacketHandlerSpawn implements IPacketHandler {
mods.write(5, pitch); mods.write(5, pitch);
} else if (disguise.getType().isPlayer()) { } else if (disguise.getType().isPlayer()) {
PlayerDisguise playerDisguise = (PlayerDisguise) disguise; PlayerDisguise playerDisguise = (PlayerDisguise) disguise;
boolean visibleOrNewCompat = playerDisguise.isNameVisible() || DisguiseConfig.isScoreboardNames(); boolean visibleOrNewCompat = playerDisguise.isNameVisible() && DisguiseConfig.isScoreboardNames();
WrappedGameProfile spawnProfile = visibleOrNewCompat ? playerDisguise.getGameProfile() : ReflectionManager 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(); int entityId = disguisedEntity.getEntityId();
PlayerSkinHandler.PlayerSkin skin; PlayerSkinHandler.PlayerSkin skin;