From ea20cdb21eee27d53302583a0a7d82cab87e97cb Mon Sep 17 00:00:00 2001 From: fullwall Date: Thu, 9 Jul 2020 23:37:45 +0800 Subject: [PATCH] Fix duplication of name hologram --- .../main/java/net/citizensnpcs/npc/CitizensNPC.java | 10 ++++++---- .../main/java/net/citizensnpcs/trait/CommandTrait.java | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index 1e1a10b28..b1f4c4813 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -268,10 +268,8 @@ public class CitizensNPC extends AbstractNPC { NMS.setHeadYaw(getEntity(), at.getYaw()); NMS.setBodyYaw(getEntity(), at.getYaw()); - if (requiresNameHologram() && !hasTrait(HologramTrait.class)) { - addTrait(HologramTrait.class); - } - String nameplateVisible = data(). get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString(); + String nameplateVisible = data(). get(NPC.NAMEPLATE_VISIBLE_METADATA, !requiresNameHologram()) + .toString(); getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible)); // Set the spawned state @@ -318,6 +316,10 @@ public class CitizensNPC extends AbstractNPC { PlayerUpdateTask.registerPlayer(getEntity()); } + if (requiresNameHologram() && !hasTrait(HologramTrait.class)) { + addTrait(HologramTrait.class); + } + updateFlyableState(); Messaging.debug("Spawned", getId(), "SpawnReason." + reason); diff --git a/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java b/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java index b86ba048a..ebc09a580 100644 --- a/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java @@ -74,6 +74,7 @@ public class CommandTrait extends Trait { economy.withdrawPlayer(player, cost); } } catch (NoClassDefFoundError e) { + Messaging.severe("Unable to find Vault when checking command cost - is it installed?"); } } return true;