primary_groups column in luckperms_players table has no purpose
lt-eburgess opened this issue ยท 4 comments
Description
Background:
- PostgreSQL 14 Database
- LuckPerms v5.4.58
- Paper version git-Paper-358 (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT) (Git: f26e9cc)
Observed Behaviour:
- Updated the
permissions
column for a specific player in theluckperms_user_permissions
table by changing theirgroup.(groupname)
permission. - Executed
/lp sync
command in server console. - Executing
/lp user (username) info
shows theirMeta: primarygroup=
is the group I assigned them. - Executing
SELECT * FROM luckperms_players;
shows theprimary_group
column as different from what I previously assigned.
I also tried an UPDATE on a user's primary_group
in the luckperms_players
table, and after executing /lp sync
it does not update a players group in game, nor does it update their group.(groupname)
permission in the lp_user_permissions
table.
Proposed Behaviour
If the primary_group
column is to exist, both the luckperms_players.primary_group
column and group.(groupname)
permission in luckperms_user_permissions.permissions
column should have a relation such that when the /lp sync
command is executed, there should be a conflict resolution effort that redefines the luckperms_players.primary_group
for that user.
Example workflow:
/lp sync
detects a difference between thegroup.(groupname)
permission and theluckperms_players.primary_group
column.- Parse the group name from groupname in
group.(groupname)
. - Update
luckperms_players.primarygroup
for the specific player(s).
Extra Details
No response
The column is only used when the primary group calculation method is set to manual, and thus the data needs to be stored. Otherwise, the primary group is calculated at runtime, by default the highest weighted group a user inherits. As this data could be affected by contexts, storing it when the manual system isn't active would result in a ton of writes that serve no useful purpose for LP.
I'm going to assume you're attempting to automatically pull data from LP's database to use elsewhere, in which case I'd highly encourage you to instead hook into our API. The storage implementation is exactly that, implementation, and thus subject to change with no warning.
I understand the getPrimaryGroup()
pulls from the metadata, and that it inherits the highest weighted group a user inherits. What I'm saying is, the primary_group
column in the luckperms_players
table does not have a function pulling the primaryGroup that is used in metadata, thus deeming this column meaningless.
Like _11 said, the column is used when the primary-group-calculation
is set to manual (stored
) (which it isn't by default), that will also make the switchprimarygroup
command "work"; the other two options for that setting disregard the storage entry.
LuckPerms/bukkit/src/main/resources/config.yml
Lines 312 to 323 in 1bfbd27