mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-25 12:35:23 +01:00
47 lines
2.0 KiB
Diff
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 b243db56756c67cd2c41d7768898d01539f9260a..fd5ed5d6725537c26e6139dd6242c4154b306a97 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2657,6 +2657,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 6b72eccdcb6f75534a4267a1dd0a4cc2f39e917b..57d4789c1eb00cb376adce31ece2b6672c4a12a9 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -2313,4 +2313,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
|
|
}
|