3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

SPIGOT-5225: World handle isn't closed if world is unloaded without saving

Dieser Commit ist enthalten in:
md_5 2019-07-29 16:36:51 +10:00
Ursprung 104b3831f8
Commit da62a66ab7
2 geänderte Dateien mit 24 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -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() {

Datei anzeigen

@ -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));