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

分层权限系统

在现在allay的权限系统中,每个玩家只持有一个权限树。在切换模式时我们需要频繁设置一些权限,例如BUILD, MINE, ATTACK-PLAYERS, ATTACK-MOBS等等

假设插件有一个需求,希望玩家在生存模式只能放置方块不能破坏方块。于是插件remove了玩家的MINE权限。但是如果玩家切换到冒险模式又切换回生存模式,玩家的MINE权限就会重新获得

原版有一个概念叫做分层权限,即对于每个游戏模式都有一个与之对应的权限树

在切换模式时只需换到相应模式的权限树即可。设置权限时需要指定设置的是哪个游戏模式的权限树

也许我们可以借鉴一下?

优点

如上所述,插件不需要在每次更改游戏模式时重新设置权限。这会使得插件的编写难度下降以及一些潜在好处

缺点

并不是所有的权限都需要分层,比如说命令/聊天权限

可能的改进办法

  1. 添加几个addPerm/removePerm方法,调用时会同时操作所有游戏模式下的权限树

  2. 添加一个globalPermTree, 分层的权限树继承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