Source:
<code>protected Entity createEntity(final Location at, final NPC npc) { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = Colorizer.parseColors(npc.getFullName()); if (coloredName.length() > 16) { coloredName = coloredName.substring(0, 16); } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { long msb = uuid.getMostSignificantBits(); msb &= ~0x0000000000004000L; msb |= 0x0000000000002000L; uuid = new UUID(msb, uuid.getLeastSignificantBits()); } GameProfile profile = new GameProfile(uuid, coloredName); updateSkin(npc, nmsWorld, profile); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, new PlayerInteractManager(nmsWorld), npc); handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch()); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { boolean removeFromPlayerList = Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean(); NMS.addOrRemoveFromPlayerList(getBukkitEntity(), npc.data().get("removefromplayerlist", removeFromPlayerList)); } }, 1); handle.getBukkitEntity().setSleepingIgnored(true); NMS.sendToOnline(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle)); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { <START> NMS.sendToOnline(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, <END> ((CraftPlayer) getBukkitEntity()).getHandle())); } } }, 60); return handle.getBukkitEntity(); }</code><technical_language>method</technical_language>

Target:
protected Entity createEntity(final Location at, final NPC npc) { final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle(); String coloredName = Colorizer.parseColors(npc.getFullName()); if (coloredName.length() > 16) { coloredName = coloredName.substring(0, 16); } UUID uuid = npc.getUniqueId(); if (uuid.version() == 4) { long msb = uuid.getMostSignificantBits(); msb &= ~0x0000000000004000L; msb |= 0x0000000000002000L; uuid = new UUID(msb, uuid.getLeastSignificantBits()); } GameProfile profile = new GameProfile(uuid, coloredName); updateSkin(npc, nmsWorld, profile); final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile, new PlayerInteractManager(nmsWorld), npc); handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getYaw(), at.getPitch()); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { boolean removeFromPlayerList = Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean(); NMS.addOrRemoveFromPlayerList(getBukkitEntity(), npc.data().get("removefromplayerlist", removeFromPlayerList)); } }, 1); handle.getBukkitEntity().setSleepingIgnored(true); NMS.sendPlayerlistPacket(true, null, handle.getBukkitEntity()); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { if (npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { NMS.sendPlayerlistPacket(false, null, npc); } } }, 60); return handle.getBukkitEntity(); }