Chunky (Bukkit)

Chunky (Bukkit)

20.6k Downloads

Implement an API

Ste3et opened this issue ยท 5 comments

commented

Chunky works very fell for my farmworld pregeneration server.
Can you implement some kind of API for developers?
A Stort/Stop function for the plugin over api should be very usefull the same as an WorldPregenerateFinishEvent or something else.

   Chunky().getInstance().start(org.Bukkit.World) (void)
   Chunky().getInstance().isRunning(org.Bukkit.World) (boolean)
   Chunky().getInstance().stop(org.Bukkit.World) (boolean)
   
  WorldPregenerateFinishEvent should only return the World that the Event has been called is enaugth for me to use

How my old farmworld server works:

Step 1)

Server will be started my plugin start a world pregeneration over the WorldBorder fill command

Step 2)

If the Server has been finished the world pregeneration the server will be shutdown and move the world in an new tar.gz

if the main server has less then 10 farmworlds the server start on step 1 ^^

commented

I think this fits best here.
Is there an event to see if Chunky is done rendering the world? And if so how do I get that into my Maven project?

commented

I think this fits best here. Is there an event to see if Chunky is done rendering the world? And if so how do I get that into my Maven project?

Currently there is not an event for that, as the API isn't here yet. The best way to check completion right now would probably be to check GenerationTask.Progress#isComplete from the implementation code. As a reminder, implementation is not API and may incur breaking changes without warning. I am not against it being used (especially in the absence of a proper API) but just be aware of it. If you have questions about this feel free to ask on the Discord server.

That said, this issue is definitely overdue for a status update, so I'll just say that since my last message, multi-platform support has matured, and somewhat more recently a common event bus was added within the plugin (mostly used in implementation for ChunkyBorder at the moment, but likely to remain similar for handling registration of custom event handlers through the API). I feel comfortable in saying that the plugin at this point is stable, so releasing the API at this point is not out of the question. I just need to find time for it.

commented

I've implemented an initial API into Chunky. You can find it here.

This is a preview. Please do not use the API in public plugins yet.

Documentation will be provided soon, but for those of you who are experienced developers, using the API is simple:

  1. Add chunky-common as a provided dependency to your project.
  2. Get an instance of ChunkyAPI from the Bukkit service manager.

You will then be able to work with the API, which has the following features to start:

  1. Get the API version (preview is version 0)
  2. Check if a task is currently running
  3. Start, pause, continue, or cancel tasks
  4. Register a listener for task progress or completion

Thanks again for all of your patience as this has taken me a long time to get to. I feel it was definitely necessary as it took me a while to be comfortable with where the project is at. Please let me know if you use this and any feedback you may have! I am open to chat in the #chunky channel on our Discord server.

commented

I have added some additional documentation for the API including a javadoc on the wiki, for those interested.

commented

Yeah that sounds pretty cool, I'll consider adding this when I get a chance. As mentioned in the other open issue, I'm still working a bit on polishing up the current features, but I think adding an API would be a good next addition.