Folia scheduler and owned region API

Pulling Folia API to Paper is primarily intended for plugins
that want to target both Paper and Folia without unnecessary
compatibility layers.

Add both a location based scheduler, an entity based scheduler,
and a global region scheduler.

Owned region API may be useful for plugins which want to perform
operations over large areas outside of the buffer zone provided
by the regionaliser, as it is not guaranteed that anything
outside of the buffer zone is owned. Then, the plugins may use
the schedulers depending on the result of the ownership check.
This commit is contained in:
Spottedleaf
2023-06-17 11:52:52 +02:00
parent 31871f6b40
commit a13bff4a5f
11 changed files with 1374 additions and 135 deletions

View File

@@ -263,6 +263,22 @@ class PaperPluginInstanceManager {
+ pluginName + " (Is it up to date?)", ex, plugin); // Paper
}
// Paper start - Folia schedulers
try {
this.server.getGlobalRegionScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
this.handlePluginException("Error occurred (in the plugin loader) while cancelling global tasks for "
+ pluginName + " (Is it up to date?)", ex, plugin); // Paper
}
try {
this.server.getAsyncScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
this.handlePluginException("Error occurred (in the plugin loader) while cancelling async tasks for "
+ pluginName + " (Is it up to date?)", ex, plugin); // Paper
}
// Paper end - Folia schedulers
try {
this.server.getServicesManager().unregisterAll(plugin);
} catch (Throwable ex) {