mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-02-06 10:06:51 +01:00
Format code [skip actions]
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package emu.grasscutter.data;
|
||||
|
||||
import static emu.grasscutter.utils.FileUtils.getDataPath;
|
||||
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
||||
import static emu.grasscutter.utils.lang.Language.translate;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
@@ -32,12 +36,6 @@ import it.unimi.dsi.fastutil.Pair;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntArraySet;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.CompiledScript;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Files;
|
||||
@@ -49,10 +47,11 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static emu.grasscutter.utils.FileUtils.getDataPath;
|
||||
import static emu.grasscutter.utils.FileUtils.getResourcePath;
|
||||
import static emu.grasscutter.utils.lang.Language.translate;
|
||||
import javax.script.Bindings;
|
||||
import javax.script.CompiledScript;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
public final class ResourceLoader {
|
||||
|
||||
@@ -230,11 +229,15 @@ public final class ResourceLoader {
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadGlobalCombatConfig(){
|
||||
private static void loadGlobalCombatConfig() {
|
||||
try {
|
||||
GameData.setConfigGlobalCombat(JsonUtils.loadToClass(getResourcePath("BinOutput/Common/ConfigGlobalCombat.json"), ConfigGlobalCombat.class));
|
||||
GameData.setConfigGlobalCombat(
|
||||
JsonUtils.loadToClass(
|
||||
getResourcePath("BinOutput/Common/ConfigGlobalCombat.json"),
|
||||
ConfigGlobalCombat.class));
|
||||
} catch (IOException e) {
|
||||
Grasscutter.getLogger().error("Cannot load ConfigGlobalCombat.json, this error is important, fix it!");
|
||||
Grasscutter.getLogger()
|
||||
.error("Cannot load ConfigGlobalCombat.json, this error is important, fix it!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,13 +432,19 @@ public final class ResourceLoader {
|
||||
private static void loadTalents() {
|
||||
// Load from BinOutput
|
||||
try (var paths = Files.walk(getResourcePath("BinOutput/Talent/AvatarTalents/"))) {
|
||||
paths.filter(Files::isDirectory).forEach((folderPath) -> {
|
||||
try (var paths2 = Files.walk(folderPath)) {
|
||||
paths2.filter(Files::isRegularFile).filter(path -> path.toString().endsWith(".json")).forEach(ResourceLoader::loadTalent);
|
||||
} catch (IOException e) {
|
||||
Grasscutter.getLogger().error("Error loading talents: ", e);
|
||||
}
|
||||
});
|
||||
paths
|
||||
.filter(Files::isDirectory)
|
||||
.forEach(
|
||||
(folderPath) -> {
|
||||
try (var paths2 = Files.walk(folderPath)) {
|
||||
paths2
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(path -> path.toString().endsWith(".json"))
|
||||
.forEach(ResourceLoader::loadTalent);
|
||||
} catch (IOException e) {
|
||||
Grasscutter.getLogger().error("Error loading talents: ", e);
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Grasscutter.getLogger().error("Error loading talents: ", e);
|
||||
}
|
||||
@@ -443,9 +452,13 @@ public final class ResourceLoader {
|
||||
|
||||
private static void loadTalent(Path path) {
|
||||
try {
|
||||
GameData.getTalents().putAll(JsonUtils.loadToMap(path, String.class, new TypeToken<List<TalentData>>() {}.getType()));
|
||||
GameData.getTalents()
|
||||
.putAll(
|
||||
JsonUtils.loadToMap(
|
||||
path, String.class, new TypeToken<List<TalentData>>() {}.getType()));
|
||||
} catch (IOException e) {
|
||||
Grasscutter.getLogger().error("Error loading ability modifiers from path " + path.toString() + ": ", e);
|
||||
Grasscutter.getLogger()
|
||||
.error("Error loading ability modifiers from path " + path.toString() + ": ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,8 +828,9 @@ public final class ResourceLoader {
|
||||
var monsterMap = GameData.getMonsterMappingMap();
|
||||
try {
|
||||
JsonUtils.loadToList(getResourcePath("Server/MonsterMapping.json"), MonsterMapping.class)
|
||||
.forEach(entry -> monsterMap.put(entry.getMonsterId(), entry));
|
||||
} catch (IOException | NullPointerException ignored) {}
|
||||
.forEach(entry -> monsterMap.put(entry.getMonsterId(), entry));
|
||||
} catch (IOException | NullPointerException ignored) {
|
||||
}
|
||||
|
||||
Grasscutter.getLogger().debug("Loaded {} monster mappings.", monsterMap.size());
|
||||
} catch (Exception e) {
|
||||
@@ -965,7 +979,8 @@ public final class ResourceLoader {
|
||||
public int pointDelta;
|
||||
}
|
||||
|
||||
public static class ScenePointConfig { // Sadly this doesn't work as a local class in loadScenePoints()
|
||||
public static
|
||||
class ScenePointConfig { // Sadly this doesn't work as a local class in loadScenePoints()
|
||||
public Map<Integer, PointData> points;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user