How LuckPerms "predicts" permissions

This is not an issue, only something I was investigating for fun

I've been curious about how LuckPerms manages to "predict" permissions the server has available.
I made a very small single-file plugin to see this feature in action with just a single Permissible.hasPermission(String) function at the start of a command.
Apparently before trying to execute the command, luckperms is not yet aware of this permission, however after trying it once and opening the editor, it does show as a possible permission to choose.
This suggest that they might be caching permissions when Permissible.hasPermission(String) or similar functions are executed, however in their repo there isn't a clear reference to a cache on hasPermission, only on addPermission.

I've been reading their repo for a while now, and learned a lot of how the plugin works but so far, no reference as how they resolve those permissions, closest I could find is AsyncPermissionRegistry but there's nothing suggesting a possible cache.

This post is mostly for curiosity, if anyone had the same question and managed to find an answer before me.

This is the example plugin I made to test this:
class CrappyPlugin : JavaPlugin() {

    lateinit var self: CrappyPlugin

    override fun onLoad() {
        this.self = this
    }

    override fun onEnable() {
        this.server.commandMap.register("example", object : Command("canexecute"), PluginIdentifiableCommand {
            override fun execute(
                sender: CommandSender,
                label: String,
                args: Array<out String>?
            ): Boolean {
                if (sender.hasPermission("example.canexecute.test")) {
                    sender.sendMessage("Yes, you can execute")
                    return true
                }
                sender.sendMessage("No, you can't execute")
                return false
            }

            override fun getPlugin() = self

        })
    }

}
image.png
Solution
I tried that and it lead me to AsyncPermissionRegistry
Was this page helpful?