mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-02-09 05:52:52 +08:00
Fix QuestEncryptionKeys Path (#1696)
* Fix QuestEncryptionKeys Path * Load resources QuestEncryptionKeys
This commit is contained in:
parent
1dd84d69b3
commit
5db73d2849
@ -112,7 +112,7 @@ public class DataLoader {
|
|||||||
|
|
||||||
if (!Utils.fileExists(filePath)) {
|
if (!Utils.fileExists(filePath)) {
|
||||||
// Check if file is in subdirectory
|
// Check if file is in subdirectory
|
||||||
if (name.indexOf("/") != -1) {
|
if (name.contains("/")) {
|
||||||
String[] path = name.split("/");
|
String[] path = name.split("/");
|
||||||
|
|
||||||
String folder = "";
|
String folder = "";
|
||||||
|
@ -413,13 +413,18 @@ public class ResourceLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<QuestEncryptionKey> keys = DataLoader.loadList("QuestEncryptionKeys.json", QuestEncryptionKey.class);
|
List<QuestEncryptionKey> keys;
|
||||||
|
|
||||||
Int2ObjectMap<QuestEncryptionKey> questEncryptionMap = GameData.getMainQuestEncryptionMap();
|
Int2ObjectMap<QuestEncryptionKey> questEncryptionMap = GameData.getMainQuestEncryptionMap();
|
||||||
keys.forEach(key -> questEncryptionMap.put(key.getMainQuestId(), key));
|
String path = "QuestEncryptionKeys.json";
|
||||||
|
if (Utils.fileExists(RESOURCE(path))) {
|
||||||
|
keys = JsonUtils.loadToList(RESOURCE(path), QuestEncryptionKey.class);
|
||||||
|
keys.forEach(key -> questEncryptionMap.put(key.getMainQuestId(), key));
|
||||||
|
}
|
||||||
|
if (Utils.fileExists(DATA(path))) {
|
||||||
|
keys = DataLoader.loadList(path, QuestEncryptionKey.class);
|
||||||
|
keys.forEach(key -> questEncryptionMap.put(key.getMainQuestId(), key));
|
||||||
|
}
|
||||||
Grasscutter.getLogger().debug("Loaded {} quest keys.", questEncryptionMap.size());
|
Grasscutter.getLogger().debug("Loaded {} quest keys.", questEncryptionMap.size());
|
||||||
} catch (FileNotFoundException | NullPointerException ignored) {
|
|
||||||
Grasscutter.getLogger().warn("Unable to load quest keys - ./resources/QuestEncryptionKeys.json not found.");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Grasscutter.getLogger().error("Unable to load quest keys.", e);
|
Grasscutter.getLogger().error("Unable to load quest keys.", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user