From fc570959d4348515991f586b3370634af417b1ae Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sun, 1 Sep 2019 18:49:09 -0700 Subject: [PATCH] Improve POI data saving logic (#2475) - Do not unload data if world saving is disabled - Aggressively target unloading --- .../0413-Improve-POI-data-saving-logic.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Spigot-Server-Patches/0413-Improve-POI-data-saving-logic.patch diff --git a/Spigot-Server-Patches/0413-Improve-POI-data-saving-logic.patch b/Spigot-Server-Patches/0413-Improve-POI-data-saving-logic.patch new file mode 100644 index 0000000000..f9e5b39087 --- /dev/null +++ b/Spigot-Server-Patches/0413-Improve-POI-data-saving-logic.patch @@ -0,0 +1,30 @@ +From dab99d480ae6b7355408b9313b53db3681fad95e Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 19 Aug 2019 06:33:17 -0700 +Subject: [PATCH] Improve POI data saving logic + +- Do not unload data if world saving is disabled +- Aggressively target unloading + +diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java +index 0e98b7803b..fb99b43061 100644 +--- a/src/main/java/net/minecraft/server/VillagePlace.java ++++ b/src/main/java/net/minecraft/server/VillagePlace.java +@@ -132,9 +132,12 @@ public class VillagePlace extends RegionFileSection { + // Paper start - async chunk io + if (this.world == null) { + super.a(booleansupplier); +- } else { ++ } else if (!this.world.isSavingDisabled()) { // Paper - only save if saving is enabled + //super.a(booleansupplier); // re-implement below +- while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { ++ // Paper start - target unloading aggressively ++ int queueTarget = Math.min(this.d.size() - 100, (int)(this.d.size() * 0.96)); ++ while (!((RegionFileSection)this).d.isEmpty() && (this.d.size() > queueTarget || booleansupplier.getAsBoolean())) { ++ // Paper end + ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).u(); + + NBTTagCompound data; +-- +2.22.1 +