use of me.lucko.luckperms.api.DataMutateResult in project LuckPerms by lucko.
the class HolderSubjectData method removeParent.
@Override
public CompletableFuture<Boolean> removeParent(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.unsetPermission(node), () -> this.holder.unsetTransientPermission(node));
if (!result.asBoolean()) {
return CompletableFuture.completedFuture(false);
}
return objectSave(this.holder).thenApply(v -> true);
}
use of me.lucko.luckperms.api.DataMutateResult 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