LuckPerms

LuckPerms

41.4k Downloads

Specifying the same format twice (or more) should apply the second best match

BrainStone opened this issue ยท 2 comments

commented

So in the prefix/suffix stacking section you can select several different formats that will end up building the combined prefix. I think it would be very useful that if you specify the same format twice that instead of adding the same prefix/suffix twice the second adds the next best.

So if you specify this:

meta-formatting:
  prefix:
    format:
      - "highest"
      - "highest"

You get the two highest prefixes, not the highest twice.

This should of course work for any amount of repetitions.
If there isn't a next best it should just behave the same way as if it can't find a matching prefix/suffix, like it does with the more restricted ones.

commented

I like it! As usual it should probably be locked behind some default-true config option (next-highest-match?) in case somebody out there needs their duplicates really badly and wants to revert it, but tbh it's a pretty neat addition request.

Thinking about this, it would also be nice to have a way to just show the second highest. Perhaps there is a way to toggle an option to be hidden in the final display, but factored into the calculation. For example, prefixing it with a !:

meta-formatting:
  prefix:
    format:
      - "!highest"
      - "highest"

would just show the second highest, for example.

commented

I was thinking about allowing any index with a syntax like that:

meta-formatting:
  prefix:
    format:
      - "highest[3]"
      - "highest[1]"

Now I'm not sure if this should be 0 or 1 indexed but I think you get the gist. That also covers your edge case.
And if there's no index specified it gets determined automatically.