#luckperms-api

1 messages · Page 52 of 1

nocturne elbow
nocturne furnace
#

How do I remove the player from the group? please

#

user.removeGroup(g)

#

user.setPrimaryGroup(g) ?

nocturne elbow
#

Build and InheritanceNode for that group, and call remove(node) on user.data()

nocturne elbow
serene saffron
#

https://pastebin.com/UaJ7auJq

On line 52 I'm getting a Unhandled exception executing command error, have no idea why. Yes, I read the wiki but I also have 30 IQ so

nocturne elbow
#

err, and what's the error?

serene saffron
nocturne elbow
#

Yeah but like, is there no stack trace?

#

That can't possibly be the single thing about the error

serene saffron
#

Hold on imma reread the wiki and then ill ask my question again if i still cant get it working

#

I mightve just found something on the wiki

nocturne elbow
#

🤨

hybrid panther
#

🤨

night pier
#

🤨

unreal mantle
#

🤨

clever zodiac
#

🤨

uncut badge
#

🤨

spiral oasis
#

hello, i'm new at APIs and i was trying the lp one.

#

here i was in the docs, and i was wondering how to get the luckperms instance

unreal mantle
spiral oasis
#
        if (provider != null) {
            LuckPerms api = provider.getProvider();```
#

yeah i did that

spiral oasis
#

cause luckperms.getPlayerAdapter ecc... is not working

#

(i'm new at spigot dev lol)

unreal mantle
#

All I did is make a private variable for luckperms, then create a getter for it, and initialize that variable with the = provider.getProvider()

#

Then just call the getter

spiral oasis
#

uh. can you show me an example pls?

#

wait like this?

unreal mantle
#

Remove the LuckPerms from the LuckPerms api =...

#

since you already have LuckPerms api at the top

spiral oasis
#

then its done like this?

unreal mantle
#

Then you can just create a getter for the variable and then you can call the getter whenever you need to use the api

spiral oasis
#

oh yeah its working now. tysm ^^

unreal mantle
#

You should look at using Dependency injection though, instead of static 😉

spiral oasis
#

hello again! i was wondering how to add a user to a group.. i tried by doing java user.setPrimaryGroup(group) but it isnt working

#

can anyone help me about this?

sudden pelican
#

!cookbook

frank driftBOT
spiral oasis
#

thankyou!

graceful wing
#

Hello

unreal mantle
spiral oasis
#

guys, i want to make a listener that runs when a rank ("diamond") expires from a player

#

what's the eventclass called?

unreal mantle
#

NodeRemoveEvent

spiral oasis
#

thank you ^^

#

when i register the event it gets me this

spiral oasis
#

nvm, i fixed

silk star
#

Good morning! Is it possible to find out the remaining time from a temporary group of a user?

edgy slate
#

My function #refresh should be triggered when a user gets a new group or loses one, right? Because exactly this does not happen.

package de.playunlimited.limitdiscord.bungeecord.listener;

import de.playunlimited.limitdiscord.bungeecord.BungeeCordPlugin;
import de.playunlimited.limitdiscord.bungeecord.mysql.MySQLApi;
import de.playunlimited.limitdiscord.discord.action.SyncRoles;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.event.EventBus;
import net.luckperms.api.event.node.NodeAddEvent;
import net.luckperms.api.event.node.NodeRemoveEvent;
import net.luckperms.api.model.user.User;
import net.md_5.bungee.api.plugin.Plugin;

public class LuckPermsListener {

    public LuckPermsListener() {
        LuckPerms api = LuckPermsProvider.get();
        EventBus eventBus = api.getEventBus();
        Plugin plugin = BungeeCordPlugin.getPlugin();
        eventBus.subscribe(plugin, NodeAddEvent.class, event -> refresh((User) event.getTarget()));
        eventBus.subscribe(plugin, NodeRemoveEvent.class, event -> refresh((User) event.getTarget()));
    }

    private void refresh(User user) {
        System.out.println("refresh process");
        if (user != null) {
            System.out.println("user is not null");
            String uuid = user.getUniqueId().toString();
            if (MySQLApi.getMySQLApi().isVerified(uuid))
                SyncRoles.syncRoles(uuid);
        }
    }

}
proven igloo
#

Are questions about a Java plug-in code also answered here? I have the problem that when I query the permissions like this:
if (player.hasPermission ("command.use")) { }
Tabbing works, but when I want to do it through another class, tabbing doesn't work.

For example:
if (player.hasPermission (PermissionClass.command1)) { }

Authorization class would be:
public static String command1 = "command.use".

#

By tabbing I mean, for example:
/lp user Bapty permission set comma -> tab (for command.use)

nocturne elbow
silk star
#

I'll do, thank you

gilded salmon
#

rate my cringy variant (and unsafe likely) 😄

public static Instant getExpire(String playername, String node) {
        User user = LuckPermsProvider.get().getUserManager().getUser(playername);
        return user.getNodes().stream()
                .filter(n -> n.getKey().equals(node) && n.hasExpiry())
                .findFirst().get().getExpiry();
}
silk star
#

why unsafe?

gilded salmon
#

It' not tested and I'm sure there are several nullpointer exceptions may be here.

turbid solar
#

user can be null, and the node might not exists

#

And LuckPermsProvider could technically be null

jaunty pecan
#

register them in your plugin.yml

proven igloo
jaunty pecan
#

?

#

that's the only way to tell the server / other plugins about the permissions in your plugin

proven igloo
#

if(player.hasPermission("")){}

jaunty pecan
#

they are functionally the same so something else must be broken or different

turbid solar
#

Did you add the permission via command before?

jaunty pecan
#

it is worth noting that after you've performed a hasPermission check at least once, LP will "know" about the permission

proven igloo
nocturne elbow
proven igloo
#

What difference does it make whether I do "if(player.hasPermission("command.use")) " or "if(player.hasPermission(CommandUtil.command1))" -> "public static String command1 = "command.use""?

nocturne elbow
#

None unless you change the field value during runtime

#

Simply changing it from passing a string literal to passing a String field doesn't make a difference

proven igloo
#

But I would like to have all permissions queried via a central class.

nocturne elbow
#

Then do that

#

It literally makes no difference

#

they are functionally the same so something else must be broken or different

proven igloo
#

Yes, but what is that supposed to be?

nocturne elbow
#

I don't know, it's your codebase, not ours

proven igloo
#

But if it's the same it doesn't make any sense.

nocturne elbow
#

From what you've shared, that works fine and LP will suggest it fine

#

They're literally the same thing

#

It's time for you to debug, add print statements at every step, ideally attach a debugger and see the state of the whole thing from your ide as it's running, keeping to repeat the same thing to us doesn't change how Java works and that it's your code with your changes, we don't know them

proven igloo
#

I just tried again and now it suddenly works. Please excuse me. Thank you very much for your effort.

proven igloo
#

I didn't pay attention to that ... I tried right at the beginning and it just didn't work ... I'm sorry.

#

Thanks very much!

jaunty pecan
#

yep!

#

cool, no worries

clever lichen
#

How do i get all the groups in a server into an array?

unreal mantle
#

GetgroupsManager getloadedgroups or something can't remember the exact method call but I know you need to use getgroupmanager

clever lichen
#

are all groups loaded by default?

unreal mantle
#

Yeah

clever lichen
#

nvm

#

found it

twilit jasper
#

is there a way I can get the user's current group in a specific track

#

also, how can I determine which track a group belongs to

shy widget
# twilit jasper is there a way I can get the user's current group in a specific track

If you're looking for the highest group a user has on a track, I currently use

    public Optional<Group> getTopGroup(User user, Track track) {
        SortedSet<Node> allNodes = user.getDistinctNodes();
        if (!allNodes.isEmpty()) {
            GroupManager groupManager = luckPerms.getGroupManager();
            return allNodes.stream()
                    .filter(NodeType.INHERITANCE::matches)
                    .map(NodeType.INHERITANCE::cast)
                    .map(InheritanceNode::getGroupName)
                    .map(groupManager::getGroup)
                    .filter(Objects::nonNull)
                    .filter(track::containsGroup)
                    .max(Comparator.comparingInt(g -> g.getWeight().orElse(0)));
        }
        return Optional.empty();
    }
``` which works fine, though I'm not positive it's the optimal way of doing it
twilit jasper
#

thanks, I hope there's something simpler but lp sure can be verbose

shy widget
#

If there is, Cunningham's law will take over 😅

night pier
#

I see no better way that could go

unreal mantle
#

You that looks like the best way from what I can tell

#

if it works why change it xD

hollow niche
#

hey everybody, already sorry for my bad english. Also I'm a beginner with java coding... ^^

just wanted to ask if someone has a simple answer on my following problem.
Currently I'm trying to add the users current group into a scoreboard. So far, I can already seperate between someone with op
and casual players. See my code here: https://www.toptal.com/developers/hastebin/enimolohaf.less
I've already added the luckyperms api into mavens dependencies. But besides that, im stuck :D
Already read trough the wiki, but as I said, im a beginner and.. that didnt really helped me

hybrid panther
#

You’ll want to use the api to get their prefix

#

There is an example in the api wiki cookbook

hollow niche
#

which example do you mean? the one which named 'Finding a players group'?

hybrid panther
hollow niche
hollow niche
#

thats what my IntelliJ says

runic canopy
#

not a question about the API, but just question on the coding style. is there a reason why NonNull/Nullable is used in some places and not others?

nocturne elbow
#

For things like Collections/CompletableFutures/Optionals (or any kind of "value container"), it's sort of implied that they shouldn't be null… and it is kind of bad API design for those, you'd return instead an empty collection, a failed future or an empty optional

#

When returning values themselves such as Strings, you'd let the API user know whether they can get null or not

unreal mantle
#

It does get called for prefixes, show us the event code

nocturne elbow
#

that command would call the NodeClearEvent since it would remove every prefix node with that weight

#

NodeRemove is for single node removals, NodeClear for multiple

dusk bolt
#

hi

#

can i integrate this api with nameless?

#

to create a nameless module

#

i explain what i want to do

#

I have a non-premium server, and I want to link the ranks of my users with the forum, so it had occurred to me to use the integration of auth me to register, and give the ranks with the luckperms

dusk bolt
#

@hybrid pantheroh, you are here hahaha

frank driftBOT
#

Hey anchelthe! Please don't tag helpful/staff members directly.

dusk bolt
#

sorry

hybrid panther
#

i mean, you could. it would be a bit of a headache to write, but nameless provides the right api endpoints for that to be possible + obviously luckperms api makes it possible as well

dusk bolt
#

So, it is possible, but very difficult, right?

#

How much do you estimate a developer could charge me?

unreal mantle
#

Considering you're using non premium. Uuids would change every now and then and break it.

dusk bolt
#

but I could do it by usernames system

#

right?

unreal mantle
#

Non premium servers allow for users with same username.

#

Or changing usernames.

dusk bolt
#

but for that there is a login system

unreal mantle
#

Better to use a premium server.

#

Less likely it will break.

dusk bolt
#

The truth is that probably yes, but it is more difficult to grow, apart from the fact that I started as non-premium, now I cannot change ...

unreal mantle
#

Never too late to change.

dusk bolt
#

and what do I do with my users? and the people who have paid?

hybrid panther
#

daily ethics debate in luckperms

dusk bolt
#

is there always this debate?

unreal mantle
#

Idk your server. You pick. I'm only giving you advice which you asked for. Non premium servers always have a chance of breaking everything. An provide countless issues. So its your choice what you're wanting to do.

dusk bolt
#

None have arisen so far, can they appear out of nowhere in the future?

#

If I'm honest, if the server started it today, it would leave the online option to true, but now I can't do that anymore ...

unreal mantle
#

Yep. That's the unpredictability of cracked servers. A single uuid change or name change can break so much

dusk bolt
unreal mantle
#

Non premium.

dusk bolt
#

but the non-premium ones, they don't have an id registered by mojang, right?

unreal mantle
#

Premium users have a dedicated uuid that doesn't change so things go off that. Non premium can change name and uuid

dusk bolt
#

ah ok, thanks

#

well...

#

but how can you change the name of the non-premium ones? changing of acount, right?

unreal mantle
#

The client they use let's them change it.

dusk bolt
#

yea, i know

#

but that is like create a diferent acount, right?

#

they do not keep the same uuid

unreal mantle
#

I haven't used cracked clients so can't remember.

river epoch
#

hey guys im running a plugin and wanted to change the people who can use a specfic command from default to op, how do i do this 😄

dusk bolt
#

ah ok

#

Well then it can be done per username?

unreal mantle
#

Probably. But if nonpremium user name changes, it will break it for that user.

dusk bolt
#

mmmm

#

it simply loose their rank

#

i have to put a package of acount transfere on my webstore or something

#

or an area of the staff that is dedicated to that, free

#

I mean, free for the customer

#

well, no customer

#

because it is free xd

pastel cliff
#

ohh

#

i see

#

ur right

#

ahh

#

cracked servers!!!

#

yea cracked servers generate a random uuid for cracked players

turbid solar
#

Based on name

pastel cliff
#

i don’t think so

turbid solar
#

I think so

pastel cliff
#

ok

turbid solar
pastel cliff
#

ah fax

#

i only saw OfflienPlayer

#

and was oh ok then

#

you think correctly

#

i didn’t think so

#

i knew so

graceful wing
#

If I wanted to create a command like /giveytrank <player> how would I do this (using luckperms ofc)?

unreal mantle
full parrot
#

I want to luckperms autocomplete my plugin permissions on website
How I can do that?

unreal mantle
#

The LP web-editor will suggest permissions that are registered correctly and permission checks have been made for them since last restart

full parrot
#

ok

#

thx

hollow niche
# hollow niche Im trying to add those prefixes into the scoreboard since hours now, but i dont ...

regarding to my message here, I've made this post on spigotmc https://www.spigotmc.org/threads/luckperms-api-get-group-prefix-into-scoreboard.540952/#post-4336453

might anyone have a answer on that? especially my last two comments i have made are important for me ^^

unreal mantle
hollow niche
#

what exactly do you mean?

unreal mantle
#

!placeholder

frank driftBOT
unreal mantle
#

Otherwise, all you need to do is get the group, then get the cacheddata then get metadata then get prefix

#

...getCachedData().getMetaData().getPrefix()

#

@hollow niche

hollow niche
#

thank you.. ill check that

hollow niche
#

so i've installed PlaceholderAPI, the latest version of the expansion and reloaded
what do i have to do to use it in my code? do i have to import smth?

#

ah ive found its github
ill try that first :)

