From 418254bfbcd110f507c563326bdd36ffa1bbcffe Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Wed, 13 Mar 2024 00:37:49 -0700 Subject: [PATCH] Create data folder if it doesnt exist when starting the server --- src/main/java/emu/lunarcore/data/ResourceLoader.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/emu/lunarcore/data/ResourceLoader.java b/src/main/java/emu/lunarcore/data/ResourceLoader.java index 3c7af4d..c4f1554 100644 --- a/src/main/java/emu/lunarcore/data/ResourceLoader.java +++ b/src/main/java/emu/lunarcore/data/ResourceLoader.java @@ -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> getResourceDefClasses() { Reflections reflections = new Reflections(ResourceLoader.class.getPackage().getName());