diff --git a/patches/api/0383-Add-method-isTickingWorlds-to-Bukkit.patch b/patches/api/0383-Add-method-isTickingWorlds-to-Bukkit.patch new file mode 100644 index 000000000..19074e376 --- /dev/null +++ b/patches/api/0383-Add-method-isTickingWorlds-to-Bukkit.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BuildTools <46540330+willkroboth@users.noreply.github.com> +Date: Fri, 19 Aug 2022 16:11:51 -0400 +Subject: [PATCH] Add method isTickingWorlds() to Bukkit. + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 840aaf9e8fc828b5a7ea02252038c6524680f2e0..b5a7d6ab4e458843f2e163bf06b5668627012f91 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -753,12 +753,26 @@ public final class Bukkit { + return server.getWorlds(); + } + ++ // Paper start ++ /** ++ * Gets whether the worlds are being ticked right not or not. ++ * ++ * @return true if the worlds are being ticked, false otherwise. ++ */ ++ public static boolean isTickingWorlds(){ ++ return server.isTickingWorlds(); ++ } ++ // Paper end ++ + /** + * Creates or loads a world with the given name using the specified + * options. + *

+ * If the world is already loaded, it will just return the equivalent of + * getWorld(creator.name()). ++ *

++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param creator the options to use when creating the world + * @return newly created or loaded world +@@ -770,6 +784,9 @@ public final class Bukkit { + + /** + * Unloads a world with the given name. ++ *

++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param name Name of the world to unload + * @param save whether to save the chunks before unloading +@@ -781,6 +798,9 @@ public final class Bukkit { + + /** + * Unloads the given world. ++ *

++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param world the world to unload + * @param save whether to save the chunks before unloading +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index da5cab4246bd253fcc4e4d9574bdae1867ebb5ab..1982fc2d7f1cb80d3e324ee283211b251a976c6e 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -622,34 +622,55 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @NotNull + public List getWorlds(); + ++ // Paper start ++ /** ++ * Gets whether the worlds are being ticked right not or not. ++ * ++ * @return true if the worlds are being ticked, false otherwise. ++ */ ++ public boolean isTickingWorlds(); ++ // Paper end ++ + /** + * Creates or loads a world with the given name using the specified + * options. + *

+ * If the world is already loaded, it will just return the equivalent of + * getWorld(creator.name()). ++ *

++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param creator the options to use when creating the world + * @return newly created or loaded world ++ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true + */ + @Nullable + public World createWorld(@NotNull WorldCreator creator); + + /** + * Unloads a world with the given name. ++ *

++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param name Name of the world to unload + * @param save whether to save the chunks before unloading + * @return true if successful, false otherwise ++ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true + */ + public boolean unloadWorld(@NotNull String name, boolean save); + + /** + * Unloads the given world. ++ *

++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param world the world to unload + * @param save whether to save the chunks before unloading + * @return true if successful, false otherwise ++ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true + */ + public boolean unloadWorld(@NotNull World world, boolean save); + diff --git a/patches/api/0383-Add-WardenAngerChangeEvent.patch b/patches/api/0384-Add-WardenAngerChangeEvent.patch similarity index 100% rename from patches/api/0383-Add-WardenAngerChangeEvent.patch rename to patches/api/0384-Add-WardenAngerChangeEvent.patch diff --git a/patches/api/0384-Nameable-Banner-API.patch b/patches/api/0385-Nameable-Banner-API.patch similarity index 100% rename from patches/api/0384-Nameable-Banner-API.patch rename to patches/api/0385-Nameable-Banner-API.patch diff --git a/patches/api/0385-Add-Player-getFishHook.patch b/patches/api/0386-Add-Player-getFishHook.patch similarity index 100% rename from patches/api/0385-Add-Player-getFishHook.patch rename to patches/api/0386-Add-Player-getFishHook.patch diff --git a/patches/api/0386-More-Teleport-API.patch b/patches/api/0387-More-Teleport-API.patch similarity index 100% rename from patches/api/0386-More-Teleport-API.patch rename to patches/api/0387-More-Teleport-API.patch diff --git a/patches/api/0387-Add-EntityPortalReadyEvent.patch b/patches/api/0388-Add-EntityPortalReadyEvent.patch similarity index 100% rename from patches/api/0387-Add-EntityPortalReadyEvent.patch rename to patches/api/0388-Add-EntityPortalReadyEvent.patch diff --git a/patches/api/0388-Custom-Chat-Completion-Suggestions-API.patch b/patches/api/0389-Custom-Chat-Completion-Suggestions-API.patch similarity index 100% rename from patches/api/0388-Custom-Chat-Completion-Suggestions-API.patch rename to patches/api/0389-Custom-Chat-Completion-Suggestions-API.patch diff --git a/patches/api/0389-Collision-API.patch b/patches/api/0390-Collision-API.patch similarity index 100% rename from patches/api/0389-Collision-API.patch rename to patches/api/0390-Collision-API.patch diff --git a/patches/api/0390-Block-Ticking-API.patch b/patches/api/0391-Block-Ticking-API.patch similarity index 100% rename from patches/api/0390-Block-Ticking-API.patch rename to patches/api/0391-Block-Ticking-API.patch diff --git a/patches/api/0391-Add-NamespacedKey-biome-methods.patch b/patches/api/0392-Add-NamespacedKey-biome-methods.patch similarity index 100% rename from patches/api/0391-Add-NamespacedKey-biome-methods.patch rename to patches/api/0392-Add-NamespacedKey-biome-methods.patch diff --git a/patches/api/0392-Add-custom-destroyerIdentity-to-sendBlockDamage.patch b/patches/api/0393-Add-custom-destroyerIdentity-to-sendBlockDamage.patch similarity index 100% rename from patches/api/0392-Add-custom-destroyerIdentity-to-sendBlockDamage.patch rename to patches/api/0393-Add-custom-destroyerIdentity-to-sendBlockDamage.patch diff --git a/patches/api/0393-Also-load-resources-from-LibraryLoader.patch b/patches/api/0394-Also-load-resources-from-LibraryLoader.patch similarity index 100% rename from patches/api/0393-Also-load-resources-from-LibraryLoader.patch rename to patches/api/0394-Also-load-resources-from-LibraryLoader.patch diff --git a/patches/api/0394-Added-byte-array-serialization-deserialization-for-P.patch b/patches/api/0395-Added-byte-array-serialization-deserialization-for-P.patch similarity index 100% rename from patches/api/0394-Added-byte-array-serialization-deserialization-for-P.patch rename to patches/api/0395-Added-byte-array-serialization-deserialization-for-P.patch diff --git a/patches/api/0395-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/0396-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch similarity index 100% rename from patches/api/0395-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch rename to patches/api/0396-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch diff --git a/patches/api/0396-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch b/patches/api/0397-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch similarity index 100% rename from patches/api/0396-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch rename to patches/api/0397-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch diff --git a/patches/server/0899-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0899-Throw-exception-on-world-create-while-being-ticked.patch index c7ac48bd9..6c91627e3 100644 --- a/patches/server/0899-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0899-Throw-exception-on-world-create-while-being-ticked.patch @@ -45,22 +45,34 @@ index 4d920031300a9801debc2eb39a4d3cb9d8fbb330..f1e14f7850c0a64128839285f09e2aa3 this.profiler.popPush("connection"); MinecraftTimings.connectionTimer.startTiming(); // Spigot diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c75e3cd197bee7caeef3a55b2746c15de3c0c3e4..61b9d44e4edc4cb6ffbd8bf99e8e098bcc9957b3 100644 +index c75e3cd197bee7caeef3a55b2746c15de3c0c3e4..19a98e502b4ba49485fa3e51c48309a06ded5a9d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1139,6 +1139,7 @@ public final class CraftServer implements Server { +@@ -855,6 +855,11 @@ public final class CraftServer implements Server { + return new ArrayList(this.worlds.values()); + } + ++ @Override ++ public boolean isTickingWorlds() { ++ return console.isIteratingOverLevels; ++ } ++ + public DedicatedPlayerList getHandle() { + return this.playerList; + } +@@ -1139,6 +1144,7 @@ public final class CraftServer implements Server { @Override public World createWorld(WorldCreator creator) { Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP"); -+ Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper ++ //Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes. Validate.notNull(creator, "Creator may not be null"); String name = creator.name(); -@@ -1263,6 +1264,7 @@ public final class CraftServer implements Server { +@@ -1263,6 +1269,7 @@ public final class CraftServer implements Server { @Override public boolean unloadWorld(World world, boolean save) { -+ Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot unload a world while worlds are being ticked"); // Paper ++ //Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot unload a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes. if (world == null) { return false; } diff --git a/patches/server/0907-Don-t-broadcast-messages-to-command-blocks.patch b/patches/server/0907-Don-t-broadcast-messages-to-command-blocks.patch index 7ce886777..95330c3de 100644 --- a/patches/server/0907-Don-t-broadcast-messages-to-command-blocks.patch +++ b/patches/server/0907-Don-t-broadcast-messages-to-command-blocks.patch @@ -20,10 +20,10 @@ index c0195f73cd2c8721e882c681eaead65471710081..861b348f73867af3199f1cc0dab1ddd4 Date date = new Date(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 61b9d44e4edc4cb6ffbd8bf99e8e098bcc9957b3..3c9ba17cd0f016a21f56c6b6f8861c512734637a 100644 +index 19a98e502b4ba49485fa3e51c48309a06ded5a9d..df0472f275b4fa3a1088db84712a39ea0257f17e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1758,7 +1758,7 @@ public final class CraftServer implements Server { +@@ -1763,7 +1763,7 @@ public final class CraftServer implements Server { // Paper end Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {