Skip to content

Commit 3152b62

Browse files
authored
Merge pull request #3339 from Multiverse/fix/worlds-old-exist
Fix issue when trying to backup `worlds.yml.old` and file already exists
2 parents fa3adbe + f60b656 commit 3152b62

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/org/mvplugins/multiverse/core/world/WorldsConfigManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.mvplugins.multiverse.core.MultiverseCore;
2020

2121
import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES;
22+
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
2223

2324
/**
2425
* Manages the worlds.yml file.
@@ -81,8 +82,9 @@ private void migrateRemoveOldConfigSerializable() {
8182
}
8283

8384
// Copy old config file to `worlds.yml.old`
84-
Path oldWorldConfig = worldConfigFile.toPath().getParent().resolve(CONFIG_FILENAME + ".old");
85-
Files.copy(worldConfigFile.toPath(), oldWorldConfig, COPY_ATTRIBUTES);
85+
Path oldWorldConfig = worldConfigFile.toPath().getParent()
86+
.resolve(CONFIG_FILENAME + ".old." + System.currentTimeMillis());
87+
Files.copy(worldConfigFile.toPath(), oldWorldConfig, COPY_ATTRIBUTES, REPLACE_EXISTING);
8688

8789
return configData.replace("==: MVWorld", "w@: world")
8890
.replace("==: MVSpawnSettings", "")

0 commit comments

Comments
 (0)