SPIGOT-7089: Crash when command blocks attempt to load worlds
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -988,7 +988,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public World createWorld(WorldCreator creator) {
|
||||
Preconditions.checkState(!console.levels.isEmpty(), "Cannot create additional worlds on STARTUP");
|
||||
Preconditions.checkState(console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
|
||||
Validate.notNull(creator, "Creator may not be null");
|
||||
|
||||
String name = creator.name();
|
||||
@@ -1087,7 +1087,7 @@ public final class CraftServer implements Server {
|
||||
console.initWorld(internal, worlddata, worlddata, worlddata.worldGenSettings());
|
||||
|
||||
internal.setSpawnSettings(true, true);
|
||||
console.levels.put(internal.dimension(), internal);
|
||||
console.addLevel(internal);
|
||||
|
||||
getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
|
||||
internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API
|
||||
@@ -1109,7 +1109,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
WorldServer handle = ((CraftWorld) world).getHandle();
|
||||
|
||||
if (!(console.levels.containsKey(handle.dimension()))) {
|
||||
if (console.getLevel(handle.dimension()) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1141,7 +1141,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
console.levels.remove(handle.dimension());
|
||||
console.removeLevel(handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user