long abyss
#

and reloaded

#

Did you use /reload?

#

If you do never use /reload

hollow niche
#

ive used /papi reload

long abyss
#

Okay

#

Good

hollow niche
hollow niche
hybrid panther
#

You never defined the luckPerms variable

tacit sail
#

private LuckPerms luckPerms; this?

hybrid panther
#

Did you set it to something though

#

Like luckPerms = …

tacit sail
#

I have used that variable to use the methods that you see in the picture

hybrid panther
#

Ok

#

Do you get any error message when the code is ran? What is the actual problem

tacit sail
#

I want to add the permission that I add as second argument to the method to the user, I have put as it comes in the documentation but the error that I get is what you see in the hastebin that I have passed

#

It tells me that the value is null...

hybrid panther
#

Yeah you didn’t initialize the luckPerms variable to anything

tacit sail
#

And what do I have to start it? The variable is simply to call the API.

tacit sail
#

Is there any way to remove that? I have it loaded and it comes out apparently.

night pier
#

You’re softdepending LuckPermsAPI. it’s just LuckPerms

tacit sail
#

Well that's what I mean, it indicates that it is not a softdepend of my plugin, isn't it?

night pier
#

It’s not, because you’re not soft depending the right name.

tacit sail
#

What is the name I should put then?

night pier
tacit sail
#

oh ok sorry, my english is not good xD

tacit sail
#

Is there a way that instead of adding, it sets it in case there is an existing one to replace it?

turbid solar
#

!cookbook

frank driftBOT
nocturne elbow
#

Hi How to get the time of the range in days or in seconds because in case the code comes out like this when there is a range with temp 2022-01-13T

#

Code

#

if (user != null) {
for (Node node : user.getNodes()) {
score = score.replace("%rank_expire%", String.valueOf(node.getExpiry()));
}
}

#

What I want to do is make it appear in scoreboard expires: 1d (days) or Seconds

nocturne elbow
#

xd

#

help

lean egret
#

Hello

#

Is it possible

#

To make you chat color

#

like light red?

#

&c

night pier
#

LuckPerms doesn't do anything related to chat formatting, but how is this API related? thonk

lean egret
#

Idk, but that is impossible to type with color &C

#

Right?

#

@night pier so...?

frank driftBOT
#

Hey MrKebabas! Please don't tag helpful/staff members directly.

lean egret
#

Oh sorry @frank drift

night pier
#

#general, this isn't related to LuckPerms, or the API.

lean egret
#

OPS...

tacit sail
turbid solar
#

There’s an example

nocturne elbow
#

That's not something LP provides, LP gives you the Instant the node expires at or the Duration until it expires

#

You may format it however you want, but it's up to you to do

nocturne elbow
turbid solar
#

No

#

You need to handle the formatting yourself

lofty dew
#

