diff --git a/src/main/java/emu/grasscutter/tools/Dumpers.java b/src/main/java/emu/grasscutter/tools/Dumpers.java index 9857d4815..6251b9ce1 100644 --- a/src/main/java/emu/grasscutter/tools/Dumpers.java +++ b/src/main/java/emu/grasscutter/tools/Dumpers.java @@ -9,8 +9,6 @@ import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.props.SceneType; import emu.grasscutter.utils.JsonUtils; import emu.grasscutter.utils.Language; -import lombok.AllArgsConstructor; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -19,6 +17,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import lombok.AllArgsConstructor; public interface Dumpers { // See `src/handbook/data/README.md` for attributions. @@ -284,26 +283,32 @@ public interface Dumpers { // Convert all known quests to a quest map. var dump = new HashMap(); - GameData.getQuestDataMap().forEach((id, quest) -> { - var langHash = quest.getDescTextMapHash(); - dump.put(id, new QuestInfo( - langHash == 0 ? "Unknown" : - Language.getTextMapKey(langHash).get(locale) - .replaceAll(",", "\\\\"), - quest.getMainId() - )); - }); + GameData.getQuestDataMap() + .forEach( + (id, quest) -> { + var langHash = quest.getDescTextMapHash(); + dump.put( + id, + new QuestInfo( + langHash == 0 + ? "Unknown" + : Language.getTextMapKey(langHash).get(locale).replaceAll(",", "\\\\"), + quest.getMainId())); + }); // Convert all known main quests into a quest map. var mainDump = new HashMap(); - GameData.getMainQuestDataMap().forEach((id, mainQuest) -> { - var langHash = mainQuest.getTitleTextMapHash(); - mainDump.put(id, new MainQuestInfo( - langHash == 0 ? "Unknown" : - Language.getTextMapKey(langHash).get(locale) - .replaceAll(",", "\\\\") - )); - }); + GameData.getMainQuestDataMap() + .forEach( + (id, mainQuest) -> { + var langHash = mainQuest.getTitleTextMapHash(); + mainDump.put( + id, + new MainQuestInfo( + langHash == 0 + ? "Unknown" + : Language.getTextMapKey(langHash).get(locale).replaceAll(",", "\\\\"))); + }); try { // Create a file for the dump. @@ -313,8 +318,7 @@ public interface Dumpers { throw new RuntimeException("Failed to create file."); // Write the dump to the file. - Files.writeString(file.toPath(), Dumpers.miniEncode(dump, - "id", "description", "mainId")); + Files.writeString(file.toPath(), Dumpers.miniEncode(dump, "id", "description", "mainId")); } catch (IOException ignored) { throw new RuntimeException("Failed to write to file."); } @@ -327,8 +331,7 @@ public interface Dumpers { throw new RuntimeException("Failed to create file."); // Write the dump to the file. - Files.writeString(file.toPath(), Dumpers.miniEncode(mainDump, - "id", "title")); + Files.writeString(file.toPath(), Dumpers.miniEncode(mainDump, "id", "title")); } catch (IOException ignored) { throw new RuntimeException("Failed to write to file."); } diff --git a/src/main/java/emu/grasscutter/utils/StartupArguments.java b/src/main/java/emu/grasscutter/utils/StartupArguments.java index 07eac7a35..3c11a2d5f 100644 --- a/src/main/java/emu/grasscutter/utils/StartupArguments.java +++ b/src/main/java/emu/grasscutter/utils/StartupArguments.java @@ -1,18 +1,17 @@ package emu.grasscutter.utils; +import static emu.grasscutter.config.Configuration.*; + import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import emu.grasscutter.BuildConfig; import emu.grasscutter.Grasscutter; import emu.grasscutter.net.packet.PacketOpcodesUtils; import emu.grasscutter.tools.Dumpers; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.Map; import java.util.function.Function; - -import static emu.grasscutter.config.Configuration.*; +import org.slf4j.LoggerFactory; /** A parser for start-up arguments. */ public final class StartupArguments {