Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: layered perm system #108

Open
smartcmd opened this issue Jan 6, 2024 · 0 comments
Open

proposal: layered perm system #108

smartcmd opened this issue Jan 6, 2024 · 0 comments
Labels
Proposal Some important decisions

Comments

@smartcmd
Copy link
Member

smartcmd commented Jan 6, 2024

Layered Permission System

In the current permission system of Allay, each player only holds one permission tree. When switching modes, we need to frequently set some permissions, such as BUILD, MINE, ATTACK-PLAYERS, ATTACK-MOBS, etc.

Assume the plugin has a requirement that players can only place blocks but not destroy blocks in survival mode. Thus, the plugin removes the player's MINE permission. However, if the player switches to adventure mode and then back to survival mode, the player's MINE permission is restored.

The original version has a concept called layered permissions, meaning that each game mode has a corresponding permission tree.

When switching modes, you only need to switch to the permission tree of the corresponding mode. When setting permissions, you need to specify which game mode's permission tree is being set.

Perhaps we can learn from this?

Advantages

As mentioned above, the plugin does not need to reset permissions every time the game mode changes. This will make writing the plugin easier and have some potential benefits.

Disadvantages

Not all permissions need to be layered, such as command/chat permissions.

Possible Improvements

  1. Add several addPerm/removePerm methods that operate on all game mode permission trees simultaneously when called.

  2. Add a globalPermTree, with the layered permission trees inheriting from the globalPermTree.

@smartcmd smartcmd added the Proposal Some important decisions label Jan 6, 2024
@smartcmd smartcmd changed the title proposal: layered perm system? proposal: layered perm system Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Some important decisions
Projects
None yet
Development

No branches or pull requests

1 participant