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

@ -18,7 +18,7 @@ the schedulers depending on the result of the ownership check.
diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e6cb733ed index 0000000000000000000000000000000000000000..9852e14e68d12ca56b0d57cd6e83e252f47bde72
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java +++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e
+ * @return The {@link ScheduledTask} that represents the scheduled task. + * @return The {@link ScheduledTask} that represents the scheduled task.
+ */ + */
+ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, long delay, + @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, long delay,
+ @NotNull TimeUnit unit); + @NotNull TimeUnit unit);
+ +
+ /** + /**
+ * Schedules the specified task to be executed asynchronously after the initial delay has passed, + * Schedules the specified task to be executed asynchronously after the initial delay has passed,
@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e
+ * @return The {@link ScheduledTask} that represents the scheduled task. + * @return The {@link ScheduledTask} that represents the scheduled task.
+ */ + */
+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, + @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ long initialDelay, long period, @NotNull TimeUnit unit); + long initialDelay, long period, @NotNull TimeUnit unit);
+ +
+ /** + /**
+ * Attempts to cancel all tasks scheduled by the specified plugin. + * Attempts to cancel all tasks scheduled by the specified plugin.
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e
+} +}
diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d12187ba6c987 index 0000000000000000000000000000000000000000..99e9e20ae01f9b4b8cde585d29c57e27c53c996e
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java +++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java
@@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d1218
+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. + * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed.
+ */ + */
+ @Nullable ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, + @Nullable ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ @Nullable Runnable retired); + @Nullable Runnable retired);
+ +
+ /** + /**
+ * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity + * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity
@ -161,7 +161,7 @@ index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d1218
+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. + * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed.
+ */ + */
+ @Nullable ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, + @Nullable ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ @Nullable Runnable retired, long delayTicks); + @Nullable Runnable retired, long delayTicks);
+ +
+ /** + /**
+ * Schedules a repeating task with the given delay and period. If the task failed to schedule because the scheduler + * Schedules a repeating task with the given delay and period. If the task failed to schedule because the scheduler
@ -181,11 +181,11 @@ index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d1218
+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. + * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed.
+ */ + */
+ @Nullable ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, + @Nullable ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ @Nullable Runnable retired, long initialDelayTicks, long periodTicks); + @Nullable Runnable retired, long initialDelayTicks, long periodTicks);
+} +}
diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..365b53fea8dee09cdc11f4399dea5f00c6ee70e2 index 0000000000000000000000000000000000000000..57455aca80ecc458b96b44c086cea94ddcecae47
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java +++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..365b53fea8dee09cdc11f4399dea5f00
+ * @return The {@link ScheduledTask} that represents the scheduled task. + * @return The {@link ScheduledTask} that represents the scheduled task.
+ */ + */
+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task, + @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer<ScheduledTask> task,
+ long initialDelayTicks, long periodTicks); + long initialDelayTicks, long periodTicks);
+ +
+ /** + /**
+ * Attempts to cancel all tasks scheduled by the specified plugin. + * Attempts to cancel all tasks scheduled by the specified plugin.
@ -499,10 +499,10 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4f08cfb88 100644 index 7919a001e5b5886a3d0fb64913064bc9607a2102..42beeecad288a7600d4906877932ccd701ed7cc2 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2696,6 +2696,141 @@ public final class Bukkit { @@ -2696,6 +2696,164 @@ public final class Bukkit {
} }
// Paper end // Paper end
@ -631,6 +631,21 @@ index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4
+ +
+ /** + /**
+ * Returns whether the current thread is ticking a region and that the region being ticked + * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the chunks in the rectangle specified by the min and max parameters.
+ * Specifically, this function checks that every chunk with position x in [minChunkX, maxChunkX] and
+ * position z in [minChunkZ, maxChunkZ] is owned by the current ticking region.
+ * @param world Specified world.
+ * @param minChunkX Specified x-coordinate of the minimum chunk position.
+ * @param minChunkZ Specified z-coordinate of the minimum chunk position.
+ * @param maxChunkX Specified x-coordinate of the maximum chunk position.
+ * @param maxChunkZ Specified z-coordinate of the maximum chunk position.
+ */
+ public static boolean isOwnedByCurrentRegion(@NotNull World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ) {
+ return server.isOwnedByCurrentRegion(world, minChunkX, minChunkZ, maxChunkX, maxChunkZ);
+ }
+
+ /**
+ * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the specified entity. Note that this function is the only appropriate method of checking + * owns the specified entity. Note that this function is the only appropriate method of checking
+ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned + * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned
+ * by the current region. + * by the current region.
@ -639,16 +654,24 @@ index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4
+ public static boolean isOwnedByCurrentRegion(@NotNull Entity entity) { + public static boolean isOwnedByCurrentRegion(@NotNull Entity entity) {
+ return server.isOwnedByCurrentRegion(entity); + return server.isOwnedByCurrentRegion(entity);
+ } + }
+
+ /**
+ * Returns whether the current thread is ticking the global region.
+ * @see io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler
+ */
+ public static boolean isGlobalTickThread() {
+ return server.isGlobalTickThread();
+ }
+ // Paper end - Folia region threading API + // Paper end - Folia region threading API
+ +
@NotNull @NotNull
public static Server.Spigot spigot() { public static Server.Spigot spigot() {
return server.spigot(); return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..01b1aa2af1aac83ac8b341e7ba2803317373056b 100644 index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..ecfe4f0079038e0a4541ac71ab590ac18108d1d3 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2351,4 +2351,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2351,4 +2351,138 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end // Paper end
@ -760,12 +783,31 @@ index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..01b1aa2af1aac83ac8b341e7ba280331
+ +
+ /** + /**
+ * Returns whether the current thread is ticking a region and that the region being ticked + * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the chunks in the rectangle specified by the min and max parameters.
+ * Specifically, this function checks that every chunk with position x in [minChunkX, maxChunkX] and
+ * position z in [minChunkZ, maxChunkZ] is owned by the current ticking region.
+ * @param world Specified world.
+ * @param minChunkX Specified x-coordinate of the minimum chunk position.
+ * @param minChunkZ Specified z-coordinate of the minimum chunk position.
+ * @param maxChunkX Specified x-coordinate of the maximum chunk position.
+ * @param maxChunkZ Specified z-coordinate of the maximum chunk position.
+ */
+ boolean isOwnedByCurrentRegion(@NotNull World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ);
+
+ /**
+ * Returns whether the current thread is ticking a region and that the region being ticked
+ * owns the specified entity. Note that this function is the only appropriate method of checking + * owns the specified entity. Note that this function is the only appropriate method of checking
+ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned + * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned
+ * by the current region. + * by the current region.
+ * @param entity Specified entity. + * @param entity Specified entity.
+ */ + */
+ boolean isOwnedByCurrentRegion(@NotNull Entity entity); + boolean isOwnedByCurrentRegion(@NotNull Entity entity);
+
+ /**
+ * Returns whether the current thread is ticking the global region.
+ * @see io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler
+ */
+ public boolean isGlobalTickThread();
+ // Paper end - Folia region threading API + // Paper end - Folia region threading API
} }
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java

