PaperMC / PaperMC/Folia

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.

status: needs triage type: bug
Dominant language
Shell
Stars
4.4k
Forks
623
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.