[API] Clearing all InheritanceNodes from a User adds the default group right after
emilyy-dev opened this issue · 1 comments
Description
Clearing all InheritanceNode
s from a User
adds the group.default
right after, adding an extra step (removing group.default
) when simulating the parent set
command through the API.
Reproduction steps
Sample snippet
// onCommand
final User user = this.luckPerms.getPlayerAdapter(Player.class).getUser((Player) sender);
user.data().clear(NodeType.INHERITANCE::matches);
user.data().add(InheritanceNode.builder("first").build());
this.luckPerms.getUserManager().saveUser(user);
Results (ran user info before and after running the command)
Expected behaviour
Would expect it to remove all inheritance nodes with no exceptions.
Environment details
- Server type/version:
Paper
running version1.16.4
build325
- LuckPerms version:
v5.2.61
Any other relevant details
A possible fix would be instead of adding group.default
on the spot, doing it when saving the user, invalidating user cache or traversing/calculating through the inheritance tree (if there are no other inheritance nodes by the time). Just a few ideas that popped right away, I'm sure there are better solutions.