If i update nodes for a user (like the example in the cookbook plugin's "AddPermissionCommand"), how would I go about notifying other servers of the change?
like, in the same way as the notification goes out if I were to manually do /lp user SomeUser parent add SomeGroup as a player.
The issue is that if the player connects to a server that still has data cached from a point in time before a node got added via the api (in this instance, an inheritance node), the server isn't notified and continues to use the old data.
This isn't so much an issue for servers that don't have cached data because they'll just load it from the SQL database

#

I can see in the developer-api-usage page that I can subscribe to LP's events, but not any way to send out my own

nocturne elbow
#

You need to push the changes through the messaging service

#

See ReadPins

lofty dew
#

blobcatfacepalm I checked the pins of all the other channels but this one, thanks

lethal ether
nocturne elbow
#

setting a node with a value involves removing the node with opposite value

lethal ether
#

ok, so in this case, check if the node is false?

nocturne elbow
#

if that does the job for you, absolutely

lethal ether
#

just needing to check if its false/unset, which is exactly what i wanted

nocturne elbow
#

sounds appropriate

acoustic raptor
#

I edited the luckperms plugin for my own server, but now I'm having a problem, the placeholderapi plugin gives an error

#

help pls

jaunty pecan
#

Seems like you broke it!

#

My suggestion would be to not make changes to the plugin if you don’t know what you’re doing

acoustic raptor
#

I just wanted to edit the English texts and commands and permissions in the console.

#

./lp -> /rp

#

example

opaque zealot
#

hello, I have a question, if I check for Player#hasPermission in the bungeecord api, will it check for luckperms perms?

#

someone?

#

I need this asap please

nocturne elbow
#

If you have LP on the proxy

opaque zealot
#

so it overrides it?

nocturne elbow
#

Yeah that's what LuckPerms is for

opaque zealot
#

alr thanks

nocturne elbow
#

Hi everyone I have implemented the luckperms bees and I would like to put in the events of the "onQuit" which verifies if a player has the permission if it is not there it removes it through luckperms only that reading the bees and putting only the part of the permission check doesn't work it asks me more and more cos and to import

#

// run a permission check!
Tristate checkResult = permissionData.checkPermission("some.permission.node");

// the same as what Player#hasPermission would return
boolean checkResultAsBoolean = checkResult.asBoolean();
public boolean hasPermission(User user, String permission) {
return user.getCachedData().getPermissionData().checkPermission(permission).asBoolean();
}

#

what?

nocturne elbow
#

what

#

Sorry but I don't understand what you're trying to say or do..

#

To check if a player has a certain permission if you have to remove it

acoustic raptor
wild whale
#

Once again, if you change things without knowing what you're doing, things will break.

acoustic raptor
wild whale
acoustic raptor
#

my editor subdomain is not working either

turbid solar
#

this is api support

#

for LuckPerms

clever zodiac
#

why are you attempting to rebrand luckperms ??

hybrid panther
#

fantastic question

strong ginkgo
#

Does anyone know if there is a way through the API to create a new group? I couldn't find it on the wiki. I feel like there is probably a better method than to run /lp creategroup with Bukkit.dispatchCommand() and wait a tick before trying to use the new group, but I am not sure what it is

night pier
#

I’d imagine cookbook has an example

#

!cookbook

frank driftBOT
night pier
#

Doesn’t seem like it, nevermind.

strong ginkgo
#

Yeah, I already checked. I was surprised because I assumed it's be a pretty basic thing

unreal mantle
#

getGroupManager().createAndLoadGroup(String name)

strong ginkgo
#

I swear that didn't pop up on my autocomplete when I typed in create lol. Thanks

unreal mantle
#

That will create a new group in the plugins storage provider and then load it.

#

If it already is created, it will just load it

strong ginkgo
#

Won't the rank already be loaded if it exists or no?

unreal mantle
#

Not 100% sure, but might depend if a player online is in that group, or inherits from that group

strong ginkgo
#

Alright, gotcha

unreal mantle
#

or if you are obviously editing said group, then it loads it

#

You can always check if a group is loaded with getGroupManager().isLoaded(String name)

strong ginkgo
#

I learned the hard way that LP doesn't like it if you try to use vault to add a group to a player if the group doesn't exist

unreal mantle
#

Yeah, it generally won't like that

#

That's why if you were going to use vault to add the player to a group you'd check if the group exists first

#

But if you're using LP api, just add the group to the player with that

strong ginkgo
#

Yeah but I didn't see a way with vault to create a group, hence why I am using the LP api

unreal mantle
#

Fair enough, it's pretty easy to create a group through the api

strong ginkgo
#

Well I managed to do something interesting. /lp user me info doesn't show that I am in the group I added myself to, but when my plugin checks if I have the perm for the group group.group I do

unreal mantle
#

How did you add yourself to the group

strong ginkgo
#

I made an InheritanceNode using the builder and gave it the group, then did user.data().add(node)

unreal mantle
#

Did you save the user data

#

luckPerms.getUserManager().saveUser(user);

strong ginkgo
#

Didn't realize I had to do that

unreal mantle
#

Yeah, after you modify a user you need to save it back to the storage provider

strong ginkgo
#

I guess that makes sense

unreal mantle
#

If you want, you can actually use

    luckPerms.getUserManager().modifyUser(userUuid, user -> {
        // Add the permission
        user.data().add(Node.builder(permission).build());
    });

To auto save

strong ginkgo
#

I assume I have to do the same thing if I modify a group

unreal mantle
#

Yeah, you'll need to save the group as well

strong ginkgo
#

an excuse to use a lambda, say no more

unreal mantle
#

The modifyUser method, will do the thing, then it will save at the end

hybrid panther
#

🤨

unreal mantle
#

Otherwise you can use the saveUser method

#

Upto you really how you want to do it 😛

strong ginkgo
#

Perfect, thank you

clever zodiac
#

On any platform, how can I listen to updates to users, groups, tracks, etc

unreal mantle
#

Like what? What are you wanting to do?

clever zodiac
#

Need to listen to every update to keep something in sync

short ocean
#

can i get the priority of the user's prefix?

nocturne elbow
#

%luckperms_in_group% hi when I put this API it puts "no" or "yes" how to replace by ✘

#

(ping me )

turbid solar
#

Placeholderapi question and probably not possible?

hybrid panther
#

thats not very cash money of you

sterile pike
#

so i've just realized that bukkit doesn't natively deal with or support wildcards in permissions
does luckperms inject anything such that calling bukkitPlayer#hasPermission(String permission) handles wildcards?

clever zodiac
#

That should be possible with PAPI scripts (the no to X)

wild whale
#

LP does handle wildcards, yes

tropic jewel
#

how do I look up the meta value without using the CachedData?

#

I tried the following:

user.resolveInheritedNodes(queryOptions).stream()
            .filter(NodeType.META::matches)
            .map(NodeType.META::cast)
            .filter(node -> node.getKey().equals(metaKey))
            .map(MetaNode::getMetaValue)
            .map(Integer::parseInt).reduce(Integer::sum)

but it doesn't return anything

#

nvm, got it. I needed to use getMetaKey instead of getKey

grand crater
#

Hey 👋, I was looking for a way to get a list of members sorted by their group weight and since I haven't worked with Streams before I wasn't really sure how to do it

lethal ether
#

When using the accumulate tag to add time to a already existing temporary permission, it removes and adds the permission with the new time. This also calls the NodeRemoveEvent. Is there a way to check if time is being added and/or if the time has actually ran out?

nocturne elbow
#

Node#hasExpired I think it's called?

lethal ether
#

I’ll have to give it a try

lethal ether
plain chasm
#

what method i have to use for get all the nodes that a player has and copy them in a new user?

#

this is what i done

        LuckPerms lp = LuckPermsProvider.get();
        UUID oldUUID = UUID.fromString(args[1]); // the UUID of the player from which we will take the data
        UserManager userManager = lp.getUserManager(); 
        User newUser = lp.getPlayerAdapter(Player.class).getUser(target); //gets the "target" user what will receive the data from "oldUser"
        CompletableFuture<User> oldUserFuture = userManager.loadUser(oldUUID); 
        oldUserFuture.thenAcceptAsync(oldUser -> {
            //What to do now?
            Collection<Node> oldNodes = oldUser.getNodes();
        });
glad skiff
#

how can I convert mysql database to h2?

#

and vice versa

turbid solar
#

or 2

nocturne elbow
#

jaja discrods.gift

main dagger
#

i wont be surpised if nobody is able to help with this but im using grakkit and when i try to use the luckperms api in a certain command i have it works perfectly fine, but in a different one calling the api with basically the same code causes .getUserManager().modifyUser(uuid, function) to never call my function. in my /nick command i the setLPMeta function (the code of which is attached in a screenshot) with setLPMeta(sender, "nickname", nick) where sender is the player who sent the message and nick is just a string with the nick they want, and this works fine, but in my /infolocation command i call it with setLPMeta(sender, 'tdmsinfo', 'sb') (again with sender being the player) and this seems to only work sometimes, doing nothing most of the time. the attached log you can see that the all the logs statements get run when i do the /nick command, but when i do /infolocation it never runs the one inside the modifyUser call that logs the user object. im stumped as to why it works in once place but not another

turbid solar
#

Yes

old sky
#

How can I change the prefix of a player / group (whichever is easier)

hybrid panther
#

thats not very cash money of you

old sky
#

either way works ¯_(ツ)_/¯

agile gorge
#

Hello, with the LuckPerms API if i have a User Object, can i retrieve all their groups?

#

I am aware there is a getPrimaryGroup(); But i want to retrieve all of them

#

disregard i figured it out thank you

nocturne elbow
#

You're welcome!!

agile gorge
#

lol

#

Never used the stream API before its pretty neat

hybrid panther
#

streams can be beautiful if written well

agile gorge
#

Is there any relationships of a group to track? So lets say i have group A can I determine the tracks its on?

nocturne elbow
#

The group doesn't know in what tracks it's in

#

A Track is basically a List<Group>

#

With some funny methods to make things a tad easier

#

That reminds me: reminder to self: improve track API too

hybrid panther
#

mod abuse pinning

night pier
#

Based

nocturne elbow
turbid solar
#

Could look at /lp listgroups code? Iirc that shows the tracks a group is in

agile gorge
#

Im new to the API however, it would be useful it seems with the stream API to be able to use make use of the track. So like there are InheritanceNodes is it possible for a like a TrackNode?

#

obviously i don't know how it is designed so i may be wrong on this lol

hybrid panther
#

what does the stream api have to do with Tracks 🤨

nocturne elbow
#

Nah, tracks are essentially a "simple" way for end users to have a promotion system, all it does is "remove the previous InheritanceNode and add the next one"

agile gorge
#

ah okay

#

For anyone wondering seems like this is how they get the TRACKS FOR A GROUP lol

List<String> tracks = allTracks.stream().filter(t -> t.containsGroup(group)).map(Track::getName).collect(Collectors.toList());
nocturne elbow
#

You mean the tracks for a group? 😄

agile gorge
#

sorry im all over the place LOL

nocturne elbow
#

Lmao it's fine

glacial oriole
#

Guys i cant understand how to get a LuckPerm instance inside my Spigot plugin

#
PluginManager pm = Bukkit.getServer().getPluginManager();
        if (pm.isPluginEnabled("LuckPerms")) {
           ConsoleUtils.logInfo("Hooked LuckPerms.");
            RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
            if (provider != null) {
                this.luckPermsApi = provider.getProvider();
            }
        } else {
            ConsoleUtils.logInfo("Can't hook LuckPerms.");
        }
``` this is what i did so far
lofty dew
#
// in onEnable()
LuckPerms luckperms = getServer().getServicesManager().load(LuckPerms.class);

Is how I load it in my plugin, which i believe is how the wiki used to show it but now it's not... I've looked back through the commit history for the wiki, and nothing mentions changing of the way to get the luckperms api so I have no idea how i got my code to work...

#

it is entirely possible that i'm doing something the wrong way so my solution might not be correct

glacial oriole
#

now if i try to access GroupManager from luckperms instance i can't

glacial oriole
#

I am following the code written in the documentation but it is not working

lofty dew
#

other than the difference in how we get the LuckPerms variable, you're doing the same as what my code does and that isn't flagging up any warnings... Try restarting your IDE? I've had Idea tell me something isn't defined or whatever and a restart usually forced it to re-index stuff properly

glacial oriole
#

let me try

#

nop

#

the only thing you included in your pom.xml is:

<!-- https://mvnrepository.com/artifact/me.lucko.luckperms/luckperms-api -->
        <dependency>
            <groupId>me.lucko.luckperms</groupId>
            <artifactId>luckperms-api</artifactId>
            <version>4.0</version>
        </dependency>
lofty dew
#

ah

glacial oriole
#

right?

lofty dew
#

API is at version 5 now

#

which might explain the issues you're getting if it's pulling an old API down

#

is how i've got it set up

glacial oriole
#

oh right, i just copied and paste from mvn central

#

now works, thank you 😄

lofty dew
#

No problem blobcathappy

glacial oriole
#

do you have an idea on how to get the "highest" rank for a player?

#

ex. if a player has Groups "User" and "Vip", i want to get "Vip" (which is higher)

nocturne elbow
#

get the primary group name from the user, get the group from the groupmanager, get its weight

glacial oriole
#

thank you

nocturne elbow
#

perhaps this one is easier user.getPrimaryGroup()

#

since apparently thats a thing

glacial oriole
#

how can i get the user?

#

#getUserManager i think

lofty dew
nocturne elbow
lofty dew
#

The way my plugin gets the class is different than what the wiki shows

#

Which confused me as to how I managed to get a working instance the way I did but the API cookbook also does it the way I do it

#

(hopefully that made sense)

glacial oriole
#
if (plugin.getLuckPermsApi() != null) {

                net.luckperms.api.model.user.User luckUser = plugin.getLuckPermsApi().getUserManager().getUser(p.getName());

                if (luckUser != null) {
                    embedMsg.addField("Rank", luckUser.getPrimaryGroup(), false);
                }
            }

java.lang.NullPointerException: Cannot invoke "net.luckperms.api.model.user.User.getPrimaryGroup()" because "luckUser" is null
How is this possible?

turbid solar
#

Is the user online?

glacial oriole
#

no

turbid solar
#

Well that would do it

#

Load the user

glacial oriole
#

how can i check for offline users?

turbid solar
#

you can just load the user

#

If you want

glacial oriole
#

how?

turbid solar
#

loadUser

#

!api

frank driftBOT
glacial oriole
#

thank you

nocturne elbow
#

Is there a way of getting the default context set? I'm basically trying to recreate the behavior of the various set commands when you don't pass in contexts, which use the contexts.json default-contexts

#

@ Luck blushu

#

The QueryOptionsRegistry::defaultContextualOptions' context set is empty, uh

jaunty pecan
#

I kinda regret that feature

#

Or rather, regret how it was implemented

#

contexts.json shouldn’t be a thing really

#

And all that stuff should just be in the main configuration file

#

I think the reason I did it that way was because bukkits config library didn’t support what I needed in a nice way

jaunty pecan
#

the server name + static contexts are I think the only exceptions to that rule

nocturne elbow
#

hmmm

ivory sand
#

im using the luckperms api right now to get uuids from usernames for my whitelist plugin, but is there one like UserManager#loadUser or something that can look it up for users that haven't joined before?

turbid solar
#

No

#

Your platform should handle that

ivory sand
#

i'm using velocity

turbid solar
#

Then query the Mojang api

ivory sand
#

ok

cobalt venture
#

!api

frank driftBOT
agile gorge
#

Hi question, i can't seem to find it. But what determines if it is a players primary group?

#

Cause i may think the way im determining getPlayerPrimary(group) is the wrong group 😮

wild whale
#

By default, the highest weighted group a user inherits is their primary, although this is modifiable in the config. You can easily check which group LP thinks is someone's primary w/ /lp user <who> info

agile gorge
#

Okay thank you, that makes sense. I think im just going to get the players groups then the track im looking for then to ensure i don't get the weight of a group not on that track

signal hemlock
#

hi

turbid solar
#

?

cerulean apex
#

any one know why luckPerms.getGroupManager() is null?
full code:

public static boolean addPlayerToGroup(OfflinePlayer player, String group) {
        **Group newGroup = luckPerms.getGroupManager().getGroup(group);**
        if (newGroup == null) {
            return false;
        }

        String playerName = player.getName();
        if (playerName == null) {
            return false;
        }
        User user = luckPerms.getUserManager().getUser(playerName);
        if (user == null) {
            return false;
        }

        InheritanceNode node = InheritanceNode.builder(group).build();
        DataMutateResult result = user.data().add(node);
        if (result == DataMutateResult.FAIL) {
            return false;
        }

        luckPerms.getUserManager().saveUser(user);
        return true;
    }

    public static User getUser(UUID uniqueId) {
        UserManager userManager = luckPerms.getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);

        return userFuture.join();
    }

(i have the LuckPerms luckPerms = new LuckPerms() and all the other stuff)

nocturne elbow
#

you have the what?

hybrid panther
#

🥲

clever zodiac
#

you create a new luckperms instance?

#

who hit you on the head because that is definitely not how you use an API

#

!cookbook

frank driftBOT
clever zodiac
#

@cerulean apex

cerulean apex
#

wht

#

wait

cerulean apex
neon sparrow
#

thats not how you get a luckperms instance at all

clever zodiac
#

im like dying right now

#

who told you to ever do that

#

and of course it returns null if your anonymous class returns null

neon sparrow
#

just what i was typing out lmao

cerulean apex
#

okokok
now that its working I need help with removing some one from a group

cerulean apex
#

nvm

bold plover
#

Does UserManager::searchAll work on offline users, and if so is there a method that only works on online ones? Just trying to grab all users who inherit a group and update some cached values based on meta

umbral wagon
#

Hello!
I am trying at the moment to get the groups of a player, that are direct linked. No inherits.
I saw something about the Flag.RESOLVE_INHERITANCE but I am not sure where to set that.
Is there some link to look that up or does anyone have some small codeline?

EDIT: NVM. I think I just found it....

soft lagoon
#

How do I access to the repo?

#

there is nothing abt it in the wiki

unreal mantle
frank driftBOT
runic canopy
#

not exactly a question about the api, but where are luck perm users/players cached?

nocturne elbow
#

AbstractManager (which is extended by.. managers, among them there's the AbstractUserManager, extended by StandardUserManager)

#

then there's the UserHousekeeper which handles the scheduled user unloading

storm relic
#

!api

frank driftBOT
mild kraken
#

is this call expensive to do? Might want to use ContextSet but now sure how I would perform the permission lookup

#

Player p = event.getPlayer();
LuckPerms api = LuckPermsProvider.get();
User user = api.getPlayerAdapter(Player.class).getUser(p);
String permissionMultipler = user.resolveDistinctInheritedNodes(QueryOptions.nonContextual()).stream().map(Node::getKey).filter(permission -> permission.startsWith("bigdrop.multiplier.")).findFirst().get();

mild kraken
nocturne elbow
#

that's exactly what meta nodes are for

mild kraken
#

oh I see, I just need to convert all the permissions to meta

wintry pier
#

is it possible to sync the perms from the database with the api?

#

like do /lp sync without executing the command?

nocturne elbow
#

LuckPerms#runUpdateTask
Note that that's just (the equivalent of) /lp sync and not /lp networksync which propagates the task throughout the network, for that you'd have to runUpdateTask + get the MessagingService and call #pushUpdate (ReadPins)

wintry pier
nocturne elbow
#

I mean

#

when it syncs depends on what is being done

wintry pier
#

adding a group etc

#

its just not workin

nocturne elbow
#

that will sync by default

#

but there are like a bajillion settings controlling how syncing works

#

trying to work around that with a custom made plugin may or may not yield the same result

wintry pier
#

i tried setting auto-sync or what its called to 3, maybe it works then

nocturne elbow
#

¯_(ツ)_/¯

#

pluginmsg requires players to be online for the message to be propagated, both in the server that runs the task and in the server that will receive the update message
auto-push-updates should be set to true, and it is by default
sync-minutes set as -1 is fine for most people as it will just push/pull updates as necessary (when changes are made)

#

in general if you're using sql-based storage (postgresql, mariadb, mysql), setting it to sql is more than enough
for other cases (mongodb) personally I suggest redis or rabbitmq, I myself am not super keen about pluginmsg, it's not my jam

wintry pier
#

and then it doesnt get synced

nocturne elbow
wintry pier
#

thx

last merlin
#

yo im tryna loop through offline players using uuid and checking if their group/them have permissions but its not working as expected can anyone help me

hybrid panther
#

what do you expect it to work like

#

how is it currently working

#

share code

last merlin
#
if(resultSet.next()) {
                String uuid = resultSet.getString("uuid");
                System.out.println(uuid);
                plugin.getLuckPermsApi().getUserManager().loadUser(UUID.fromString(uuid)).thenAcceptAsync(user -> {
                    user.getNodes(NodeType.PERMISSION).forEach(p -> {
                        System.out.println("passed 1");
                        if(p.getValue()) {
                            System.out.println("passed 2");
                            if(p.getPermission().equals("mcevents.staff")) {
                                System.out.println("passed 3");
                                try {
                                    System.out.println("adding " + UUID.fromString(uuid));
                                    staffTime.put(UUID.fromString(uuid), resultSet.getInt("playtime"));
                                } catch (SQLException e) {
                                    e.printStackTrace();
                                }
                            }
                        }
                    });
                });
            }
#

weird

#
                while(resultSet.next()) {
                    String uuid = resultSet.getString("uuid");
                    System.out.println(uuid);
                    plugin.getLuckPermsApi().getUserManager().loadUser(UUID.fromString(uuid)).thenAcceptAsync(user -> {
                        user.getNodes(NodeType.PERMISSION).forEach(p -> {
                            System.out.println("passed 1");
                            if(p.getValue()) {
                                System.out.println("passed 2");
                                if(p.getPermission().equals("mcevents.staff")) {
                                    System.out.println("passed 3");
                                    try {
                                        System.out.println("adding " + UUID.fromString(uuid));
                                        staffTime.put(UUID.fromString(uuid), resultSet.getInt("playtime"));
                                    } catch (SQLException e) {
                                        e.printStackTrace();
                                    }
                                }
                            }
                        });
                    });
                }
            }
#

gonna try this

#

only loads one or two players

nocturne elbow
#

uh...

last merlin
#

[20:24:11] [ForkJoinPool.commonPool-worker-15/INFO]: passed 1
[20:24:11] [ForkJoinPool.commonPool-worker-15/INFO]: passed 2

nocturne elbow
#

loading the user is done async and your processing happens both in another thread and at a later time

#

that is to say you're basically fucking up all your resultset usage

last merlin
#

oh

#

any recommendations

nocturne elbow
#

are you trying to get all users that have a certain permission?

last merlin
#

yes

#

i could loop through people with permission then get them from db

nocturne elbow
#

yep, UserManager#searchAll, then process all of them against your db

last merlin
#

any examples

nocturne elbow
#

!cookbook

frank driftBOT
nocturne elbow
#

there's a "group members command" example in there that uses the searchAll function

last merlin
#

How could I get it from group

nocturne elbow
#

what

last merlin
#

like get all players that have that permission nomatter if its from group or just user

nocturne elbow
#

yeah no there's no such thing, searchAll looks up those that have the permission in their own data, not inherited

last merlin
#

any idea wat i could do

nocturne elbow
#

mm not without loading every single user to check

last merlin
#

i wanted to just loop on start to find all staff and add them to an arraylist

#

how would i do that

nocturne elbow
#

ideally you'd check if they have the permission as they log in tho

#

do you really need ALL of the UUIDs at ALL times? before during and after they're playing?

hard wharf
#

How i can get all player uuid in a group?

cursive tinsel
#

Through the api, say I have the messaging-channel set to bungee. how do I see if player has permission {x} on server1 so i can grant them access to {y} on server2

unreal mantle
cursive tinsel
unreal mantle
#

!sync

frank driftBOT
unreal mantle
#

!context

frank driftBOT
cursive tinsel
cursive tinsel
#

When I type the command with server in it, how do I actually sync that with the hub or is it like that by default ?

unreal mantle
#

You need to make sure they are connected to the same remote database, and you have luckperms on all servers.

cursive tinsel
#

Oh database alright, I just had it still set to lily pad

bold plover
#

whats up with the display_name node type? cant find any obvious way to use it, atleast in the same manner of prefix and suffixes

nocturne elbow
#

the displayname is used instead of the actual group name wherever a group name would be returned

bold plover
#

Oh, so not for players? makes sense

#

Would be cool if it could be used on a player like the prefix and suffix so you could grab that easily if you are making a chat plugin.
Was playing around with a forge based chat formatter and saw that , couldn't find any documentation on it figured it could be used like prefix and suffix types

#

Ended up just making my own meta key for it

nocturne elbow
#

since lp works with vault, the vault placeholder %vault_rank% should return the group name. ofc you can only use this in chat if your chat plugin has support for it. most, like for instance essentials, introduce their very own which also hook directly into vault, for essx, that would be {group}.

sudden fractal
#

How do i use bungee api

#

where do i put
LuckPerms api = LuckPermsProvider.get();

wild whale
#

Where you put it depends on how you want to lay out your plugin

#

If you mean like "where in the class do I put it", LP API is not for java newbies,

sudden fractal
#

its just my first plugin so i just use main class

turbid solar
#

in onEnable

sudden fractal
sudden fractal
#

cycle through all roles they have and do something

turbid solar
#

You need to import it

#

!api

frank driftBOT
sharp summit
#

How can I check if a group has been modified, in terms of the prefix? I have already used an event, for the overview here already once the code to it:

        final LuckPerms api = LuckPermsProvider.get();
        api.getEventBus().subscribe(LimitProxy.getPlugin(), NodeAddEvent.class, event -> {
            if (!event.isUser()) return;
            final Node node = event.getNode();
            if (node instanceof InheritanceNode) {
                final ProxiedPlayer player = ProxyServer.getInstance().getPlayer(((User) event.getTarget()).getUniqueId());
                if (player != null) {
                    updatePlayerPermissionGroup(player);
                    ProxyServer.getInstance().getConsole().sendMessage("NodeAddEvent, update team info");
                }
            }
        });
turbid solar
#

check if the node is instanceof PrefixNode? iirc that's one

#

d;lp PrefixNode

slate deltaBOT
#
public interface PrefixNode
extends Builder>```
PrefixNode has 2 methods, 1 extensions, and  5 super interfaces.
Description:

A sub-type of Node used to store prefix assignments.

sharp summit
#

thanks 🙂

#

one more question,. how can i get the node from NodeMutateEvent

#

Ehm, he doesn't trigger on prefix change?

    public ScoreboardStyle() {
        final LuckPerms api = LuckPermsProvider.get();
        api.getEventBus().subscribe(LimitProxy.getPlugin(), NodeAddEvent.class, event -> {
            final Node node = event.getNode();
            if (node instanceof InheritanceNode) {
                if (!event.isUser()) return;
                final ProxiedPlayer player = ProxyServer.getInstance().getPlayer(((User) event.getTarget()).getUniqueId());
                if (player != null) {
                    updatePlayerPermissionGroup(player);
                    ProxyServer.getInstance().getConsole().sendMessage("NodeAddEvent, update team info");
                }
            } else if (node instanceof PrefixNode) {
                if (!event.isGroup()) return;
                final Group group = (Group) event.getTarget();
                updatePermissionGroupMeta(group);
                ProxyServer.getInstance().getConsole().sendMessage("NodeAddEvent:PrefixNode, update team META");
            }
        });
        api.getEventBus().subscribe(LimitProxy.getPlugin(), NodeRemoveEvent.class, event -> {
            final Node node = event.getNode();
            if (!event.isGroup()) return;
            if (node instanceof PrefixNode) {
                final Group group = (Group) event.getTarget();
                updatePermissionGroupMeta(group);
                ProxyServer.getInstance().getConsole().sendMessage("NodeRemoveEvent:PrefixNode, update team META");
            }
        });
    }
foggy flower
#
        if (provider == null) {
            this.plugin.getLogger().severe("LuckPerms not found!");
            Bukkit.shutdown();
            return;
        }
        this.luckPerms = (LuckPerms)provider.getProvider()```
#

provider is null somehow

#

I tried to sout all the registered classes and it outputs LuckPerms but still provider is null

#

any ideas?

tough geyser
#

I'm having this problem too on 1.18

turbid solar
#

Are you (soft)depending on Luckperms?

tough geyser
#

yes

nocturne elbow
#

CC @foggy flower @tough geyser

foggy flower
late pelican
#

How can I get all the groups that are in my server and put them in the Collection<String> required to get the highest group a player is in?

#

Nevermind I think I found a different way to do what I need

jovial ice
#

hello

modern hound
#

How can I add a group to an entity?

frank driftBOT
nocturne elbow
#

why would you even attempt that...

modern hound
nocturne elbow
#

to do what though? display a pet wolf's name in tablist with a rank prefix?

modern hound
#

I just want them under other players

#

So that entities won't come above normal players

#

So I want to add a group

#

That is configured in TAB

nocturne elbow
#

i see. as far as i know, pets get the same 'label' as their owners if you will. im unsure if that can be changed, but i know it can be disabled (pet name fix, TAB wiki lists it). entities themselves do not have a uuid like players do, so i dont think it would remotely be possible to even do that. if you really want pets displayed in tablist for example, it would be easier to just get a pet plugin which has placeholder which you can then use in your tablist format, perhaps even after the name of the players so its obvious whose pet it is.

nocturne elbow
#

id's, not uuids

modern hound
#

What is Entity.getUniqueId() then?

#
            Wolf wolf = null;
            wolf.getUniqueId();```
nocturne elbow
#

they are not player entities, those are different

modern hound
#

^ Just to show you

nocturne elbow
#

iirc lp checks if the entity is a player

#

and if not, well, then it errors

modern hound
#

@nocturne elbow Could I do something with this then?

            nmsHelper.sendPacket(player, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a, this.entity));
            nmsHelper.sendPacket(player, new PacketPlayOutNamedEntitySpawn(this.entity));
