#luckperms-api

1 messages · Page 18 of 1

dreamy jasper
#

Well for now it is fine. And if it grows slower, I'll look into replacing it. But I won't be using what you sent as it's just impossible to look at.

#

There must be another way that does not involve having one call on 3 different lines.

hollow grotto
#

You're welcome to read the API documentation. If you find a better way, I'm all ears. ¯_(ツ)_/¯

dreamy jasper
#

Thanks

hollow grotto
#

My code is based off of the docs

dreamy jasper
#

Just looking at your code I have no idea what it's doing.

hollow grotto
#

I'm happy to answer any questions

foggy warren
#

I need some help

hollow grotto
#

What's up, Venom?

foggy warren
#

I'm using rankup, and delux menus. I'm trying to make a /titles gui but i have no clue on how to get this to work with luck perms

hollow grotto
#

I'm not quite sure what you're trying to accomplish

foggy warren
#

To set the prefix basically if they passed a group in that track

#

They can select something in the menu which will set their prefix to that groups

dreamy jasper
#

@hollow grotto 1. What is the key variable? What is that doing? 2. CompletableFuture.completedFuture(""); gives an error.

hollow grotto
#

You'll need a permission node for their prefix. If you can fetch their prefix node, then you can call node.toBuilder().setValue("newPrefix").build() and then apply that user object.
Alternatively, if you want to follow the RBAC guideslines, it's as simple as removing the old group and adding a new one. Once they inherit from the new group, they'll pick up that group's prefix, which is probably the better way to go.

#

@dreamy jasper The key variable is the key in the Map.Entry<K, V>, where K means Key and V means Value.
Metadata in LP is stored as these KeyValuePairs, where you have a unique key that identifies a certain value. For instance, in my case, I have a key called selectedtitle which maps to an integer for their selected title.

If you want to get a specific metadata value, you find it using its key.

dreamy jasper
#

What's the key for a prefix?

foggy warren
#

Yes the second group does inherit from the default group, i just don't know what command to use and to check if the player has access to that group

hollow grotto
#

Another example is Nucleus has the max-homes meta value, where max-homes is the key and the value is whatever their max homes are set to.

For the prefix, you don't get that as meta. You get that as a prefix. Note the difference between these two lines:

.filter(Node::isPrefix)
.filter(Node::isMeta)```
#

They're two different types of node

foggy warren
#

Sorry, i'm really confused.

#
        - '[close]'
        - '[console] lp user %player_name% promote standard'```
hollow grotto
#

If you want to see if a player is a member of a group, then use player.hasPermission("group." + group);

foggy warren
#

I think i'm in the wrong channel

hollow grotto
#

Where group is the group name

dreamy jasper
#

If I just want the prefix, do I need the key variable?

#

I don't see any need for it

hollow grotto
#

No, you do not need a key if you're getting a prefix.

#

That's for user meta.

#
@Override
public CompletableFuture<String> getUserPrefix(UUID uuid) {
    if (getLuckPermsApi().isPresent()) {
        return api.getUserManager().loadUser(uuid)
                .thenApplyAsync(user -> user.getOwnNodes().stream()
                    .filter(Node::isPrefix)
                    .collect(Collectors.toList())
                    .get(0))
                .thenApplyAsync(Node::getPrefix)
                .thenApplyAsync(Map.Entry::getValue);
    } else return CompletableFuture.completedFuture("");
}```
#

That's how you get the user prefix.

#

Note two important lines:

.filter(Node::isPrefix)
.thenApplyAsync(Node::getPrefix)```
#

the :: block is short hand for node -> node.isPrefix() and node -> node.getPrefix(), respectively.

foggy warren
#

I don't want them getting access to a title when they haven't ranked up to it yet, I'm using just basic config's from; luck perms, delux menus, and rankup.

hollow grotto
#

I use stream() because I have to get all of the user's permission nodes (in this case, only their own, not those they inherit), and then I have to filter all of those by whether they're a prefix node.

#

@foggy warren You seem to be doing everything correctly on the LuckPerms end. It's just up to those plugins now.

foggy warren
#

Yea, just don't know how to check if they have gotten those ranks

hollow grotto
#

/lp user <user> info should list all of the groups they are a member of.

foggy warren
#

Heres and example of what im trying to do.

#

So they can activate the title from a previous rank

hollow grotto
#

Yeah, that's outside of the scope of LP

#

Actually, I'm building a plugin that does exactly that, though without the gui element.

#

It's for Sponge though-

foggy warren
#

Yeah the gui is easy. Just dont know how to do the perm stuff though

#

Like check if they have access to the group, or have access to the "rank"

dreamy jasper
#

@hollow grotto Now that this is a CompletableFuture string, how on earth do I use this in sending it as a message to a player?

hollow grotto
#

Use completableFuture.join(), but carefully. It should be done in its own thread, and I'm not entirely certain how to do that yet.

#

I have an AsyncService that I have set up, but it doesn't do much at this point.

dreamy jasper
#

I just want to send the message to a player...

#

do I really have to do all of this

#

Just to send a message

hollow grotto
#

Tbch, I wish this system wasn't here either. But Java is years behind on a proper concurrency library.

#

This is how you'd do it in C#:

public async Task<string> GetUserPrefix(Guid guid)
{
    // ?. is effectively wrapping the "is present" check into a single line.
    // The code to the right of the . is only executed if it is present
    
    // .Where() and .FirstOrDefault() are part of C#'s LINQ library. This is roughly analogous to Java's stream library.
    
    // Notice how some things are no longer methods? This is because C# has read-only properties.
    
    // ?? is the short-hand null coalescence operator. If the left side is null, it gets the value of the item on the right.
    // In this case, it's used to say that "if the api is NOT present, return an empty string"

    return luckPermsApi?.GetUserManager().LoadUser(guid) // We have the user handle
        .GetOwnNodes() // Get a collection of their nodes
        // .Where(x -> x.IsPrefix)[0]    
        .FirstOrDefault(x -> x.isPrefix) // This returns only one result instead of an entire collection. The "Default" is null
        ?.Prefix // If it's not null, grab the prefix
        ?.Value ?? ""; // If the prefix is not null, get its value. Otherwise, if anything is null, return ""
}

// How to actually get the prefix
string prefix = await GetUserPrefix(Player.Guid);
// Alternatively, if you're not in an async method (which gives you the await keyword)
string prefix = GetUserPrefix(Player.Guid).GetAwaiter().GetResult();
#

The GetUserPrefix function is identical to the Java version with the CompletableFuture in operation. There is an equivalent to the .thenApplyAsync() method in C#, but that belongs to Task. As you can see here, we don't interact with the Task library directly until we get to calling this method. Then we just await it, which automatically handles concurrency and just returns a string.

toxic marlin
#

Can anyone check that code and tell me, if it is correct, or if there is a more "correct" way.

crystal sonnet
#

@toxic marlin you need to save the changes

toxic marlin
#

Thx a lot mate, didn't read the developer guide this far

ebon ether
bold crypt
#

String prefix = metaData.getPrefix();

#

Yes that

ebon ether
#

Yes, and a line below is a example on how to retrive Meta data

bold crypt
#

Yes, but how do I get the MetaData

ebon ether
#
MetaData metaData = group.getCachedData().getMetaData(contexts);
bold crypt
#

LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
ContextManager contextManager = api.getContextManager();
Contexts contexts = contextManager.lookupApplicableContexts(user).orElseGet(contextManager::getStaticContexts);
MetaData metaData = user.getCachedData().getMetaData(contexts);

        final String prefix = metaData.getPrefix();
#

so

#

but that's not possible

ebon ether
#

Looks right to me, also write it like

this

this is easier to read, for your case:
```java
<code>
```

bold crypt
#

< LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
ContextManager contextManager = api.getContextManager();
Contexts contexts = contextManager.lookupApplicableContexts(user).orElseGet(contextManager::getStaticContexts);
MetaData metaData = user.getCachedData().getMetaData(contexts);

                final String prefix = metaData.getPrefix();>
#

´´´java
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
ContextManager contextManager = api.getContextManager();
Contexts contexts = contextManager.lookupApplicableContexts(user).orElseGet(contextManager::getStaticContexts);
MetaData metaData = user.getCachedData().getMetaData(contexts);

                final String prefix = metaData.getPrefix();
ebon ether
#

Other `

bold crypt
#

`test

#

#

xD

ebon ether
#

Alter, du schreibst
```java
code
```

bold crypt
#

`
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
ContextManager contextManager = api.getContextManager();
Contexts contexts = contextManager.lookupApplicableContexts(user).orElseGet(contextManager::getStaticContexts);
MetaData metaData = user.getCachedData().getMetaData(contexts);

                final String prefix = metaData.getPrefix();`
ebon ether
#
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
ContextManager contextManager = api.getContextManager();
Contexts contexts = contextManager.lookupApplicableContexts(user).orElseGet(contextManager::getStaticContexts);
MetaData metaData = user.getCachedData().getMetaData(contexts);

final String prefix = metaData.getPrefix();
bold crypt
#

*don't work

ebon ether
#

The code?
Well, I am no Java developer, but I read the Wiki page

bold crypt
#

Yes

ebon ether
#

Debug the single variables to find out when it errors out

bold crypt
#

ist work

#

But ich dont ca make the Prefix so

#

&4&lOwner |

#

| its the problem

crystal sonnet
#

Oh boy

bold crypt
#

what for a Command

crystal sonnet
#

!meta

frank driftBOT
bold crypt
#

tanks

#

thanks

