use of me.lucko.luckperms.api.context.MutableContextSet in project LuckPerms by lucko.
the class ContextSetConfigurateSerializer method deserializeContextSet.
public static ContextSet deserializeContextSet(ConfigurationNode data) {
Preconditions.checkArgument(data.hasMapChildren());
Map<Object, ? extends ConfigurationNode> dataMap = data.getChildrenMap();
if (dataMap.isEmpty()) {
return ContextSet.empty();
}
MutableContextSet map = MutableContextSet.create();
for (Map.Entry<Object, ? extends ConfigurationNode> e : dataMap.entrySet()) {
String k = e.getKey().toString();
ConfigurationNode v = e.getValue();
if (v.hasListChildren()) {
List<? extends ConfigurationNode> values = v.getChildrenList();
for (ConfigurationNode value : values) {
map.add(k, value.getString());
}
} else {
map.add(k, v.getString());
}
}
return map;
}
Aggregations