-
Notifications
You must be signed in to change notification settings - Fork 65
Add Folia compatibility #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 adds compatibility with Folia by introducing SchedulerUtils to abstract scheduler behavior, ensuring sync and async tasks are dispatched with the appropriate Folia APIs when available while maintaining backwards compatibility with Paper and Spigot.
- Updated plugin.yml to declare Folia support.
- Modified WebhookEventListener, ServerExecCommandSender, Metrics, and ServerTapMain to leverage Folia scheduling.
- Added SchedulerUtils to encapsulate scheduler differences.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/plugin.yml | Added a new key to declare Folia support |
| src/main/java/io/servertap/webhooks/WebhookEventListener.java | Updated async task scheduling to use Folia’s async scheduler when available |
| src/main/java/io/servertap/utils/ServerExecCommandSender.java | Refactored command execution to use Folia’s global region scheduler in compatible mode |
| src/main/java/io/servertap/utils/SchedulerUtils.java | Introduced a utility class to abstract scheduler operations across environments |
| src/main/java/io/servertap/metrics/Metrics.java | Adjusted metrics submission scheduling to support Folia |
| src/main/java/io/servertap/ServerTapMain.java | Replaced direct scheduler call with SchedulerUtils for repeating tasks |
|
This looks good to me. Should test things out to make sure nothing breaks and it actually works, but I don't see any reason it won't. Thanks @CaptainParis for the PR |
|
Added robust error handling to scheduler methods ensuring exceptions are logged appropriately. Refactored code to leverage SchedulerUtils across the project for consistent task scheduling on Bukkit and Folia. These changes enhance code maintainability and improve error diagnostics. |
There was a problem hiding this 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 pull request adds Folia compatibility by introducing SchedulerUtils to abstract scheduler behavior and updates various scheduling calls across the plugin.
- Updates plugin.yml to declare Folia support.
- Refactors asynchronous and repeating tasks in WebhookEventListener, ServerExecCommandSender, Metrics, and ServerTapMain to leverage SchedulerUtils.
- Introduces SchedulerUtils to conditionally dispatch tasks using either Folia or traditional Bukkit APIs.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/plugin.yml | Adds a new property to declare Folia support. |
| src/main/java/io/servertap/webhooks/WebhookEventListener.java | Switches asynchronous execution to SchedulerUtils for HTTP requests. |
| src/main/java/io/servertap/utils/ServerExecCommandSender.java | Updates command execution to support Folia scheduling and copies messageBuffer to avoid modification issues. |
| src/main/java/io/servertap/utils/SchedulerUtils.java | New utility class to handle scheduler tasks for both Folia and Bukkit. |
| src/main/java/io/servertap/metrics/Metrics.java | Changes task scheduling to use SchedulerUtils. |
| src/main/java/io/servertap/ServerTapMain.java | Updates TPS counter scheduling to support both platforms. |
Co-authored-by: Copilot <[email protected]>
Adds compatibility with Folia by introducing SchedulerUtils to abstract scheduler behavior. All sync and async tasks are now dispatched using the appropriate Folia APIs when available. Also updated plugin.yml to declare folia support. Maintains backward compatibility with Paper and Spigot.