sick elbow
#

How can I get the server context of a server defined in the config?

#

Nevermind, I got it with api.getConfiguration().getServer()

fluid plank
#

haii

#

what command do i use to give my players permission to use essentials commands

white crater
#

#support-1 - command is /lp user <user> permission add <node> Or you can create a group, add the node to the group, then add the player to the group

fluid plank
#

What does node stand for

white crater
#

The permission node

#

example essentials.fly

bitter gulch
#

how do you get a groups's prefix

#

through the api

wispy harness
#

How can i set an player's prefix for 1 specific server? (With API)

#

The struggle is to get the Contexts object for the current server.

crystal sonnet
#

@bitter gulch @wispy harness have a look at the usage page for devs on the wiki

#

And for specifics like that @wispy harness have a look at the Javadocs

#

I probably would at least point you in the right direction if I knew @wispy harness

wispy harness
#

But you don't know? 😂

crystal sonnet
#

And really no need to remove your messages

#

No. I don’t know that

#

I am not involved in the development of the plugin

wispy harness
#
        User user = api.getUser(player.getUniqueId());
        Node node = api.getNodeFactory().makePrefixNode(1000, ChatColor.stripColor(prefix).replaceAll("§", "&")).setServer(api.getConfiguration().getServer()).build();
        user.setPermission(node);```
crystal sonnet
#

👍🏻

wispy harness
#

Hmm

#

When i restart or open the editor of the player it's gone

#

Solved, just used Vault 😂

bitter gulch
#

I did, i dont understans what contex to use

#

I only have the group name

crystal sonnet
#

@wispy harness you need to save the changes

#

@bitter gulch there’s a special context that matches any

#

Use that

#

The context class should have a bunch of static contexts for you to use

bitter gulch
#

wdym special context? Sorry, I did read the thing on contexts

#

isn't really just clicking in my head

#

I assume I would be fine using a global context for getting a group's prefix?

crystal sonnet
#

Sure

azure latch
#
    @EventHandler
    public void PlayerEnterRegion(RegionEnterEvent e) {
        LuckPermsApi api = LuckPerms.getApi();
        Node node = api.getNodeFactory().makeGroupNode("grinder_game").build();
        if (e.getRegion().getId().equals("grinder0")) {
            loadUser(e.getPlayer()).setPermission(node);
            User user = loadUser(e.getPlayer());
            api.getUserManager().saveUser((user));
            e.getPlayer().sendMessage(ChatColor.AQUA +"Welcome to the Grinder Minigame!");

        }
    }```
#

this was working a few days ago, but now nothing happens in my server if i enter the region "grinder0". Can anyone see some obvious mistakes?

#

There are also no errors to the console

azure latch
#

Can anyone help with this? im so confused atm

azure latch
#

Still no clue, can anyone take a look/glance over the code?

wispy harness
#

I don't know, sorry :/

old relic
#

Massive noob question: What is the ‘api’?

crystal sonnet
#

For plugin devs to interact with the plugin @old relic

#

Also you can easily google the meaning of API

hardy vapor
#

But when the Owner group have weight 200 and VIP 100. Is VIP on the top from Tablist and Owner in second place but when owner have 90 is owner in first place in the Tablist. What is wrong?

patent mulch
#

How do I have my own plugin's permission nodes show up in the tab completer of the LuckPerms commands

azure latch
#

Have you referenced your plugins jar?

crystal sonnet
#

@patent mulch Spigot or Sponge?

patent mulch
#

Spigot

#

I don't know what you mean by referencing my jar file

crystal sonnet
#

Put them in your plugin.yml @patent mulch

patent mulch
#

Thank you, I figured it out. It's working great!

crystal sonnet
#

👍🏻

buoyant bear
#

this isn't so much an api question but an impl one: why does Vault hook's #getPlayerGroups only return one group if a user is in multiple?

buoyant bear
#

is the default group not considered a group? trying to reproduce an issue users tend to have a lot

#

ugh, well i can't reproduce

#

no clue how people are setting things up but it works when i get groups from superperms myself, but not through vault

#

¯_(ツ)_/¯

jaunty pecan
#

Erm, I'm not sure

#

I'll have a look into it

buoyant bear
#

i mean i'm really unsure how to reproduce atm, but the gist of it is that this code https://github.com/EngineHub/WorldGuard/blob/029f867a4146bfa97acd10ed625ea6729261fc4a/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java#L219 returns the wrong groups when https://github.com/EngineHub/WorldEdit/blob/master/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java#L115 is called, but not when https://github.com/EngineHub/WorldEdit/blob/master/worldedit-bukkit/src/main/java/com/sk89q/wepif/DinnerPermsResolver.java#L112 is
(but note that "#inGroup(Player,String)" is correct - which is checked for e.g. region membership, just not "#getGroups" which is checked for that region count)

#

if someone else comes to me with the problem i'll try nailing down what LP/Vault/etc they are using ¯_(ツ)_/¯

jaunty pecan
#

so the difference between those two

#

The vault method will return a list of the groups the player has "directly"

#

whereas the wepif method will return a list of all groups the player has, including inheritance

#

for example, if my only group is "admin", but admin inherits from moderator

#

vault would return [admin]

#

wepif would return [admin, moderator]

#

so I suspect that's where the difference is

#

vault doesn't really say whether inheritance should be included in that call

#

¯_(ツ)_/¯

rapid egret
#

I can't seem to find a simple API method to return all users that are part of a group

#

so for example, why can't there be a method like group.getUsers() ?

#

and vice versa for users , user.getGroups()

buoyant bear
#

ah, makes sense luck

#

there's no way to get a list of inherited groups through vault tho is there

#

should probably just write a perms resolver that hooks LP directly lol. sounds like work tho. ¯_(ツ)_/¯

candid vapor
#

Trying to use Helper promises, quite confused on the implementation. How would I write a method with an async promise to run a database query, and return the results when done?

obsidian tangle
#

Is there like a ContextChangeEvent or equivalent ?

obsidian tangle
#

(Ping me if answering)

obsidian tangle
#

An event called each time there's a permission / context update would work too.

unkempt oar
#

how can I check if a player has a group permanently

upper sonnet
#

is there a method in the lp api that gets the storage type?

upper sonnet
#

nvm

nocturne elbow
#

How do I give myself rights for bungeecord with Luckperms bungee

polar egret
#

lpb user <user> permission set <permission> true

#

You should ask this in the #support-1 chat though, this channel is intended for questions about the api

lyric crypt
#

