Hide nameplates for empty hologram names

This commit is contained in:
fullwall 2020-11-17 11:36:18 +08:00
parent 3c2d0625b4
commit 59d4f7033c

View File

@ -164,8 +164,10 @@ public class HologramTrait extends Trait {
String text = lines.get(i); String text = lines.get(i);
if (text != null && !text.isEmpty()) { if (text != null && !text.isEmpty()) {
hologramNPC.setName(Placeholders.replace(text, null, npc)); hologramNPC.setName(Placeholders.replace(text, null, npc));
hologramNPC.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true);
} else { } else {
hologramNPC.setName(""); hologramNPC.setName("");
hologramNPC.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
} }
} }
} }