Developer mode flag
Closed this issue · 2 comments
Is your feature request related to a problem?
It's kinda hard as a plugin developer to tell what the do's and don'ts are of writing a folia plugin
Describe the solution you'd like.
A guide for plugin developers, with code snippets for paper vs folia version of code and answering questions such as:
- how is the thread for which a command is executed on decided? the region of executing player?
- how is the thread which an event listener will run on decided? region of where the event took place?
- how is the thread of a bukkit runnable decided? can it be changed or is it fixed from when it is created? What if the ticking region owning the runnable is destroyed?
- Is there a way to use folia schedulers for folia servers but falling back to bukkit scheduler for regular paper servers?
- A full list of unsupported events/apis would be nice
Also more api for async stuff maybe like instead of:
for (World world : Bukkit.getWorlds()){
for(Chunk chunk : world.getChunks()){
// ran on main thread
}
}
could be like this:
Folia.runOnEachRegion(tickRegion -> {
tickRegion.getOwnedChunks().forEach(chunk -> {
// ran on the different tick threads
});
});
also a mode with strict thread checks everywhere, ensuring we are doing things correctly to avoid race conditions. For example thread checks EVERYWHERE where cross region access occurs, maybe plugin scanning for non thread-safe collections (silly idea maybe), stuff like that.
Describe alternatives you've considered.
idk
Other
No response
I'm pretty sure your runOnEachRegion
example would require locking the regions while it runs to prevent them from merging or splitting in the middle, all regions would have to stop ticking to process this.
Also, this is like 3-8 issues in one, you should split it up in to API requests, documentation requests, and server feature requests (the flag).
I'm pretty sure your
runOnEachRegion
example would require locking the regions while it runs to prevent them from merging or splitting in the middle, all regions would have to stop ticking to process this.Also, this is like 3-8 issues in one, you should split it up in to API requests, documentation requests, and server feature requests (the flag).
done