2016-04-14 16:24:03 +00:00
|
|
|
package me.mrCookieSlime.Slimefun.Setup;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
2019-08-27 21:08:13 +00:00
|
|
|
public final class Files {
|
|
|
|
|
|
|
|
private Files() {}
|
2016-04-14 16:24:03 +00:00
|
|
|
|
2019-08-30 20:58:46 +00:00
|
|
|
public static File Researches = new File("plugins/Slimefun/Researches.yml");
|
|
|
|
public static File config = new File("plugins/Slimefun/config.yml");
|
|
|
|
public static File items = new File("plugins/Slimefun/Items.yml");
|
|
|
|
public static File database = new File("data-storage/Slimefun/Players");
|
|
|
|
public static File whitelist = new File("plugins/Slimefun/whitelist.yml");
|
2016-04-14 16:24:03 +00:00
|
|
|
|
|
|
|
public static void cleanup() {
|
2019-08-30 20:58:46 +00:00
|
|
|
if (!Researches.exists()) {
|
2018-09-06 10:50:49 +00:00
|
|
|
System.err.println("###############################################");
|
|
|
|
System.err.println("############## = - INFO - = #################");
|
|
|
|
System.err.println("###############################################");
|
2016-04-14 16:24:03 +00:00
|
|
|
System.err.println(" ");
|
|
|
|
System.err.println("Slimefun Warning:");
|
|
|
|
System.err.println(" ");
|
2017-12-31 01:07:02 +00:00
|
|
|
System.err.println("Slimefun has detected that your Files are either");
|
2016-04-14 16:24:03 +00:00
|
|
|
System.err.println("outdated or do not exist. We generated new Files");
|
|
|
|
System.err.println("instead otherwise Slimefun would not work. If you");
|
|
|
|
System.err.println("have used Slimefun before, your Settings are now");
|
|
|
|
System.err.println("gone. But therefore Slimefun works!");
|
|
|
|
delete(new File("plugins/Slimefun"));
|
|
|
|
delete(new File("data-storage/Slimefun"));
|
|
|
|
}
|
|
|
|
|
2019-08-30 20:58:46 +00:00
|
|
|
if (!database.exists()) {
|
|
|
|
database.mkdirs();
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-28 08:59:20 +00:00
|
|
|
public static boolean delete(File folder) {
|
2016-04-14 16:24:03 +00:00
|
|
|
File[] files = folder.listFiles();
|
|
|
|
if (files != null) {
|
|
|
|
for (File current: files) {
|
|
|
|
if (current.isDirectory()) {
|
2019-08-29 17:12:53 +00:00
|
|
|
if (!delete(current)) return false;
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-08-28 08:59:20 +00:00
|
|
|
if (!current.delete()) return false;
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-28 08:59:20 +00:00
|
|
|
|
|
|
|
return folder.delete();
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|