LuckPerms

LuckPerms

41.4k Downloads

[Bulk] Updating a context with 2 contexts

msmanui opened this issue ยท 4 comments

commented

Description

Hello there!

Basically, the idea is being able to update a current context with two context. Example:

All my VIPS are in the server=survival, so i want to to add them in the server lobby.

Before: vip server=survival
After bulk: vip server=survival server=lobby

Proposed Behaviour

Already described.

Extra Details

No response

commented

Unfortunately, the bulk system is by design restricted to only changing/removing already existent data - it cannot add anything, even if it's also changing something in the process. This is in part because of the complexity required to make a single command add things in bulk, but also by design.

The intent is that you should be abstracting things away to groups in order to apply large changes instead of adding things to large bunches of people 'piecemeal', which basically nullifies the purpose of groups and can have negative impacts on the plugin's internal logic. For example, you could be adding a group to players with those contexts and need to add yet another context - adding that to every player is time consuming. Instead, you can make a new group and add it as a parent of the initial group with the contexts and permission you need, and then remove the context restrictions on the original group. This effectively allows grouping contexts.

commented

can make a new group and add it as a parent of the initial group with the contexts and permission you need, and the

I dont understand :/. How that would give users the context server=bungee. I can add a parent groups to the group vip but that doesnt trigger the server=bungee to the vips because they dont have that context
Maybe you could give me an example with commands?
Thanks in advance

commented

You can add groups as parent groups of other groups. When you do this, you can set contexts for when the parent groups apply as parents of other groups. For example, you could set a group survivalperms as a parent of group default with context server=survival, and that parent group will only apply when a player is in a server called survival.

I really also recommend setting this up using the editor (run /lp editor and click the link. Also be sure to read the wiki page on how to use it properly) rather than commands. It's way easier to visualize.

Here's an example:

Say you have a group, survival, applied to certain people with the context server=survival. You want to add the context server=creative to the certain people who have it added to them with the context server=survival.

  1. Rename survival to survivalandcreative and create a new group called survival. Add survivalandcreative as a parent group of survival with contexts server=survival and server=creative.
  2. You have two options:
    a) Add survival as a parent group of default (if you want this change to apply to everyone, this is the option for you)
    b) Use bulkupdate to remove the context server=survival for everyone that has group survival. (if you want this to apply to only the people who already had group survival, this is the option for you) You can probably achieve this with /lp bulkupdate users update permission group.survival "permission == group.survival" "server == global" but make sure to create a backup and test - I'm not certain that's a perfect command.
commented

And there is no way to update via any MariaDB command? To add a context to certain users?