Skip to content

Fix Folia chunk ticket scheduling in 1.21.11 adapter#7

Merged
Chwitst187 merged 1 commit intomainfrom
codex/fix-unsupportedoperationexception-in-fastasyncworldedit
Feb 25, 2026
Merged

Fix Folia chunk ticket scheduling in 1.21.11 adapter#7
Chwitst187 merged 1 commit intomainfrom
codex/fix-unsupportedoperationexception-in-fastasyncworldedit

Conversation

@Chwitst187
Copy link
Copy Markdown
Owner

Motivation

  • Avoid calling MinecraftServer.execute(...) (via MCUtil.MAIN_EXECUTOR.execute(...)) from Folia region threads which throws UnsupportedOperationException, by scheduling the chunk ticket work through FAWE's task manager instead.

Description

  • Replace io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(...) with TaskManager.taskManager().task(...) in PaperweightPlatformAdapter.addTicket(...) so chunk unload-cooldown tickets are scheduled via FAWE's scheduler abstraction.

Testing

  • Attempted to compile the adapter with ./gradlew :worldedit-bukkit:adapters:adapter-1_21_11:compileJava --no-daemon, but the build did not proceed to Java compilation due to an unrelated Gradle configuration error: Task with name 'build' not found in project ':worldedit-libs:cli'.

Codex Task

Copilot AI review requested due to automatic review settings February 25, 2026 20:32
@Chwitst187 Chwitst187 merged commit a09dd3f into main Feb 25, 2026
2 checks passed
@Chwitst187 Chwitst187 deleted the codex/fix-unsupportedoperationexception-in-fastasyncworldedit branch February 25, 2026 20:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Folia compatibility issue in the 1.21.11 adapter by replacing direct calls to MCUtil.MAIN_EXECUTOR.execute() with FAWE's TaskManager.taskManager().task() for scheduling chunk ticket operations. The change prevents UnsupportedOperationException when running on Folia, where region threads cannot directly execute tasks on the main thread.

Changes:

  • Replace io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute() with TaskManager.taskManager().task() in the addTicket() method to use FAWE's scheduler abstraction that properly handles both Bukkit and Folia environments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) {
// Ensure chunk is definitely loaded before applying a ticket
io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel
TaskManager.taskManager().task(() -> serverLevel
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same Folia compatibility issue exists in other adapter versions (adapter-1_21_5, adapter-1_21_6, and adapter-1_21_9) where MCUtil.MAIN_EXECUTOR.execute is still used in the addTicket method. Consider applying this fix consistently across all affected adapters to ensure Folia compatibility throughout the codebase.

Suggested change
TaskManager.taskManager().task(() -> serverLevel
TaskManager.taskManager().sync(() -> serverLevel

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants