You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Add several addPerm/removePerm methods that operate on all game mode permission trees simultaneously when called.
Add a globalPermTree, with the layered permission trees inheriting from the globalPermTree.
The text was updated successfully, but these errors were encountered:
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'sMINE
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
Add several
addPerm
/removePerm
methods that operate on all game mode permission trees simultaneously when called.Add a
globalPermTree
, with the layered permission trees inheriting from theglobalPermTree
.The text was updated successfully, but these errors were encountered: