EventHandlers not working.

Discussion in 'Plugin Development' started by Classy, Nov 28, 2014.

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

    Classy

    Cleared codings
     
    Last edited: Jan 2, 2015
  2. Online

    timtower Administrator Administrator Moderator

    Classy You never register the event.
     
  3. Offline

    Tecno_Wizard

    Second that.
     
  4. Classy Like what was said above.
    In case you have never used events before, add this to your onEnable() method:
    Code:java
    1. Bukkit.getPluginManager().registerEvents(this, this);
     
  5. Offline

    teej107


    Code:java
    1. public class Dummy
    2. {
    3. public void onEnable()
    4. {
    5. Bukkit.getPluginManager().registerEvents(this, this);
    6. }
    7. }
    It don't work.

    Perhaps giving more context than just code will be more helpful.
    http://wiki.bukkit.org/Event_API_Reference#Registering_Events
    http://jd.bukkit.org/rb/apidocs/org...kit.event.Listener, org.bukkit.plugin.Plugin)
     
  6. Offline

    Classy

    Cleared codings.
     
    Last edited: Jan 2, 2015
  7. Offline

    teej107

     
    xTrollxDudex likes this.
  8. Offline

    Skionz

    Classy Have you thought to call your 'connectCommands()' method onEnable()?
     
  9. Offline

    Classy

    Skionz How do I do that? Could you please link me with something.
     
  10. Offline

    Skionz

    Classy You didn't write that code did you? *facepalm*
     
    xTrollxDudex likes this.
  11. Offline

    uksspy

    How to call a method? Is that what you are asking?
     
  12. Offline

    teej107

    uksspy Yes sadly. Classy Learn Java before writing anything that requires Java.
     
  13. By having nothing in your onEnable, having methods but not using them, using deprecated(and unsafe methods), and not initializing the plugin variable, you show to have no real knowledge in Java. What I recommend? Stop stealing code and take a few days to learn some basic Java. If you don't want to do that, at least do your research on how to use the things you are trying to implement in your plugin. Use the Bukkit Javadocs, Bukkit wiki, and Bukkit forum(which you are but this is a last resort).
     
    xTrollxDudex and Skionz like this.
  14. Offline

    eyamaz

    teej107 and Skionz like this.
Thread Status:
Not open for further replies.

Share This Page