mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 17:21:37 +01:00
SPIGOT-6722: Close entity manager when unloading world
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
dd503b542b
commit
c8ef43f1b5
@ -0,0 +1,89 @@
|
||||
--- a/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
+++ b/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||
@@ -82,7 +82,7 @@
|
||||
long i = SectionPosition.c(t0.getChunkCoordinates());
|
||||
EntitySection<T> entitysection = this.sectionStorage.c(i);
|
||||
|
||||
- entitysection.a((Object) t0);
|
||||
+ entitysection.a(t0); // CraftBukkit - decompile error
|
||||
t0.a(new PersistentEntitySectionManager.a(t0, i, entitysection));
|
||||
if (!flag) {
|
||||
this.callbacks.f(t0);
|
||||
@@ -254,13 +254,13 @@
|
||||
}
|
||||
|
||||
private void f() {
|
||||
- this.chunksToUnload.removeIf((i) -> {
|
||||
+ this.chunksToUnload.removeIf((java.util.function.LongPredicate) (i) -> { // CraftBukkit - decompile error
|
||||
return this.chunkVisibility.get(i) != Visibility.HIDDEN ? true : this.d(i);
|
||||
});
|
||||
}
|
||||
|
||||
private void g() {
|
||||
- ChunkEntities chunkentities;
|
||||
+ ChunkEntities<T> chunkentities; // CraftBukkit - decompile error
|
||||
|
||||
while ((chunkentities = (ChunkEntities) this.loadingInbox.poll()) != null) {
|
||||
chunkentities.b().forEach((entityaccess) -> {
|
||||
@@ -292,7 +292,7 @@
|
||||
}
|
||||
|
||||
public void b() {
|
||||
- this.h().forEach((i) -> {
|
||||
+ this.h().forEach((java.util.function.LongConsumer) (i) -> { // CraftBukkit - decompile error
|
||||
boolean flag = this.chunkVisibility.get(i) == Visibility.HIDDEN;
|
||||
|
||||
if (flag) {
|
||||
@@ -311,7 +311,7 @@
|
||||
while (!longset.isEmpty()) {
|
||||
this.permanentStorage.a(false);
|
||||
this.g();
|
||||
- longset.removeIf((i) -> {
|
||||
+ longset.removeIf((java.util.function.LongPredicate) (i) -> { // CraftBukkit - decompile error
|
||||
boolean flag = this.chunkVisibility.get(i) == Visibility.HIDDEN;
|
||||
|
||||
return flag ? this.d(i) : this.a(i, (entityaccess) -> {
|
||||
@@ -323,7 +323,15 @@
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
- this.c();
|
||||
+ // CraftBukkit start - add save boolean
|
||||
+ close(true);
|
||||
+ }
|
||||
+
|
||||
+ public void close(boolean save) throws IOException {
|
||||
+ if (save) {
|
||||
+ this.c(); // PAIL rename saveAll
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.permanentStorage.close();
|
||||
}
|
||||
|
||||
@@ -350,7 +358,7 @@
|
||||
public void a(Writer writer) throws IOException {
|
||||
CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("visibility").a("load_status").a("entity_count").a(writer);
|
||||
|
||||
- this.sectionStorage.a().forEach((i) -> {
|
||||
+ this.sectionStorage.a().forEach((java.util.function.LongConsumer) (i) -> { // CraftBukkit - decompile error
|
||||
PersistentEntitySectionManager.b persistententitysectionmanager_b = (PersistentEntitySectionManager.b) this.chunkLoadStatuses.get(i);
|
||||
|
||||
this.sectionStorage.a(i).forEach((j) -> {
|
||||
@@ -389,7 +397,7 @@
|
||||
private EntitySection<T> currentSection;
|
||||
|
||||
a(EntityAccess entityaccess, long i, EntitySection entitysection) {
|
||||
- this.entity = entityaccess;
|
||||
+ this.entity = (T) entityaccess; // CraftBukkit - decompile error
|
||||
this.currentSectionKey = i;
|
||||
this.currentSection = entitysection;
|
||||
}
|
||||
@@ -409,7 +417,7 @@
|
||||
PersistentEntitySectionManager.this.a(this.currentSectionKey, this.currentSection);
|
||||
EntitySection<T> entitysection = PersistentEntitySectionManager.this.sectionStorage.c(i);
|
||||
|
||||
- entitysection.a((Object) this.entity);
|
||||
+ entitysection.a(this.entity); // CraftBukkit - decompile error
|
||||
this.currentSection = entitysection;
|
||||
this.currentSectionKey = i;
|
||||
this.a(visibility, entitysection.c());
|
@ -1128,6 +1128,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
handle.getChunkProvider().close(save);
|
||||
handle.entityManager.close(save); // SPIGOT-6722: close entityManager
|
||||
handle.convertable.close();
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
|
Loading…
Reference in New Issue
Block a user