#

But if I do that

#

It shows above every other player

#

and thats not what i want

nocturne elbow
#

i think this is the same issue then as if you let tab add the prefix of its owner to the pet

#

im not sure exactly but somehow the owner and their pet are connected

#

i dont think you can break that connection

#

if you could, im sure someone else would have done this by now

modern hound
#

I want to add

#

Not a pet that is connected to a player

#

just a entity that i spawn with nms

nocturne elbow
#

that is why i asked you if that is what you wanted to do

#

still, lp checks if an entity is a player

#

so working with lp and groups i dont see this happening at all

#

why not set a static hologram for above the entity and add a static text containing that name to tablist

#

so much easier, its just a config setting

uneven scarab
#

!download

frank driftBOT
left estuary
#

Hello, how do you think I could get the remaining time of permission ? Of course with the API

hybrid panther
#

what is a "leave"?

left estuary
#

ho sorry shit traductor, the remaining time of permission

clever zodiac
#

@left estuary theres a getExpiry method or something similar in Node iirc

queen radish
#

Hi, I am facing some cases (a few only) where some new players are joining but not getting permission that I try to give them. How every, the code is really basic

    @EventHandler
    public void onPlayerFirstJoin(PlayerJoinEvent event) {
         if(!event.getPlayer().hasPlayedBefore()) {
             Player player = event.getPlayer();
             List<String> permissions = new ArrayList<>();
             permissions.add("historya.jobs.nojob");
             LuckPermsUtils.addPlayerPermissions(player, permissions);
         }
public static void addPlayerPermissions(Player player, List<String> permissions) {

    luckPermsAPI.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
        permissions.forEach(permission -> {
            DataMutateResult result = user.data().add(Node.builder(permission).build());
            if (!result.wasSuccessful()) {
                Bukkit.getLogger().log(Level.WARNING, user.getUsername() + " à déjà la permission: " + permission);
            }
        });
    });
}

