Format code [skip actions]

This commit is contained in:
github-actions 2023-05-23 23:38:49 +00:00
parent c0ad1bf75b
commit a4ef130923
2 changed files with 14 additions and 22 deletions

View File

@ -9,8 +9,6 @@ import emu.grasscutter.game.inventory.ItemType;
import emu.grasscutter.game.props.SceneType; import emu.grasscutter.game.props.SceneType;
import emu.grasscutter.utils.JsonUtils; import emu.grasscutter.utils.JsonUtils;
import emu.grasscutter.utils.lang.Language; import emu.grasscutter.utils.lang.Language;
import lombok.AllArgsConstructor;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -19,6 +17,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
public interface Dumpers { public interface Dumpers {
// See `src/handbook/data/README.md` for attributions. // See `src/handbook/data/README.md` for attributions.
@ -351,20 +350,15 @@ public interface Dumpers {
// Convert all known areas to an area map. // Convert all known areas to an area map.
var dump = new HashMap<Integer, AreaInfo>(); var dump = new HashMap<Integer, AreaInfo>();
GameData.getWorldAreaDataMap() GameData.getWorldAreaDataMap()
.forEach( .forEach(
(id, area) -> { (id, area) -> {
var langHash = area.getTextMapHash(); var langHash = area.getTextMapHash();
dump.put( dump.put(
area.getChildArea() == 0 ? area.getChildArea() == 0 ? area.getParentArea() : area.getChildArea(),
area.getParentArea() : new AreaInfo(
area.getChildArea(), area.getParentArea(),
new AreaInfo( langHash == 0 ? "Unknown" : Language.getTextMapKey(langHash).get(locale)));
area.getParentArea(), });
langHash == 0
? "Unknown"
: Language.getTextMapKey(langHash).get(locale)
));
});
try { try {
// Create a file for the dump. // Create a file for the dump.
@ -374,8 +368,7 @@ public interface Dumpers {
throw new RuntimeException("Failed to create file."); throw new RuntimeException("Failed to create file.");
// Write the dump to the file. // Write the dump to the file.
Files.writeString(file.toPath(), Dumpers.miniEncode(dump, Files.writeString(file.toPath(), Dumpers.miniEncode(dump, "id", "parent", "name"));
"id", "parent", "name"));
} catch (IOException ignored) { } catch (IOException ignored) {
throw new RuntimeException("Failed to write to file."); throw new RuntimeException("Failed to write to file.");
} }

View File

@ -1,18 +1,17 @@
package emu.grasscutter.utils; package emu.grasscutter.utils;
import static emu.grasscutter.config.Configuration.*;
import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
import emu.grasscutter.BuildConfig; import emu.grasscutter.BuildConfig;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.net.packet.PacketOpcodesUtils; import emu.grasscutter.net.packet.PacketOpcodesUtils;
import emu.grasscutter.tools.Dumpers; import emu.grasscutter.tools.Dumpers;
import org.slf4j.LoggerFactory;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import org.slf4j.LoggerFactory;
import static emu.grasscutter.config.Configuration.*;
/** A parser for start-up arguments. */ /** A parser for start-up arguments. */
public interface StartupArguments { public interface StartupArguments {