Search in sources :

Example 6 with InheritanceNode

use of net.luckperms.api.node.types.InheritanceNode in project AuthMeReloaded by AuthMe.

the class LuckPermsHandler method removeFromGroup.

@Override
public boolean removeFromGroup(OfflinePlayer player, UserGroup group) {
    String playerName = player.getName();
    if (playerName == null) {
        return false;
    }
    User user = luckPerms.getUserManager().getUser(playerName);
    if (user == null) {
        logger.warning("LuckPermsHandler: tried to remove group for offline user " + player.getName() + " but it isn't loaded!");
        return false;
    }
    InheritanceNode groupNode = InheritanceNode.builder(group.getGroupName()).build();
    boolean result = user.data().remove(groupNode) != DataMutateResult.FAIL;
    luckPerms.getUserManager().saveUser(user);
    return result;
}
Also used : User(net.luckperms.api.model.user.User) InheritanceNode(net.luckperms.api.node.types.InheritanceNode)

Aggregations

InheritanceNode (net.luckperms.api.node.types.InheritanceNode)6 User (net.luckperms.api.model.user.User)5 DataMutateResult (net.luckperms.api.model.data.DataMutateResult)3 UserGroup (fr.xephi.authme.data.limbo.UserGroup)2 ContextSetFactory (net.luckperms.api.context.ContextSetFactory)2 Group (net.luckperms.api.model.group.Group)2 NotNull (org.jetbrains.annotations.NotNull)2 ConsoleLogger (fr.xephi.authme.ConsoleLogger)1 ConsoleLoggerFactory (fr.xephi.authme.output.ConsoleLoggerFactory)1 PermissionNode (fr.xephi.authme.permission.PermissionNode)1 PermissionsSystemType (fr.xephi.authme.permission.PermissionsSystemType)1 Collections (java.util.Collections)1 List (java.util.List)1 Objects (java.util.Objects)1 UUID (java.util.UUID)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeUnit (java.util.concurrent.TimeUnit)1 TimeoutException (java.util.concurrent.TimeoutException)1 Collectors (java.util.stream.Collectors)1 LuckPerms (net.luckperms.api.LuckPerms)1