Those issue are happening rarely. Any idea where does it could come from ?

#

Yes I did read the wiki

#

mostly

#

🙄

wild whale
#
  • are you sure the event is firing? Tried adding debug prints to the listener to ensure it's firing & the hasPlayedBefore check is as expected?
  • Why are you not just adding the permission to the default group? Adding a permission to each user seems like you're doing something odd.
queen radish
#
  • are you sure the event is firing? Tried adding debug prints to the listener to ensure it's firing & the hasPlayedBefore check is as expected?
    Wanna try to add some debug prints just to be sure. However, I feel like it's unlikely that this event is sometimes not fired or that hasPlayedBefore doesn't work has excepted. I guess those things have been tested, tested, and tested again by thousand of servers.

Why are you not just adding the permission to the default group? Adding a permission to each user seems like you're doing something odd.
You are right, it could have been done in different way. Instead of adding then negating the permission on the player, we could just negate the permission on the player. But I am still curious about how those issue could happen. I will go for this way and it might solve the issue (I hope so)

#

Thanks

wild whale
#

What's the use case? This feels like XY problem, like you're using permissions to store data that would best be stored either in meta or in a dedicated storage system

jade grove
#

How do I get the groups in the correct weight order?
One screenshot is the plugin, one is what it should be.

left estuary
#

