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

View File

@ -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()) {

View File

@ -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));
}

View File

@ -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)) {

View File

@ -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;