diff options
author | Shane Freeder <[email protected]> | 2022-04-20 10:26:09 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-04-20 10:26:09 +0100 |
commit | 4ecc338e09caf3e9e8046c6360e9309642092532 (patch) | |
tree | a0ee9b168af2dcecc725c8669760b22ecf032340 | |
parent | c7d4c0188e2f2513148194eabe3ec42fbfc809aa (diff) | |
download | Paper-4ecc338e09caf3e9e8046c6360e9309642092532.tar.gz Paper-4ecc338e09caf3e9e8046c6360e9309642092532.zip |
WorldCreator#keepSpawnLoaded (#7673)
-rw-r--r-- | patches/api/0380-WorldCreator-keepSpawnLoaded.patch | 48 | ||||
-rw-r--r-- | patches/server/0896-WorldCreator-keepSpawnLoaded.patch | 18 |
2 files changed, 66 insertions, 0 deletions
diff --git a/patches/api/0380-WorldCreator-keepSpawnLoaded.patch b/patches/api/0380-WorldCreator-keepSpawnLoaded.patch new file mode 100644 index 0000000000..73c1bc7776 --- /dev/null +++ b/patches/api/0380-WorldCreator-keepSpawnLoaded.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder <[email protected]> +Date: Sat, 3 Jul 2021 21:18:41 +0100 +Subject: [PATCH] WorldCreator#keepSpawnLoaded + + +diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java +index 9fab6eed92c27ec9dd123171f5c4e1e7cda723e4..1386ba7fd6466965d700db9493e009c186c07d43 100644 +--- a/src/main/java/org/bukkit/WorldCreator.java ++++ b/src/main/java/org/bukkit/WorldCreator.java +@@ -22,6 +22,7 @@ public class WorldCreator { + private boolean generateStructures = true; + private String generatorSettings = ""; + private boolean hardcore = false; ++ private net.kyori.adventure.util.TriState keepSpawnLoaded = net.kyori.adventure.util.TriState.NOT_SET; // Paper + + /** + * Creates an empty WorldCreationOptions for the given world name +@@ -560,4 +561,29 @@ public class WorldCreator { + + return result; + } ++ ++ // Paper start ++ ++ /** ++ * Returns the current intent to keep the world loaded, @see {@link WorldCreator#keepSpawnLoaded(net.kyori.adventure.util.TriState)} ++ * ++ * @return the current tristate value ++ */ ++ @NotNull ++ public net.kyori.adventure.util.TriState keepSpawnLoaded() { ++ return keepSpawnLoaded; ++ } ++ ++ /** ++ * Controls if a world should be kept loaded or not, default (NOT_SET) will use the servers standard ++ * configuration, otherwise, will act as an override towards this setting ++ * ++ * @param keepSpawnLoaded the new value ++ */ ++ public void keepSpawnLoaded(@NotNull net.kyori.adventure.util.TriState keepSpawnLoaded) { ++ java.util.Objects.requireNonNull(keepSpawnLoaded, "keepSpawnLoaded"); ++ this.keepSpawnLoaded = keepSpawnLoaded; ++ } ++ ++ // Paper end + } diff --git a/patches/server/0896-WorldCreator-keepSpawnLoaded.patch b/patches/server/0896-WorldCreator-keepSpawnLoaded.patch new file mode 100644 index 0000000000..a1d5ffe013 --- /dev/null +++ b/patches/server/0896-WorldCreator-keepSpawnLoaded.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder <[email protected]> +Date: Sat, 3 Jul 2021 21:18:28 +0100 +Subject: [PATCH] WorldCreator#keepSpawnLoaded + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 16d3f2dce44fc374ec3ab5882135d06113681fb6..ba4578fb4a2d861a6ffbb0ec022db31d9d7cc2be 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1256,6 +1256,7 @@ public final class CraftServer implements Server { + internal.setSpawnSettings(true, true); + // Paper - move up + ++ internal.keepSpawnInMemory = creator.keepSpawnLoaded().toBooleanOrElse(internal.getWorld().getKeepSpawnInMemory()); // Paper + this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal); + internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API + |