LuckPerms

LuckPerms

41.4k Downloads

Incorrect prefixes shown multiple tracks

jortvanleenen opened this issue · 6 comments

commented

Description

I seem to be running into a bug related to multiple tracks and prefix stacking. I have got three tracks set up: donateur (donator track), staff (staff track) and general (server specific ranks, similar to the 'mine' prefixes of a prison server). When I promote myself using '/lp user promote staff', for example, I correctly get set to the first (from default) on the track, which would be builder in this case. This somehow messes up my prefixes, as I get shown the highest prefix of the general track, the builder staff prefix and the highest prefix of the donateur track. I suppose this has something to do with builder being technically above the highest ranks in those tracks, but I have set LuckPerms up to stack prefixes using highest_on_track_ and the builder rank is not on either of the tracks and I should not be as well, so shouldn't they be silently ignored?

Reproduction steps

I feel like the easiest option would be to make use of the same chat formatting plugin and configuration, LP prefix options (for both, see the 'any other relevant details' section) and lp editor (https://luckperms.net/editor/LNE6TQKVJN).

OR

(I have done the steps below in the following editor: https://luckperms.net/editor/3cp79MJZME)

  1. Create three groups like: group1 (weight: 50, prefix: group1), group2 (weight 100, parent: group1, prefix: group1) and group3 (weight: 150, parent: group2, prefix: group3).
  2. Create three tracks and set them up like this: track1: default -> group1, track2: default -> group2 and track3: default -> group3.
  3. Go to the LP config.yml and set the prefix formatting to (make use of chosen track names):
    format:
    • "highest_on_track_track1"
    • "highest_on_track_track2"
    • "highest_on_track_track3"
      duplicates: first-only
      start-spacer: ""
      middle-spacer: " "
      end-spacer: " "
  4. Reload LP config using /lp reloadconfig
  5. Run /lp user promote track3
  6. Type something in the game.
  7. See that this will result in the prefixes showing up of group 1 and 2 as well, instead of just group 3.

Expected behaviour

[Onbekend] shows up from the general track, followed by [Builder] from the staff track and the donateur track is silently ignored as the duplicate setting is set to first-only (otherwise it would be [Onbekend] again from the default rank).

OR

The prefix of group1 should show up, the prefix of group2 should not show up (duplicate setting is set to first-only) and the prefix of group3 should be shown. For more information see the other expected behaviour explanation.

Environment details

*Chat formatting: EssentialsX Chat 2.19.0-dev+115-071f995
*Proxy type/version: Velocity 1.1.5

  • Server type/version: Purpur (Spigot fork) build 0190 running version 1.16.5 (2x)
  • LuckPerms version: v5.3.39

Any other relevant details

My EssentialsX Chat name format is set to {DISPLAYNAME}.
My LP prefix format is set to:
prefix:
format:
- "highest_on_track_general"
- "highest_on_track_staff"
- "highest_on_track_donateur"
duplicates: first-only
start-spacer: ""
middle-spacer: " "
end-spacer: " "

These screenshots show my prefix with the default rank, as if the user just joined for the first time and the tracks I currently have.
Screenshot (184)
Screenshot (185)
These screenshots show my prefix after using /lp user jortpepe promote staff (making me a builder) and the track I currently have.
Screenshot (186)
Screenshot (187)

commented

Hi Laarryy,
As it took quite some time to get a response from LP, I have changed my permission configuration to something that does work regarding tracks, but it requires me to duplicate all permissions I grant my highest rank on track1 to my lowest on track2, as they must not inherit from each other. I remember the issue probably being as follows: track2 consisted of my staff ranks. I wanted the lowest staff rank to inherit all permissions of the highest player rank (track1). Therefore e.g. lowest-staff-rank inherited perms from highest-player-rank. This lead to the prefixes also getting inherited by the lowest-staff-rank, probably messing up the track-based prefix formatting. I remember trying to block the prefixes from getting inherited using e.g. -prefix permissions etc. but nothing would work.

As I am no longer running the exact config as mentioned in the above post, I believe it would be the easiest for you to copy the second part in the 'Reproduction Steps'-section and run it yourself. As I mentioned, I probably know what lead to the issues, so if you have a solution to that problem it would be really helpful as well. As I currently have to duplicate all permissions of my highest-player-rank to my lowest-staff-rank as inheriting it would mess up the prefixes as mentioned earlier!

commented

Hi - thank you so much for the detailed issue. Could you please send a screenshot also of lp user <name> meta info? If you're still able to reproduce on the latest version of LuckPerms from https://luckperms.net that is!

commented

I wanted the lowest staff rank to inherit all permissions of the highest player rank (track1). Therefore e.g. lowest-staff-rank inherited perms from highest-player-rank. This lead to the prefixes also getting inherited by the lowest-staff-rank, probably messing up the track-based prefix formatting.

Ah! Yes, this is what would have caused that. If a group inherits the prefix from another group, it will pass it on. This is intended LP behaviour. I'm not sure what we could even do to modify this on LP's end without completely changing how the system works.

It might be feasible to include a setting that enables a check in the code, a check to only count prefixes which are directly inherited from the groups on the track itself, and not from their parent groups. I don't know if it actually is a good idea, but I'll ask Luck.

As you mentioned, you tried -prefix permissions. Those are for PEX! Have you tried setting the prefix nodes themselves to false? I can't test this whole system at the moment, but perhaps that would work if it isn't something you've already tried!

commented

As noted above, @lucko has fixed it - negating the prefix on the group that's in the track will now stop it from being inherited, which fixes your problem!

Thanks again for the detailed report, sorry for the long time, and hope this helps!

commented

Glad to hear we could confirm the cause of my issue! And indeed, as I also expected, it's probably unavoidable default LP behaviour as you mentioned as well. Some sort of config setting for these kinds of use-cases sounds very helpful to me, but indeed perhaps LP currently offers something I do not know off that would help me avoid permission duplication for the two ranks. Looking forward to Lucks reply.

Regarding the '-prefix'-permission, I did try the LP way by using the web-based editor and setting the prefix to false, accidentally used PEX terms as I was kind of typing from memory haha! I was just getting back into server owning when posting this issue and was still used to the days without LP, where simply everyone still used PEX, me included.

commented

Wow, that's some timing, just received your comment. Great to hear, thank you for the help and no worries!