LuckPerms

LuckPerms

41.4k Downloads

[API] Clearing all InheritanceNodes from a User adds the default group right after

emilyy-dev opened this issue · 1 comments

commented

Description

Clearing all InheritanceNodes 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)

image

Expected behaviour

Would expect it to remove all inheritance nodes with no exceptions.

Environment details

  • Server type/version: Paper running version 1.16.4 build 325
  • 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.

commented

Thanks for the detailed report as always :)