@clever zodiac Hello, thanks but i don't understand to get the permission node with this method getExpiry with just the UUID of the player

jade grove
# jade grove How do I get the groups in the correct weight order? One screenshot is the plug...

Edit: I kind of fixed it by just using a hashmap and sorting it by value/weight but the problem is now:

How do I get what the group is from an offlineplayer? Right now I'm using this but it has 2 problems

  1. It's using Vault not LuckPerms and even a message came up in console that you shouldn't do that which I had to disable using the config
  2. If I have * it always assumes I have the top rank
public static String getPlayerGroup(OfflinePlayer player) {
        List<String> possibleGroups = getGroups();
        for (String group : possibleGroups) {
            if(vaultpermsapi.playerHas(Bukkit.getWorlds().get(0).getName(), player, "group." + group)) {
                return group;
            }
        }
        return "default";
    }

Pseudo-code of what I want:

public static String getPlayerGroup(OfflinePlayer player) {
    Group group = lpapi.getPlayer(player).getPrimaryGroup();
    return group.getName();
}
queen radish
red creek
#

How do I get the player prefix using the Api
I currently have this but I don't know what a context is

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

you can just leave it empty

#

i think?

red creek
#

It's returning an error

#

I can't

#

There is no empty one

turbid solar
#

make sure oyu're using API 5.3

red creek
main dagger
#

im trying to convert some stuff i made a while ago using luckperms from bukkit to sponge. do i just replace the org.bukkit.Player in getPlayerAdapter(Player.class) with org.spongepowered.api.entity.living.player.Player, or is it something else?

turbid solar
#

yes

#

look at the JD

open orbit
#

does luckperms work with 1.18.1

civic cove
open orbit
#

can u send link

#

im not able to find

civic cove
#

original link

#

If I'm using API 4.3, how do I make it work with the latest version of Luckperms?

unreal mantle
#

The Legacy API won't work without the addon for it, but you won't get support for it.

civic cove
#

Addon?

unreal mantle
#
#

Legacy API Extension

#

But it is 100% recommended you use the latest api version

#

If you want to use the latest version of LP

civic cove
#

Ok....

#

Thx

unreal mantle
#

There shouldn't really be any reason not to use the latest api version

civic cove
#

Just the last update of the plugin (not mine) was 2019. I decided to fix it...

#
boolean result = luckyPermsUser.setPermission(api.getNodeFactory()
                    .newBuilder("group." + group).build()).wasSuccess();
#

setPermission and getNodeFactory don`t work...

unreal mantle
#

!notworking

frank driftBOT
#
Please tell us what's going on!

We really would absolutely love to help you out! However, telling us that it isn't working wastes everyone's time. Please, just describe the issue you're having clearly and with as much detail as possible, and send any relevant screenshots of whatever problems you're having.

For Console Errors:
civic cove
#
public class LuckPermsProvider implements PermissionProvider {

    private static RegisteredServiceProvider<LuckPerms> LuckPermsProvider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

    @Override
    public boolean addToGroup(ru.mrbrikster.shoppingcartreborn.cart.User user, String group, long time) {
        if (!(user instanceof BukkitUser)) {
            return false;
        }

        if (LuckPermsProvider != null) {
            LuckPerms api = LuckPermsProvider.getProvider();

            User luckyPermsUser = api.getUserManager().getUser(((BukkitUser) user).getAsPlayer().getName());

            boolean result = luckyPermsUser.setPermission(api.getNodeFactory()
                    .newBuilder("group." + group)
                    .setExpiry(time, TimeUnit.SECONDS).build()).wasSuccess();

            api.getUserManager().saveUser(luckyPermsUser);

            return result;
        }

        return false;
    }

#

Updated Luck Perms API to 5.3

unreal mantle
weak totem
#

When i add the dependency to Maven, the IDE I use(IntelliJ IDEA), complains that it doesnt exist

night pier
#

What did you add to your pom

weak totem
#

Let me add a picture

night pier
#

Press this

weak totem
#

still there

night pier
#

Did it actually finish reloading the dependencies?

weak totem
#

oh never mind

#

wow that

#

thanks

nocturne elbow
#

!api

frank driftBOT
turbid solar
#

First link

green fable
#

Hello everyone, I have a question, what event is responsible for removing the player's permission after his time expires?

nocturne elbow
blazing vessel
#

Hello, I am struggling removing a user (playerID) from a single group (groupName) using the following:

Group verified = luckPerms.getGroupManager().getGroup(groupName);
User u = Util.getLuckPermUser(luckPerms, playerID);
InheritanceNode r = InheritanceNode.builder(groupName).build();
u.data().remove(r);
luckPerms.getUserManager().saveUser(u);
luckPerms.getGroupManager().saveGroup(verified);

Nothing happens, no error thrown but also the group is still parent. Any ideas?

clever lichen
#

how do i check if a user's primary group is a temp group?

azure flame
#

Get the permission from the player, then use this to check whether it has an expiry.

blissful solar
#

Anyone have ideas for how I (a) get a user's groups given a particular context, and (b) check a user's permissions in a given context? Or does simple LP checks check for their active context already? Porting a plugin of mine to Velocity, so yeah (UPDATE: Nevermind I think I might have figured it out)

digital wedge
#

How do I get and set a users role using API? I can't understand the collection framework of luckperms because I'm quite new to data structures :)

#

(I tried reading the docs I'm just new)

turbid solar
#

!cookbook

frank driftBOT
digital wedge
#

It made nullPointerException

#

at getUser

turbid solar
#

is the user offline?

digital wedge
#

no

#

It's GUI that player can click on and it gives clicker rank

turbid solar
#

debug your code

#

and show code here

cobalt venture
#

How to handle permissions checking in LuckPermsAPI?

unreal mantle
cobalt venture
#

I want to handle permissions before return result

fair stirrup
#

Hi, is PlayerDataSaveEvent called when player's permission groups change?

quartz current
#

Hey :D I have a little problem with the API. I have subscribed my proxy plugin to the GroupCreateEvent. My problem is that the event is only toggled when groups are created through the proxy (/luckpermsbungee). It does not work with the default /lp setting, although Redis messaging works properly. Any ideas how to fix this?

quartz current
#

._.

bold plover
#

is there an easy platform agnostic way to get a world object (minecraft) and get the context key for it ?

rocky aurora
#

hey, how can I perform
/lp user <user> permission unset <permission> via the API?

#
User#getNodes().remove(Node.builder("chatcontrol.chat.globalrange").build());

Is this correct?

clever zodiac
#

It looks correct, why not try it lol

turbid solar
#

iirc it’s .data()?

#

d;lp User#getNodes

slate deltaBOT
#
@Unmodifiable @NonNull
default Collection<Node> getNodes()```
Description:

