use of me.lucko.luckperms.api.Node in project LuckPerms by lucko.
the class HolderSubjectData method addParent.
@Override
public CompletableFuture<Boolean> addParent(ImmutableContextSet contexts, LPSubjectReference subject) {
Objects.requireNonNull(contexts, "contexts");
Objects.requireNonNull(subject, "subject");
if (!subject.getCollectionIdentifier().equals(PermissionService.SUBJECTS_GROUP)) {
return CompletableFuture.completedFuture(false);
}
Node node = NodeFactory.buildGroupNode(subject.getSubjectIdentifier()).withExtraContext(contexts).build();
DataMutateResult result = this.type.supply(() -> this.holder.setPermission(node), () -> this.holder.setTransientPermission(node));
if (!result.asBoolean()) {
return CompletableFuture.completedFuture(false);
}
return objectSave(this.holder).thenApply(v -> true);
}
Aggregations