From 18b98eb609f3edb6cc218763e1935e49e8222e66 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 15 Jun 2014 20:26:29 +0800 Subject: [PATCH] Fix name tags affecting NPC names --- src/main/java/net/citizensnpcs/npc/CitizensNPC.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index b71c5cf90..3ffd1638e 100644 --- a/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -64,7 +64,7 @@ public class CitizensNPC extends AbstractNPC { } Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { - getEntity().getLocation().getChunk().load(); + getEntity().getLocation().getChunk(); Messaging.debug("Couldn't despawn", getId(), "due to despawn event cancellation. Force loaded chunk."); return false; } @@ -230,6 +230,9 @@ public class CitizensNPC extends AbstractNPC { if (!getNavigator().isNavigating() && getEntity().getWorld().getFullTime() % Setting.PACKET_UPDATE_DELAY.asInt() == 0) { + if (getEntity() instanceof LivingEntity) { + ((LivingEntity) getEntity()).setCustomName(getFullName()); + } Player player = getEntity() instanceof Player ? (Player) getEntity() : null; NMS.sendPacketNearby(player, getStoredLocation(), new PacketPlayOutEntityTeleport(NMS.getHandle(getEntity()))); @@ -256,4 +259,4 @@ public class CitizensNPC extends AbstractNPC { } private static final String NPC_METADATA_MARKER = "NPC"; -} \ No newline at end of file +}