Add Server#isGlobalTickThread

This method should be present in Paper, not just in Folia, given
that the GlobalRegionScheduler is present.

Additonally, add Server#isOwnedByCurrentRegion(World, int, int, int, int)
for checking of a rectangle of chunks is owned by the current region.
This commit is contained in:
Spottedleaf 2024-11-25 10:43:28 -08:00
parent 280b497783
commit 4190ee7439
15 changed files with 110 additions and 56 deletions

View file

@ -2376,7 +2376,7 @@ index c4ffa8519b520e0793af90e149518951d7ffb65b..688916c8fef40d4c81379ad38609a979
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8ad87d16c 100644
index 0d62694e2f9086702eaca7a11799eb90a06ce853..338b60f0254d55ac4a0645ca351d0ce736ce0681 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -275,11 +275,11 @@ public final class CraftServer implements Server {
@ -2394,7 +2394,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
private final StructureManager structureManager;
protected final DedicatedServer console;
protected final DedicatedPlayerList playerList;
@@ -407,6 +407,12 @@ public final class CraftServer implements Server {
@@ -419,6 +419,12 @@ public final class CraftServer implements Server {
this.serverLinks = new CraftServerLinks(console);
Bukkit.setServer(this);
@ -2407,7 +2407,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
CraftRegistry.setMinecraftRegistry(console.registryAccess());
@@ -605,48 +611,11 @@ public final class CraftServer implements Server {
@@ -617,48 +623,11 @@ public final class CraftServer implements Server {
}
private void setVanillaCommands(boolean first) { // Spigot
@ -2458,7 +2458,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
// Refresh commands
for (ServerPlayer player : this.getHandle().players) {
@@ -1033,17 +1002,31 @@ public final class CraftServer implements Server {
@@ -1045,17 +1014,31 @@ public final class CraftServer implements Server {
return true;
}
@ -2500,7 +2500,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
return false;
}
@@ -1052,7 +1035,7 @@ public final class CraftServer implements Server {
@@ -1064,7 +1047,7 @@ public final class CraftServer implements Server {
public void reload() {
// Paper start - lifecycle events
if (io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.blocksPluginReloading()) {
@ -2509,7 +2509,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
}
// Paper end - lifecycle events
org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload
@@ -1107,8 +1090,9 @@ public final class CraftServer implements Server {
@@ -1119,8 +1102,9 @@ public final class CraftServer implements Server {
}
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@ -2520,7 +2520,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
// Paper start
for (Plugin plugin : pluginClone) {
entityMetadata.removeAll(plugin);
@@ -1148,6 +1132,12 @@ public final class CraftServer implements Server {
@@ -1160,6 +1144,12 @@ public final class CraftServer implements Server {
this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD);
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins