0
0
mirror of https://github.com/PaperMC/Folia.git synced 2024-11-27 09:19:04 +00:00
Folia/patches/api/0002-Region-scheduler-API.patch
2024-06-19 14:42:39 -07: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 003bece642b682985625db93cad93026352bfc66..065352b383d6398382b4f14641859dbfe2e6a355 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -557,9 +557,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 {
/**