private CitizensNpc spawnNpc(Location location, String nametag, Consumer<Npc> skin) {
        Objects.requireNonNull(this.npcRegistry, "npcRegistry");

        // create a new npc
        NPC npc = this.npcRegistry.createNPC(EntityType.PLAYER, nametag);

        // add the trait
        ClickableTrait trait = new ClickableTrait();
        npc.addTrait(trait);

        // create a new helperNpc instance
        CitizensNpc helperNpc = new NpcImpl(npc, trait, location.clone());
        trait.npc = helperNpc;

        // apply the skin and spawn it
        skin.accept(helperNpc);
        npc.spawn(location);

        return helperNpc;
    }
Implementation of {@link NpcFactory} using Citizens.
helper/src/main/java/me/lucko/helper/npc/CitizensNpcFactory.java