mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-30 06:33:56 +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();
|
updateFlyableState();
|
||||||
|
updateCustomNameVisibility();
|
||||||
updateCustomName();
|
updateCustomName();
|
||||||
|
|
||||||
Messaging.debug("Spawned", getId(), "SpawnReason." + reason);
|
Messaging.debug("Spawned", getId(), "SpawnReason." + reason);
|
||||||
@ -381,11 +382,7 @@ public class CitizensNPC extends AbstractNPC {
|
|||||||
updateCounter = 0;
|
updateCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString();
|
updateCustomNameVisibility();
|
||||||
if (requiresNameHologram()) {
|
|
||||||
nameplateVisible = "false";
|
|
||||||
}
|
|
||||||
getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible));
|
|
||||||
|
|
||||||
if (isLiving) {
|
if (isLiving) {
|
||||||
NMS.setKnockbackResistance((LivingEntity) getEntity(),
|
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() {
|
private void updateCustomName() {
|
||||||
boolean nameVisibility = false;
|
boolean nameVisibility = false;
|
||||||
if (!getEntity().isCustomNameVisible()
|
if (!getEntity().isCustomNameVisible()
|
||||||
|
Loading…
Reference in New Issue
Block a user