Help Me update this to new Event System

Discussion in 'Plugin Development' started by l4pierce, May 15, 2012.

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

    l4pierce

    Hey guys, im trying to update this plugin to the new event system (as it was coded around the 1.0.1 time) Im down to this last part, can someone please help me? Thanks.

    Code:java
    1.  
    2. @Override
    3. public void onEnable() {
    4. setupPermissions();
    5. pdf = this.getDescription();
    6. version = pdf.getVersion();
    7. log.info(String.format(
    8. "%s NightLight version %s enabled successfully.", prefix,
    9. version));
    10. this.getServer().getPluginManager().registerEvent()
    11. .getPluginManager()
    12. .registerEvent(Event.class,
    13. new NightLightPlayerListener(), EventPriority.NORMAL,
    14. this);
    15. this.getServer()
    16. .getPluginManager()
    17. .registerEvent(Event.class,
    18. new NightLightPlayerListener(), EventPriority.NORMAL,
    19. this);
    20. this.getServer()
    21. .getPluginManager()
    22. .registerEvent(Event.class,
    23. new NightLightPlayerListener(), EventPriority.NORMAL,
    24. this);
    25. }
    26.  
     
  2. Offline

    Sagacious_Zed Bukkit Docs

  3. Offline

    l4pierce

    Oh, and the whole source for this can be found on the repo Here

    Yes i read it, but i was hoping somebody with a little bit more experience could help me, his coding is a bit confusing since i didnt write it myself , lol

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  4. Offline

    Sagacious_Zed Bukkit Docs

    I am not sure what would be the source of confusion. Is it because the method names are the same, but take different parameters?

    The answer I think is almost trivial.
     
  5. The method you're using is wrong in the thing you're trying to do. I don't even know when the method should be used at all. However, just use .registerEvents(<listener>, <main>); and you'll only need that once per listener class.
     
  6. Offline

    colony88

    If you want, I could update it for you?
     
  7. Offline

    Sagacious_Zed Bukkit Docs

    A long time ago, with internet time, those methods were once valid. They were deprecated and later removed.
     
  8. Offline

    Sagacious_Zed Bukkit Docs

  9. Ohhh, yeah. Sorry, I overlooked that one.
     
  10. Offline

    colony88

    I updated it. You want it? I can post the source too?
     
Thread Status:
Not open for further replies.

Share This Page