Gets a flattened view of the holders own Nodes.

This list is constructed using the values of both the normal and transient backing node maps.

It may contain duplicate entries if the same node is added to both the normal and transient node maps. You can use getDistinctNodes() for a view without duplicates.

This method does not resolve inheritance rules.

Returns:

a collection of the holders own nodes.

turbid solar
#

d;lp User#data

slate deltaBOT
turbid solar
#

Yep

clever zodiac
#

oh kekw

swift pagoda
#

Hi, I'm getting an issue. I'm using Jedis with LuckPerms to make it works on a bungeecord serveur. Everything works fine when I'm making the command for example /lp user <name> group set myGroup.
I want to know when the group is updated. So, -such as suggested in doc- in my plugin I made this:

public void load(MyPlugin pl) {
   EventBus bus = LuckPermsProvider.get().getEventBus();
   bus.subscribe(UserTrackEvent.class, this::onTrackEvent);
}

public void onTrackEvent(UserTrackEvent e) {
   log("Receiving event for " + e.getUser().getUsername());
}

But:

  1. The serveur well receive informations like showed in the screen
  2. I tried by using my plugin's instance in the first object, before setting class
  3. I tried by using UserPromoteEvent & UserDemoteEvent such as said in doc
  4. No logs, no error and this event seems well registered (this method is well called)
nocturne elbow
#

Events are not propagated through a network, if an event is dispatched on the proxy, listeners on the servers won't be called

#

There are other various network/post/sync/refresh events that will be dispatched but because of the syncing behavior, you might want to look into those instead.

#

^

swift pagoda
nocturne elbow
#

what

swift pagoda
# nocturne elbow what

the "LOG" is just with jedis event ? Also, I just tried PreNetworkSyncEvent & PostSyncEvent, and each time the server send log that it receive something, but no event are called

nocturne elbow
#

the log message is only shown when anything is changed, and that same message is sent throughout the network as well

#

you can disable the log message altogether but syncing and events will still happen, they're somewhat unrelated

swift pagoda
nocturne elbow
#

What exactly are you doing? Where are you running the command? Where are you listening to events and which events?

languid walrus
#

Got this from the API docs but it just doesn't make sense to me, the instance will only be set if the provider isn't null? So if the provider is not null the instance will be null?

        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            luckPerms = provider.getProvider();
        }
nocturne elbow
#

if the provider isn't null.. the instance won't be null either

swift pagoda
nocturne elbow
#

why would it? what?

nocturne elbow
languid walrus
nocturne elbow
#

yes you want to detect changes, that's what events are for, but not all events are useful and it depends on where you run stuff and how you're listening to what events and where

nocturne elbow
languid walrus
nocturne elbow
#

no, that's correct

#

because you need to get it from the services manager and assign it into the field

swift pagoda
nocturne elbow
#

they are for the promote/demote commands; for parent set you'll want to use NodeAddEvent, check that the target is a User and that the event node is an InheritanceNode

blazing vessel
unreal mantle
#

Make sure to save the changes as well.

azure flame
blazing vessel
clever lichen
#

How would i get a users group with the most weight and get all the info for it and also check if its temporary

nocturne elbow
# clever lichen How would i get a users group with the most weight and get all the info for it a...

How would i get a users group with the most weight
by default that's what User#getPrimaryGroup returns
Now I'm not sure what you mean by "get all the info for it", but if you want to get the node for it (which would give you info such as expiry date if any) in API 5.4 there's this method you can use in the CachedPermissionData https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/cacheddata/CachedPermissionData.html#queryPermission(java.lang.String)

#

though the "permission" would be group.<group> rather than just the group name itself, cuz that's what the inheritance node actually is

clever lichen
nocturne elbow
#

yeah

clever lichen
#

and how would i check for expiry if it has one?

nocturne elbow
#

Node#hasExpiry, #getExpiry

clever lichen
#

or how would i get the instance to get the expiry

nocturne elbow
clever lichen
#

and its this one right?

nocturne elbow
nocturne elbow
clever lichen
#

k thanks Emily

clever lichen
#

one last thing @nocturne elbow (sorry for ping), i have to do user#getCachedData and then what?

frank driftBOT
#

Hey agus_marmor! Please don't tag helpful/staff members directly.

nocturne elbow
#

Then getPermissionData()

clever lichen
#

and then what?

#

because the query thing is not there

#

nmv i think i know why

#

im using 5.3

#

and i need 5.4

pliant vector
#
        Player player = chat.getPlayer();
        User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);

        String message = "§7§l(§3§lL§7§l)" + user.getCachedData().getMetaData().getPrefix() + chat.getPlayer().getName() + "§f"+msg + user.getCachedData().getMetaData().getSuffix();

How can I include the group's prefix and suffix colors into the message?

pliant vector
#

nvm; just added an alternateChatCode tag

mystic junco
#

i am struggeling to use the api i am trying to add a player to a group but cant find the code on the website

mystic junco
#

whetre do i get user from

unreal mantle
mystic junco
#

i have tryed from your example

#

why is this error showing

night pier
#

well, you haven't defined groupName anywhere, so that's not gonna do anything.

neon sparrow
#

also if you hover over this.luckPerms it will tell you whats wrong

grand crater
#

Is it possible to get a Prefix from the Spigot server onto the BungeeCord plugin?

grand crater
#

Or just generally Spigot permissions to my BungeeCord plugin

grand crater
#

Or any way to switch from BungeeCord to Spigot with the API

unreal mantle
void juniper
#

Hi, i'm trying to import the luckperms api on itellij idea, i tried to follow some tutorials but when i try to access the api, i get only errors

turbid solar
#

What errors?

#

!api

frank driftBOT
void juniper
#

cannot resolve symbol LuckPerms

turbid solar
#

!paste your build file

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!

For console errors:

Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!

Other errors:

Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!

void juniper
#

intellij suggests me to import the luckperms api class, but when i click on it nothing happens

night pier
#

your build file.
settings.gradle or pom.xml

how are you trying to add the api to your project

void juniper
#

sorry

void juniper
night pier
#

the package isn't me.lucko.luckperms anymore
it's net.luckperms.api

void juniper
#

that's what i found on the official wiki

night pier
void juniper
#

i know

#

however, i'll try to change the package name

#

and see if that works

nocturne elbow
#

nowhere in there it says me.lucko.luckperms? thonk

void juniper
#

i know

#

i found it out now

#

because i clicked on a intellij suggestion to import luckperms api

nocturne elbow
#

yeah you shouldn't have these as dependency, v4 is err.. very old and unsupported lol

void juniper
#

intellij's fault

#

thanks guys

void juniper
nocturne elbow
#

yes?

void juniper
#

another question

#

once i removed that two lines in the build file, should i hit build on gradle toolbar?

nocturne elbow
#

there should be a refresh button floating around somewhere

void juniper
#

on the gradle toolbar

nocturne elbow
#

just floating around

void juniper
#

ok

#

thx

nocturne elbow
#

but if there's a refresh button on the toolbar that could work too i guess ¯_(ツ)_/¯

void juniper
#

sorry if i appear like an idiot

#

thanks again

nocturne elbow
#

no worries

fair furnace
#

hello how can i remove player prefixes?

#

solved

nocturne elbow
#

How do I setup luckperms api into my plugin?

obtuse jolt
#

!api

frank driftBOT
nocturne elbow
#

it ok i did it

eternal tree
#

does User#getNodes include nodes from their parent groups or does it only return their specific nodes

nocturne elbow
#

it returns the holder's own nodes

eternal tree
#

alright thanks

mighty hearth
#

Is the event PlayerLoginProcessEvent called anywhere? I'm using Fabric and doesn't look like I am getting the event

daring sandal
#

So, I have a plugin where there's this "actions" feature such as [command] say Hey there! [player] warp spawn etc.. and I want to add a [luckperms] action to help people avoid the usage of [console] lp user %player_name% ....

Basically, I want to turn [console] lp user %player_name% permission set permission.node true into [luckperms] permission set permission.node true.
I was wondering if I could pass permission set permission.node true and the player object to the LuckPerms api and it would process the arguments like it does when someone run /lp user {player} permission set permission.node true

