Region ticker disables before plugins, disallowing plugin cleanups in the world #353
Labels
No labels
documentation
good first issue
help wanted
resolution: duplicate
resolution: invalid
resolution: won't fix
status: needs triage
type: bug
type: feature
type: performance
type: question
version: 1.19.4
version: 1.20
version: 1.20.1
version: 1.20.2
version: 1.20.4
version: 1.20.6
version: 1.21.11
version: 1.21.4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Minecraft/Folia#353
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Expected behavior
N/A
Observed/Actual behavior
The region ticker disables before plugins, preventing any further ticks while shutting down.
For some plugins, who spawn entities or block modifications in the world, normally they can run cleanups in
onDisable(). However, because synchronous tasks on disable cannot be done due to the lack of main thread, they have to pend this task to RegionScheduler. Which is disabled at the timeonDisable()occurs.This means some plugins cannot run their cleanup, such as removing entities, reverting block changes, etc.
Steps/models to reproduce
onDisable()Plugin and Datapack List
BetterScoreboard, packetevents, PlaceholderAPI, ProjectKorra, ViaBackwards, ViaVersion
Folia version
1.21.4-DEV-master@8af1aef (2025-04-11T00:37:47Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
Other
No response
I also run into this issue :P
I run into this issue as well
I also run into this issue dude.
I also run into the same issue
I also run this issue.
Same issue here
This is also something I struggle with. It would be great if it can be fixed as soon as possible!
I probably need to make more uses of the regionized world data tolerant to shutdown. There are still some things that you really can't do though, like load chunks.
I don't know if it would be viable, but before the server shutdown call, create some kind of event like ServerWillShutdownEvent?
But if so, it would be more on the Paper side that would need to be added.
ServerPreShutdownEvent would be good for cleanup for sure, though yes, it should exist in both Paper and Folia if added. Probably fired after Players are effectively "disconnected" (on folia, still in world, but on Paper iirc they'd be disconnected already?), though the specifics of that could be pretty easily documented and handled per platform by devs. Would, in general, be helpful since just handling
onDisableis too late for many Folia API calls, plus if the server region crashes or something it could allow better, safe Plugin cleanupplayers are booted from the server long after plugins disable on paper, and changing that behavior requires a whole lot of testing as it's fairly easy for stuff to get lost if you start changing the semantics of shutting down which brings in a lot of edge case issues
@electronicboy I'm not suggesting making a change to shutdown behavior, I was just making an assertion that's probably wrong. AFAIK on Folia players are only removed from the world late into shutdown, idk what it is on Paper.