Skip to content

Commit

Permalink
Fix name tags affecting NPC names
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jun 15, 2014
1 parent 5e198e6 commit a45733e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/net/citizensnpcs/npc/CitizensNPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean despawn(DespawnReason reason) {
}
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;
}
Expand Down Expand Up @@ -230,6 +230,9 @@ public void update() {

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())));
Expand All @@ -256,4 +259,4 @@ private void updateFlyableState() {
}

private static final String NPC_METADATA_MARKER = "NPC";
}
}

0 comments on commit a45733e

Please sign in to comment.