View File

@ -5,12 +5,12 @@ Subject: [PATCH] API to check if the server is sleeping
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0b78564256ebc647ebac402e549d86ab6e307c8d..ba366576a571214e67bcc529dc1bca19e1d59ef8 100644 index dcd2699654c8848b985309f3739b4967515e41c7..7266d29ab6bb246e6daaa643951417123d42abcb 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2572,4 +2572,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2591,4 +2591,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
boolean isOwnedByCurrentRegion(@NotNull Entity entity); public boolean isGlobalTickThread();
// Paper end - Folia region threading API // Paper end - Folia region threading API
+ +
+ // Paper start - API to check if the server is sleeping + // Paper start - API to check if the server is sleeping

View File

@ -5,10 +5,10 @@ Subject: [PATCH] API to allow/disallow tick sleeping
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ba366576a571214e67bcc529dc1bca19e1d59ef8..f55638eb8b315864052f9fe17ab4846e5e9d8dbb 100644 index 7266d29ab6bb246e6daaa643951417123d42abcb..a92bd4da6788f1331a4838ab5760baec2dc6e8ec 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2578,5 +2578,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2597,5 +2597,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* Returns whether the server is sleeping/paused. * Returns whether the server is sleeping/paused.
*/ */
boolean isPaused(); boolean isPaused();

