LuckPerms

LuckPerms

905k Downloads

getCachedData() on Forge/NeoForge can cause the player to break when they die

hypherionmc opened this issue ยท 0 comments

commented

Description

When using this code from your wiki

public boolean hasPermission(User user, String permission) {
    return user.getCachedData().getPermissionData().checkPermission(permission).asBoolean();
}

getCachedData() can fail due to a missing capability and break the player completely, similar to #3830, #3471 and #3584.

A user reported this issue in 1.20.1, and I can confirm the issue. In this case it specifically happens when Curios is installed. I suspect this issue would be present in newer versions as well, but I did not test it.

We use the above code to control some command permissions, but if there is a better way of doing it that won't cause this issue, that would work too.

Reproduction Steps

  1. Set up a server with Forge 1.20.1 and LuckPerms
  2. Install CraterLib, Simple Discord Link (No need to configure either, it's enough to just install them) and Curios
  3. Die. When you respawn, you will be unable to do anything, and find the message in your log

Expected Behaviour

I would expect LuckPerms to return the cached data, but log an error, or, log and error and return the previous cached data.

Server Details

Forge 1.20.1 47.3.12

LuckPerms Version

5.4.102

Logs and Configs

https://pastebin.com/4wsRNRYF (From original reporter)

Extra Details

No response