From 1eb407338d517cf48926e9f8496439ad92860426 Mon Sep 17 00:00:00 2001 From: szymon Date: Sun, 10 Sep 2023 00:39:52 +0200 Subject: [PATCH] moved save call to the synchronous part. Still have to figure out how to deal with #81..... --- gradle.properties | 14 +++++++------- .../core/create/ExecutableBackup.java | 15 +++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/gradle.properties b/gradle.properties index c422a14..bfee7ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,18 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G -minecraft_version=1.20 -yarn_mappings=1.20+build.1 -loader_version=0.14.21 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.14.22 #Fabric api -fabric_version=0.83.0+1.20 +fabric_version=0.88.1+1.20.1 #Cloth Config -cloth_version=11.0.98 +cloth_version=11.1.106 #ModMenu -modmenu_version=7.0.0-beta.2 +modmenu_version=7.2.2 databreaker_version=0.2.10 @@ -20,6 +20,6 @@ databreaker_version=0.2.10 pgzip_commit_hash=af5f5c297e735f3f2df7aa4eb0e19a5810b8aff6 # Mod Properties -mod_version = 3.1.0 +mod_version = 3.1.1 maven_group = net.szum123321 archives_base_name = textile_backup \ No newline at end of file diff --git a/src/main/java/net/szum123321/textile_backup/core/create/ExecutableBackup.java b/src/main/java/net/szum123321/textile_backup/core/create/ExecutableBackup.java index f51e033..e5456eb 100644 --- a/src/main/java/net/szum123321/textile_backup/core/create/ExecutableBackup.java +++ b/src/main/java/net/szum123321/textile_backup/core/create/ExecutableBackup.java @@ -64,11 +64,6 @@ public record ExecutableBackup(@NotNull MinecraftServer server, } @Override public Void call() throws Exception { - if (save) { //save the world - log.sendInfoAL(this, "Saving server..."); - server.saveAll(true, true, false); - } - Path outFile = Utilities.getBackupRootPath(Utilities.getLevelName(server)).resolve(getFileName()); log.trace("Outfile is: {}", outFile); @@ -76,8 +71,8 @@ public record ExecutableBackup(@NotNull MinecraftServer server, try { //I think I should synchronise these two next calls... Utilities.disableWorldSaving(server); - Globals.INSTANCE.disableWatchdog = true; + Globals.INSTANCE.disableWatchdog = true; Globals.INSTANCE.updateTMPFSFlag(server); log.sendInfoAL(this, "Starting backup"); @@ -225,6 +220,14 @@ public record ExecutableBackup(@NotNull MinecraftServer server, ExecutableBackup v = new ExecutableBackup(server, commandSource, initiator, save, cleanup, comment, LocalDateTime.now()); if(announce) v.announce(); + + if (save) { //save the world + // We need to flush everything as next thing we'll be copying all the files. + // this is mostly the reason for #81 - minecraft doesn't flush during scheduled saves. + log.sendInfoAL(this.commandSource, "Saving server..."); + server.saveAll(true, true, false); + } + return v; } }