Add method isTickingWorlds to Bukkit (#8316)
Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Also, restores un/loading worlds mid tick. This will not be officially supported API contract that such a routine is safe, and these restrictions may be restored in the future.
This commit is contained in:
parent
6736f390a2
commit
4d52f1d247
17 changed files with 136 additions and 7 deletions
|
@ -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<World>(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;
|
||||
}
|
||||
|
|
|
@ -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<CommandSender> recipients = new HashSet<>();
|
||||
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue