Update tablist after teleport

This commit is contained in:
fullwall 2020-05-12 22:13:22 +08:00
parent feb6bc2851
commit 0498353751
2 changed files with 9 additions and 2 deletions

View File

@ -639,6 +639,13 @@ public class EventListen implements Listener {
} }
continue; continue;
} }
if (npc.isSpawned()) {
ids.remove(i--);
if (Messaging.isDebugging()) {
Messaging.debug("NPC", npc.getId(), "already spawned");
}
continue;
}
boolean success = spawn(npc); boolean success = spawn(npc);
if (!success) { if (!success) {
if (Messaging.isDebugging()) { if (Messaging.isDebugging()) {

View File

@ -318,8 +318,8 @@ public class CitizensNPC extends AbstractNPC {
@Override @Override
public void teleport(Location location, TeleportCause reason) { public void teleport(Location location, TeleportCause reason) {
super.teleport(location, reason); super.teleport(location, reason);
if (isSpawned() && getEntity().getLocation(CACHE_LOCATION).distanceSquared(location) < 1) { if (getEntity() instanceof SkinnableEntity) {
NMS.setHeadYaw(getEntity(), location.getYaw()); ((SkinnableEntity) getEntity()).getSkinTracker().updateNearbyViewers(48);
} }
} }