Skip to content

Commit

Permalink
reverted deleteWorld method overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
sh0inx committed May 10, 2024
1 parent 75f991c commit d262577
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
Expand All @@ -53,10 +55,17 @@ public IslandManager() {
}

public boolean deleteWorld(File path) {
Files.walk(pathToBeDeleted)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
if(path.exists()) {
File files[] = path.listFiles();
for(int i=0; i<files.length; i++) {
if(files[i].isDirectory()) {
deleteWorld(files[i]);
} else {
files[i].delete();
}
}
}
return(path.delete());
}

// Bukkit's createWorld method requires "/" no matter which platform we're on.
Expand Down

0 comments on commit d262577

Please sign in to comment.