LuckPerms

LuckPerms

41.4k Downloads

Config Option that Will Give Vault API’s Permission#getGroups Groups Instead of Display Names

demengc opened this issue · 19 comments

commented

When using Vault API's Permission#getGroups() method, LuckPerms will return a list of rank display names when the method is clearly getGroups (it should return group names instead). This issue is causing several functions in my plugin to malfunction. It simply doesn't make sense to return display names.

Example Code:

for(String group : i.getPermissions().getGroups()) {
  System.out.println(group);
}
commented

I'd like to note that I am not speaking on behalf of Luck, and with way too little knowledge of the specifics of this, but to the best of my understanding, Luckperms is designed to return displaynames rather than group names to vault. This is so that any other plugin that uses vault to get/use group names is able to display the group's displayname. This is important especially when a player wants their group names to be capitalized through another plugin. As Luckperms stores all groups as lowercase, the way to get a capital letter in the beginning of a group (or any number of capital letters) is to set the displayname the way you want it, so that Vault will read it the way you want it, and will not show the 'ugly' group name. If there is no displayname set, Vault just gets the group's actual name, to the best of my knowledge.

Luck, if I'm wrong feel free to correct me of course, this is simply the way I've known it to work :)

commented

SO annoying. Please fix this.

commented

Fix ASAP, thank you !

commented

This is not a bug but a intentional behaviour.
LuckPerms has a setdisplaynam command to set a displayname.
This displayname is used for Vault, to f.e. display Member instead of default.
So it's an intentional behaviour and not a bug.
If you want the actual name of the group, use the LuckPerms API.

commented

I’d also like to know where the issues are.
And keep in mind that the displayname is not intended to contain formatting. That’s what prefixes are for.

commented

Like I said, the method is getGroups so it should return groups. We should have to use the LuckPerms API for display names, not groups.

commented

Like I said, the method is getGroups so it should return groups. We should have to use the LuckPerms API for display names, not groups.

And Like I said is this intended behaviour.
You're retrieving the group through the Vault API, which retrieves it from LP. And LP gives Vault the display name, rather than the group (internal) name.
This is because there are many people who f.e. want to just display the group name in a scoreboard, but don't want the default group to show as default, so they can set a display name to f.e. Member and it will display as Member in the scoreboard.

Display names are (more or less) just for those cases and for Vault (and every plugin using it) specifically.

commented

I realize it’s intended however it doesn’t make any sense, because, again, the method is getGROUPS, not getDISPLAYNAMES or something. Yes there are some plugins that may want display names but there are also plugins that want group names. And I can’t see why somebody would use getGroups for a scoreboard?

commented

My bad- the command works just fine with the display name, however my validation checks are getting thrown off because users input the rank's group names, and I match them up against display names.
This isn't a major issue and I'll just disable this check for LP.
Thanks all!
image

commented

Two things here:

  • Why are you using commands in the first place? If you do that you don't need to bother finding the right commands for the permissions plugins.
  • Just make clear that for LP they need to put the display names in the config

I quite frankly don't see the issue.

You're having issues that don't exist and worst of all you had been playing the blame game with them.

commented

Four things here:

  • Because I want to also be able to run other commands, such as a broadcast command or a pay command, when they get granted a rank. Additionally, I have placeholders such as %next-best-group% which returns the name of the next best group they have been granted, etc. etc.. Plugins like PermissionsEX do weird things with per-world permissions when I use Vault to give them a rank, GroupManager sometimes just completely breaks, some plugins don't have group setting and only group adding/remove, etc., so commands is the best way to go about this, and this has been proven by people who use my plugins.
  • That doesn't make sense and I won't be doing that.
  • This is a suggestion/question, not an issue.
  • I'm doing what now?

I literally marked this as Closed and you're still replying when you clearly aren't understanding and worst of all you are playing a blame game with me.

I won't be wasting my time on this anymore, thank you to every who have helped and contributed.

commented

People often want to display the group name (not the prefix/suffix) somewhere like on a tab list or the scoreboard.
But displaying default or mod isn't that appealing to many, which is why the display name command exists.
The command description on the wiki descripes it a bit:

Sets the groups display name. This can effectively be used as an "alias" for the group.

Displaying "Member" instead of default or "Mod" instead of mod is something many want.
You three are the only one out of the thousands of people so far, that want this.
And when Luck would change it to what you want, then this would break the setup of hundreds if not thousand of people out there. You have to consider this too.

The best solution here would probably be a config option to disable the usage of display name in Vault.

commented

Apologies for the mistyped titles :D
I’ve changed this to a suggestion for a configuration option as @Andre601 mentioned.

commented

Keep in mind Vault only has the concepts of groups. Not displaynames. So are argument regarding “it’s called getGROUPS and not getDISPLAYNAMES” is null and void.
Display names were introduced to for the exact same you complain about. Essentially their only purpose is to change the group name for external APIs.
You asked for plugins having to use the LP API to get the display name but again that defeats the entire purpose of display names. As they are the only way for plugins not wanting to use the LP API (like plugins using Vault) to retrieve capitalized names.

I’ve asked before but you haven’t answered it: What’s the issue in the first place with Vault giving you the display names instead of the internal group names?

commented

I own the plugin GrantX which contains an import command that allows you to automatically import your permissions plugins ranks into the GUI.
The import command works for all permissions plugins except for LuckPerms because the /lp user parent set will try to set the parent to the display name which doesn’t exist

commented

Then use the API. I don’t understand your issue.
Alternatively use Vault to modify the groups. Then you don’t need to run any commands.

commented

Because it’s much easier using Vault than using a whole new API because 1 method I not returning what I am wanting? I don’t understand how you don’t understand the issue.
I switched from using the API to set groups long time ago for several reasons.

Keep in mind that my plugin supports all Vault-compatible permissions plugin and not only LuckPerms.

Since you guys mentioned other plugins may want display names and apparently we are the only 3 out of thousands of people who are wanting something like that, I’ve changed this from an issue to a suggestion for a toggleable config option.

commented

The import command works for all permissions plugins except for LuckPerms because the /lp user parent set will try to set the parent to the display name which doesn’t exist

Working fine for me...

commented

Because it’s much easier using Vault than using a whole new API because 1 method I not returning what I am wanting? I don’t understand how you don’t understand the issue.

Let me answer your question with your own answer:

Like I said, the method is getGroups so it should return groups. We should have to use the LuckPerms API for display names, not groups.

So you're saying if you want X, use the API.
I'm just doing the same. The only difference being you want the internal names and everyone else wants the displaynames. There are infinately more use cases for the display names than for the internal names. Because the only time they matter is when you are using commands or are working with the LP API directly.
Now since Vault offers methods to change groups directly, why are you even bothering with using commands at all? That just reeks of bad code.

I switched from using the API to set groups long time ago for several reasons.

Keep in mind that my plugin supports all Vault-compatible permissions plugin and not only LuckPerms.

Using the Vault methods to manipulate groups makes you compatibile with all permissions plugins at once. Without the need to use their commands internally.
I quite frankly don't understand the issue here.

Since you guys mentioned other plugins may want display names and apparently we are the only 3 out of thousands of people who are wanting something like that, I’ve changed this from an issue to a suggestion for a toggleable config option.

Then again. If you change the config setting you mess up other plugins still trying to get the displayname.