mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-21 12:15:50 +00:00
59 lines
2.1 KiB
Java
59 lines
2.1 KiB
Java
|
package me.mrCookieSlime.Slimefun.Setup;
|
||
|
|
||
|
import java.io.File;
|
||
|
|
||
|
public class Files {
|
||
|
|
||
|
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");
|
||
|
|
||
|
public static void cleanup() {
|
||
|
if (!RESEARCHES.exists()) {
|
||
|
System.err.println("################################################");
|
||
|
System.err.println("################################################");
|
||
|
System.err.println("############### = - ERROR - = ##################");
|
||
|
System.err.println("################################################");
|
||
|
System.err.println("################################################");
|
||
|
System.err.println(" ");
|
||
|
System.err.println("Slimefun Warning:");
|
||
|
System.err.println(" ");
|
||
|
System.err.println("Slimefun has detected that your Files are etiher");
|
||
|
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!");
|
||
|
System.err.println(" ");
|
||
|
System.err.println("################################################");
|
||
|
System.err.println("################################################");
|
||
|
System.err.println("############### = - ERROR - = ##################");
|
||
|
System.err.println("################################################");
|
||
|
System.err.println("################################################");
|
||
|
delete(new File("plugins/Slimefun"));
|
||
|
delete(new File("data-storage/Slimefun"));
|
||
|
}
|
||
|
|
||
|
if (!DATABASE.exists()) {
|
||
|
DATABASE.mkdirs();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void delete(File folder) {
|
||
|
File[] files = folder.listFiles();
|
||
|
if (files != null) {
|
||
|
for (File current: files) {
|
||
|
if (current.isDirectory()) {
|
||
|
delete(current);
|
||
|
}
|
||
|
else {
|
||
|
current.delete();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
folder.delete();
|
||
|
}
|
||
|
|
||
|
}
|