Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WorldCreator#keepSpawnLoaded (#7673)
- Loading branch information
1 parent
c7d4c01
commit 4ecc338
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Shane Freeder <theboyetronic@gmail.com> | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Shane Freeder <theboyetronic@gmail.com> | ||
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 | ||
|