LuckPerms

LuckPerms

41.4k Downloads

Unable to access user options before players log on

bloodmc opened this issue ยท 1 comments

commented

GP needs to access player option data after the server starts in order to properly run certain claim tasks. After server starts up, If I attempt to access a user subject that has NOT logged on yet, I always get null data.

I tested with a user that has a UUID of de86e572-d957-3b2d-8706-5c55a1dd406b

Code being tested

Subject playerSubject = GriefPrevention.instance.permissionService.getUserSubjects().get(playerUniqueId.toString());
String optionValue = playerSubject.getOption(key).orElse(null);

The above code returns the following

BEFORE login
[01:15:12] [Server thread/INFO] [STDOUT]: [me.ryanhamshire.griefprevention.util.PlayerUtils:getOptionIntValue:117]: subj = de86e572-d957-3b2d-8706-5c55a1dd406b, key = griefprevention.create-claim-limit, optionValue = null

AFTER login
[01:16:32] [Server thread/INFO] [STDOUT]: [me.ryanhamshire.griefprevention.util.PlayerUtils:getOptionIntValue:117]: subj = de86e572-d957-3b2d-8706-5c55a1dd406b, key = griefprevention.create-claim-limit, optionValue = 1

As you can see above, LP doesn't seem to load the user data unless the player logs in.

Issue seems to be in the get method

https://github.com/lucko/LuckPerms/blob/master/sponge/src/main/java/me/lucko/luckperms/sponge/service/collections/UserCollection.java#L98

I see no LP logs stating the user is being loaded from storage.

commented

Fixed by d958912