Skip to content

Commit

Permalink
use cross platform method to replace
Browse files Browse the repository at this point in the history
  • Loading branch information
hafarooki committed Jul 2, 2019
1 parent 4bb9a86 commit 07056cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/net/starlegacy/explosionregen/WorldData.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import org.bukkit.block.data.BlockData;

import java.io.*;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -132,7 +135,7 @@ public void save(World world) {
}
}

tmpFile.renameTo(file);
Files.move(tmpFile.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
tmpFile.delete();
Expand Down

0 comments on commit 07056cd

Please sign in to comment.