LuckPerms

LuckPerms

41.4k Downloads

getDisplayName API

DesperoKF opened this issue ยท 1 comments

commented

I have code a little Plugin with LuckPerms API but i need help. How can i read the Displayname (perm on MySQL is: "displayname.Owner"

I can read whit this only GroupName and shows as owner but i configure it as Owner
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId())
String GroupData = user.getPrimaryGroup();

How can i change that GroupName to Owner or read the DisplayName ?

commented

Take the result of user.getPrimaryGroup and pass that group name to api.getGroup - that will give you a Group object.

You can then use group.getFriendlyName to get its display name.

https://github.com/lucko/LuckPerms/blob/6fc2321fada78fa23b01e0d7b4ef6be72878fbd3/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java#L73-L88