mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 10:51:47 +00:00
cache fetters
This commit is contained in:
parent
376c668dd9
commit
123fc263ba
@ -58,6 +58,9 @@ public class GenshinData {
|
||||
private static final Int2ObjectMap<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// Cache
|
||||
private static Map<Integer, List<Integer>> fetters = new HashMap<>();
|
||||
|
||||
public static Int2ObjectMap<?> getMapByResourceDef(Class<?> resourceDefinition) {
|
||||
Int2ObjectMap<?> map = null;
|
||||
|
||||
@ -226,14 +229,15 @@ public class GenshinData {
|
||||
}
|
||||
|
||||
public static Map<Integer, List<Integer>> getFetterDataEntries() {
|
||||
// Can I do this?
|
||||
Map<Integer, List<Integer>> fetters = new HashMap<>();
|
||||
fetterDataMap.forEach((k, v) -> {
|
||||
if (!fetters.containsKey(v.getAvatarId())) {
|
||||
fetters.put(v.getAvatarId(), new ArrayList<>());
|
||||
}
|
||||
fetters.get(v.getAvatarId()).add(k);
|
||||
});
|
||||
if (fetters.isEmpty()) {
|
||||
fetterDataMap.forEach((k, v) -> {
|
||||
if (!fetters.containsKey(v.getAvatarId())) {
|
||||
fetters.put(v.getAvatarId(), new ArrayList<>());
|
||||
}
|
||||
fetters.get(v.getAvatarId()).add(k);
|
||||
});
|
||||
}
|
||||
|
||||
return fetters;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user