Hay, how can I interrogate the group?
I used to do it this way with Pex.
if (PermissionsEx.getUser(p).inGroup("Player")) {

polar egret
#

if(plugin.api.getUserManager().getUser(p.getUniqueId()).inheritsGroup(plugin.api.getGroup("group"))) { try this @lyric crypt

#

ofcours change the plugin.api to how you call the api

#

and also make sure you do a null check before: if(plugin.api.getGroup("group") != null) {

nocturne elbow
#

@lyric crypt are you trying to see if a user is in a group?

#
String rank = api.getUserManager().getUser(p.getUniqueId()).getPrimaryGroup()```
crystal sonnet
#

That’s getting the primary group. Not checking if the player is in a group

tender walrus
#

16.06 20:43:33 [Server] INFO Caused by: java.lang.NullPointerException: permission what does this mean?

#

seems to only happen to my plugin when users use lp

tender walrus
#

why would a permission node be null

crystal sonnet
#

Seems like you're passing null as a permission somewhere @tender walrus

tender walrus
#

Weird, because this only happens with LP.

tender walrus
#

Debugging rn

#

@crystal sonnet I can confirm that the permissions exist. I'm not sure if they have to be in a specific format?

frank driftBOT
#

Hey Demeng7215! Please don't tag staff members.

tender walrus
#

kk

#

These are the permissions:
-custom.permission
-rankgrantplus.grant

Plugin name is RankGrant+.

jaunty pecan
#

can you send the full stack trace please @tender walrus

tender walrus
#

ye got it, sending it on github

jaunty pecan
#

the only way for that exception to be thrown is if the permission is null

#

so, definitely an issue with your code, not LP

tender walrus
#

Weird, but I debugged

jaunty pecan
#

might be related to the configuration?

tender walrus
#

I printed the perms

jaunty pecan
#

were you debugging using the same config file as PreciseKill?

tender walrus
#

yes

jaunty pecan
#

can you show me the code you were using to debug?

tender walrus
#

they are the same

#

this is super confusing, i have no idea why this would happen.

#

nvm, we solved it lol

#

there was a miscommunication

#

go away @valid cove

river lance
#

Hi, my english is a bit rusty, but I hope you can help me.
I build a Synchronisation betweeen WoltLab (Website CMS) and LuckPerms-Bungee. (WSC -> LuckPerms-Bungee)

// Methode called in PostLoginEvent

ProxiedPlayer player = event.getPlayer();
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(player.getUniqueId());

// Remove all Groups the User is currently in.
user.clearMatching(Node::isGroupNode);

List<Group> assignGroups = new ArrayList<Group>();
// API fill the list with Groups... (working fine, contains 2 Groups in my test case)

for (Group group : assignGroups) {
    if (!user.setPermission(api.getNodeFactory().makeGroupNode(group).build()).asBoolean()) {
        getLogger().warning("Group assignment failed: " + player.getName() + " to group: " + group.getName());
    } else {
        getLogger().info("Group assignment success: " + player.getName() + " to group: " + group.getName());
    }
}
api.getUserManager().saveUser(user).thenRunAsync(user::refreshCachedData); //https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#saving-changes

Groups from API are assigned, but also the default group, I'm unable to remove the default Group..
Before I build a "dirty" working version, I ask, how I should do this?

teal tartan
#

Isn't default default group?

river lance
#

yes, but I don't add the default group.
I think after user.clearMatching(Node::isGroupNode); the default group was added, now I don't know how to remove it correctly..

#

I Missing a Methode like group.isDefault()

teal tartan
#

Well when you remove all groups it adds default

#

Because player does not have groups then

river lance
#

remove all Groups -> assign Groups -> Save Changes -> default group is obsolet.
remove all Groups -> Save Changes -> default group is ok.

river lance
#

So there is no way by using the api to do the same as the command? -.-

river lance
#

now I build the "dirty" version, remove all groups not in assignGroups and it works....

umbral bough
#

hey guys, i have a permission node (a string) that I want to give to a player. I looked at NodeFactory but this seems a bit cryptic

#

all i want to do is the java equivelant of /lp user <user> set <node>

umbral bough
#

ok i found the solution, im just gonna use sponge's subjectData

crystal sonnet
#

@umbral bough pretty sure that tab completion showed you the wrong class

umbral bough
#

yeah that might be the case

#

i ended up doing this

#

just using the sponge userStorageService

#

i hope luckperms picks that up and updates its cache

ripe token
#

What's the difference between: luckPermsApi.getTrack();
luckPermsApi.getTrackManager().getTrack();

#

Also how do I get a users group on a specific track

spring helm
#

Hey, can somebody tell me how to query via the API if a particular player has a certain rank?

feral iris
#

Hi i am having a bit of issue with luck perms essentialsx permission nodes are not picking up in the server people can't build or use any of the permissions in the server

ripe token
#

sad no response

#

@spring helm

#

luckPermsApi.getUser(player.getUniqueId()).inheritsGroup(GROUP)

polar egret
#

How do I get the amount of groups?

#

when I try api.getGroups().size it doesnt work

ripe token
#

Maybe try luckPermsApi.getGroupManager().getLoadedGroups().size();

polar egret
#

Already tried that

ripe token
#

Why does track.getGroups() return the groups as strings?

#

is there a way to return them as a list of groups

#
Track track = luckPermsApi.getTrack("default");
User user = luckPermsApi.getUser(player.getUniqueId());
for (String groupName : track.getGroups()) {
    Group group = luckPermsApi.getGroup(groupName);
    if (user.inheritsGroup(group)) {
        return group;
    }
}
return null;
#

Is there a better way to get the group of a player on a specific track?

crystal sonnet
#

@polar egret what doesn’t work about that?

polar egret
#

Im getting a nullpointer when I try to convert the set into a list: List<Group> groups = new ArrayList<Group>(plugin.api.getGroupManager().getLoadedGroups());

crystal sonnet
#

@polar egret When are you calling that?

polar egret
#

when I use command /grant to open an inventory

nocturne elbow
#

what is event for PermissionCheckEvent ?

#

to call when hasPermission been used

nocturne elbow
#

like it's in bungee

jaunty pecan
#

There isn't an event for that

#

(too much of a performance hit to call an event for every check)

marble shore
#

How do you get the time remaining on a permission node of a player? We set a temporary permission on the player to grant them access to certain features, but I want to add a message to say how long they have access to the features

polar egret
#

How do I sort groups according to their weight?

marble shore
#

This is my current code but I am not sure if there's any better ways as the wiki discourages use of PermissionHolder#getAllNodes due to it's slow nature:

        User user = LuckPerms.getApi().getUserManager().getUser(player.getUniqueId());
        user.getAllNodes().stream()
                .filter(it -> it.getPermission().equalsIgnoreCase("my.perm.node"))
                .findFirst()
                .ifPresent(node -> {
                    long remaining = node.getSecondsTilExpiry();
                });```
hollow grotto
#

Generally, use getOwnNodes if you're sure the node will always definitely belong to the player object. Use getAllNodes if the node will belong to a group from which the user inherits.

rugged spear
#

how do i grab prefixes

rustic salmon
#

hello everyone im having an issue checking inherited groups on a player. so basically the player is in group.b and group.b inherits group.a. when i check if the player has group.a using the function inheritsGroup("a"); it returns false.

#

shouldnt it be returning true since the player is in group.b and group.b inherits group.a?

rugged spear
#

how to get a player group username color

keen rain
#

any help would be great

polar egret
#

How do I sort all the groups by weight and if the weight is the same by name

#

Because I am pretty sure the Group class in luckperms doesnt have a compareTo method

rugged spear
#

yo dis shit dead

#

Luck fucking help us with the api

gilded bane
#

Maybe don't swear and you might get a useful response

rugged spear
#

dont type if ur not gonna help

gilded bane
#

@polar egret You can compare Group#getWeight?

rugged spear
#

f u lel

neat jackal
rugged spear
#

yeah that doesnt work properly

#

plus thats prefixs

#

im trying find group name color

neat jackal
#

So the displayname of a group?

rugged spear
#

bascily

#

but of the player and target

polar egret
#

@gilded bane How do I compare it then? You linked me to getUserChatPrefix

gilded bane
#

That was an example of LuckPerms' API being used to retrieve metadata for a group for MCHQ @polar egret

polar egret
#

Ah ok

gilded bane
#

If the group has a weight, group.getWeight().get() will give you that weight as an int

polar egret
#

But how do I compare two if I want to print them in chat so the one with the highest weight is on top etc just like in listgroups

#

but I need it in a GUI

#

But I gtg now cya

rugged spear
#

md how do i get the username colors for the lp groups?

#

whats the instance name of luckperms

#

when importing it

rugged spear
#

thingy tho how do i get the luckperms instance

#

to check if the plugin is loaded

gilded bane
rugged spear
#

no no no

#

not an instance of the api

#

an instance of the plugin itself

#

so i can check if its lodaded

gilded bane
#

Depends on the platform

rugged spear
#

Bukkit

rugged hedge
gilded bane
#

And even then, just because the plugin loaded doesn't mean it's working or that the API is available

rugged spear
#

i only want my plugin to be useable if the plugin is enabled

gilded bane
#

plugin.yml has a depends section

rugged spear
#

im trying to send a message when it doesnt work tho

#

so they know why it doesnt work

#

but this happens even if it is loaded

gilded bane
#

If the plugin isn't installed, LuckPerms.getApi will cause a NoClassDefFoundError, and if LuckPerms didn't load properly, it will throw an IllegalStateException

#

If your plugin enables before LuckPerms, it won't work, which is why you need depends

keen rain
#

hello everyone im having an issue checking inherited groups on a player. so basically the player is in group.b and group.b inherits group.a. when i check if the player has group.a using the function inheritsGroup("a"); it returns false.
shouldnt it be returning true since the player is in group.b and group.b inherits group.a?

polar egret
#

nope

#

You are checking if the player inherits group a and it doesnt if you check if group b inherits group a if will return true

obsidian tangle
#

How could I add an user to a group without overriding its other parents ?

#

I know I can do that using commands, but is that doable through the API ?

crystal sonnet
#

Just give them the permission

obsidian tangle
#

yeah that could work

wet veldt
#

I've added LuckPerms as a dependency in my pom.xml however it's saying the dependency cannot be found.

#

(IntelliJ IDEA)

wet veldt
#

I have added
<dependency> <groupId>me.locko.luckperms</groupId> <artifactId>luckperms-api</artifactId> <version>4.4</version> <scope>provided</scope> </dependency>
to my pom.xml but it's not working?

crystal sonnet
#

@wet veldt it's lucko

wet veldt
#

ok yes i just noticed sorry

#

but then what do i import?

#

getting "Cannot resolve symbol LuckPermsApi"

crystal sonnet
#

You need to import the class(es)

wet veldt
#

from where?

#

usually IntelliJ does this for me but it seems it cannot find them

#

maybe it is not an instance of ServicesManager?

crystal sonnet
#

That is something completely diifferent

#

And are you sure you have imported the class?

#

IntelliJ can do it for you

wet veldt
#

I don't think so, I've just added the dependency

crystal sonnet
#

But you need to tell it do it

wet veldt
#

I would like IntelliJ to but idk how

crystal sonnet
#

Then it's about time you learn that

wet veldt
#

what would the class be called?

crystal sonnet
#

Stuff like that is trivial to google

#

Pretty sure it's LuckPermsApi

#

And the docs on the wiki should also tell you

wet veldt
#

yeah but in IntelliJ it would automatically import the relevant class matching LuckPermsApi if it's found

#

it can't be found which is worrying

crystal sonnet
#

Pretty sure you have to at least hit a shortcut

wet veldt
#

even with that it's not working

#

ugh where is the class

crystal sonnet
#

Well, did you have a look at the docs on the wiki?

wet veldt
#

yes

#

it's just using LuckPermsApi without detail on importing it

#

like for the bukkit classes it would just automatically import them

#

it seems to not be recognising LuckPermsApi

#

i have no idea what to do

#

should work

#

ugh works now no idea what was causing it, thanks for your patience anyway

ripe thorn
#

"No LuckPerms Plugin Not Found Disabling"

#

First of all: Why Every Word Starts Uppercase?

#

Next: Does two no not result in a yes? (negativ + negative = positive)

wet veldt
#

negative * negative = positive*

#

Would I need to construct a Node object then pass this to hasPermission to simply check if a User possesses a permission node with true? I only am caring about the node string and the boolean...

#

Like, there are so many abstract methods for a Node object

#

ah I can provide a NodeEqualityPredicate and just fill the remainder of the abstract methods with garbage I guess

crystal sonnet
#

You really don't need to implement any classes/interfaces to use the API

wet veldt
#

well I had to construct a Node object

#

and a comparator

#

but that's fine, unless there's an easier way?

crystal sonnet
#

There's class that cobstructs one for you

#

Called NodeFactory iirc

wet veldt
#

ohh

#

kinda lost in the javadoc tbh

crystal sonnet
#

Did you see this page?

wet veldt
#

I was looking for something like that but missed it! many thanks

tawny aspen
#

how would i do lp user username permission set via luckperms Api? get confused with this Node's

stuck furnace
#

How do i get already exsiting standart perms as a node for example the * perm ?

crystal sonnet
#

@stuck furnace what do you mean with standard permissions?

stuck furnace
#

just the normal * perm

#

Node node = api.getNodeFactory().newBuilder("*").build();

crystal sonnet
#

The API usage page explains how to get a node object

#

And that looks right

stuck furnace
#

Yea but it doesnt work for me thats my problem so i thought i would do smth wrong

#

Im just trying to remove the perm from every online player with a for statement

#

and the user.unsetPermission(node)

crystal sonnet
#

Read the section about saving changes

stuck furnace
#

🤦🏼

#

thx

sonic snow
#

Not sure what I'm doing wrong:

#

` User pu = luckPermsApi.getUser(event.getPlayer().getUniqueId());

            MetaData meta = pu.getCachedData().getMetaData(Contexts.allowAll());

            meta.getPrefix();`
#

Attempting to get the current prefix, whether it's personal, or set by the group

#

It only works on personal prefix's though.

#

Ik, the priority is messed up. I just imported from pex, need to fix some stuff

#

Oh I see what happened. LuckPerms didn't import my suffix's. I manually added suffix's and now the problem is resolved

nocturne elbow
#

Hello

#

I just installed LuckPerms

#

And I don't understand how my data are stocked

#

And how I can edit it

tawny aspen
#

How can i put meta to user? I getMeta than u put in it key and value, save user and its making nothing. I cant even remove meta from user.

crystal sonnet
#

@nocturne elbow #support-1. This channel is for devs using the LP API

#

@tawny aspen there’s an API usage page on the wiki

tawny aspen
#

so to add meta i need to use .setPermission?

crystal sonnet
#

Pretty sure there is a meta node builder at least

#

And there might even be a method to set it directly

#

Though it'll be explained on the page

tawny aspen
#

yeap first i makeMetaNode and then add/remove it from user

wicked flame
#

Hey! Is there a way to add a player for eg 1 day to a group with Vault? Or would I have to do it with the LuckPermsAPI directly? If yes how would I do that?

crystal sonnet
#

99% sure you have to use the LP API for that

#

And how to use it is explained on the wiki @wicked flame

near ferry
#

hey, how do i set a default group for the world and how do I add individual players to a group

#

?^!

crystal sonnet
#

@near ferry are you trying to do this with a self written plugin?

near ferry
#

no, I figured it out tho

#

too much work to write one up today

crystal sonnet
#

For questions on how to do things with the plugin itself, pleas use #support-1

hasty harbor
#

there is some possibility of sending a message in the rule such as:
message: "Congratulations"
in the configuration below!!

knotty jolt
#

I want to make a bungeecord command called /resetrank

so how can i delete all player groups and set the player to the default group ?

#


LuckPerms.getApi().getUser(target.getUniqueId()).clearParents(); ?
``` ??
crystal sonnet
#

@knotty jolt the above should do. And assigned permissions are called nodes.

#

Be aware that you need to save your changes

knotty jolt
#

alright

crystal sonnet
#

And the answer is no. The rules are applied when the player joins and only when they join

#

@knotty jolt no. They change live.

#

But you need to call the method that saves the changes

#

It’s explained on the API usage page

#

No

#

Takes effect immediately

#

You can’t even disable that

#

If you change it on the bungee and it’s for the backend servers, then that means your messaging service isn’t set up correctly

hasty harbor
#

@crystal sonnet ops!!
sorry for posting here on this channel # talk-API, but thank you for your attention with the subject, my thanks and have a great week.

frank driftBOT
#

Hey MESKITA! Please don't tag staff members.

blazing topaz
#

Does this api have maven support?

crystal sonnet
#

Yes @blazing topaz

#

There's a wiki page for that

near ferry
#

how do i use the API

crystal sonnet
#

!wiki

frank driftBOT
static path
#

Yo

static path
#

LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
Group group1 = api.getGroup("Owner");

User user1 = luckPermsApi.
if(user.inheritsGroup("owner")) { For getting if group.equals
scenic palm
#

If anyone could get us a fix for this, that would be fantastic ^

#

We are trying to convert from PermissionsEx and it's a pain in the ass especially when converting with our custom plugins, so we need some API help ASAP.

stuck furnace
#

What are you guys even trying? Why is there a user and a user1.

knotty jolt
#

how can i set a user to a group?
LuckPerms.getApi().getUser(target.getUniqueId()).setPrimaryGroup(rank);
is this right?

crystal sonnet
#

I also have not the slightest idea what you are trying to do

#

Also group names are always lowercase

static path
#

I'm trying to use LuckPerms API to get if group.equalsIgnoreCase("owner") basically

stuck furnace
#

just use the method on the top of the api usage page

static path
#

You have to use the static boolean or just p.haspermission?

stuck furnace
#

the boolean just returns true or false

static path
#

So use p.hasPermission basically?

stuck furnace
#

yes

#

You can also do it with the api

static path
#

How?

stuck furnace
#

i think user.getPrimaryGroup(); works fine

#

and then you could just ask if that group is equal to the one you are searching for

static path
#

I rlly appreciate the help, I didnt want to switch but my Owner instisted compared to PermissionsEX

static path
#

User user = api.getUser(p.getUniqueId()); now this is coming back as an error?

stuck furnace
#

Works fine for me

#

What does the error say ?

scenic palm
#

Tell me that this isn't better than permissionsex... There is no comparison, Pex hasn't been touched in years

wicked flame
#

Have I made any mistakes here? Normaly it should add a player the group VIP for 7 days but it doesnt seem to be working.

                        unixTime = unixTime + 604800;
                        Node node = Lobby.permsApi.getNodeFactory().makeGroupNode("vip").setExpiry(unixTime).build();
                        Lobby.permsApi.getUser(player.getUniqueId()).setPermission(node);```
#

Oh and the permsAPI is defined as follows:

RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
        if (provider != null) {
            permsApi = provider.getProvider();
        }```
crystal sonnet
#

@wicked flame what is happening?

wicked flame
#

Nothing, the user just doesnt get get group

#

No error no nothing

stuck furnace
#

you have to save your changes

wicked flame
#

Welp that could it be ._.

bright veldt
#

Hi, question. The suffix isn't showing in chat

rough cargo
#

do you have vault and essentailasx chat?

serene haven
#
Caused by: java.lang.NoSuchMethodError: me.lucko.luckperms.common.plugin.LuckPermsPlugin.getApiProvider()Lme/lucko/luckperms/common/api/LuckPermsApiProvider;``` why am i getting this
#

fixed it by getting the apiprovider instead of getting the plugin and getting its api provider

candid vapor
#

Trying to use Helper promises, quite confused on the implementation. How would I write a method with an async promise to run a database query, and return the results when done?

crystal sonnet
#

@candid vapor Return a CompletableFuture

crystal sonnet
#

And as I've told you before, I highly recommend you use the Vault API instead. Because if you had done that before you wouldn't be needing to replace the PEX API with the LP API. And if you use it now, it's easier to use and you'll support any permission plugin that supports Vault (which is pretty much all of them (LP and PEX included)) @nocturne elbow

stray dock
#

I have an issue.
I use LuckPerms in bungeecord for permissions to get permissions player on all my servers from bungee plugins.
But i use LuckPerms in Nukkit too, but not with bungeecord, i use for myself because i don't want all permissions to be the same on all servers.
And when i want to get UUID to one OfflinePlayer, on server i have one UUID, and in bungee i have another
And i don't know what to do, to getUser

#
    private User giveMeADamnUser(UUID uuid) {
        UserManager userManager = ChatHandlers.api.getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(uuid);

        return userFuture.join(); // ouch!
    }
#

I can't get User using them name?

crystal sonnet
#

What isn't working with that code?

stray dock
#

Actually, i think is not a LuckPerms issue. UUID are the same, i get null pointer on Player.getUniqueId()

#

Thank you for all.

crystal sonnet
#

You're welcome

fallen siren
#

Hi, i am new to permission, How to add a group vip1 to the player?What does primary group mean?

static path
#

Hello

fallen siren
#

hi

#

I always feel luckperm API is not friendly, it has no user.#getGroups(), group# getmembers(), user# addGroup(string group), and other convenient way

fallen siren
#

'user#inheritsGroup' is commonly regarded as an operation to set if the prefix 'is' is not added

#

It's more like performing an lp user abc parent add admin operation

static path
#

Can I get some help

#

I'm trying to get group.equals

#

with the API, so it doesn't run through p.hasPermission

fallen siren
#

player.hasPermission("group."+groupName)

static path
#

but I want people who are op to have the correct prefix

fallen siren
#

must add group. prefix

static path
#

?

#

Explain

fallen siren
#

If you have a vip group and want to check if the player include in vipgroup, run player.hasPermission("group.vip")

static path
#

what if someone is op or has star perms?

fallen siren
#

I am new to luckperms, I don't think I can answer that question, sorry😅

static path
#

mk

fallen siren
#

maybe check minecraft.command.op before group.vip

crystal sonnet
#

If I’m not entirely mistaken internal nodes like group, prefix, etc are excluded from *

static path
#

I'm still confused

crystal sonnet
#

@static path just give it a try

#

You’re confused about what?

#

And btw, you really shouldn’t be using the * node. It has so many side effects

static path
#

Can someone please help explain?

fallow dagger
#

?

turbid solar
#

Change it to user i think?

#

the PermissionUser to User

fallow dagger
#

This plugin was compatible with pex before

#

And as I switched over to LuckPerms, I don't know how to do things.

#

@turbid solar

turbid solar
#

Oh dont know about that just knew about the getUser part

fallow dagger
#

rip

turbid solar
#

Checked wiki?

static path
#

If your op I want the player to still have the correct prefix using p.hasPermission

nocturne elbow
#

How do i give out permissions for luckperms, For example how can i make it so people can put people in diff groups but like not edit the groups etc.

crystal sonnet
#

@static path utterly unrelated

#

These things have nonthing to do with eachother

#

This channel is for plugin devs using the LP API

static path
#

?

#

That's what I'm using pal

crystal sonnet
#

Do you see that I referred to two different people there?

#

First two messages are for you, second two aren't

static path
#

You made no sense

crystal sonnet
#

The question you are asking doesn't make sense

#

Prefixes and OP are completely unrelated

#

@fallow dagger the LP API is very different than the PEX API.

#

If all you need are stuff like prefixes, you should use Vault as your API instead. Makes your plugin compatible with almost any permissions plugin

#

@static path ?

static path
#

Yes

crystal sonnet
#

I'm talking to you

static path
#

im aware

crystal sonnet
#

I said

The question you are asking doesn't make sense
Prefixes and OP are completely unrelated

And haven't gotten a response to that

static path
#

With someone being OP, I want their prefix to be the correct one based off the group they are on

crystal sonnet
#

Yeah

#

That's what happens

#

I have said it twice and I'll say it again:
Prefixes and OP are not related

static path
#

Ok

crystal sonnet
#

Are you checking these things before asking?

static path
#

?

crystal sonnet
#

You have asked a few questions

#

And all were the same theme. "How can I do/get x if player is OP?". And the answer always was "OP doesn't affect that". Now, I am wondering why you are not just checking these things before asking?

#

Will save you a lot of time

static path
#

I did

crystal sonnet
#

Then why are you asking?

#

Testing it should either show you it works or if it doesn't you can tell us

static path
#

So in the API there is physically no why of actually getting if (user.getgroupname.equals("owner") something of that nature?

rapid egret
#

getPermanentPermissionNodes() This is supposed to be returning non-transient permissions but it seems to ALSO include transient

#

fail

#

guess ill request a fix

#

looks like I had to use getNodes() instead

crystal sonnet
#

@static path you have been told numerous times

loud marsh
#
User user = LuckPerms.getApi().getUser(player.getUniqueId());
        Node node = LuckPerms.getApi().getNodeFactory().newBuilder("indefinite.testtesttest").build();
        user.setPermission(node);```
#

Hi! I am trying to add a permission to a User and it doesn't seem to work.

#

That's what I am basically using.

cold panther
#

Hey there, you are likely not saving the changes, which can be done using: LuckPermsAPI.getUserManager().saveUser(user);

loud marsh
#

Wow, thanks!

#

I completely forgot about that.

#

Appreciate it lol, you saved me a lot of time

cold panther
#

No problemo :)

loud marsh
#

Yup works great, cool

hollow grotto
#

I have the following method. Given the API docs, using .join() is apparently a bad idea because it runs the operation on the same thread instead of queueing another one, as far as I understand it.

I have a commented section where I tried doing some things but I'm not sure what the best option is. The api docs tell you not to use .join() but they don't tell you what to use in lieu of join.

#
@Placeholder(id = "title")
public String getTitle(@Source Player player) {
    if (Optional.of(_databaseService).isPresent() && Optional.of(_luckPermsService).isPresent()) {

        /*
        AsyncService<Integer> getIdAsync = new AsyncService<>(_luckPermsService.getSelectedTitleId(player.getUniqueId()));
        Thread t = new Thread(getIdAsync);
        t.start();
        t.wait();

        int titleId = AsyncService.execute(_luckPermsService.getSelectedTitleId(player.getUniqueId()));
        */

        int titleId = _luckPermsService.getSelectedTitleId(player.getUniqueId()).join();

        if (-1 == titleId || 0 == titleId)
            return "";
        try {
            Optional<TitleEntry> title = _databaseService.getTitle(titleId);
            if (title.isPresent())
                return title.get().Title;
            return "";
        } catch (SQLException se) {
            return "";
        }
    } else return "";
}```
#

This is just one of many places I'm using .join()

#

(This is for CompletableFuture<T>

#

I was able to do this:

int titleId = 0;

try
{
    AsyncService<Integer> getIdAsync = new AsyncService();
    Thread thread = new Thread(() -> getIdAsync.run(_luckPermsService.getSelectedTitleId(player.getUniqueId())));
    thread.start();
    thread.wait();
    thread.join();
    titleId = getIdAsync.getValue();
}
catch (InterruptedException ie)
{
    _logger.error(ie.getMessage(), ie);
}```
#

No idea if it'll work though.

#
public class AsyncService <T> {

    private volatile T value;

    public void run(CompletableFuture<T> future) {
        new Thread(() -> {
            value = future.join();
        });
    }

    public T getValue() {
        return value;
    }
}```
#

Oh, I forgot I did threading in run(), good thing I looked at that.

#

Merged the threading into my AsyncService and placed updated my titles class to match:

AsyncService<Integer> getIdAsync = new AsyncService(_logger);
getIdAsync.run(_luckPermsService.getSelectedTitleId(player.getUniqueId()));
int titleId = getIdAsync.getValue();

// int titleId = _luckPermsService.getSelectedTitleId(player.getUniqueId()).join();```
#
public class AsyncService <T> {

    private volatile T value;
    private final Logger _logger;

    public AsyncService(Logger logger) {
        _logger = logger;
    }

    public void run(CompletableFuture<T> future) {
        try {
            Thread thread = new Thread(() -> future.join());
            thread.start();
            thread.wait();
            thread.join();
        } catch (InterruptedException ie) {
            _logger.error(ie.getMessage(), ie);
            value = null;
        }
    }

    public T getValue() {
        return value;
    }
}```
crystal sonnet
#

@hollow grotto well the idea is to never use join on the main thread

#

If you’re just starting a thread for yourself, it’s perfectly fine to call join

hollow grotto
#

I see. I ended up making some major changes after this but I'll keep that in mind for future reference.

crystal sonnet
#

As a general rule, joining is fine if thread you’re blocking is async

long moon
#

Use a thread pool, btw

#

only 20+ hours later, but \o/ Thread creation is preeeeetty expensive

crystal sonnet
#

Using an async handler/runner from the platform should be using one iirc

hollow grotto
#

I actually ended up using Kotlin and just using completableFuture.await (I think that was it)

crystal sonnet
#

That’s still the Java library here

#

Or at least Java has an exact equivalent

obtuse rapids
#

I have an Inventory GUI for players to switch between rank prefixes. This particular part doesn't work:

case SMITHING_TABLE: {
       user.setPrimaryGroup("constructor");
}

I have absolutely no idea why it happens but it just doesn't like the group name. The group exists and I have it as a parent, yet it just refuses to set it as the primary group. I've tried changing the name to something else and that works. Does anyone have any idea on why is this a thing?

crystal sonnet
#

@obtuse rapids how does the enitre function look like?

obtuse rapids
#
User user = api.getUserManager().getUser(p.getUniqueId());
for (int i : rankSlots) {
                if (e.getCurrentItem().getType() == Material.BARRIER){
                        p.sendMessage(ChatColor.DARK_RED + "Sorry, but you don't have this rank yet!");
                        break;
                } else if (e.getRawSlot() == i) {
                    try {
                        switch (e.getCurrentItem().getType()) {
                            case PLAYER_HEAD: {
                                user.setPrimaryGroup("member");
                                break;
                            }
                            case SMITHING_TABLE: {
                                user.setPrimaryGroup("constructor");
                                break;
                            }
                                //...
                    } catch (NullPointerException nullPointerException) {
                        p.sendMessage(ChatColor.DARK_RED + "This rank does not exist!");
                    } catch (IllegalStateException illegalStateException) {
                        p.sendMessage(ChatColor.DARK_RED + "Sorry, but you don't have this rank yet.");
                    }
                    api.getUserManager().saveUser(user);
                    user.refreshCachedData();
                    p.sendMessage(ChatColor.DARK_AQUA + "Tag changed!");
                }
}

It's still unfinished and the code is probably the worst thing I've ever wrote, but that's how it looks right now

crystal sonnet
#

@obtuse rapids now to be sure

#

Setting the primary group does not give the player the group

obtuse rapids
#

When I was testing I manually added the group to my parent groups, it still didn't work

crystal sonnet
#

Now what are you expecting that to do?

obtuse rapids
#

To change the player's primary group to the one they clicked on

#

as I said, there is another switch case set up identically, just with a different name, which works as expected.

crystal sonnet
#

Do you know what the primary group is for @obtuse rapids ?

obtuse rapids
#

As far as I remember, the primary group's meta is used instead of others if more than 1 group has a property set at the same weight. Also I guess same for permission nodes, but I might be wrong because I haven't set same permissions to different values for groups that a player can be in at the same time

crystal sonnet
#

That's precisely incorrect

#

All the primary group is is the answer to "Which (single) (most important) group does the player have"

#

Which meta is picked depends on the group weight

edgy gale
#

Do Subject#getOption correspond to the meta in LP?

crystal sonnet
#

Pretty sure it does

#

Check the javadocs

sour pawn
#

So I'm making a /rank command just because it's a lot easier than doing /lp user blablabla parent set rank

#

And I was just executing console commands but I went on the wiki and saw there was a dev api and I'm trying to use that instead now, does anyone know how to set a user's primary group?

sour pawn
#

Also is it possible to get a prefix for a group through the api? I don't see it anywhere

real gulch
#

If bungeecord dont have an api, how do i check player perm/rank?

#

Like always?

crystal sonnet
#

@MrMaurice211#5248 no idea what you are talking about. LP has an API

#

@sour pawn there should be plenty of examples on how to use the API on the wiki

snow willow
#

How I set a players group

crystal sonnet
#

Have a look on the wiki @snow willow

snow willow
#

Yes but I dont find it @crystal sonnet

frank driftBOT
#

Hey Hallo5000! Please don't tag staff members.

nocturne elbow
#

hello guys, can u help me with events?
When i use /lp user nick parent set group, what event will call?

#

i think about UserPromoteEvent, but it didn't do anything after this command

#

Bukkit.dispatchCommand(LPCOMMAND)

#

...

nocturne elbow
#

anyone can help with this ☝??

nocturne elbow
#

Can anyone tell me what I'm doing wrong here? Group does not apply to player.

#

Also, how can I sync data between servers after updating it on bungeecord using api?

crystal sonnet
#

@nocturne elbow is the code executing?

#

And Syncing happens automatically if you have a proper network setup

nocturne elbow
#

Yes, I get a message saying rank is applied

#

It also doesn't sync prefix changes until i type /lp sync, all servers including bungeecord is connected to the same mysql database and using "sql" as messaging channel

#

I change prefixes using this code

api.getUserManager().saveUser(u);```
crystal sonnet
#

Hm. You might need to trigger a network sync

#

Should be a direct call on the API

#

And also worth a bug report

nocturne elbow
#

Couldn't find a network sync method in API, guess i'll just execute the command

#

will report bug, too

cinder nexus
#

could anyone help me solving a vault-unsafe-lookup problem? :)

#

Kind of a beginning dev and really can't seem to fix it

#

it happens when using vault to get an offlineplayer's permissions

crystal sonnet
#

@cinder nexus any action that reads data from disk or network, blocking operations or waiting (blockingly (Like joining a thread or CompleteableFuture)) should never be run on the main thread!

#

Else you will cause lag

#

In other words run those things async

cinder nexus
#

I tried, but I couldn't get it to work :/

#

I know it probably sounds like I don't know what I'm doing lol

crystal sonnet
#

What means you tried? @cinder nexus

nocturne elbow
#

what luckperms event is triggered when i using "/lp user <nick> parent set"?

crystal sonnet
#

A few should be

cold panther
#

I suppose you'd get NodeAddEvent and numerous NodeRemoveEvent called. The NodeAddEvent would be the addition of the group node group.<group name>, and the NodeRemoveEvent would be called whenever the other group nodes are removed

nocturne elbow
#

thnx.

cold panther
#

That may not be correct, or some more events may be called such as the UserDataRecalculateEvent, which is triggered whenever cached user data is refreshed

buoyant moat
#

Is there a version of the api that's designed for or supports javascript? (This is for a DJS bot)

#

Assuming that pinging the server will bring up luckperms data.

cold panther
#

There is not, no :/ The only real solution to that is to have the discord bot query the database directly, or have a bridge plugin on the mc server which can be pinged by the bot

buoyant moat
#

K

#

I'll read from the database

nocturne elbow
#

I suppose you'd get NodeAddEvent and numerous NodeRemoveEvent called. The NodeAddEvent would be the addition of the group node group.<group name>, and the NodeRemoveEvent would be called whenever the other group nodes are removed

#

NodeAddEvent throws this:

[18:50:11 ERROR]: [xxI] xx v1.0.1 attempted to register an invalid EventHandler method signature "public void xx.xx.xx.handlers.listeners.permissions.ChangeGroupEvent.onGroupChange1(me.lucko.luckperms.api.event.node.NodeAddEvent) throws java.sql.SQLException" in class xx.xx.xx.handlers.listeners.permissions.ChangeGroupEvent
#

i need get new user's group name

crystal sonnet
#

Your listener method must not throw exceptions

nocturne elbow
#

okey. thx

cinder nexus
#

@crystal sonnet I created a new thread and called my methods from the new thread, but it didn't work, I don't know what I'm doing wrong lol

frank driftBOT
#

Hey The_King_Senne! Please don't tag staff members.

crystal sonnet
#

@cinder nexus well, this is basic plugin stuff. I think you're better off asking on a Discord dedicated to bukkit/spigot plugins

#

And have your code handy

#

That will help considerably

nocturne elbow
#

now my listener method not throw exceptions, but error...

    @EventHandler
    public void onGroupChange1 (UserDataRecalculateEvent e) {
        Bukkit.broadcastMessage("test");
        User user1 = e.getUser();
        UUID user = user1.getUuid();
}
#
[20:58:29 ERROR]: [xx] xx  v1.0.1 attempted to register an invalid EventHandler method signature "public void xx.xx.xx.handlers.listeners.permissions.ChangeGroupEvent.onGroupChange1(me.lucko.luckperms.api.event.user.UserDataRecalculateEvent)" in class xx.xx.xx.handlers.listeners.permissions.ChangeGroupEvent
crystal sonnet
#

Make sure you're registing these events in the LP event handler

#

Not the one of the platform

nocturne elbow
#

when i can read about LP event handler

#

what page at wiki

crystal sonnet
#

On the JavaDocs

#

if you don't have them included in you IDE, make sure you do

nocturne elbow
#

are i know it right?
in onEnable():

luckPermsApi.getEventBus().subscribe(UserDataRecalculateEvent.class, new ChangeGroupEvent()::onGroupChange1);
#

but same error

#

oh, i fixed it. just removed @EventHandler annotation

cinder nexus
#

okay thanks brainstone, thought I could try asking the author x)

crystal sonnet
#

The thing is you’ll just get the same answer: run it async

cinder nexus
#

Well Thanks anyway :)

karmic steeple
#

Hey! How can I force load LuckPerms API? It's throwing IllegalStateException

#

Using bungee btw.

crystal sonnet
#

@karmic steeple make your plugin depend on LuckPerms and be sure to not load the API before your onEnable

#

First access it during your onEnable

karmic steeple
#

Like this in bungee.yml?

depends: ['LuckPerms', 'BungeeTabListPlus']```
crystal sonnet
#

Yes

#

If the dependency is optional, I think there's also SoftDepend or After

#

I'm not sure which one it is, but I know it exists. Check the docs if you want to make the dependency optional

karmic steeple
#

I think I somehow f up the bungee.yml because it's still not working same as BungeeTabListPlus custom variable

crystal sonnet
#

When are you first accessing the LP API?

#

If in doubt post your main class

karmic steeple
#

I'm accessing it within ChatEvent

crystal sonnet
#

Is the error being thrown then or during the start of your plugin=

karmic steeple
#

whenever I try to chat

crystal sonnet
#

Then check for startup errors of LP

karmic steeple
#

There are none

crystal sonnet
#

The API not being accessible means the plugin isn't starting correctly

karmic steeple
#

I should probably change implementation to compileOnly

crystal sonnet
#

Though we are at a point where any further diagnosis becomes impossible without code or at least log

#

Erm yes

#

Pretty sure that's pointed out pretty clearly

karmic steeple
#

And my Windows crashed

#

nice

nocturne elbow
#

@nocturne elbow How you

#

Embed your message

white crater
#

He does it via Better discord and a plugin

#

I’ve already asked 🤣

left imp
#

Greetings, Using VAULT to apply permissions, luckperms appears to only set the permissions on a per world basis, I am not supplying vault with any context for world. Is there a way to make the perms/groups apply globally or do I need to switch to the LuckPerms API for setting permissions?

crystal sonnet
#

Most likely the latter

light breach
#

Hey can anyone help me ?

#

I got a problem with the API

crystal sonnet
#

Have you tried using it correctly?

#

(Best I can do with that information)

light breach
#

It's working

#

But i got errors

crystal sonnet
#

Then don’t make the errors
(Again. Best I can do with the lack of information you provide)

light breach
#

This is the error when i don't have ranks

#

And this is the error when i join with a rank

crystal sonnet
#

This is not the LP API not working

#

That’s entirely your code

light breach
#

Yes i know

#

But i don't understand why

#

And how to fix it

crystal sonnet
#

In the first error the optional is empty

#

99% certain there’s an example on how to deal with that on the wiki

light breach
#

Yes but what i should do ? i don't know this api^ i don't understand all the doc i'm not english that's hard to understand

crystal sonnet
#

And in the second case your player object is null

light breach
#

How ?

crystal sonnet
#

How am I supposed to know?

#

You’re passing null

#

Not a player

light breach
#

How a player join can be null

crystal sonnet
#

And these things have nothing to do with the API itself

#

Now for the first problem, check the wiki on how to properly get the context

#

It should account for an empty optional

light breach
#

@crystal sonnet Something like this ? ```java
public String getPrefix(Player player) {
LuckPermsApi lpAPI = LuckPerms.getApi();
User user = lpAPI.getUser(player.getUniqueId());
Contexts userCtx = lpAPI.getContextForUser(user).orElseThrow(()
-> new IllegalStateException("Could not get LuckPerms context for player " + player.getName()));

    return user.getCachedData().getMetaData(userCtx).getPrefix();
}
frank driftBOT
#

Hey Rourou! Please don't tag staff members.

light breach
#

i find it on programcreek

crystal sonnet
#

Do you have that from the wiki?

light breach
#

Nop

#

It's fixed thx you

crystal sonnet
#

You’re welcome

left imp
#

okay so if I want to apply a permission that will return true with player.getPermission("somePerm") in ALL worlds on that server, is it as simple as: Node node = luckPermsAPI.getNodeFactory().newBuilder("permToSet").build(); luckPermsAPI.getUserManager().loadUser(playerUuid) .thenApplyAsync(user -> user.setPermission(node)); Will this create a global node, or do I have to also create a contextset? I do not want a permission to be applied based on the world the player is standing in.

left imp
#

this does not appear to save the changes...

crystal sonnet
#

@left imp Because you need to save the changes

#

But, yes. This will make a global node

left imp
#

to add a user to a group would it be the same method except luckPermsAPI.getNodeFactory().newBuilder("group.permToSet").build(); ?

crystal sonnet
#

@left imp in essence yes

#

Though there's also a builder for grtoup nodes

left imp
#

ah i see it now

#

man this sucks, not excited about redoing all this because vault's api seems to by default add the permissions depending on the world the player is standing in.

crystal sonnet
#

Pretty sure you can have a look at LPs implementation of the Vault API

unique olive
#

hey, think i could get my patreon tags?
also what's the possibility of getting bulkupdate to work on meta?
in the sponge version
i use TONS of meta and would like to be able to reset it for a map wipe

crystal sonnet
umbral axle
#

Luckperms API docs say to use group.### perm to see if someone has a group, but it doesn't seem to work with OPs
any fix for that?

proud crypt
#

yeah - dont use OP with a permission plugin 😜

crystal sonnet
#

Alternatively you can iterate over all nodes a player has

#

And check if one of them is that group you want

grand parcel
#

Hi

#

How can I use the api to set a player group?

#

Like luckperms.getPlayer(p).setParent("Owner")?

grand parcel
rain barn
#

hey, is there an event for when the users primary group changes?

rain barn
#

still need this ^ or any event similar if there is one

nocturne elbow
#

NodeAddEvent UserDataRecalculateEvent

rain barn
#

how often are these called @nocturne elbow

#

looking to update the users prefix whenever they change group

#

but i use a different chat plugin (my own)

nocturne elbow
#

UserDataRecalculateEvent is triggered whenever cached user data is refreshed

#

The NodeAddEvent would be the addition of the group node group.<group name>, and the NodeRemoveEvent would be called whenever the other group nodes are removed

#

I recommended u to use Vault API for chat plugin

upbeat jackal
#

Hi ! I would like to get how many players have a rank, is it possible ?

#

For example, how many players have the vip rank

crystal sonnet
#

@Tabbin#3874 why not just let LP handle the prefixes?

#

@upbeat jackal you need to iterate over all players and check if they have a certain group

#

If they’re offline you need to load them too

#

So if you’re doing that, don’t do it too often

upbeat jackal
#

Okay thank you and how can I load them ?

#

And can I do it asynchronously ?

crystal sonnet
#

You shouldn’t do anything else

#

And check the wiki

#

There’s a page on how to use the API

upbeat jackal
#

Okay thank you so much

crystal sonnet
#

You’re welcome

nocturne elbow
#

Just wanna say thank you thumbs great plugin easy interface. Learning to use it as a first time MC server owner... So it's a learning curve but thanks for making it easy

zenith linden
#

How do I use LuckPerms API to do this without a command doing a command

#
@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player p = (Player) sender;
        if (cmd.getName().equalsIgnoreCase("prisongroups")) {
            if (p.hasPermission("set.display")) {
                p.chat("/lp group default setdisplayname A");
                p.chat("/lp createtrack prestige");
                p.chat("/lp createtrack prison");
                for (char value = 'A'; value <= 'Z'; value++){
                    p.chat("/lp creategroup " + value);
                    p.chat("/lp group " + value + " setdisplayname " + value);
                    p.chat("/lp group " + value + " meta setprefix 1 &8[&a" + value + "&8]&f");
                    p.chat("/lp track prison append " + value);
                    p.chat("/lp group " + value + " parent set A");
                }
                for (int i = 1; i <= 100; i++) {
                    p.chat("/lp creategroup " + i);
                    p.chat("/lp track prestige append " + i);
                    p.chat("/lp group " + i + " meta setprefix 1 &7[&6" + i + "&7]&f");
                    p.chat("/lp group " + i + " parent set A");
                }
            }
        }
        return false;
    }```
#

without having to do all of these commands

#

is there an API within luckperms do this

crystal sonnet
#

Yes there is. The wiki has a basic documentation on how to work with the API

#

And the API itself has great Javadocs

long wyvern
#

Hey is there's any way to register my custom luckperms sub command without modifying the source?

frank driftBOT
#

Hey NotHillo! Please don't tag staff members.

zenith linden
#

I'm not sure how to do that

viscid grove
#

I joined to ask a question regarding to luck perms
Would I be able to manually add permissions into the config file of luckperms? If so, I can't seem to find it.
Because if not, I'll end up keeping on looking for other plugins.

white crater
#

Depends on your storage method

proud crypt
#

Try the web editor @viscid grove /lp editor
Also this channel is meant for developers who are using the API, use #support-1 for LuckPerms support

viscid grove
#

thanks but i already got this question answered about a few horus ago on one of the other channels

#

thanks anyways

#

oh and my bad

valid turtle
#

how do you add someone to a group?

wicked flame
#

Why does this not work?

                            if (!pl.hasPermission("rank.vip")) {
                                long unixTime = System.currentTimeMillis() / 1000L;
                                User user = Lobby.permsApi.getUser(pl.getUniqueId());
                                unixTime = unixTime + 259200;
                                Node node1 = Lobby.permsApi.getNodeFactory().makeGroupNode("vip").setExpiry(unixTime).build();
                                user.setPermission(node1);
                                Lobby.permsApi.getUserManager().saveUser(user);
                                Bukkit.broadcastMessage("§6§l" + pl.getName() + " §c§lgot VIP!");
                            }
                        }```

But this works:
```long unixTime = System.currentTimeMillis() / 1000L;
                        unixTime = unixTime + 604800;
                        Node node = Lobby.permsApi.getNodeFactory().makeGroupNode("vip").setExpiry(unixTime).build();
                        User user = Lobby.permsApi.getUser(player.getUniqueId());
                        user.setPermission(node);
                        Lobby.permsApi.getUserManager().saveUser(user);```
crystal sonnet
#

@wicked flame what’s not working in the above code?

wicked flame
#

Oh yea sorry forgot to mention it. The user just dosnt get the rank. It writes "username got vip" and throws no error.

crystal sonnet
#

Try throwing in some debug statements

nocturne elbow
#

Hello, is there any easy way to set player group?
I use this now but I have to remove the permission before I add to a new group:

public static LuckPermsApi api;

public static void init() {
    api = LuckPerms.getApi();
}

public static void setGroup(Player plr, String group) {
        User user = api.getUser(plr.getUniqueId());
        
        Node node = api.getNodeFactory().newBuilder("group." + group).build();
        
        user.setPermission(node);
}
midnight gorge
#

do you want to add a player to a group? @nocturne elbow

nocturne elbow
#

Yes.

midnight gorge
#

use this and ull be fine

#

lp user NAME Luck parent add GROUP NAME

crystal sonnet
#

@nocturne elbow you forgot to save the changes

#

I’d recommend you check the wiki

#

There are plenty of API usage examples

midnight gorge
#

ya i dont know wgat api is so i really dont kow

crystal sonnet
#

Programming interface @midnight gorge

quiet bough
#

hey, I need help - im trying to make my scoreboard show their luckperms rank (im using luckperms bungee version), but im not sure what the method is

#

tried looking on github, but didnt find anything that helped me

crystal sonnet
#

what method @quiet bough

quiet bough
#

like, im trying to show the rank on the scoreboard

#

not method

#

but

#
    for (String group : possibleGroups) {
        if (player.hasPermission("group." + group)) {
            return group;
        }
    }
    return null;
}```
#

I found this on the Developer API usage on github, but that doesnt help me for my scoreboard

crystal sonnet
#

Get a LP User object and get their primary group

quiet bough
#

this is my first time using the API, so how would I do that? xd

crystal sonnet
#

Check the wiki

quiet bough
#

alright

#

thanks for the help

crystal sonnet
#

You're welcome

#

Btw, make sure you include either the source or javadoc of the API in your IDE, so you can see the docs of the methods and classes

quiet bough
#

alright

#

thanks!

#

@crystal sonnet where do I get regular lp support?

frank driftBOT
#

Hey AJ! Please don't tag staff members.

quiet bough
#

my bad clippy

crystal sonnet
nocturne elbow
#

BrainStone, help plz

crystal sonnet
#

@nocturne elbow your switch statements doesn't have break statements

#

And btw, you really should wrap that try catch block around the whole switch statement instead of around each call

nocturne elbow
#

okey, sorry for dumb quest...
thnx

crystal sonnet
#

It's highly recommended you properly learn Java before writing plugins

#

MC plugins are one of worst ways to get started with programming

nocturne elbow
#

I learn java through writing plugins ;D

crystal sonnet
#

Terrible idea

nocturne elbow
#

i know

nocturne elbow
#

Why does this code not set the primary group?

    public static void setGroup(Player plr, String group) {
        User user = api.getUser(plr.getUniqueId());
        user.setPrimaryGroup(group);
        
        api.getUserManager().saveUser(user);
    }```
