mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
SPIGOT-5225: World handle isn't closed if world is unloaded without saving
This commit is contained in:
parent
104b3831f8
commit
da62a66ab7
2 changed files with 24 additions and 9 deletions
|
@ -50,7 +50,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoaded(int i, int j) {
|
public boolean isLoaded(int i, int j) {
|
||||||
@@ -294,6 +302,18 @@
|
@@ -289,11 +297,31 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
- this.save(true);
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ close(true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void close(boolean save) throws IOException {
|
||||||
|
+ if (save) {
|
||||||
|
+ this.save(true);
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
this.lightEngine.close();
|
||||||
this.playerChunkMap.close();
|
this.playerChunkMap.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +83,7 @@
|
||||||
public void tick(BooleanSupplier booleansupplier) {
|
public void tick(BooleanSupplier booleansupplier) {
|
||||||
this.world.getMethodProfiler().enter("purge");
|
this.world.getMethodProfiler().enter("purge");
|
||||||
this.chunkMapDistance.purgeTickets();
|
this.chunkMapDistance.purgeTickets();
|
||||||
@@ -313,13 +333,13 @@
|
@@ -313,13 +341,13 @@
|
||||||
this.lastTickTime = i;
|
this.lastTickTime = i;
|
||||||
WorldData worlddata = this.world.getWorldData();
|
WorldData worlddata = this.world.getWorldData();
|
||||||
boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES;
|
boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES;
|
||||||
|
@ -85,7 +99,7 @@
|
||||||
|
|
||||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||||
int l = this.chunkMapDistance.b();
|
int l = this.chunkMapDistance.b();
|
||||||
@@ -348,8 +368,30 @@
|
@@ -348,8 +376,30 @@
|
||||||
for (int j1 = 0; j1 < i1; ++j1) {
|
for (int j1 = 0; j1 < i1; ++j1) {
|
||||||
EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1];
|
EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1];
|
||||||
|
|
||||||
|
@ -117,7 +131,7 @@
|
||||||
|
|
||||||
if (object2intmap.getInt(enumcreaturetype) <= k1) {
|
if (object2intmap.getInt(enumcreaturetype) <= k1) {
|
||||||
SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition);
|
SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition);
|
||||||
@@ -497,12 +539,18 @@
|
@@ -497,12 +547,18 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean executeNext() {
|
protected boolean executeNext() {
|
||||||
|
|
|
@ -981,13 +981,14 @@ public final class CraftServer implements Server {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save) {
|
try {
|
||||||
try {
|
if (save) {
|
||||||
handle.save(null, true, true);
|
handle.save(null, true, true);
|
||||||
handle.close();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
getLogger().log(Level.SEVERE, null, ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle.getChunkProvider().close(save);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
getLogger().log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||||
|
|
Loading…
Reference in a new issue