[NMS] Player Entities and General NPCs

Discussion in 'Plugin Development' started by TheDummy, Jan 31, 2014.

Thread Status:
Not open for further replies.
  1. CaptainBern
    Can you please reupload the code to pastebin or pastie.org? Hastebin stupidly deletes code after a certain amount of time and you can't make it stay forever.
     
  2. Paxination and KingFaris11 like this.
  3. Offline

    TheDummy

    CaptainBern Ok. Thank you.
     
  4. Offline

    Paxination

    CaptainBern OMG your awesome. I have been following this and JUST NOW got my NPC to spawn. I totally flipped when I saw it spawn.

    TheDummy Not sure if you have had this issue, but in PVP regions, only SOME of the NPC's can be damaged. Have you had this issue? I am using the same method to spawn them.

    And I know this is a stupid question, but its late and I cant think (past my bed time), but is it possible to cast EntityPlayer to entity or some superclass of it?
     
  5. Offline

    xTrollxDudex

    Paxination
    EntityPlayer automatically inherits superclass and implementing class methods, and you can also use the superclasses's superclass a methods as well. EntityPlayer extends EntityHuman, which extends EntityLiving, which extends Entity, and you can use any method from any class from an EntityPlayer object.
     
  6. Offline

    Paxination

    TheDummy Nvm about the pvp issue. It turns out, if you spawn an NPC with a player that exist on your server and you have essentials installed, essentials, and im assuming any other plugin as well, will treat that NPC the same as that player as if they were on. So if that player has /god on, you cant kill it.
     
  7. Offline

    MrAwellstein


    That makes sense if you think about it, and is really interesting. I bet other plugins will act the same. Also you should try killing a player next to their NPC and see if it kills their NPC.
     
  8. Offline

    Paxination

    [​IMG]

    As you can see, the players you see dieing in the back ground are my NPC's. I am assuming apon death I need to do......

    ((CraftWorld)Bukkit.getServer().getWorld("world")).getHandle().removeEntity(npc);

    MrAwellstein Forgot to mention, I tried your suggestion. No affect. Player death message plugin picks up on them. They take damage from players and arrows, and would assume other projectiles as well. Fire and lava and suffocation dont affect them.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  9. Offline

    Jogy34


    You could just do
    Code:java
    1. npc.getBukkitEntity().remove()
     
  10. Offline

    ResultStatic

    CaptainBern Garris0n lol i thought they became final in 1.7.9, i would have been screwed. the obfuscater almost gave me a heartattack. after looking back i noticed i was looking at the wrong fields

    private final Queue k = Queues.newConcurrentLinkedQueue(); // same name
    private final Queue l = Queues.newConcurrentLinkedQueue();

    new ones
    private Channel m;
    public SocketAddress n;
     
  11. Offline

    xTrollxDudex

    ResultStatic
    3 months later....

    I wonder which page you were able to find this on?
     
  12. Offline

    ResultStatic

    xTrollxDudex I had to do some digging but the code still does work. I hate using an api. the only thing i cant get to work is adding potion effects like invisibility to the player object. the standard bukkit player object does MOSTLY work just a few methods dont. Its so cool because even events like PlayerDamageEvent PlayerInteractEntityEvent work great
     
  13. Offline

    xTrollxDudex

    ResultStatic
    Well... You don't need to bump to post updated information. If that happened, all of the new threads would be near the bottom of plugin development.
     
  14. Offline

    ResultStatic

  15. Offline

    xTrollxDudex

  16. Offline

    ResultStatic

Thread Status:
Not open for further replies.

Share This Page