use of me.lucko.luckperms.common.calculators.PermissionCalculatorMetadata in project LuckPerms by lucko.
the class AbstractCachedData method calculatePermissions.
/**
* Calculates a {@link PermissionCache} instance.
*
* @param contexts the contexts to calculate in
* @param data an old data instance to try to reuse - ignored if null
* @return the calculated instance
*/
private PermissionCache calculatePermissions(Contexts contexts, PermissionCache data) {
Objects.requireNonNull(contexts, "contexts");
if (data == null) {
PermissionCalculatorMetadata metadata = getMetadataForContexts(contexts);
data = new PermissionCache(contexts, metadata, getCalculatorFactory());
}
if (contexts == Contexts.allowAll()) {
data.setPermissions(resolvePermissions());
} else {
data.setPermissions(resolvePermissions(contexts));
}
return data;
}
Aggregations