mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 06:50:12 +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) {
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
@ -69,7 +83,7 @@
|
|||
public void tick(BooleanSupplier booleansupplier) {
|
||||
this.world.getMethodProfiler().enter("purge");
|
||||
this.chunkMapDistance.purgeTickets();
|
||||
@@ -313,13 +333,13 @@
|
||||
@@ -313,13 +341,13 @@
|
||||
this.lastTickTime = i;
|
||||
WorldData worlddata = this.world.getWorldData();
|
||||
boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES;
|
||||
|
@ -85,7 +99,7 @@
|
|||
|
||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||
int l = this.chunkMapDistance.b();
|
||||
@@ -348,8 +368,30 @@
|
||||
@@ -348,8 +376,30 @@
|
||||
for (int j1 = 0; j1 < i1; ++j1) {
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1];
|
||||
|
||||
|
@ -117,7 +131,7 @@
|
|||
|
||||
if (object2intmap.getInt(enumcreaturetype) <= k1) {
|
||||
SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition);
|
||||
@@ -497,12 +539,18 @@
|
||||
@@ -497,12 +547,18 @@
|
||||
|
||||
@Override
|
||||
protected boolean executeNext() {
|
||||
|
|
|
@ -981,13 +981,14 @@ public final class CraftServer implements Server {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (save) {
|
||||
try {
|
||||
try {
|
||||
if (save) {
|
||||
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));
|
||||
|
|
Loading…
Reference in a new issue