View File

@ -1249,10 +1249,10 @@ index 4cced854e750ea9057b4a8d686245925e5dc2868..5a2d33b7da60469f27f9782841b0cf87
public void setLevelCallback(EntityInLevelCallback changeListener) { public void setLevelCallback(EntityInLevelCallback changeListener) {
this.levelCallback = changeListener; this.levelCallback = changeListener;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5c907eca23d936ba3095f2d81256775edaa737da..1bf51d4a1ffb6ab56c4023c49725e412f4350197 100644 index 5c907eca23d936ba3095f2d81256775edaa737da..4c4fa7bbafb075beb0d9c1ef21e3ba2d62b1ae65 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -313,6 +313,76 @@ public final class CraftServer implements Server { @@ -313,6 +313,88 @@ public final class CraftServer implements Server {
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
@ -1321,9 +1321,21 @@ index 5c907eca23d936ba3095f2d81256775edaa737da..1bf51d4a1ffb6ab56c4023c49725e412
+ } + }
+ +
+ @Override + @Override
+ public final boolean isOwnedByCurrentRegion(World world, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ) {
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(
+ ((CraftWorld) world).getHandle(), minChunkX, minChunkZ, maxChunkX, maxChunkZ
+ );
+ }
+
+ @Override
+ public final boolean isOwnedByCurrentRegion(Entity entity) { + public final boolean isOwnedByCurrentRegion(Entity entity) {
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandleRaw()); + return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandleRaw());
+ } + }
+
+ @Override
+ public final boolean isGlobalTickThread() {
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThread();
+ }
+ // Paper end - Folia reagion threading API + // Paper end - Folia reagion threading API
+ +
static { static {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Use correct seed on api world load
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1bf51d4a1ffb6ab56c4023c49725e412f4350197..d5e8cb8a907385e807c786815cf33f1cd9355f0c 100644 index 4c4fa7bbafb075beb0d9c1ef21e3ba2d62b1ae65..54b5dee7cfd19ad58e376eee80d3827f1a80cfcd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1388,7 +1388,7 @@ public final class CraftServer implements Server { @@ -1400,7 +1400,7 @@ public final class CraftServer implements Server {
net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistrycustom_dimension, this.console.options.has("recreateRegionFiles")); net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistrycustom_dimension, this.console.options.has("recreateRegionFiles"));
} }

View File

