Skip to content

Conversation

@CaptainParis
Copy link

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.

@DeathTrooperr DeathTrooperr requested review from Velyn-N and Copilot May 5, 2025 02:14
Copy link

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 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

@DeathTrooperr
Copy link
Collaborator

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

@DeathTrooperr DeathTrooperr self-assigned this May 5, 2025
@DeathTrooperr DeathTrooperr requested a review from Copilot May 5, 2025 02:31
@CaptainParis
Copy link
Author

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.

Copy link

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 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.

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.

2 participants