Create data folder if it doesnt exist when starting the server

This commit is contained in:
Melledy 2024-03-13 00:37:49 -07:00
parent a6b656bdd2
commit 418254bfbc

View File

@ -37,6 +37,8 @@ public class ResourceLoader {
// Make sure we don't load more than once
if (loaded) return;
// Create data folder if it doesnt exist when starting the server
checkDataFolder();
// Start loading resources
loadResources();
// Load floor infos after resources
@ -54,6 +56,13 @@ public class ResourceLoader {
loaded = true;
LunarCore.getLogger().info("Resource loading complete");
}
private static void checkDataFolder() {
File dir = new File(LunarCore.getConfig().getDataDir());
if (!dir.exists()) {
dir.mkdir();
}
}
private static List<Class<?>> getResourceDefClasses() {
Reflections reflections = new Reflections(ResourceLoader.class.getPackage().getName());