crystal sonnet
#

@nocturne elbow because by default the primary group is calculated

nocturne elbow
#

How can I set it? Or I definitely have to use user.setPermission(/group perm/);?

crystal sonnet
#

If you want to add a group to a player, then you have to add the respective node

#

And if you want to set it, then you have to remove all other group nodes

#

The wiki has plenty of usage examples

nocturne elbow
#

So if I want players have only one group then before I set it I have to remove other groups that he has?

crystal sonnet
#

Yes

nocturne elbow
#

Okay, I think I am done with it.
Do you change anything on this?

    public static void setGroup(Player plr, String group) {
        if(api.getGroupManager().getGroup(group) == null) {
            return;
        }
        
        User user = api.getUser(plr.getUniqueId());
        
        Set<String> groups = user.getAllNodes().stream().filter(Node::isGroupNode).map(Node::getGroupName).collect(Collectors.toSet());
        
        for(String groupname : groups) {
            Node node = api.getNodeFactory().makeGroupNode(groupname).build();
            
            user.unsetPermission(node);
        }
        
        Node finalnode = api.getNodeFactory().makeGroupNode(group).build();
        
        user.setPermission(finalnode);
        
        api.getUserManager().saveUser(user);
    }
crystal sonnet
#

Yeah, Combine getting and removing the group nodes into one step.

