Event Handling Help!

Discussion in 'Plugin Development' started by mccrafter1212, Jul 11, 2015.

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

    mccrafter1212

    Alright so I hope someone can help me on this. I can't get my events for my plugin to function. Take a look at the images below and can someone please tell me what you think I did wrong or how on earth to do it. I am really frustrated and could use help. Images Below!
    upload_2015-7-11_11-29-2.png
    This is my MAIN class. It contains my commands and the connection to my events(Look at onEnabled).
    upload_2015-7-11_11-31-15.png
    This is my PLAYERLISTENER class. It has my events which are not working.
     

    Attached Files:

  2. Offline

    1Rogue

    You didn't override onEnable, your method is "onEnabled"
     
  3. Offline

    mccrafter1212

    Alright thanks I am going to try this. Hopefully it works.

    Hey so I tried it and I am getting an error with it
     
    Last edited by a moderator: Jul 11, 2015
  4. Offline

    benjfb1

    Please provide me with a FULL log on your server after you changed it so I can help :)

    This may fix it:
    In your on enable:
    Code:
    PluginManager plm = getServer().getPluginManager();
    plm.registerEvents(new PlayerListener(), this);
    
    Then remove any other Event Register that you have in your classes
     
    Last edited: Jul 11, 2015
  5. Offline

    poepdrolify

    In your main class:
    Code:
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new PlayerListener(), this)
    }
    Done.
     
  6. Offline

    caderape

  7. Offline

    MasterMatt5

    Check before casting to a player and post your plugin.yml.
     
  8. Offline

    mccrafter1212

    Alright benjfb1 i'll give you a full update on the error I am getting in console asap. You should receive the report in 9-11 hours.

    @benjfb thanks sooo much you did not only fix the event error I was receiving but also a plugin.yml error. Everything is running smoothly now. :):):):)

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

    MasterMatt5

    Please mark as solved.
     
  10. Offline

    benjfb1

    Glad to help :)
     
Thread Status:
Not open for further replies.

Share This Page