Folia/patches/api/0005-Add-API-for-checking-ownership-of-region-by-position.patch
Spottedleaf 388cdacd1b Initial pass of 1.21
Most significant changes are to portal/teleport logic, there may
be some bugs there. Not really concerned about the passenger
teleport, as Folia had already added support for that.

Not sure how the spark changes are going to work.
2024-07-30 20:09:52 -07:00

47 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 7 Mar 2023 14:34:09 -0800
Subject: [PATCH] Add API for checking ownership of region by position/entity
This 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.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 4705c1d91e39fcc3c608b1f1a38a30d063ccf06e..886920b33b37bdefc301f898ad0003e40eff6443 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2905,6 +2905,14 @@ public final class Bukkit {
return server.isOwnedByCurrentRegion(entity);
}
// Paper end - Folia region threading API
+ // Folia start - region threading API
+ /**
+ * Returns whether the current thread is ticking the global region.
+ */
+ public static boolean isGlobalTickThread() {
+ return server.isGlobalTickThread();
+ }
+ // Folia end - region threading API
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c043d239c449bf4bb13a24467f2f6c67b4d28d2d..d6f72cb1e2380bd1a18d695c7d26ae3834f6eb52 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2543,4 +2543,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
// Paper end - Folia region threading API
+ // Folia start - region threading API
+ /**
+ * Returns whether the current thread is ticking the global region.
+ */
+ public boolean isGlobalTickThread();
+ // Folia end - region threading API
}