Merge fix

This commit is contained in:
Oleg Agafonov 2020-08-22 19:21:25 +04:00
parent 1b430e5d99
commit 4e174e25be
2 changed files with 25 additions and 7 deletions

View file

@ -26,7 +26,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
return instance;
}
private Set<String> customSets = new HashSet<>();
private final Set<String> customSets = new HashSet<>();
private Sets() {
List<String> packages = new ArrayList<>();
@ -199,4 +199,21 @@ public class Sets extends HashMap<String, ExpansionSet> {
return null;
}
public static ExpansionSet.SetCardInfo findCardByClass(Class<?> clazz, String preferedSetCode) {
ExpansionSet.SetCardInfo info = null;
if (instance.containsKey(preferedSetCode)) {
info = instance.get(preferedSetCode).findCardInfoByClass(clazz).stream().findFirst().orElse(null);
}
if (info == null) {
for (Map.Entry<String, ExpansionSet> entry : instance.entrySet()) {
info = entry.getValue().findCardInfoByClass(clazz).stream().findFirst().orElse(null);
if (info != null) {
break;
}
}
}
return info;
}
}