-
Notifications
You must be signed in to change notification settings - Fork 33
Add complete Folia support #40
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?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,14 @@ An api to get input text via a sign in Minecraft. | |||||
| The api supports the Minecraft versions from `1.8` to `1.21`. | ||||||
| Also supports adventure text and mojang-mapped Paper plugins (1.20.5+). | ||||||
|
|
||||||
| ## ✨ Full Platform Support | ||||||
| - ✅ **Bukkit / Spigot / Paper** - Full support | ||||||
| - ✅ **Folia** - Complete regionized multithreading support | ||||||
| - ✅ **CanvasMC** - Full support | ||||||
| - ✅ **Archlight** - Full support (Forge+Bukkit hybrid) | ||||||
|
|
||||||
| SignGUI automatically detects your server platform and uses the appropriate scheduler for thread-safe operation! | ||||||
|
|
||||||
| ## Integration | ||||||
|
|
||||||
| Maven dependency: | ||||||
|
|
@@ -120,6 +128,10 @@ try { | |||||
| return Collections.emptyList(); | ||||||
| }) | ||||||
|
|
||||||
| // RECOMMENDED: Call handler synchronously for thread safety | ||||||
| // REQUIRED for Folia, CanvasMC, and Archlight | ||||||
| .callHandlerSynchronously(this) // "this" = your JavaPlugin instance | ||||||
|
|
||||||
| // build the SignGUI | ||||||
| .build(); | ||||||
|
|
||||||
|
|
@@ -135,6 +147,8 @@ try { | |||||
|
|
||||||
| You don't have to call all methods. Only `setHandler` is mandatory. | ||||||
|
|
||||||
| **Important for Folia/CanvasMC/Archlight:** Always use `callHandlerSynchronously(plugin)` to ensure thread-safe operation on all platforms. On Folia, this ensures tasks run on the correct region thread. On other platforms, it ensures tasks run on the main thread. | ||||||
|
||||||
| **Important for Folia/CanvasMC/Archlight:** Always use `callHandlerSynchronously(plugin)` to ensure thread-safe operation on all platforms. On Folia, this ensures tasks run on the correct region thread. On other platforms, it ensures tasks run on the main thread. | |
| **Important:** `callHandlerSynchronously(plugin)` is **REQUIRED for Folia** and **RECOMMENDED for all other platforms for thread safety**. On Folia, this ensures tasks run on the correct region thread. On other platforms, it ensures tasks run on the main thread. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -168,7 +168,10 @@ public SignGUIBuilder setHandler(SignGUIFinishHandler handler) { | |||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * If called the handler will be called synchronously by calling the method {@link org.bukkit.scheduler.BukkitScheduler#runTask(Plugin, Runnable)} | ||||||
| * If called the handler will be called synchronously by using the appropriate scheduler. | ||||||
| * This is required for Folia, CanvasMC, and Archlight support and ensures thread-safe execution. | ||||||
| * On Folia, tasks are scheduled on the player's region thread. | ||||||
|
||||||
| * On Folia, tasks are scheduled on the player's region thread. | |
| * On Folia, tasks are scheduled via the player's entity scheduler (on the thread owning the player's region). |
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.
The statement "REQUIRED for Folia, CanvasMC, and Archlight" is somewhat misleading. Based on the PlatformDetector implementation, CanvasMC and Archlight are detected but both use the BukkitSchedulerAdapter, not a special scheduler. So while using callHandlerSynchronously is good practice for thread safety, it's technically not "REQUIRED" specifically for CanvasMC and Archlight in the same way it is for Folia. Consider revising to "REQUIRED for Folia; RECOMMENDED for CanvasMC, Archlight, and other platforms".