Folia/patches/api/0002-Region-scheduler-API.patch
Spottedleaf de6a87e338 Apply patches for 1.20.4
- Compile needs to be checked.
- Behaviors around the new tick manager need to be designed
  and implemented.

Chk update.txt for anything specific.
2023-12-16 15:32:48 -08:00

45 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 4 Mar 2023 12:48:43 -0800
Subject: [PATCH] Region scheduler API
Add both a location based scheduler, an entity based scheduler,
and a global region scheduler.
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index fc2dae69165776d08274e34a69962cc70445f411..06149045a44148bf0af5f52952ff0092fe2c70cb 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -544,9 +544,9 @@ public final class SimplePluginManager implements PluginManager {
}
try {
- server.getScheduler().cancelTasks(plugin);
+ server.getAsyncScheduler().cancelTasks(plugin); // Folia - new schedulers
} catch (Throwable ex) {
- handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
+ handlePluginException("Error occurred (in the plugin loader) while cancelling async tasks for " // Folia - new schedulers
+ plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
index 487b5ca23159b531475c3d650894be707b49914e..31b90d1c2259a8f200b0589909dbbfe4cc526989 100644
--- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
@@ -7,6 +7,15 @@ import java.util.function.Consumer;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
+// Folia start - add new schedulers
+/**
+ * @deprecated Use one of {@link io.papermc.paper.threadedregions.scheduler.RegionScheduler},
+ * {@link io.papermc.paper.threadedregions.scheduler.AsyncScheduler},
+ * {@link io.papermc.paper.threadedregions.scheduler.EntityScheduler},
+ * or {@link io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler}
+ */
+// Folia end - add new schedulers
+@Deprecated
public interface BukkitScheduler {
/**