mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-15 23:26:16 +01:00
Respect name visibility properly
This commit is contained in:
parent
44b6da408d
commit
652a68a79d
@ -399,7 +399,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
if (!getEntity().isCustomNameVisible()
|
||||
&& !data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString().equals("hover")) {
|
||||
getEntity().setCustomName("");
|
||||
} else {
|
||||
} else if (!requiresNameHologram()) {
|
||||
nameVisibility = true;
|
||||
getEntity().setCustomName(getFullName());
|
||||
}
|
||||
|
@ -77,9 +77,8 @@ public class HologramTrait extends Trait {
|
||||
private void load() {
|
||||
currentLoc = npc.getStoredLocation();
|
||||
int i = 0;
|
||||
if (npc.requiresNameHologram()) {
|
||||
if (npc.requiresNameHologram() && npc.data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true)) {
|
||||
nameNPC = createHologram(npc.getFullName(), 0);
|
||||
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
||||
}
|
||||
for (String line : lines) {
|
||||
hologramNPCs.add(createHologram(Placeholders.replace(line, null, npc), getHeight(i)));
|
||||
@ -114,6 +113,15 @@ public class HologramTrait extends Trait {
|
||||
unload();
|
||||
return;
|
||||
}
|
||||
if (npc.requiresNameHologram()) {
|
||||
boolean visible = npc.data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true);
|
||||
if (nameNPC != null && !visible) {
|
||||
nameNPC.destroy();
|
||||
nameNPC = null;
|
||||
} else if (nameNPC == null && visible) {
|
||||
nameNPC = createHologram(npc.getFullName(), 0);
|
||||
}
|
||||
}
|
||||
boolean update = currentLoc.distanceSquared(npc.getStoredLocation()) >= 0.01;
|
||||
if (update) {
|
||||
currentLoc = npc.getStoredLocation();
|
||||
|
Loading…
Reference in New Issue
Block a user