@ -38,10 +38,10 @@ index 3a6e918e9db6397b6f1cff531041655298ce087d..efc12d629b71ba1da664d9ecfd4575be
public void reloadRecipes() { public void reloadRecipes() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3 100644 index 54b5dee7cfd19ad58e376eee80d3827f1a80cfcd..a755137d8d4b266a648cb2a4f41a5ed00262f121 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1178,6 +1178,18 @@ public final class CraftServer implements Server { @@ -1190,6 +1190,18 @@ public final class CraftServer implements Server {
ReloadCommand.reload(this.console); ReloadCommand.reload(this.console);
} }
@ -60,7 +60,7 @@ index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca37
private void loadIcon() { private void loadIcon() {
this.icon = new CraftIconCache(null); this.icon = new CraftIconCache(null);
try { try {
@@ -1557,6 +1569,13 @@ public final class CraftServer implements Server { @@ -1569,6 +1581,13 @@ public final class CraftServer implements Server {
@Override @Override
public boolean addRecipe(Recipe recipe) { public boolean addRecipe(Recipe recipe) {
@ -74,7 +74,7 @@ index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca37
CraftRecipe toAdd; CraftRecipe toAdd;
if (recipe instanceof CraftRecipe) { if (recipe instanceof CraftRecipe) {
toAdd = (CraftRecipe) recipe; toAdd = (CraftRecipe) recipe;
@@ -1588,6 +1607,11 @@ public final class CraftServer implements Server { @@ -1600,6 +1619,11 @@ public final class CraftServer implements Server {
} }
} }
toAdd.addToCraftingManager(); toAdd.addToCraftingManager();
@ -86,7 +86,7 @@ index d5e8cb8a907385e807c786815cf33f1cd9355f0c..8e0d8fafa68d909d1d10c6d6a03cca37
return true; return true;
} }
@@ -1768,9 +1792,23 @@ public final class CraftServer implements Server { @@ -1780,9 +1804,23 @@ public final class CraftServer implements Server {
@Override @Override
public boolean removeRecipe(NamespacedKey recipeKey) { public boolean removeRecipe(NamespacedKey recipeKey) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3..ee79e3374b50ba21620a9685975a0341c15f313b 100644 index a755137d8d4b266a648cb2a4f41a5ed00262f121..eaea08530ca864158a2fa15dca38ca0c25a49bde 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2007,6 +2007,11 @@ public final class CraftServer implements Server { @@ -2019,6 +2019,11 @@ public final class CraftServer implements Server {
ServerLevel worldServer = ((CraftWorld) world).getHandle(); ServerLevel worldServer = ((CraftWorld) world).getHandle();
Location structureLocation = world.locateNearestStructure(location, structureType, radius, findUnexplored); Location structureLocation = world.locateNearestStructure(location, structureType, radius, findUnexplored);
@ -20,7 +20,7 @@ index 8e0d8fafa68d909d1d10c6d6a03cca371c0e6fb3..ee79e3374b50ba21620a9685975a0341
BlockPos structurePosition = CraftLocation.toBlockPosition(structureLocation); BlockPos structurePosition = CraftLocation.toBlockPosition(structureLocation);
// Create map with trackPlayer = true, unlimitedTracking = true // Create map with trackPlayer = true, unlimitedTracking = true
@@ -2017,6 +2022,31 @@ public final class CraftServer implements Server { @@ -2029,6 +2034,31 @@ public final class CraftServer implements Server {
return CraftItemStack.asBukkitCopy(stack); return CraftItemStack.asBukkitCopy(stack);
} }

View File

@ -727,10 +727,10 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67
} catch (Throwable e) { } catch (Throwable e) {
LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e); LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ee79e3374b50ba21620a9685975a0341c15f313b..7cc96d03472a4cb94e679251f0969995284f7eaa 100644 index eaea08530ca864158a2fa15dca38ca0c25a49bde..b4a823a62d7088262b7f799c977aec71f8778ff5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1050,6 +1050,11 @@ public final class CraftServer implements Server { @@ -1062,6 +1062,11 @@ public final class CraftServer implements Server {
@Override @Override
public void reload() { public void reload() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7cc96d03472a4cb94e679251f0969995284f7eaa..54ef70eff81194c85d6433d00382a5909b6d797f 100644 index b4a823a62d7088262b7f799c977aec71f8778ff5..0d62694e2f9086702eaca7a11799eb90a06ce853 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2260,6 +2260,21 @@ public final class CraftServer implements Server { @@ -2272,6 +2272,21 @@ public final class CraftServer implements Server {
}; };
} }

View File

@ -2376,7 +2376,7 @@ index c4ffa8519b520e0793af90e149518951d7ffb65b..688916c8fef40d4c81379ad38609a979
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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 { @@ -275,11 +275,11 @@ public final class CraftServer implements Server {
@ -2394,7 +2394,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
private final StructureManager structureManager; private final StructureManager structureManager;
protected final DedicatedServer console; protected final DedicatedServer console;
protected final DedicatedPlayerList playerList; 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); this.serverLinks = new CraftServerLinks(console);
Bukkit.setServer(this); Bukkit.setServer(this);
@ -2407,7 +2407,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
CraftRegistry.setMinecraftRegistry(console.registryAccess()); 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 private void setVanillaCommands(boolean first) { // Spigot
@ -2458,7 +2458,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
// Refresh commands // Refresh commands
for (ServerPlayer player : this.getHandle().players) { 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; return true;
} }
@ -2500,7 +2500,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
return false; 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() { public void reload() {
// Paper start - lifecycle events // Paper start - lifecycle events
if (io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.blocksPluginReloading()) { if (io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.blocksPluginReloading()) {
@ -2509,7 +2509,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
} }
// Paper end - lifecycle events // Paper end - lifecycle events
org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload 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 Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@ -2520,7 +2520,7 @@ index 54ef70eff81194c85d6433d00382a5909b6d797f..c65a4bb7f1818378a5e571d39a5aabe8
// Paper start // Paper start
for (Plugin plugin : pluginClone) { for (Plugin plugin : pluginClone) {
entityMetadata.removeAll(plugin); 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.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD); this.enablePlugins(PluginLoadOrder.POSTWORLD);
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins

View File

@ -1599,10 +1599,10 @@ index 5fc9e8e969debb3e15ed474b36a1c48b086d0449..f65cc95ab28e8a3b21eac2b16bd9ebe9
private static final byte[] EMPTY_LIGHT = new byte[2048]; private static final byte[] EMPTY_LIGHT = new byte[2048];
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c65a4bb7f1818378a5e571d39a5aabe8ad87d16c..758d86865136e5ef58f401f00c5e62fbb8cf25a3 100644 index 338b60f0254d55ac4a0645ca351d0ce736ce0681..87477ad186b5f692a39f323a618d016b669d8051 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2702,7 +2702,7 @@ public final class CraftServer implements Server { @@ -2714,7 +2714,7 @@ public final class CraftServer implements Server {
public ChunkGenerator.ChunkData createChunkData(World world) { public ChunkGenerator.ChunkData createChunkData(World world) {
Preconditions.checkArgument(world != null, "World cannot be null"); Preconditions.checkArgument(world != null, "World cannot be null");
ServerLevel handle = ((CraftWorld) world).getHandle(); ServerLevel handle = ((CraftWorld) world).getHandle();

View File

@ -23206,7 +23206,7 @@ index 0000000000000000000000000000000000000000..85950a1aa732ab8c01ad28bec9e0de14
+ } + }
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 46c37c8db8ecf3cc808fcf59f6bee5fe6ca49b75..cbd0f2c6636b8ae332f20a3cb763b06855dfe795 100644 index 5e9c471ab20b0391e7e41351c65d96745fc8ce4a..9221ce36355eaf8d4456209c57b68486d587c255 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -219,6 +219,23 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -219,6 +219,23 @@ public class GlobalConfiguration extends ConfigurationPart {
@ -36027,10 +36027,10 @@ index f65cc95ab28e8a3b21eac2b16bd9ebe97e56e571..0074bc0e7147dc3a8c538e796f14ac9b
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125c36ecf90 100644 index 87477ad186b5f692a39f323a618d016b669d8051..1df118625aeb57f3353c40f9552f00d2f34fc655 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1432,7 +1432,7 @@ public final class CraftServer implements Server { @@ -1444,7 +1444,7 @@ public final class CraftServer implements Server {
// Paper - Put world into worldlist before initing the world; move up // Paper - Put world into worldlist before initing the world; move up
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal); this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
@ -36039,7 +36039,7 @@ index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125
this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld())); this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
return internal.getWorld(); return internal.getWorld();
@@ -1477,7 +1477,7 @@ public final class CraftServer implements Server { @@ -1489,7 +1489,7 @@ public final class CraftServer implements Server {
} }
handle.getChunkSource().close(save); handle.getChunkSource().close(save);
@ -36048,7 +36048,7 @@ index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125
handle.convertable.close(); handle.convertable.close();
} catch (Exception ex) { } catch (Exception ex) {
this.getLogger().log(Level.SEVERE, null, ex); this.getLogger().log(Level.SEVERE, null, ex);
@@ -2515,7 +2515,7 @@ public final class CraftServer implements Server { @@ -2527,7 +2527,7 @@ public final class CraftServer implements Server {
@Override @Override
public boolean isPrimaryThread() { public boolean isPrimaryThread() {

View File

@ -364,7 +364,7 @@ index c06863578c5d654706d93e73059d89c12ae502a5..17a158ff6ce6520b69a5a0032ba4c054
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd54c2d46e3 100644 index 1df118625aeb57f3353c40f9552f00d2f34fc655..11ff5f3b5cd25f0ad6ca944d59bca8434f8510d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -312,6 +312,7 @@ public final class CraftServer implements Server { @@ -312,6 +312,7 @@ public final class CraftServer implements Server {
@ -375,7 +375,7 @@ index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd5
// Paper start - Folia region threading API // Paper start - Folia region threading API
private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler(); private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
@@ -477,6 +478,7 @@ public final class CraftServer implements Server { @@ -489,6 +490,7 @@ public final class CraftServer implements Server {
} }
this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
@ -383,7 +383,7 @@ index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd5
} }
public boolean getCommandBlockOverride(String command) { public boolean getCommandBlockOverride(String command) {
@@ -1103,6 +1105,7 @@ public final class CraftServer implements Server { @@ -1115,6 +1117,7 @@ public final class CraftServer implements Server {
this.reloadData(); this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@ -391,7 +391,7 @@ index 6323738fe96c8e815a0835e6d8b03125c36ecf90..806e56cb60235a99f468d36a059fdbd5
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -1131,6 +1134,7 @@ public final class CraftServer implements Server { @@ -1143,6 +1146,7 @@ public final class CraftServer implements Server {
this.loadPlugins(); this.loadPlugins();
this.enablePlugins(PluginLoadOrder.STARTUP); this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD); this.enablePlugins(PluginLoadOrder.POSTWORLD);

View File

@ -20,10 +20,10 @@ index 64b56abf8900d0424100da460fc68ac964394793..5d070f036dae6d93f863c55192b55741
+ // Paper end - API to check if the server is sleeping + // Paper end - API to check if the server is sleeping
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 806e56cb60235a99f468d36a059fdbd54c2d46e3..605662917a7720a6c5134fd1d93aa2d26116b76d 100644 index 11ff5f3b5cd25f0ad6ca944d59bca8434f8510d8..7afc3d4244c096f78d48338da2eb65c4e834b6f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3246,4 +3246,11 @@ public final class CraftServer implements Server { @@ -3258,4 +3258,11 @@ public final class CraftServer implements Server {
return this.potionBrewer; return this.potionBrewer;
} }
// Paper end // Paper end

View File

@ -51,10 +51,10 @@ index 5d070f036dae6d93f863c55192b557419634456d..c26e3a239441376f2694782d4f079435
// Paper end - API to check if the server is sleeping // Paper end - API to check if the server is sleeping
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 605662917a7720a6c5134fd1d93aa2d26116b76d..cac8592e3a2f438fe9ca167a4fdcd65152bbb2de 100644 index 7afc3d4244c096f78d48338da2eb65c4e834b6f1..ac8af406180bc680d46e8edc3da0fc2e5211345a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3252,5 +3252,10 @@ public final class CraftServer implements Server { @@ -3264,5 +3264,10 @@ public final class CraftServer implements Server {
public boolean isPaused() { public boolean isPaused() {
return this.console.isTickPaused(); return this.console.isTickPaused();
} }