mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-28 03:57:35 +01:00
Set /npc name as persistent
This commit is contained in:
parent
db88b84c97
commit
8c3ef5e629
@ -806,6 +806,7 @@ public class NPCCommands {
|
||||
public void name(CommandContext args, CommandSender sender, NPC npc) {
|
||||
LivingEntity entity = (LivingEntity) npc.getEntity();
|
||||
entity.setCustomNameVisible(!entity.isCustomNameVisible());
|
||||
npc.data().setPersistent(NPC.NAMEPLATE_VISIBLE_METADATA, entity.isCustomNameVisible());
|
||||
Messaging.sendTr(sender, Messages.NAMEPLATE_VISIBILITY_TOGGLED);
|
||||
}
|
||||
|
||||
|
@ -220,6 +220,10 @@ public class CitizensNPC extends AbstractNPC {
|
||||
NMS.sendPacketNearby(getStoredLocation(),
|
||||
new PacketPlayOutEntityTeleport(NMS.getHandle(getEntity())));
|
||||
}
|
||||
|
||||
if (getEntity() instanceof LivingEntity) {
|
||||
((LivingEntity) getEntity()).setCustomNameVisible(data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Throwable error = Throwables.getRootCause(ex);
|
||||
|
Loading…
Reference in New Issue
Block a user