mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Fix blank names for a few seconds after spawning a npc. (#2477)
This commit is contained in:
parent
6c26f98080
commit
0b41b24425
@ -327,6 +327,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
updateFlyableState();
|
||||
updateCustomNameVisibility();
|
||||
updateCustomName();
|
||||
|
||||
Messaging.debug("Spawned", getId(), "SpawnReason." + reason);
|
||||
@ -381,11 +382,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
updateCounter = 0;
|
||||
}
|
||||
|
||||
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString();
|
||||
if (requiresNameHologram()) {
|
||||
nameplateVisible = "false";
|
||||
}
|
||||
getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible));
|
||||
updateCustomNameVisibility();
|
||||
|
||||
if (isLiving) {
|
||||
NMS.setKnockbackResistance((LivingEntity) getEntity(),
|
||||
@ -406,6 +403,14 @@ public class CitizensNPC extends AbstractNPC {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCustomNameVisibility() {
|
||||
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString();
|
||||
if (requiresNameHologram()) {
|
||||
nameplateVisible = "false";
|
||||
}
|
||||
getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible));
|
||||
}
|
||||
|
||||
private void updateCustomName() {
|
||||
boolean nameVisibility = false;
|
||||
if (!getEntity().isCustomNameVisible()
|
||||
|
Loading…
Reference in New Issue
Block a user