"lookclose" with Citizens API

Discussion in 'Plugin Development' started by Skyost, Oct 22, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Skyost

    Hi,
    I have a NPC created with this code :
    Code:java
    1. final NPC npc = registry.createNPC(EntityType.PLAYER, "Steve");
    2. npc.setProtected(true);
    3. npc.spawn(player.getTargetBlock(null, 100).getLocation());
    4. npc.faceLocation(player.getLocation());
    5. npc.data().setPersistent("lookclose", true);
    6. player.getWorld().playEffect(player.getTargetBlock(null, 100).getLocation(), Effect.MOBSPAWNER_FLAMES, 0);
    7. Bukkit.getScheduler().scheduleSyncDelayedTask(Halloween.plugin, new Runnable() {
    8.  
    9. @Override
    10. public void run() {
    11. npc.destroy();
    12. }
    13.  
    14. }, 200);

    How can I force it to look nearby players ?

    Thanks ;)
     
  2. Offline

    qhenckel

    I think what you want is:
    Code:
    npc.addTrait(Trait(lookclose));
     
Thread Status:
Not open for further replies.

Share This Page