use of org.lanternpowered.server.advancement.criteria.LanternScoreCriterion in project LanternServer by LanternPowered.
the class LanternPlayerAdvancements method createCriteria.
static Tuple<List<AdvancementCriterion>, String[][]> createCriteria(AdvancementCriterion criterion) {
final List<AdvancementCriterion> criteria = new ArrayList<>();
final List<String[]> names = new ArrayList<>();
if (criterion instanceof AndCriterion) {
for (AdvancementCriterion child : ((AndCriterion) criterion).getCriteria()) {
if (child instanceof LanternScoreCriterion) {
for (String id : ((LanternScoreCriterion) child).getIds()) {
names.add(new String[] { id });
}
} else {
names.add(new String[] { child.getName() });
}
criteria.add(child);
}
} else {
if (criterion instanceof LanternScoreCriterion) {
for (String id : ((LanternScoreCriterion) criterion).getIds()) {
names.add(new String[] { id });
}
} else {
names.add(new String[] { criterion.getName() });
}
criteria.add(criterion);
}
return new Tuple<>(criteria, names.toArray(new String[names.size()][]));
}
Aggregations