diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index e649b537c..8c3248dd7 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -158,6 +158,8 @@ public final class Grasscutter { // Generate handbooks. Tools.createGmHandbooks(false); + // Generate gacha mappings. + Tools.generateGachaMappings(); } // Start servers. diff --git a/src/main/java/emu/grasscutter/data/DataLoader.java b/src/main/java/emu/grasscutter/data/DataLoader.java index 04b643606..7379a75a4 100644 --- a/src/main/java/emu/grasscutter/data/DataLoader.java +++ b/src/main/java/emu/grasscutter/data/DataLoader.java @@ -114,8 +114,6 @@ public class DataLoader { } catch (Exception e) { Grasscutter.getLogger().error("An error occurred while trying to check the data folder.", e); } - - generateGachaMappings(); } private static void checkAndCopyData(String name) { @@ -131,16 +129,4 @@ public class DataLoader { FileUtils.copyResource("/defaults/data/" + name, filePath.toString()); } } - - private static void generateGachaMappings() { - var path = GachaHandler.getGachaMappingsPath(); - if (!Files.exists(path)) { - try { - Grasscutter.getLogger().debug("Creating default '" + path + "' data"); - Tools.createGachaMappings(path); - } catch (Exception exception) { - Grasscutter.getLogger().warn("Failed to create gacha mappings. \n" + exception); - } - } - } } diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index a611acb89..ea88a5296 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -10,6 +10,7 @@ import emu.grasscutter.data.common.ItemUseData; import emu.grasscutter.data.excels.*; import emu.grasscutter.data.excels.achievement.AchievementData; import emu.grasscutter.data.excels.avatar.AvatarData; +import emu.grasscutter.server.http.handlers.GachaHandler; import emu.grasscutter.utils.*; import emu.grasscutter.utils.lang.Language; import emu.grasscutter.utils.lang.Language.TextStrings; @@ -311,8 +312,19 @@ public final class Tools { return sbs.stream().map(StringBuilder::toString).toList(); } + public static void generateGachaMappings() { + var path = GachaHandler.getGachaMappingsPath(); + if (!Files.exists(path)) { + try { + Grasscutter.getLogger().debug("Creating default '" + path + "' data"); + Tools.createGachaMappings(path); + } catch (Exception exception) { + Grasscutter.getLogger().warn("Failed to create gacha mappings. \n" + exception); + } + } + } + public static void createGachaMappings(Path location) throws IOException { - ResourceLoader.loadResources(); List jsons = createGachaMappingJsons(); var usedLocales = new HashSet(); StringBuilder sb = new StringBuilder("mappings = {\n");