Skip to content

fix: dispatch reward commands on main thread for Folia compat (#31)#32

Open
hermes18974-jpg wants to merge 1 commit into
BitAspire:masterfrom
hermes18974-jpg:master
Open

fix: dispatch reward commands on main thread for Folia compat (#31)#32
hermes18974-jpg wants to merge 1 commit into
BitAspire:masterfrom
hermes18974-jpg:master

Conversation

@hermes18974-jpg
Copy link
Copy Markdown

@hermes18974-jpg hermes18974-jpg commented May 21, 2026

Fixes #31

Problem

On Folia-based servers, throws because it must run on the global tick thread. Level-up reward commands fire from event handlers on region threads.

Fix

Wrap calls in so they execute synchronously on the main thread.

Verification

  • now dispatched via scheduler task
  • Player/console commands both handled correctly
  • Spigot/Paper servers unaffected (scheduler works everywhere)

/claim #31


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

@review-me-code
Copy link
Copy Markdown

Pull request overview

Wraps command dispatch in scheduler tasks to ensure execution on the main thread for Folia compatibility. Fixes thread-safety issues where reward commands were being fired from region threads.

Changes:

  • Rewards.java: Renamed loop variable and wrapped dispatchCommand calls in Bukkit.getScheduler().runTask(main, ...)

Reviewed changes

No blocking or high-confidence comments.

Reviewed 1 changed file in this pull request and generated no inline comments.


Generated by pull_request.opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IllegalStateException: Dispatching command async on Folia when reward commands fire from region thread events

1 participant