Solved All the classes in package listeners don't work.

Discussion in 'Plugin Development' started by NickDEV, Sep 20, 2015.

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

    NickDEV

  2. Offline

    Zombie_Striker

    1. You are enabling the listener FOR THE MAIN CLASS
    2. You did not register the listener for the other event class (which you should not have multiple classes for multiple events. JUST HAVE ONE CLASS for ALL EVENT)
    3. You did not let those listeners implement listener
    [edit] Took a second look. The way you registered your classes may be the reason. Instead if having one class register the listener, move it all to the onEnable. Also, may we see the events classes themselves?

    [edit2] You should have all classes IN THE SAME PACKAGE.
     
    Last edited: Sep 20, 2015
  3. Offline

    TeddyDev

    @Zombie_Striker That did not make sense.

    @NickDEV What did you change/add for it to stop working all of a sudden?
     
  4. Offline

    Hawktasard

    Care to explain why that would change anything?... All of his classes are public so they can be accessed anywhere.
     
  5. Offline

    rbrick

    @NickDEV The static reference (*shudders*) to your plugin is probably null.
     
  6. Offline

    NickDEV

    @TeddyDev I just switched from one class to multiple classes. When I tried to run plugin with multiple classes everything except MAIN class (WATW.java) stopped working. :(
     
  7. Offline

    RoboticPlayer

    Why are you using the § symbol AND ChatColor in your onEnable()? You should only use ChatColor, it's more stable.
     
  8. Offline

    NickDEV

    @henderry2019 Thanks for noticing, but this is not our main problem here. Any other ideas how can I fix this?
     
  9. Offline

    RoboticPlayer

    It would be better if you showed the code that was actually the issue.
     
  10. Offline

    NickDEV

    @henderry2019 Tell me what's the issue and here we go, you get the code.
     
  11. @NickDEV
    I think this might be the issue
     
  12. Offline

    Zombie_Striker

    Your main class is only in one package, while your other classes are in two packages lower down. This may be an issue. Try moving all the classes out of those extra class (And if you can, consolidate all those event classes. YOU ONLY NEED ONE)
     
  13. Offline

    Hawktasard

    @Zombie_Striker
    I seriously doubt this is the issue.. Can you please give us the reason as to why you think this would cause any problems?
     
    mine-care likes this.
  14. Offline

    mythbusterma

    @Zombie_Striker

    Err....there's no reason not to put it in another package, it's much more organised that way.
     
  15. Offline

    L3N

    @NickDEV I bet that's giving a NullPointerException error, and that's because WATWkitpvp is null/not initialized/whatever. The way you can fix this is pretty simple I'm going to give u pseudo-code if you don't understand something just reply back:
    • Make an argument in RegisterListeners that takes WATWkitpvp class and use that object/variable to get the plugin;
    • in the Main initialize WATWkitpvp by :
      Code:
      new WATWkitpvp(this);
    And that's pretty much it, I also recommend you change from: "1.0" to:
    Code:
    getDescription().getVersion();
    Again, if you don't understood something or think it needs more explaining just throw a reply.
     
  16. @NickDEV
    1. Don't use §
    2. No need for enable messages
    3. plugin is most likely null, can't see it being initialized anywhere.
     
  17. Offline

    NickDEV

    Thanks for helping :p The problem was that I forgot this line on enable:
    Code:
    plugin = this;
     
Thread Status:
Not open for further replies.

Share This Page