diff --git a/libs/commons-codec-1.13.jar b/libs/commons-codec-1.13.jar new file mode 100644 index 00000000..bf6ccb38 Binary files /dev/null and b/libs/commons-codec-1.13.jar differ diff --git a/libs/paperspigot.jar b/libs/paperspigot.jar deleted file mode 100644 index fdc3ac98..00000000 Binary files a/libs/paperspigot.jar and /dev/null differ diff --git a/libs/paperspigot_1.14.4.jar b/libs/paperspigot_1.14.4.jar new file mode 100644 index 00000000..d20c71e6 Binary files /dev/null and b/libs/paperspigot_1.14.4.jar differ diff --git a/src/autosaveworld/features/save/AutoSaveThread.java b/src/autosaveworld/features/save/AutoSaveThread.java index c67b1105..00d615b1 100644 --- a/src/autosaveworld/features/save/AutoSaveThread.java +++ b/src/autosaveworld/features/save/AutoSaveThread.java @@ -131,8 +131,16 @@ private void dumpRegionCache(World world) { if (world.isAutoSave()) { try { Object worldserver = getNMSWorld(world); - // invoke saveLevel method which waits for all chunks to save and than dumps RegionFileCache - ReflectionUtils.getMethod(worldserver.getClass(), NMSNames.getSaveLevelMethodName(), 0).invoke(worldserver); + // Navigate to the RegionFileCache class + Object chunkprovider = ReflectionUtils.getMethod(worldserver.getClass(), "getChunkProvider", 0).invoke(worldserver); + Object playerchunkmap = ReflectionUtils.getField(chunkprovider.getClass(), "playerChunkMap").get(chunkprovider); + Object cache = ReflectionUtils.getField(playerchunkmap.getClass(), "cache").get(playerchunkmap); + + // Waits for all chunks to save and then dumps RegionFileCache + while ((int) ReflectionUtils.getMethod(cache.getClass(), "size", 0).invoke(cache) > 0) { + Object popped = ReflectionUtils.getMethod(cache.getClass(), "removeLast", 0).invoke(cache); + ReflectionUtils.getMethod(popped.getClass(), "close", 0).invoke(popped); + } } catch (Exception e) { MessageLogger.exception("Could not dump RegionFileCache", e); }