Fixes to per-player name holograms

This commit is contained in:
fullwall 2024-01-18 17:22:22 +08:00
parent 4529f7dc39
commit 647215e8dd
2 changed files with 2 additions and 2 deletions

View File

@ -109,7 +109,7 @@ public class ProtocolLibListener implements Listener {
for (WrappedDataValue wdv : wdvs) {
if (fakeName != null && wdv.getIndex() == 2) {
wdv.setValue(fakeName);
wdv.setRawValue(fakeName);
delta = true;
} else if (sneaking && wdv.getIndex() == 0) {
byte b = (byte) (((Number) wdv.getValue()).byteValue() | 0x02);

View File

@ -503,10 +503,10 @@ public class HologramTrait extends Trait {
if (hologram != null) {
String name = Placeholders.replace(text, null, npc);
hologram.setName(name);
hologram.data().set(NPC.Metadata.NAMEPLATE_VISIBLE, ChatColor.stripColor(name).length() > 0);
if (Placeholders.containsPlaceholders(text)) {
hologram.data().set(NPC.Metadata.HOLOGRAM_LINE_SUPPLIER, this);
} else {
hologram.data().set(NPC.Metadata.NAMEPLATE_VISIBLE, ChatColor.stripColor(name).length() > 0);
hologram.data().remove(NPC.Metadata.HOLOGRAM_LINE_SUPPLIER);
}
}