Search in sources :

Example 56 with Node

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);
}
Also used : Node(me.lucko.luckperms.api.Node) DataMutateResult(me.lucko.luckperms.api.DataMutateResult)

Aggregations

Node (me.lucko.luckperms.api.Node)56 LocalizedNode (me.lucko.luckperms.api.LocalizedNode)15 Group (me.lucko.luckperms.common.model.Group)15 User (me.lucko.luckperms.common.model.User)13 Map (java.util.Map)12 ImmutableLocalizedNode (me.lucko.luckperms.common.node.ImmutableLocalizedNode)12 List (java.util.List)11 NodeFactory (me.lucko.luckperms.common.node.NodeFactory)10 Message (me.lucko.luckperms.common.locale.message.Message)9 LuckPermsPlugin (me.lucko.luckperms.common.plugin.LuckPermsPlugin)9 Sender (me.lucko.luckperms.common.sender.Sender)9 Collectors (java.util.stream.Collectors)8 MutableContextSet (me.lucko.luckperms.api.context.MutableContextSet)8 CommandResult (me.lucko.luckperms.common.command.CommandResult)8 CommandPermission (me.lucko.luckperms.common.command.access.CommandPermission)8 LocaleManager (me.lucko.luckperms.common.locale.LocaleManager)8 CommandSpec (me.lucko.luckperms.common.locale.command.CommandSpec)8 Predicates (me.lucko.luckperms.common.utils.Predicates)8 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7