mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 13:01:03 +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<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<FetterData> fetterDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
|
// Cache
|
||||||
|
private static Map<Integer, List<Integer>> fetters = new HashMap<>();
|
||||||
|
|
||||||
public static Int2ObjectMap<?> getMapByResourceDef(Class<?> resourceDefinition) {
|
public static Int2ObjectMap<?> getMapByResourceDef(Class<?> resourceDefinition) {
|
||||||
Int2ObjectMap<?> map = null;
|
Int2ObjectMap<?> map = null;
|
||||||
|
|
||||||
@ -226,14 +229,15 @@ public class GenshinData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Integer, List<Integer>> getFetterDataEntries() {
|
public static Map<Integer, List<Integer>> getFetterDataEntries() {
|
||||||
// Can I do this?
|
if (fetters.isEmpty()) {
|
||||||
Map<Integer, List<Integer>> fetters = new HashMap<>();
|
fetterDataMap.forEach((k, v) -> {
|
||||||
fetterDataMap.forEach((k, v) -> {
|
if (!fetters.containsKey(v.getAvatarId())) {
|
||||||
if (!fetters.containsKey(v.getAvatarId())) {
|
fetters.put(v.getAvatarId(), new ArrayList<>());
|
||||||
fetters.put(v.getAvatarId(), new ArrayList<>());
|
}
|
||||||
}
|
fetters.get(v.getAvatarId()).add(k);
|
||||||
fetters.get(v.getAvatarId()).add(k);
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
return fetters;
|
return fetters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user