nocturne elbow
daring sandal
#

yeah I was expecting that answer xD guess I will implement the command login on my end

mighty hearth
nocturne elbow
#

that's not api, no

clever zodiac
#

I know its not part of the APi aha

nocturne elbow
#

wdym by "exposed" then?

#

the only part that's exposed is the api

clever zodiac
#

its exposed

#

CommandManager#executeCommand is public, then LPBukkitPlugin exposes getCommandManager(), which would allow him to use executeCommand

nocturne elbow
#

"exposed" as in has public modifier?

#

sure

clever zodiac
#

I know its not intended for use of course, but he is able to 🤷‍♂️

nocturne elbow
#

that's really not any different (at all) that just using Server#dispatchCommand or whatever

clever zodiac
#

though dispatchCommand will log it to console that it was ran

nocturne elbow
#

I mean, LP would log the action too

clever zodiac
#

if he creates a custom Sender would he be able to override sendMessage to make it not actually go to console

nocturne elbow
#

I mean

#

"can" he do all of this?

#

yes

clever zodiac
#

@daring sandal I can't recommend you do this and because it's not API, there is no guarantee that this will not be broken in any future version. However, if this is functionality you really want, you can find a way to get the CommandManager instance and call executeCommand with a custom Sender modelling console and just not accepting messages

nocturne elbow
#

even if it was all private and whatnot

#

he still could

clever zodiac
#

he could use reflection to do so anyways, there are a number of hacky ways 🤷‍♂️

#

it just depends on how much he really wants this

nocturne elbow
#

¯_(ツ)_/¯

#

he asked if it was possible with the api

#

it's not

#

internals are internals

daring sandal
#

I thought about using the command manager, will see, don't really want to use this hacky system though

#

might as well just not implement it at all

jaunty pecan
#

using bukkit.dispatchcommand is the only correct way to achieve what you're doing

#

doing reflection in LP internals is not a good idea

clever zodiac
#

well it’s exposed so it wouldn’t be reflection, but just as hacky imo

nocturne elbow
#

actually it's not "exposed", since (at least for bukkit (and a few other platforms)) the common module and the "plugin" class is in the nested jar

#

good luck getting around that 🥴

clever zodiac
#

Oh?

#

Is LPBukkitPlugin not available from Bukkit's service registry in any way?

wild whale
#

Nope, and afaik it's on it's own classloader

clever zodiac
#

lmfao it seems I dont know anything about how LP is loaded into the server

nocturne elbow
#

again, you ""can"" get it

#

just like you ""can"" get the internal command dispatcher

#

but like you have to go out of your way by a thousand miles

#

and there's no way without reflection

daring sandal
#

Say no to reflection

hushed narwhal
#
package net.plexpvp.core;

import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.milkbowl.vault.economy.Economy;
import net.plexpvp.core.data.GuildControl;
import net.plexpvp.core.data.MiscControl;
import net.plexpvp.core.data.PlayerControl;
import net.plexpvp.core.data.instanceTargets.FilteredWords;
import net.plexpvp.core.guilds.Command;
import net.plexpvp.core.misc.ChatFormat;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import redempt.redlib.commandmanager.ArgType;
import redempt.redlib.commandmanager.CommandParser;
import redempt.redlib.misc.UserCache;

import java.util.UUID;

public final class Main extends JavaPlugin {

    // Instance Methods
    private static Main instance;
    public static Main get() { return instance; }
    private static Economy econ = null;
    public static Economy getEconomy() { return econ; }
    private static final LuckPerms luckperms = LuckPermsProvider.get();
    public static LuckPerms getLuckPerms() { return luckperms; }
    private static PlayerControl playerControl;
    public static PlayerControl getPlayerControl() { return playerControl; }
    private static GuildControl guildControl;
    public static GuildControl getGuildControl() { return guildControl; }
    private static MiscControl miscControl;
    public static MiscControl getMiscControl() { return miscControl; }

    @Override
    public void onEnable() {
        instance = this;
        playerControl = new PlayerControl();
        guildControl = new GuildControl();
        miscControl = new MiscControl();

        // Config Registration
        playerControl.reloadPlayers();
        guildControl.registerExisting();
        miscControl.register("miscData/FilteredWords", new FilteredWords());

        // Listener Registration
        Bukkit.getPluginManager().registerEvents(playerControl, this);
        Bukkit.getPluginManager().registerEvents(new ChatFormat(), this);

        // Library Registration
        if (!setupEconomy()) getServer().getPluginManager().disablePlugin(this);
        new Placeholders().register();

        // Command Registration
        ArgType<OfflinePlayer> offlinePlayerArgType = new ArgType<>("offlineplayer", UserCache::getOfflinePlayer).tabStream(c -> Bukkit.getOnlinePlayers().stream().map(Player::getName));
        ArgType<UUID> uuidArgType = new ArgType<>("uuid", UUID::fromString);
        new CommandParser(getResource("command.rdcml"))
                .setArgTypes(offlinePlayerArgType, uuidArgType)
                .parse().register("plex", new Command());

    }

    @Override
    public void onDisable() {

        // Config Saving
        playerControl.save();
        guildControl.save();
        miscControl.save();

    }


    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null)
            return false;
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null)
            return false;
        econ = rsp.getProvider();
        return econ != null;
    }


}```
#

this is my main file

turbid solar
#

move LuckPermsProvider.get(); to onEnable

hushed narwhal
#

how does that even work

turbid solar
#

LuckPerms luckPerms;

onEnable:
luckPerms = LuckPermsProvider.get()

hushed narwhal
#

oh

#

ok

night pier
#

Capital P, and did you do the first part cas said

sick abyss
#

Hi, can anyone help me with getting player's group. Ik that there is a method for it and i'm using it but how do i convert Collection<Group> to Collection<String>?

// Get a Bukkit player adapter.
PlayerAdapter<Player> playerAdapter = main.luckPerms.getPlayerAdapter(Player.class);

// Get a LuckPerms user for the player.
User user = playerAdapter.getUser(player);

// Get all of the groups they inherit from on the current server.
Collection<Group> groups = user.getInheritedGroups(playerAdapter.getQueryOptions(player));

// Convert to a comma separated string (e.g. "admin, mod, default")
String groupsString = groups.stream().map(Group::getName).collect(Collectors.joining(", "));

String format = "<group-prefix><player>: <message>";
format.replace("<group-prefix>", ChatColor.translateAlternateColorCodes('&', main.getPlayerGroup(player, groupsString)));


//MAIN
public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
        for (String group : possibleGroups) {
            if (player.hasPermission("group." + group)) {
                return group;
            }
        }
        return null;
    }
hushed narwhal
#

how can i get all online players with a certain permission

nocturne elbow
nocturne elbow
sick abyss
# nocturne elbow There's `User#getPrimaryGroup`? That's probably what you want? As for "how to co...

i figure it out somehow but now i have other problem
Code

Player player = e.getPlayer();

// Get a Bukkit player adapter.
PlayerAdapter<Player> playerAdapter = main.luckPerms.getPlayerAdapter(Player.class);

// Get a LuckPerms user for the player.
User user = playerAdapter.getUser(player);

// Get all of the groups they inherit from on the current server.
Collection<Group> groups = user.getInheritedGroups(playerAdapter.getQueryOptions(player));

Collection<String> groupsToString = Collections.singleton(groups.toString());
Group group = main.luckPerms.getGroupManager().getGroup(main.getPlayerGroup(player, groupsToString));

player.sendMessage(group.getCachedData().getMetaData().getPrefix()); // LINE 95

ERROR

Caused by: java.lang.NullPointerException: Cannot invoke "net.luckperms.api.model.group.Group.getCachedData()" because "group" is null
        at com.mires.rpg.core.events.OnChat.onChat(OnChat.java:95) ~[?:?]
nocturne elbow
#

You shouldn't call toString on random things, the stream.map method was fine, this isn't

hushed narwhal
#

how can i use conditions in lambdas

#

oof spellign

sick abyss
nocturne elbow
#

Yes, because you're not supposed to call toString on random things, that doesn't work like that
groups.stream().map(Group::getName).collect(toList) should work fine

nocturne elbow
hushed narwhal
#

yeah

#

im thinkin of using ternary operator

#

is there a better way?

hybrid panther
#

What exactly are you trying to do

hushed narwhal
#

nvmd i got it working

heavy eagle
#

How can I check if an offline player has a permission?

#

Right now, after following the wiki I have:

            UserManager userManager = luckPerms.getUserManager();
            CompletableFuture<User> userFuture = userManager.loadUser(p.getUniqueId());

            userFuture.thenAcceptAsync(user -> {
               
            });
#

not sure how to check the users perms with the user variable though...

upbeat berry
#

Maybe something like this:

user.getNodes(NodeType.PERMISSION).stream()
        .map(PermissionNode::getPermission)
        .anyMatch(perm -> perm.equals(permission));
unreal mantle
heavy eagle
#

Already resolved

#

thanks though 🙂

modern kernel
#

I dont understand it, in other Plugins from me, is working everything.

nocturne elbow
#

You seem to be shading/bundling the LP API into your own plugin :P

#

Don't do that 😆

modern kernel
nocturne elbow
#

Because you're not shading the LP API in those

modern kernel
#

huh?

nocturne elbow
nocturne elbow
#

Huh, can you share the entire pom file?

nocturne elbow
#

err

#

!pasteit please