LuckPerms

LuckPerms

41.4k Downloads

Attempt to parse RGB color in LP commands

pop4959 opened this issue ยท 7 comments

commented

Currently, LP passes prefix and suffix information through Vault without processing it. This is good, because it is best left to the chat plugin to do this.

However, for a better experience using LP, I think it would be nice if it can parse RGB colors in its commands. For example, the info command (e.g. /lp user <user> info) and setprefix command (e.g. /lp user <user> meta setprefix <weight> <prefix>) currently do parse basic color and formatting codes 0-9, a-f, l-o, r, but not RGB. This can be confusing in MC 1.16+, since users might think their RGB codes are not working (in fact, LP support often points to the info command to show if LP is doing "its part" correctly, and otherwise it's the chat plugin's fault).

I can see arguments against this because of the way that the way RGB codes are formatted may not be standardized across chat plugins -- however, I don't think this would be a good reason to drop this issue. In fact, regular color codes are technically not standardized, because plugins are allowed to use any character, although almost all support '&'. LP uses this assumption as well ('&' works, but if I type '%', it doesn't, even though a chat plugin could technically use it).

Popular chat plugins (namely EssentialsXChat) are currently adopting the format &#RRGGBB for RGB color codes. I admittedly may have some bias here, but I think this would be a good format for LP to try to recognize, and further establish some standard. If LP is not willing to commit quite yet fully to adopting something like this, I would suggest adding configuration to the plugin to allow users to set what format to attempt to interpret.

I think that's about all. Thanks for taking the time to entertain my feature request. I just want to be able to see a preview of my prefix in LP. ๐Ÿ˜‚

commented

I'd like to point out that most platforms themselves offer parsing the color codes with &. It's built in and I believe as soon as those platforms adopted it in their libraries is the point where LP should do the same. Up until that point it's just a speculation as to which format wil prevail and a hasty implementation will just bring more issues than it will solve.

commented

Good point, I just wanted to point out the potential improvements to user experience. I would have made a PR but I'm not all too familiar with LP's code, and I believe that Luck probably has a better idea of how to implement this idea properly across platforms. To be clear, I was referring to the Bukkit implementation, which does have a de facto standard '&' code, but allows plugins to do whatever they want.

commented

Sure. There just needs to be an accepted standard before I think it makes sense to implement it into LP because else it's just gonna create confusion.

commented

I agree that there's no need to rush with it, but Luck can probably take the time to evaluate how he plans to support it, if he plans to do anything at all.

commented

I will probably opt to support &#rrggbb (format used by adventure) and &x&r&r&g&g&b&b (the nonsense used by BungeeCord/Spigot)

This is pending the adventure release, which hopefully will come in the next few days.

However, to be clear, this will only be for rendering in LuckPerms command outputs. Fundamentally, if you set a prefix to be "&#ffffffAdmin" - that's exactly what LP will pass on via Vault or whatever - the chat plugin will still need to support that format.

commented

Yup, that seems to be the format that the community intends to adopt, and EssentialsXChat was just pretty quick about implementing it. It does make a lot of sense over the nonsense that Spigot uses (especially for users to type).

commented

This was added in 4811129