#

So instead of

        Set<String> groups = user.getAllNodes().stream().filter(Node::isGroupNode).map(Node::getGroupName).collect(Collectors.toSet());
        
        for(String groupname : groups) {
            Node node = api.getNodeFactory().makeGroupNode(groupname).build();
            
            user.unsetPermission(node);
        }

do

user.getAllNodes().stream().filter(Node::isGroupNode).forEach(user::unsetPermission);
#

@nocturne elbow

nocturne elbow
#

Okay, thanks.

chrome coral
#

how to grant a group using the api? adding the permission node didnt work

fair herald
#

how i can set group on players?

crystal sonnet
#

@chrome coral don't cross post

chrome coral
#

Essentials.instance.luckApi.getUser(player.getUniqueId()).setPermission(Essentials.instance.luckApi.getNodeFactory().newBuilder("group.regular").build());

#

@crystal sonnet is that correct?

frank driftBOT
#

Hey DerWand the mighty Intellectual! Please don't tag staff members.

crystal sonnet
#

Yes and no

#

For one, there's a node builder method for group nodes. But what you did works too

chrome coral
#

i think i saw the "group.regular" node in the editor but it doesnt show up with user info as a group

crystal sonnet
#

The next thing is (as mentioned in #support-1) you are not saving the changes

#

So check the Dev page on the wiki

#

@fair herald also do that 👆🏼

chrome coral
#

saveUser?

crystal sonnet
#

Yes

chrome coral
#

thanks

fair herald
#

ok

#

tnx for help

crystal sonnet
#

Why do I even have to tell you to read the docs is the more pressing question

fierce dew
#

how do i obtain context for a group

chrome coral
fierce dew
#

Ctrl + F

#

@chrome coral

chrome coral
#

thats the browser search ...

fierce dew
#

thats the search in the opened page

chrome coral
#

doesnt help me

fierce dew
#

the top right

#

Ctrl + F

chrome coral
#

okay now tell me where userloadevent appears

chrome coral
#

i dont have that kind of a browser, okay?

fierce dew
#

hold on

#

ok go me.lucko.luckperms.api.event.user and there it is

#

@chrome coral thats google chrome lol

chrome coral
#

yes lol i dont have it

fierce dew
#

then download it

chrome coral
#

no thank u

fierce dew
#

if you use edge or IE -_-

#

or you were living in a cave for the last 11 years

#

and dont know what google chrome is

chrome coral
#

i know what google chrome is

#

but this isnt about the api anymore

fierce dew
#

for UserLoadEvent you go me.lucko.luckperms.api.event.user and there it is

chrome coral
#

is it possible that the example there is out of date?

    // get the LuckPerms event bus
        EventBus eventBus = api.getEventBus();

        // subscribe to an event using a lambda
        eventBus.subscribe(LogPublishEvent.class, e -> e.getCancellationState().set(true));

        eventBus.subscribe(UserLoadEvent.class, e -> {
            System.out.println("User " + e.getUser().getName() + " was loaded!");
            if (e.getUser().hasPermission("some.perm", true)) {
                // Do something
            }
        });
fierce dew
#

its not outdated

chrome coral
#

hasPermission doesnt work for me with a string and a boolean

fierce dew
#

then use regular player's hasPermission

chrome coral
#

the question was wether it is out of date

#

or not

fierce dew
#

is this the right way to obtain group prefix?

    Node prefixNode =
        asLuckPermsGroup.getOwnNodes().parallelStream().filter(Node::isPrefix).findFirst().get();
    return prefixNode.getTypeData(PrefixType.KEY).get().getPrefix();
crystal sonnet
#

@fierce dew what do you mean with “context for a group”?

fierce dew
#

nothing

#

is this the right way of getting group's prefix

#
    Node prefixNode =
        asLuckPermsGroup.getOwnNodes().parallelStream().filter(Node::isPrefix).findFirst().get();
    return prefixNode.getTypeData(PrefixType.KEY).get().getPrefix();
#

??

crystal sonnet
#

Nope

#

There should be a method on both groups and users to get it directly

fierce dew
#

there's getDisplayName

#

on group

crystal sonnet
#

Or if not, get the cached data and get it from there

fierce dew
#

how to get the cached data??

crystal sonnet
#

It’s a method

fierce dew
#

oh yh

#

now what

crystal sonnet
#

One sec

fierce dew
crystal sonnet
#

Get the metadata

fierce dew
#

how to get contexts??

crystal sonnet
#

And that gives you the context

#

One sec

#

Check the context class

#

There are several options

fierce dew
#

Contexts.GLOBAL ??

crystal sonnet
#

There should be one that accepts all

#

But essentially use whatever suits you best

valid turtle
#

how do I add someone to a group?

crystal sonnet
#

@valid turtle give them the group node

#

The wiki has a few good pages on the API

valid turtle
#

ok, ty!

tired pond
#

!contexts

#

!context

frank driftBOT
zenith linden
#

Can someone remake this, but using LuckPErms API?

#
for (char value = 'A'; value <= 'Z'; value++){
                    p.chat("/lp creategroup " + value);
                    p.chat("/lp group " + value + " setdisplayname " + value);
                    p.chat("/lp group " + value + " meta setprefix 1 &8[&a" + value + "&8]&f");
                    p.chat("/lp track prison append " + value);
                    p.chat("/lp group " + value + " parent set A");
                }
                for (int i = 1; i <= 20; i++) {
                    p.chat("/lp creategroup " + i);
                    p.chat("/lp track prestige append " + i);
                    p.chat("/lp group " + i + " meta setprefix 1 &7[&6" + i + "&7]&f");
                    p.chat("/lp group " + i + " parent set A");
                    p.chat("/lp group " + i + " permission set some.shopmultiplier.p" + i);
                }```
#

or show me some things with luckperms api so i can learn how to use it

white crater
#

!wiki

frank driftBOT
white crater
#

There’s a section regarding the API and use cases

spring helm
#

Hello,
How can I query if a player has a specific group?

half bolt
#

@spring helm asked right after "There’s a section regarding the API and use cases"

#

!wiki

frank driftBOT
half bolt
#

:>

serene haven
#

i'm sooo confused by usage

#

how do i check if a player has a permission in the current server context

#

I'll just try the suggested method

old relic
#

Lp user <ign> permission i

hollow horizon
#

Are you able to get a permission from an OfflinePlayer using the LuckPerms API?

nocturne elbow
#

Yes, by uuid

rotund light
#

I checked the wiki but didn't understand.
How do I change data such as suffix and prefix using the API?

next wren
#

How do I get fetch when someone gets their group removed?

next wren
#

what event should I use for that?

maiden vault
#

Hello, how i can ser the primary group of player ?

I have try with group getName, getFriendlyName,getDisplayName and getObjectName but this always return FAIL when call setPrimaryGroup.

Note: i am on bungee

Thanks for your help

crystal sonnet
#

Now what are you expecting setting the primary group to do @maiden vault ?

#

@rotund light there should examples for just that

maiden vault
#

@crystal sonnet I use the primary group for use the prefix of that role

frank driftBOT
#

Hey orblazer! Please don't tag staff members.

crystal sonnet
#

Btw, is it "how i can see the primary" or "how i can set the primary"?

maiden vault
#

how i can set, because i need that for an command promote player event if offline on bungee

crystal sonnet
#

So you want to change someone's group or add a group to someone?

#

That's not what setting the primary group does

#

The primary group is the group that LP returns to the question "which single most important group does the player have"

#

Setting it will only change which of the several groups a player has is that group

#

It will not add or set a different group @maiden vault

#

The wiki has a developer guide

#

Which also explains how to add and set groups

maiden vault
#

ok, if i want define group to player like VIP i need pass by the permission and i need manually remove other groups

crystal sonnet
#

Yes