LuckPerms

LuckPerms

41.4k Downloads

PermissionCheckEvent | Ability to Change the permission before checking it

ohAleee opened this issue ยท 4 comments

commented

Description

Ability to Change the permission before checking it

Proposed behaviour

It would be useful for some developers to be able to change the permission before checking it. This way a permit containing for example quantities would be easier to develop:

token.

A plugin can request to check the number of tokens needed for a certain action and with this method, it would be super simple to go and change the permission in order to check the number of tokens in this case.

Example:

a token plugin changes when permission is checked:

token.has. -> token.has.10 (number of real tokens)

otherwise you will need to set a permission for each change in the token quantity

commented

Use transitive permissions.

Those are non persistent permissions that take precedence over normal permissions. Intended for exactly that. A permission check event would completely kill performance.

commented

A token storage system doesn't really fit well with permission checks. Permission checks return a boolean (true/false) value - not ints, strings or anything else.

If anything, using MetaNodes would be better, however, for that to work well, LuckPerms would need to be the source of truth for token balances. It wouldn't make sense to have another plugin be able to alter the lookup results, based on some other stored value.

If another system needs to be the source of truth on token balances, then it makes no sense to integrate with permissions/LuckPerms.

commented

I am aware that it sucks to use permissions to manage this but it is the only way to integrate it with another plugin (not made by me and therefore I cannot change in a short time)

commented

Fair enough, but I'm afraid it's not something we want to encourage or accommodate in LuckPerms itself.