Region ticker disables before plugins, disallowing plugin cleanups in the world

Open
#353 12 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
api, backend

Research direction

Start by tracing the shutdown ordering for the region ticker, RegionScheduler, and plugin onDisable() lifecycle described in the issue. Reproduce the block-change cleanup scenario, then verify that plugin cleanup work can still be scheduled during shutdown and that the reverted block or removed entities are processed before the server stops.

Written by the indexing model from the issue text.

Description

status: needs triage type: bug
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 time onDisable() occurs.

This means some plugins cannot run their cleanup, such as removing entities, reverting block changes, etc.

Steps/models to reproduce
  1. Set a block in the world with a task
  2. Set a task to revert that block change in onDisable()
  3. Stop the server
  4. The block will not be reverted
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

Dominant language
Shell
Stars
4.7k
Forks
651
Avg merge
10d 3h
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PaperMC/Folia

All issues in PaperMC/Folia

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.