Clean-Up Startup Sequence

hey i like it clean ok.. dont judge..
This commit is contained in:
KingRainbow44
2022-12-30 20:31:27 -05:00
parent fe80290bed
commit 668461a6f1
4 changed files with 19 additions and 6 deletions

View File

@@ -30,12 +30,24 @@ import it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
import lombok.val;
import static emu.grasscutter.config.Configuration.*;
import static emu.grasscutter.utils.FileUtils.getResourcePath;
import static emu.grasscutter.utils.Language.getTextMapKey;
public final class Tools {
/**
* This generates the GM handbooks with a message by default.
* @throws Exception If an error occurs while generating the handbooks.
*/
public static void createGmHandbooks() throws Exception {
Tools.createGmHandbooks(true);
}
/**
* Generates a GM handbook for each language.
* @param message Should a message be printed to the console?
* @throws Exception If an error occurs while generating the handbooks.
*/
public static void createGmHandbooks(boolean message) throws Exception {
val languages = Language.TextStrings.getLanguages();
ResourceLoader.loadAll();
@@ -48,7 +60,7 @@ public final class Tools {
val sceneDataMap = new Int2ObjectRBTreeMap<>(GameData.getSceneDataMap());
val questDataMap = new Int2ObjectRBTreeMap<>(GameData.getQuestDataMap());
Function<SortedMap, String> getPad = m -> "%" + m.lastKey().toString().length() + "s : ";
Function<SortedMap<?, ?>, String> getPad = m -> "%" + m.lastKey().toString().length() + "s : ";
// Create builders and helper functions
val handbookBuilders = IntStream.range(0, TextStrings.NUM_LANGUAGES).mapToObj(i -> new StringBuilder()).toList();
@@ -143,7 +155,8 @@ public final class Tools {
writer.write(handbookBuilders.get(i).toString());
}
}
Grasscutter.getLogger().info("GM Handbooks generated!");
if (message) Grasscutter.getLogger().info("GM Handbooks generated!");
}
public static List<String> createGachaMappingJsons() {