PlayerInteractEntity NPE

Discussion in 'Plugin Development' started by Darkman2412, Nov 2, 2011.

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

    Darkman2412

    Hi!

    First time that I use the PlayerInteractEntityEvent, and I already bounced against an error...
    How can getRightClicked() be null?
    Code:
    b(!(e.getRightClicked() instanceof Wolf));
    Thanks in advance,
    Darkman2412
     
  2. Offline

    Darkman2412

    Bump. Any ideas?
     
  3. Offline

    vaiquero

    Do check if the interaction reason is for right clicked entities first.
     
  4. Offline

    Darkman2412

    Event only gets called when player interacts with entity.
     
  5. Offline

    vaiquero

    In that case the getBukkitEntity() function for that entity is invalid. Report the issue to Bukkit.
     
  6. Offline

    Sleaker

    Pretty sure you can do (null instanceof AnyClass) without getting any errors - I have a feeling you have errors elsewhere in your code.

    Example reasoning: http://www.java2s.com/Tutorial/Java/0060__Operators/TheinstanceofKeyword.htm
     
Thread Status:
Not open for further replies.

Share This Page