LuckPerms

LuckPerms

1M Downloads

NullPointerException when getting meta of offline player in Fabric 1.21.1+

Closed this issue ยท 5 comments

commented

Description

Whenever I try to get a metadata from an offline player with no matter GameProfile or UUID, it just left me a NullPointerException.

Reproduction Steps

// source instanceof CommandSourceStack && source.isPlayer()
Options.get(source.getPlayer().getGameProfile(), "foo").join()

Result:

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "java.util.Optional.isPresent()" because "value" is null

Expected Behaviour

Return me anything but a null. :(

Server Details

Fabric 0.16.14 (MC 1.21.6)

LuckPerms Version

v5.5.8

Logs and Configs

I am working on this PR.

 java.lang.NullPointerException: null
        at java.base/java.util.concurrent.CompletableFuture.andTree(Unknown Source) ~[?:?]
        at java.base/java.util.concurrent.CompletableFuture.allOf(Unknown Source) ~[?:?]
        at knot/me.drex.vanillapermissions.util.ArgumentPermission.check(ArgumentPermission.java:80) ~[main/:?]

Extra Details

This glitch seems exist from at least MC 1.21.1?

commented

are you actually loading the user? you must load the user first

commented

are you actually loading the user? you must load the user first

@BNTFryingPan Excuse me, I don't actually know what is loading a user. I didn't find any introductions in fabirc-permission-api

Being tested:

Permissions.check(source.getPlayer().getGameProfile(), "foo").join(); // Success
Options.get(source.getPlayer(), "foo").join(); // Success
Options.get(source.getPlayer().getGameProfile(), "foo").join(); // NullPointerException
commented

you must use the LP api directly if you want to get data about offline players

commented

@BNTFryingPan
May I ask why? It seems that getting data from offline player with farbic permission api has already been implemented. It just not works.

commented

Okay, I see. This is caused by an unexpected null in farbic permission api.

Thank you for your help anyway. I'll later fix it.