[SOLVED] NullPointerException when PLAYER_INTERACT event gets fired

Discussion in 'Plugin Development' started by hmpf, Mar 31, 2011.

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

    hmpf

    Hi there,

    Ive got a problem with a PlayerListener and dont know if the problem is caused by me or CraftBukkit (612).

    In my MainClass I register the event:
    this._pm.registerEvent(Event.Type.PLAYER_INTERACT, this._playerListener, Event.Priority.High, this);

    (_pm is the PluginManager)

    I have an PlayerListener class with the method:
    public void onPlayerInteract( PlayerInteractEvent event )

    When playing minecraft and interacting with a chest I see in the server console that the event gets fired.
    However it results in a NullPointerException:
    2011-04-01 04:38:24 [SEVERE] Could not pass event PLAYER_INTERACT to JustATest java.lang.NullPointerException

    What am I doing wrong? Or is it CraftBukkit thats causing the problem?

    I can see the same exception for BigBrother, when I right-click a chest:
    2011-04-01 04:38:24 [SEVERE] Could not pass event PLAYER_INTERACT to BigBrother
    java.lang.NullPointerException

    Oh, feeling tremendous stupid.. Forgot to initialize the listener.
    Nevermind, long nights do strange things to peoples minds.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
Thread Status:
Not open for further replies.

Share This Page