World Time Event

Discussion in 'Plugin Development' started by wristdirect, Nov 11, 2012.

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

    wristdirect

    Is there a way to make an event that triggers when a specific world time ticks (say 18000)? This would be really helpful, and after a decent amount of searching the API and forums I couldn't find anything.

    Any help would be greatly appreciated! Thanks guys :)
     
  2. Offline

    ChrisixStudios

    Even though there is not a specified event for this but it is not that hard to create an event that can do this :) I could either tell you how to create a time event or give you the code :)
     
  3. Offline

    gomeow

    How does one make an event, exactly?
     
  4. Offline

    ChrisixStudios

    You have to create a class that extends the Bukkit API Event class. Then you put it in your code when you want it to execute by creating an Instance of that class then using the Bukkit.getPluginManager().callEvent(Event e) method to call it. Then just create the listening class and Listen to your event.
     
  5. Offline

    The_Coder

    WorldEvent
     
  6. Offline

    ChrisixStudios

    I didn't think WorldEvent works
     
  7. Offline

    The_Coder

    I just looked in bukkit source code though...
     
  8. Offline

    ChrisixStudios

    Okay, lol I didn't test it.
     
  9. Offline

    The_Coder

    I don't think it will just work you might need some if statements and checks.
     
  10. Offline

    ChrisixStudios

    Well I just made WorldTimeEvent and it works fine xD
     
  11. Offline

    The_Coder

    Here is a better idea run a bukkit scheduler in the onenable that checks world time.
     
  12. Offline

    ChrisixStudios

    That's pretty much what my event does xD But it makes it easier for people who don't know how to run a repeating task.
     
  13. Offline

    fireblast709

    next step: pull request on github
     
  14. Offline

    wristdirect

    Sorry for abandoning this after making the question, busy busy.

    ChrisixStudios Thanks for the reply :) Source for that would be totally awesome, though just giving me the thought of doing that with the scheduler made me face palm for not thinking of it. I even looked into custom events a little and for some reason didn't think to do that. Thanks! And thanks x2 if you share that source with me ;)
     
  15. Offline

    cman1885

    Why would you pull for a world time event that just runs a scheduler...?
     
  16. Offline

    coldandtired

    I have a library plugin here which includes this.

    You can see the source here.
     
  17. Offline

    wristdirect

    Awesome, thanks coldandtired, what an awesome plugin :D

    And thanks for the source too, even more awesome ^_^
     
Thread Status:
Not open for further replies.

Share This Page