How to detect NPC?

Discussion in 'Plugin Development' started by fromgate, May 13, 2012.

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

    fromgate

    Hello!

    I need to detect if damaged entity is NPC (not a Player, not any kind of mob). Please help me: how I can do it?
     
  2. Offline

    Njol

    Check if it's a HumanEntity, but not a Player maybe?
     
    fromgate likes this.
  3. Offline

    ZNickq

    NPCs are human entitites ;)

    You'd usually hook into a specific NPC plugin (it's usually Citizens) and check using its API if it is really a NPC, other than that you could try (world.getOnlinePlayers().contains(player)) <= The npc's aren't on bukkit's online player list ;D
     
    fromgate likes this.
  4. Offline

    Neodork

    if your using the npclib use:

    plugin.NPCManager.isNPC(entity);
     
    fromgate likes this.
  5. Offline

    pers2981

    How are you creating the NPC?
     
    fromgate likes this.
  6. Offline

    fromgate

    Hello!

    Thank you for support. I will try all solutions as soon as I can.

    I did not creating NPC, I need to check if player is npc to prevent damaging or item dropping from NPC. In our server installed Citizens plugin and sometimes it conflicting with our other plugins. For example, headshots provided by MonsterFix plugin, are allowing players to farm helms from NPC.

    I think world.getOnlinePlayers().contains(player) will be best solution (Same idea also came to my mind today while I could not get to Eclipse :))
     
  7. Offline

    pers2981

    I know this thread is about targeting the NPC, It would help me help you however if I know how you created/spawned the NPC.
     
Thread Status:
Not open for further replies.

Share This Page