Question about entityplayer

Discussion in 'Plugin Development' started by Paxination, Feb 14, 2014.

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

    Paxination

    So i have a class that extends EntityPlayer. To spawn npc's. When ever an event is triggered with that entity, shouldnt I be able to test if its my NPC by doing an INSTANCEOF MYCLASS? Since it was spawned/created with my custom entityplayer class?
     
  2. Offline

    xTrollxDudex

    Paxination
    I no event is called when you add an entity that is instanceof EntityHuman. Bukkit just skips it. I would expect that PacketPlayOutNamedEntitySpawn gets sent in the spawn.
     
  3. Offline

    Paxination

    @xTrollxDude

    Thanks for the reply, but maybe you misunderstood me. I have a custom class that extends EntityPlayer. Its called OasisEntityPlayer. When I need to check if an entity was created through my class, should INSTANCEOF OasisEntityPlayer work?
     
  4. Offline

    Paxination

  5. Offline

    xTrollxDudex

    Paxination
    How do you check when it is created...?
     
  6. Offline

    Garris0n

    if(((CraftEntity) entity).getHandle() instanceof YourWhateverPlayerThing)

    Well, at least that should work. I've never needed to mess around with extending EntityPlayer.
     
    Paxination likes this.
  7. Offline

    Paxination

    Garris0n

    Thanks that worked. Didnt think about casting to CraftEntity first.
     
Thread Status:
Not open for further replies.

Share This Page