#luckperms-api

1 messages · Page 53 of 1

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!

modern kernel
nocturne elbow
#

hmn think

modern kernel
#

huh, now it works, after i export the 4. time lol

#

thank you xD

nocturne elbow
#

blame caching :d

modern kernel
#

xD

umbral yacht
#

When I change my parent group, I get a UserDataRecalculateEvent and a UserLoadEvent but I do not receive a NodeAddEvent.
Edit: Hmm, when I use /lp on my server it sends the event locally (works), but when I use /lpv I guess the event isn't transported? I can work around this pretty easily by just sending my own event over rabbitmq, but that's a bit messy

eternal tree
#

is it possible to check if a user is in the default group?
edit: nevermind i'm blind

quartz shadow
#

hi

#

how can i get displayname from luckperms api

#

not a user displayname

#

this displayname from player that have that rank

weary badger
#

why i can't load lp api in my plugin. It said my pox.xml is wrong☹️

jaunty pecan
weary badger
#

Did i download the wrong jar file?

jaunty pecan
weary badger
#

@jaunty pecan How much did you pay for the web server

frank driftBOT
#

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

weary badger
grizzled lynx
#

whats the best way to do a sorted tab with luckperms?

grizzled lynx
#

?

hybrid panther
#

!tab

frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!

List of chat/tablist formatting plugins that work with LuckPerms
night pier
#

Weights would probably be your best option.

grizzled lynx
#

ist there a way to iterate through every group sorted

#

then i could put them into a map

#

!groups

frank driftBOT
#

Sorry! I do not understand the command groups
Type !help for a list of commands

grizzled lynx
#

!weight

frank driftBOT
#

LuckPerms allows you to set weights in order to determine the priority of certain nodes, like permissions and even prefixes. A higher weight number is a higher priority.

grizzled lynx
#

!metaweight

frank driftBOT
#

Sorry! I do not understand the command metaweight Did you mean weight?
Type !help for a list of commands

grizzled lynx
#

you mean this?

#

@night pier

frank driftBOT
#

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

grizzled lynx
#

sorry

#

anyone there?

turbid solar
#

!api

frank driftBOT
grizzled lynx
#

yes but how to get groups sorted by their weight

wild whale
#

You probably need to do that yourself.

turbid solar
#

getLaodedGroup#stream#sorted

wild whale
#

stream
bye-bye performance 🙂

hybrid panther
#

🤨

nocturne elbow
#

contrary to popular belief, streams aren't actually that bad..

hybrid panther
#

esp with minuscule data sets like groups

nocturne elbow
#

they are inherently slower than imperative and eager evaluation but they do go almost in par with them

jaunty pecan
#

is it popular belief?

grizzled lynx
#

it doesnt sugggest compareto

wild whale
#

Integer is comparable see luck's msg

jaunty pecan
#

I think getWeight returns an optional

wild whale
#

yeah that would make sense

nocturne elbow
# jaunty pecan is it popular belief?

I mean, are they slow(er)? Yeah, but they aren't as slow as people make it seem by blowing it out of proportion
Obviously if you want to squeeze every single clock cycle out of things you're gonna want to not use them

#

also lazy eval good eager bad

grizzled lynx
#

i dont understand how

#

sorry

wild whale
#

Also with Bukkit, if you're off the main thread it's probably fine

jaunty pecan
grizzled lynx
jaunty pecan
#

lowest first

#

you could steal how LP does it for the listgroups command

#

that does highest first, then sorts alphabetically

#

ignore the stuff before .sorted(...)

grizzled lynx
#

thank you ❤️

quartz shadow
#

Why i used if(groupString == "default"){
...
} else {
p.sendMessage("You can't buy this rank because u have high rank than this rank")
}

But i have default so i can buy this rank but why is said You can't buy this rank because u have high rank than this rank

turbid solar
#

Don’t == strings

#

.equals or .equalsIgnoreCase

frail breach
#

luckperms works with vault (I want to use vault api to get user rank)?

turbid solar
#

Yes

frail breach
hybrid panther
#

Yes ..

simple lodge
#

hmm hello

#

how can i check an offlinePlayer has permission ?

neat haven
#

How to I get luck perms

#

Please help I can’t get luck perms

#

I don’t know how?

clever zodiac
#

!download

frank driftBOT
neat haven
#

!chat

frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!

List of chat/tablist formatting plugins that work with LuckPerms
rustic laurel
#

No ads @neat haven

neat haven
#

Wdym

nocturne elbow
#

Hi! How I can update instant and start sync task using API?

limber girder
#

Hello. I am writing some kind of cross-platform API, which I would like to use in Bukkit servers, Bungeecord and most importantly, web-application. I decided to use LuckPerms for permission management. Unfortunately I cannot find any information about using LuckPerms API in an environment, that is not minecraft-related. (not bungeecord, spigot, sponge etc.). Is it possible to use the LuckPerms API on a web backend in order to for example set or get rank of a player?

#

Thanks in advance

clever zodiac
#

@limber girder definitely not

#

you can only obtain an instance of the API if you're web app is running on the same classloader as the Minecraft server

jaunty pecan
#

best bet is to interact directly with the database in that case

#

you could make your own http api to do that, for example :)

limber girder
jaunty pecan
#

nothing official

#

you might find someone has done it before and put it on github, but I'm not aware of anything

limber girder
#

Okay, thank you very much

clever zodiac
#

I mean if you're okay with entering an editor key into your web app, then using the websocket with bytesocks to send the server updates

#

but that requires the end user to enter an editor key anyways

#

and trust it, you'd have to recreate the whole trust system as well

jaunty pecan
#

don't do that :p

limber girder
#

Yeah, I don't want to do that xD

clever zodiac
#

lmao

#

definitely not ideal, just the only thing I can think of other than directly interacting with the database (of course a backend in the middle)

#

and at that point, it's probably better to do that anyways

limber girder
#

I think interacting with database would be a cleaner approach than using websockets in some tricky way

clever zodiac
#

welp, have fun with it aha

limber girder
#

Thanks for the info anyway 😃

final otter
#

what depend will be on plugin.yml for lp?

#

like ```depend: [luckpermsapi]

#

??

turbid solar
#

no

#

LuckPerms

final otter
#

ok

final otter
#

hello i need a help

#

i had made a bot with jda and i had attached lp api on my plugin

#

so i want to make a thing like if somebody type !rank <playername> it will return player group

#

i made this thing

#

but its not working

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

    public void onMessageReceivedtwo(MessageReceivedEvent event)
    {


        Message msg = event.getMessage();
        if (msg.getContentRaw().equals("!" + group))
        {
            MessageChannel channel = event.getChannel();
            long time = System.currentTimeMillis();
            channel.sendMessage() /* => RestAction<Message> */
                    .queue();
        }
    }```
turbid solar
#

!mw

frank driftBOT
#

Sorry! I do not understand the command mw
Type !help for a list of commands

turbid solar
#

!nw

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:
plucky furnace
#

hey

#

i have a question

#

How can I query if he has luckperms permission?

wild whale
#

easiest way is to just use platform api methods

#

(i.e. assuming you're on bukkit, Player#hasPermission(String)

plucky furnace
#

ahh thanks!

final otter
#

how to get players rank with their name?

#

i cant find it

upbeat berry
#

Hello, I'm kinda lost on how to change player group on a specific server. This is how I do it normally:

    public CompletableFuture<Void> setPlayerGroup(UUID uniqueId, Group group, String trackName) {
        return userManager.modifyUser(uniqueId, (User user) -> {
            user.data().clear(NodeType.INHERITANCE.predicate(foundNode -> isOnTrack(foundNode, trackName)));
            Node node = InheritanceNode.builder(group).build();
            user.data().add(node);
        });
    }

So what should I do to make it so it grants the player a group on a specific server rather than globally? Is it stored within user data or the group it self. Should I edit the group data or something like that? Please help me.

#

Oh wait, should I just contextify it?

ImmutableContextSet contextSet = ImmutableContextSet.builder()  
                    .add("server", serverName)
                    .build();
Node node = InheritanceNode.builder(group).context(contextSet).build();
nocturne elbow
#

You can use the withContext(key, value) in the node builder too, it's easier for setting one or two contexts only

upbeat berry
nocturne elbow
#

looks about right

burnt lark
#

can someone help me?

upbeat berry
#

Noice, thanks for your time

upbeat berry
burnt lark
#

well, i use NukkitX on my server and I wanted to set up ranks - i cant get a dependency (vault), is there a way i can use ranks?

upbeat berry
#

You don't need Vault

#

Just install LuckPerms alone

burnt lark
#

i cant see my ranks tho

upbeat berry
#

You mean in the chat?

burnt lark
#

yeah

upbeat berry
#

You need a chat formatting plugin

burnt lark
#

could you send me a link?

upbeat berry
#
burnt lark
#

thank you

#

@upbeat berry it doesnt work still

#

@jaunty pecan can you help?

frank driftBOT
#

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

nocturne elbow
#

is something like this possible? and when yes hoe can i make it work
if(luckPerms.getPlayerAdapter(Player.class).getMetaData(p).getMetaValue("lobby-tpanimation").equals("false")){

nocturne elbow
# unreal mantle That should work.
p.sendMessage("debug-1");
p.sendMessage(luckPerms.getPlayerAdapter(Player.class).getMetaData(p).getMetaValue("lobby-tpanimation"));
p.sendMessage("debug-2");
if(luckPerms.getPlayerAdapter(Player.class).getMetaData(p).getMetaValue("lobby-tpanimation").equals("false")){
  p.sendMessage("debug-3");```
I only get the ouput debug-1 after this nothing will happen. How can i fix it?
nocturne elbow
nocturne elbow
queen radish
#

Would it be fine to add some permissions to a player by dispatching some luckperms commands instead of using the API ?

jaunty pecan
#

yes, but if it's more than one permission, consider adding the permissions to a group, then adding the player to the group

winged schooner
#

Is there any way to configure Luckperms server name with environment variable rather than runtime variable? Or maybe a changeServerName function? I only the getServerName, but there isn't anything else for the change by programatically

obtuse jolt
#

!context

frank driftBOT
nocturne elbow
#

yooo wody ur here?

#

cody

normal hedge
#

I am

nocturne elbow
#

hi

#

can u help me with something

#

on luck perms

normal hedge
#

Euhh, im not home atm

#

Just phone

nocturne elbow
#

oh alr

#

but do you know how to make it so its like "owner ros"

normal hedge
#

with code?

#

you could use User#getPrimaryGroup(); to just get the group name

#

Idk if thats what u want

nocturne elbow
#

ok let me try dat

normal hedge
#

Oh u play on my server lol

#

nice

nocturne elbow
#

wait no like yk in melon it say devolper codiq

#

how do you make it say devoilper

#

next to your name?

normal hedge
#

Ah, its a prefix

nocturne elbow
#

ohh

normal hedge
#

Look up, luckperms prefixes

nocturne elbow
#

alright thanks 😄

#

oh and 1 more thing

#

how did u setup the /vote

#

thing

turbid solar
eternal nova
#

i need at placeholder for the players group on my scoreboard?

nocturne elbow
turbid solar
#

no

nocturne elbow
#

Wow

#

Lmao

shy oriole
#

Hi ! How to set a permission to a player, and to check if a player has a permission, please ?

eager coral
#

Orrrr

#

You can go to their website

#

Or watch a youtube tutorial

shy oriole
clever zodiac
#

!cookbook

frank driftBOT
clever zodiac
#

@shy oriole

manic mason
#

Hello, I'm trying to code a plugin that manages a User's groups

#

I see that you can modify the Primary Group of a user with the method setPrimaryGroup()

#

But I'm looking for a way to add/remove groups from all the groups a user inherits permissions from

#

Should I just add/remove the respective group.<group_name> permissions? Or is there a better way to do this through your api?

nocturne elbow
# manic mason Should I just add/remove the respective group.<group_name> permissions? Or is th...

setPrimaryGroup is most likely not what you want
if you want to mimic the parent set/add command behavior you need to create an InheritanceNode as shown here https://luckperms.net/wiki/Developer-API-Usage#creating-new-node-instances and then adding it to the user's node map https://luckperms.net/wiki/Developer-API-Usage#modifying-usergroup-data
You can also check the cookbook repo for a few somewhat common API usage examples https://github.com/LuckPerms/api-cookbook

manic mason
#

Thanks!

final otter
#

how do i get a player group with player name?

#

i connected my plugin with jda and i am trying to get a player name with !rank <playername>

nocturne elbow
# final otter how do i get a player group with player name?

First you need to get the UUID for that player, there are many ways to go about doing that (either keep your own cache, use the server's system or query LP's own cache through UserManager#lookupUniqueId(String) https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html#lookupUniqueId(java.lang.String))
Then simply get the user by the UUID from the usermanager and get the primary group, you can find examples and functions for doing those in these
https://luckperms.net/wiki/Developer-API-Usage
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html
https://github.com/LuckPerms/api-cookbook

final otter
#

Okay i will try in morning.. and if i found any issue i will ask thank you

bronze loom
#

Hey, I've been looking for a solution for a long time.

So I'm trying to take the primary group of an offline player. I just can't get it to work and the docs won't help....
Can someone help me?

solar sedge
#

Hey there
Wanted to ask if it's intended that when you accumulate temporary permission, a NodeRemoveEvent is called?
If so, is there a way to check if the event is accumulate or not?
found a fix

nocturne elbow
#

Luck

#

I love you

echo holly
#

Hello, is there a way to get the duration left of an offline user's temp permission?

echo holly
#
    public int getExpiry(UUID who) {      
        User user = (User) luckPerms.getUserManager().loadUser(who);
        CachedMetaData metaData = user.getCachedData().getMetaData();

        // query & parse the meta value
        return metaData.getMetaValue("expiry", Integer::parseInt).orElse(0);
    }
#

Maybe something like? but I want to check for a specific permission

#

or maybe if there is an Event that checks when a specific permission (of offline player) expiries, then //do stuff

#

The placeholder %luckperms_expiry_time_<permission>% doesn't work for offline players so I'm trying to find a way to do that. If you could help me somehow I would appreciate it!

echo holly
#

Ok so I found a way to do that, but there might be laggy? It runs every 1 second for all offline players

#
    public String getExpiry(UUID p, String perm) {
        User user = (User) LuckPermsProvider.get().getUserManager().getUser(p);    
        if (user!=null) {
            for (Node node : user.getNodes(NodeType.PERMISSION)) {
                if (node.getKey().equalsIgnoreCase(perm)) {
                    return String.valueOf(node.getExpiryDuration().toSeconds());
                }
            }
        }
        return null;
    }
upbeat berry
echo holly
#

It's working! Thank you very much!

unborn arch
#

Hello, I need help to add a permission to a player. I am using API version 4.4

hybrid panther
#

update :D

#

5.4 is the latest version

unborn arch
unborn arch
turbid solar
#

!api

frank driftBOT
turbid solar
#

groupid changed

unborn arch
turbid solar
nocturne elbow
#

Hello My question would be how do I get the prefix from the group I'm in right now?

turbid solar
#

!cookbook

frank driftBOT
orchid widget
#

Hello, am I able to add permissions to a player with luckperms API

#

permanent permissions

#

!gradle

#

!maven

frank driftBOT
#

Sorry! I do not understand the command maven
Type !help for a list of commands

orchid widget
#

!dependency

frank driftBOT
#

Sorry! I do not understand the command dependency Did you mean dependencies?
Type !help for a list of commands

turbid solar
#

!api

frank driftBOT
orchid widget
#

am reading that now

#

but struggling to get the luckPerms plugin?

#

i cant find how to get the instance of it on the doc

#

!instance

frank driftBOT
#

Sorry! I do not understand the command instance Did you mean bansince?
Type !help for a list of commands

orchid widget
#

!getinstance

frank driftBOT
#

Sorry! I do not understand the command getinstance Did you mean bansince?
Type !help for a list of commands

turbid solar
#

!api

frank driftBOT
turbid solar
#

2nd

#

nvm

#

1st

orchid widget
#

great thank you

nocturne elbow
#

hi i am new to coding and want to work with luckpermsapi how do i do that? So I want you to get a rank via a command can someone help me

hybrid panther
#

Are you familiar with Java and writing spigot plugins? :)

hybrid panther
#

Just making sure, it helps a lot haha

#

Have you got the api in your project with maven/gradle yet?

nocturne elbow
hybrid panther
#

!api Ok, you should consult the documentation:

frank driftBOT
orchid widget
#

My LuckPerms plugin instance is null for some reason. I'm defining it like this ```public class ConsumablePermissions extends JavaPlugin implements Listener {
private final FileConfiguration config = this.getConfig();

public static ConsumablePermissions instance;
public static ConsumablePermissions getInstance() {
    return instance;
}

public LuckPerms luckPerms;
public LuckPerms getLuckPerms() { return luckPerms; }```

and in my onEnable I have this RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); if (provider != null) { luckPerms = provider.getProvider(); }
and in my other class I have this: ```public class ConsumeListener implements Listener{

public ConsumablePermissions plugin;
public LuckPerms luckPerms;

public ConsumeListener(ConsumablePermissions passedPlugin) {
    this.plugin = passedPlugin;
    this.luckPerms = plugin.getLuckPerms();
}```

but it's saying it's null when I try to call it

hybrid panther
#

Just to be sure, can you send the full error?

orchid widget
#

😭

turbid solar
#

Are you soft depending on Lp ?

clever lichen
#

How would i listen to when a group is added to a player/

#

?

night pier
clever lichen
#

and how would i get the expiry date of a InheritanceNode as YYYY-MM-DD

clever zodiac
#

You’d get it as an Instant, turn it to a date, then use a simple date formatter

crimson cipher
#

can anyone help with this error? what does it mean when it says getGroupManager() is null?

turbid solar
#

Show code

frank driftBOT
crimson cipher
#

I have the 3 groups stored in my servers mongodb. so im sure that they exist.

turbid solar
#

well that explains it lol

#

don’t create an instance of LP

#

!api

frank driftBOT
turbid solar
#

1st

crimson cipher
#

If i dont create an instance , i get this error. Any help. I ensured that the API was registered using RegisteredServiceProvider

nocturne elbow
#

you get the existing instance provided by LuckPerms from the service manager

#

you don't create one yourself or register one yourself

hybrid panther
#

Lol

earnest acorn
#

hi, how can i get all players with xyz rank?

turbid solar
earnest acorn
#

ty

crimson cipher
# nocturne elbow you don't create one yourself or register one yourself

ty. Im fairly new to building plugins and java as well. Im trying to learn. I am currently getting an error saying that "this.luckPerms" is null. Here is my code: https://pastes.dev/u89Z9GXpup and https://pastes.dev/eGNpukVV0v
my plugin.yml file:https://pastes.dev/ZNYo1sOK1A

#

any guidance would be helpful! Thank you in advance

turbid solar
#

!cookbook

frank driftBOT
orchid widget
#

this is my dependency

orchid widget
orchid widget
#

its not null in the main class but it's null in my other classes

#

so it's being passed wrong but not sure whats wrong

hybrid panther
#

What

hushed narwhal
#

is there an event i can use to detect when a player's group changes?

clever zodiac
#

lol?

#

LuckPerms is open source if you want to mess with the base command, but I mean LP is literally the most popular permissiosn plugin, there's nothing wrong with people knowing you use it

#

also disrespectful to the contributors if you're trying to like "sell" it as your own basically

#

you can always contribute to the language

#

t!translate

#

t!translations

karmic shadow
#

!translations

frank driftBOT
clever zodiac
#

ah thank you

karmic shadow
#

excuse me

clever zodiac
#

oh he's gone

#

did he leave or was he booted

#

i demand answers 🔨

karmic shadow
#

i dont know but like, why tell me stfu. literally no reason

clever zodiac
#

he's probably trying to like rip off LuckPerms or something 🤷‍♂️

karmic shadow
#

¯_(ツ)_/¯

#

just copy the plugin and change the prefix. "hey look what i made" muhahah

clever zodiac
#

precisely

#

maybe change the package from me.lucko to me.tomasito

frail olive
#

I was just about to ask this again but turns out I already asked this and got a good answer.
Thanks Emily and past me.

nocturne elbow
#

You're welcome

#

lmao

nocturne elbow
#

If i have luckperms on multiple velocity instances and have it connected all with redis. If I call getLoadedUsers will it return loaded users just on that server or the whole proxy, all proxies or just on the spigot server

turbid solar
#

on the current server iirc

nocturne elbow
#

thanks!

ocean berry
#

helo

#

how to get data if player have "the end of track was reached,...

nocturne elbow
#

what

wheat lake
#

Hi there,
Quick question; I'm getting the prefix of a player with the following method already loadUser(uuid).getCachedData().getMetaData(QueryOptions.defaultContextualOptions()).getPrefix(). I now want to get all context that's together with this (highest) prefix. Does anyone know how?

nocturne elbow
#

QueryOptions.defaultContextualOptions()

Eeeee that's probably not what you want blobcatgrimacing you'd want to use the user's active context set, the default contextual options will use the context set in the contexts.json -> default-contexts
Fortunately there's a getMetaData() method that doesn't take any parameters that will user the holder's active query opts

#

Luck why is Result#node() nullable instead of returning an optional ugh

hybrid panther
#

pr or shut up

nocturne elbow
#

ooh +1 for my api improvements pr

#

coming up with a new function name tho ugh

wheat lake
#

Fortunately there's a getMetaData() method that doesn't take any parameters that will user the holder's active query opts
Yea already found that method. But as soon as the player's primary group has a prefix with out of scope contexts this means it's getting the prefix from another group I'm unable to get those other context

nocturne elbow
#

What is it you want to do?

wheat lake
#

At the moment I get the current prefix of a player and adapt it. After that I add the custom prefix to the player itself with a higher weight.

Now someone asked me if it's possible to keep the old context. This means I need to get the context of the default prefix, and save it with the custom prefix.

nocturne elbow
#

Okaaaay I see

#

Let me see if I got this straight

#

Actually hold up..

jaunty pecan
#

I think Emily might be about to say the same thing, but: the better way to do that is to not override the LuckPerms "prefix" - but instead use meta for your tag and let your users access it via a placeholder

#

e.g.
(do the API equivalent of) /lp user Luck meta set special-tag "&c[MySpecialTag]"
then use the placeholder %luckperms_meta_special-tag% in your chat formatter/tablist/whatever

wheat lake
#

Hmm. At the moment I'm overwriting indeed the LuckPerms prefix itself. This is the easiest for most of the plugin users

jaunty pecan
#

what is the purpose?

#

like, what bit of the prefix are you changing

wheat lake
#

In my example I'm not changing anything. But with my plugin you can customize almost every bit of it

jaunty pecan
#

the text as well as the color?

wheat lake
#

Yes, tag color, name color, tag text. Even the bracket colors

#

Fully customizable based on permission for players themself

jaunty pecan
#

alright

#

is probably the method to use then

#

but contexts (in theory can) change all the time, so it's a tricky one

wheat lake
#

Yea, Emily already pointed that out. Was already looking into this (new) method

#

I know context can change, and I'm gonna warn the admins about this when enabling this feature (disabled by default)

jaunty pecan
#

the other option is that you provide a placeholder that takes the prefix returned by LP and edits it on the fly

#

if I was trying to achieve the specific thing you're trying to do - that's probably how I'd do it :)

wheat lake
#

Yea, but that means I need to save all modifications a player does to their prefix.

#

At the moment a player can change the prefix and I'll save it back into luckperms 😉
No need to save userdata for me

jaunty pecan
#

hm yeah

wheat lake
#

And since I use some aggressive regexes for splitting the prefix into the customizable parts, I don't wanna do it on the fly

jaunty pecan
#

I don't entirely understand why you'd want to let players customize every aspect :P

#

but that's ok - I don't have to :D

wheat lake
#

Yea, good question. The plugin started small, but I add new features if someone asks it

jaunty pecan
#

ah yes I know how that can be!

wheat lake
#

It's a very nice concept, let players choose their own prefix color, name color, bracket color or even prefix test. In the latest version I also support suffixes as well

#

And it's al based on permissions, every color can be granted or revoked. Word can be black/whitelisted as well

#

But thank you Luck for your help, and I'm starting to try your new method. I assume the API Cookbook doesn't include a nice example yet?

distant hemlock
#

This is for API version 4:

        Set<String> groups = user.getAllNodes().stream()
                .filter(Node::isGroupNode)
                .map(Node::getGroupName)
                .collect(Collectors.toSet());

but this dont work in version 5 why?

turbid solar
#

cus it’s a different api version

#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
rocky compass
#

Any way I can do /lp search <permission> programmatically with the api? I don't need to do any kind of comparison other than the exact permission.

turbid solar
#

d;lp UserManager#searchAll

slate deltaBOT
rocky compass
#

ah spicy thanks

red bane
#

Anyone has any clue why luckPermUser.setPrimaryGroup("member"); returns FAIL? User found and can be added to said group using InheritanceNode.builder(memberGroup).value(true).build(); though.

nocturne elbow
#

primary group is (by default) automatically calculated from the parent group with highest weight

red bane
#

So the setPrimaryGroup method is broken?

nocturne elbow
#

it's not broken, the primary group is automatically calculated by default

#

it is configurable, but for 99.9999% of the cases it should be left that way

red bane
#

Hmm, okay

#

How can I set a node's weight?

#

I've got the following and I'd want to make sure the group I'm adding has a high weight, instead of deleting all existing ones

                luckPermUser.data().clear(NodeType.INHERITANCE::matches);
                var result = luckPermUser.data().add(node);
                userManager.saveUser(luckPermUser);
```e
nocturne elbow
#

nodes themselves don't have weights, groups (group permission holders) have WeightNodes which, well, determine their weight

red bane
#

So how does one add an InheritenceNode with weight? I don't understand

#

Or in other words, how do I combine an InheritenceNode with a WeightNode?

nocturne elbow
#

it's the group itself that holds the weight node, groupManager.getGroup("blah").data() etc

#

the InheritanceNode on the User doesn't change

red bane
#

The weight isn't reflected per user? e.g owner group could have weight 50 for user X and weight 60 for user Y?

nocturne elbow
#

that's not a thing, no

red bane
#

Alright, and when a group inherits from another, is there a 'weight bump' there?

#

Or do I have to manually define a group's weight?, with some 'buffer' for future groups, ect

nocturne elbow
#

There isn't, it needs to have its own weight too

red bane
#

alright so as i understand when configuring groups, i need to configure their weights as well as their inheritance (when i have a simple hierarchy as admin -> mod -> member -> default)

nocturne elbow
#

if "->" is "inherits from" yeah, and admin would have higher weight than mod, mod higher than member etc

red bane
#

but all of their weight is 0, the inheritance will take over the weight equality?

nocturne elbow
#

weight is crucial when one inherits directly from multiple groups (e.g. I have both "mod" and "translator" as parent) (and for prefixes/suffixes but that's separate from group weight)

#

let me find something

#

(though the numbers here represent the visiting order)
but in this case 2 would have higher weight than 5, and 6 would have higher weight than 8
also 2 inherits from 3 and 5 from 6 and 8

#

graphs :')

hybrid panther
#

graphs :D

red bane
#

wait

#

the lower the number the stronger the weight? no

nocturne elbow
#

no, that on the gif is the visiting order

#

but for groups, the higher the weight the, higher the weight

#

lol

red bane
#

i'm confused

#

but!

#

at last i understand what i need to do in order to get the group right

nocturne elbow
#

ignore the numbers
inheritance determines up to down
weight determines left to right

red bane
#

there is no need to remove the 'default' group though as I understand

nocturne elbow
#

unless you actually need to not have its permissions I suppose ¯_(ツ)_/¯

red bane
#

better get to work

#

i'll look into it, thanks for the guidance!

nocturne elbow
#

!weight might be of interest, uh

frank driftBOT
#

LuckPerms allows you to set weights in order to determine the priority of certain nodes, like permissions and even prefixes. A higher weight number is a higher priority.

halcyon fern
#

Hey guys could i just check if this is correct usage to add user a specific permission?

turbid solar
#

save the user

halcyon fern
#

this luckPerms.getUserManager().saveUser(user);?

brazen sinew
#

is there any way I can remove all users from a specific group with the api?

fierce cove
#

Here is a plugin i make with LUCKPERMSAPI

karmic shadow
#

why not just let people use argbase permissions so people can set only x specific groups or otherwise modify users based on lp permissions manythink

#

by default with luckperms commands they can give themselfs and others player Owner rank and destroy your beloved server.
this is just untrue yk.

#

!arbased

frank driftBOT
turbid solar
#

d;lp hasPermission

slate deltaBOT
#
public interface CachedPermissionData
extends CachedData```
CachedPermissionData has 3 methods, 1 extensions, and  1 super interfaces.
Description:

Holds cached permission lookup data for a specific set of contexts.

tame raft
#

hey how i can set a user to a group?

#

i have use the setPrimaryGroup method but this dons´t work

turbid solar
#

!cokmbokk

frank driftBOT
tame raft
#

thx

#

!help

frank driftBOT
#
Available commands

!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir

!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki

nocturne elbow
#

!tutorial

frank driftBOT
tame raft
#

!api

frank driftBOT
tame raft
#

hey

#

I get this error when I get the suffix from the api

#

[23:15:54] [Craft Scheduler Thread - 3/WARN]: Exception in thread "Craft Scheduler Thread - 3"
[23:15:54] [Craft Scheduler Thread - 3/WARN]: org.apache.commons.lang.UnhandledException: Plugin DevServerSystem v1.0 generated an exception while executing task 7
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Unable to get a user for CraftPlayer{name=johngeorgas}
at me.lucko.luckperms.common.api.implementation.ApiPlayerAdapter.getUser(ApiPlayerAdapter.java:61)
at net.luckperms.api.platform.PlayerAdapter.getMetaData(PlayerAdapter.java:113)
at de.samir.devserversystem.utils.LuckPermsPermissions.getSuffix(LuckPermsPermissions.java:50)
at de.samir.devserversystem.manager.ScoreBoardManager.lambda$new$0(ScoreBoardManager.java:30)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3 more

#

my code

#

public String getSuffix(final Player player) {
CachedMetaData metaData = luckPerms.getPlayerAdapter(Player.class).getMetaData(player);
return metaData.getSuffix();
}

hazy pewter
#

Hey guys, is there some way to listen for changes to nodes and retrieve which command sender is making these changes? NodeMutateEvent doesn't have a sender field

light moon
#

help me please

turbid solar
#

soft depend on LP

nocturne elbow
#

You might be able to extract that info from one of the action log events (LogPublish/LogReceive)

light moon
#

am I using correct library?

nocturne elbow
#

LP is on v5.4

#

!api

frank driftBOT
nocturne elbow
#

check out the first page ^

#

Not only that but you are not able to get the API instance in the constructor, get it in ProxyInitialize

nocturne elbow
light moon
#

okey, but If I use spigot I will use this method to initialize luckperms

#

but how can I do it in velocity plugin?

nocturne elbow
#

Keep reading that page

#

Right below

light moon
#

I dont have LuckPermsProvider class

#

ohh

nocturne elbow
light moon
#

wait

#

I have it now

#

my bad

#

so

#

it will work yea?

nocturne elbow
#

it should

light moon
#

I will try

light moon
nocturne elbow
#

don't @Inject it

#

simply get it from the LP provider in the proxyinitialize event

light moon
#

It is working

#

but I can't get player prefix

#

it is always null

#

but I am in group with prefix

#

it is working

#

thanks for help

hazy pewter
edgy bramble
#

Hey! How could I delete an user from the storage provider (MySQL) using the Developer API?

clever zodiac
#

to my knowledge, there is no support for deleting users

nocturne elbow
#

mm yeah there's UserManager#deletePlayerData(UUID) if you want to remove the username -> UUID entry in the cache, but if you want to remove the user's permissions just call NodeMap#clear().. basically emulating the user clear command and that's as far as you're gonna get honestly

wheat venture
#

What is the easiest way to access the api once it's loaded on fabric? Just need to register a context calculator, but I get error that luckperms isn't loaded if I do it at mod init.

nocturne elbow
#

I think on SERVER_STARTING it's fine
it'll definitely be there on SERVER_STARTED otherwise tho

wheat venture
#

oh yes that'd work

nocturne elbow
#

Hi, 1 question please, i will create server (bukkit) 1.12.2 , but i error because lp permision of cause server offline. please help

turbid solar
#

use one of the support channels

#

and use paper

#

or spigot

nocturne elbow
#

okey thanks

onyx hull
#

Hello friends, is it possible to restrict entry zones according to the rank you have?

tranquil tangle
#

worldguard probably

onyx hull
#

I find it very difficult to combine the ranges of the lucky perms with the wordguard

tranquil tangle
#

it might be outdated tho

sharp nova
#

hi

onyx hull
#

Thx so much😀

still trout
#

so when i updated to 18.2 my luck perm custom ranks stopped working.. any solutions?

night pier
#

this is for the API.

still trout
#

yeah i didn’t know where to ask sorry

tranquil tangle
#

its fine

still trout
#

i barely got back to this server aswell tysm tho!

cedar ember
#

Hi! Is there a way to get the prefix from a Group instance?

turbid solar
#

yes

#

i think

#

!cokmbook

frank driftBOT
turbid solar
#

d;lp Group#getCachedData

slate deltaBOT
cedar ember
sudden fractal
#

I want a list of roles a user has EG:


servers:
  survival:
    Role,Role2
  KitPvP:
    Awesome

#

is their an api metheord for this

half bolt
#

Are there plans for a Fabric "meta API" to go with the permissions API? I'd like to use LuckPerms' meta system to store things other than boolean flags, and I'm wondering if there's a more generic interface I can use rather than depending on LP directly. (I'm aware LP is the only permission manager for Fabric, would just like to keep compatibility open)

karmic shadow
#

I'm about to PR adding the table prefix (in case of mysql) or collection name (in case of mongodb) to lp info command output.
I can't seem to find the default value, i.e. 'luckperms_' to be stored anywhere to compare it and only add it if differs. Am I just blind?

hybrid panther
karmic shadow
#

That doesn't set it anywhere. It stores one string, not both?

#

Could add it sure but meh, bruh i been fighting this all day already

hybrid panther
#

wat

#

the mongodb collection string is like 12 lines under that

#

if ConfigKeys.sql_table_prefix != "luckperms_" {
// add to /lp info here
}

karmic shadow
#

magic numbers??

hybrid panther
#

wat

karmic shadow
#

Well, that was mostly in vain <.< I'll try harder next time I guess

jaunty pecan
#

changed it

karmic shadow
#

jesus you're fast. thought it looks a bit weird with the same color. hope we can figure out 'mimimi my server doesnt sync mimimi' a bit faster in some cases where it totally appears to be a mystery lol

jaunty pecan
#

yep! thanks again :D

karmic shadow
#

Thanks for pulling it. I sat on this for hours, thinking how best to do it only for you to change like...a lot? But hey, at least I didn't perform bad enough to be worth being roasted 😂 Yes, I have insecurity issues and battle java every day so I didn't just shake this out of my sleeve like that

jaunty pecan
#

ah, I didn't change much! just a few tweaks which mostly come down to personal preference

#

there was nothing wrong with what you PRed as-is :)

karmic shadow
#

❤️

half bolt
nocturne elbow
#

I think that would be a fair addition to make given that LP also has "native" integration with Vault on Bukkit (and already has a "native" integration with the permissions API in Fabric too!), @jaunty pecan what do you think?

winter crystal
#

hi

#

there is api to remove group from user ?

covert pasture
#

!cookbook

frank driftBOT
winter crystal
#

@covert pasture bunngeecord

turbid solar
#

api is the same

frank driftBOT
fierce cove
#

!help

frank driftBOT
#
Available commands

!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir

!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki

fierce cove
#

!whyluckperms

frank driftBOT
tame saffron
#

!testingperms

frank driftBOT
#
How-to test permissions

Small list of things for you to make sure when testing permissions:
1. Don't test as op, your players/general staff will most likely not have op
2. Make sure you don't have any special permissions (e.g. * or the same permission you are testing) on your user (/lp user <user> permission info)
3. Make sure your parent groups are the ones the target audience you are testing will have (if you are testing mod perms, don't have owner as parent)
4. Use verbose to see exactly what's going on, what permissions are being checked

unkempt atlas
#

Hey, how can I call the LuckPermsAPI instance on bungeecord?

nocturne elbow
#

you get the LuckPerms instance through the LuckPermsProvider class

#

!api might want to check these pages out :D

frank driftBOT
humble void
#

how do you get a players prefix

#

nvm

oblique hedge
#

I'm confused
what is the luckPerms var? Its not able to find it

#

what should luckPerms be defined as?

nocturne elbow
#

an instance of the LuckPerms interface which you get either through the platform's service manager or through the LuckPermsProvider class

ember hedge
#

any idea why UserManager#getUser would return null for an online player?
someone using my plugin is having constant issues with it returning null (any my plugin only tries to access it for online players)

clever zodiac
#

Are you sure that's what's returning null, and if so that it's only running for an online player?

#

it should return a User object if the user is loaded, which should be true for every online player

ember hedge
#

yes, im sure theyre online. its being run when the player executes a command

and the user is the only thing that could be null on the line

User user = api.getUserManager().getUser(player.getUniqueId());

SortedSet<Node> nodes = user.resolveDistinctInheritedNodes(QueryOptions.nonContextual()); // nullpointer from this line
#

(please ping me if you reply again)

clever zodiac
#

Do they have an old version of the plugin with the NPE line being something else?

#

because straight from the LP dev docs "Online players are guaranteed to have an associated User object loaded already."

#

@ember hedge

ember hedge
#

i doubt it. this class in my plugins hasnt changed in quite a while (as its a class specifically for a luckperms hook, and there hasnt really been issues in a while)

#

ill double-check

#

oh wait actually yes i am sure its that line

#

java.lang.NullPointerException: Cannot invoke "net.luckperms.api.model.user.User.resolveDistinctInheritedNodes(net.luckperms.api.query.QueryOptions)" because "<local3>" is null

clever zodiac
#

ah okay

ember hedge
#

please ping me if you reply 😉

turbid solar
#

what’s <local3>?

#

@ember hedge

clever zodiac
#

I'm going to assume whatever he used to compile didn't fill out the locals frame in the bytecode

#

though it's pretty safe to assume it's just user

ember hedge
#

could it be something wrong with their luckperms installation?

clever zodiac
#

I mean if every other player is fine I don't think so

ember hedge
#

apparently its spamming so i guess its more than one player

clever zodiac
#

its spamming?

#

why would it be spamming if its on command

ember hedge
#

lots of players doing the command

#

its also long so im sure it seems a lot more "spammy" 😄

clever zodiac
#

all right, I think we need more information

#

have them run /lp user <user that it is null for> info

#

just curious what shows up

ember hedge
#

ok, ill ask them

jaunty pecan
#

check player.isOnline() :p

#

it's possible that a player instance has stuck around but the corresponding player is no longer online

clever zodiac
#

well if they have a Player object & the code is being ran after the player runs a command

#

how would they not be online

jaunty pecan
#

if it's directly in a command executor then yes that's unlikely

#

the other possible explanation is that some plugin has changed their uuid with reflection after they first logged in

clever zodiac
#

that's also very possible, or if there's a proxy the proxy told the server something else, I just think the server owner would know something like that is happening

#

any plugin that does something like that is probably very specific to the server

umbral imp
#

Somebody wants to help?

turbid solar
#

show your pom

#

or build.gradle

torn wolf
#

Hi,
is there a way to retrieve all users from a specific group?
The User only provides a method to get the primary group as a string.
I could loop through all loaded groups and check if they're the same, but this won't get me to my goal to get all users

nocturne elbow
#

@torn wolf there's UserManager#searchAll(NodeMatcher) (or something similar), you'd pass a NodeMatcher for the corresponding InheritanceNode

nocturne elbow
#

which one what?

torn wolf
#

Didn't understand nodes so well, but I read the docs and I have a rough idea how I can do that.
I'll try that tomorrow and get back to you, if I have something

void kiln
#

I have a very peculiar question,

#

We are a large scale network running with a lot of players, and currently using luckperms.

#

One of the largest concerns we currently have is reducing the amount of requests made to mojang,

#

And for that we have deployed our own, pretty effective solution which uses several third party API's and multiple caching layers

#

What I was wondering, would it be possible to somehow "hijack" LuckPerms's UUID provider to source it from our solution?

turbid solar
#

iirc it uses the server’s method

nocturne elbow
#

by default LP won't do any requests neither directly or indirectly, it keeps its own cache but the single "source of truth" for UUIDs are the login events (so those are provided by the server, how the server gets them is irrelevant to LP)

#

you can enable username lookups in the config so it asks the server for the UUID for a username (if it isn't in its own cache) but that lookup itself is handled by the server, whether it reaches out to Mojang or not is still irrelevant to LP

jaunty pecan
jaunty pecan
#

:)

void kiln
#

I assume LP relies on those right?

jaunty pecan
#

the server (and therefore all plugins) does

void kiln
#

Also, while I've got you here,

#

Is there any way to programmatically trigger spark?

#

I already setup some emulation of a player, to be able to do this kind of stuff

#

Showing up as this

#

But this feels rather clunky

jaunty pecan
#

that's the best way for now

void kiln
#

I essentially jerry-rigged the player to send packets with the messages to our main console

jaunty pecan
#

there is an open PR for a "profiler API"

#

I'm unsure on it - I don't mind people doing what you're doing, that seems fine!

void kiln
#

Yeah, but picking the URL out of the message seems error prone

jaunty pecan
#

the problem is when people try to trigger it automatically (e.g. in response to some event) and get the thresholds wrong :P

void kiln
#

And I would also start needing to implement some kind of differentiator inside my message packet

#

And emulate a player for each command call

#

so i can associate commands to messages recieved

#

but still, this feels clunky

void kiln
jaunty pecan
#

yea that's my fault mostly

void kiln
#

No worries, even so, it's a fantastic piece of code, and, along with JProfiler has helped me discover a lot of issues

#

Thanks eitherway a lot for your contributions

jaunty pecan
#

cheers, no problem! :)

shadow scaffold
#

Hi. I am running Luckperms on a seperate system, like the jar is a standalone program which I intergrated Luckperms with, I have done this before, but now I don't remember how.
I want to check for a permission on all of the network, each gamemode has a different context. How can I search for a permission on all available contexts the user has?

torn wolf
#

Wasn't it UserManager#searchAll?

shadow scaffold
#

Nope

nocturne elbow
#

You want to ignore the user's (and the node's) context set?

#

In that case you would get the user's cached data, then call getPermissionData passing QueryOptions.nonContextual() as QOpts

#

then checkPermission

shadow scaffold
#

I’ll check

shadow scaffold
#

Thanks that solved it, appreciated.

tardy bone
#

Hi

#

It's my first time working with lp api

#

How can I add and remove players from a specific group

wild whale
#

!cookbook

frank driftBOT
tulip lantern
#

I want do have the amount of homes a player can have with the permission freebuild.home.
I found the contexts, is that possible that i can use that? Also, how can i get the Value of a context?

nocturne elbow
tulip lantern
#

thx

woven topaz
#

hi,
I wanted to check if offline player has permission. I used:

LuckPermsProvider.get().getUserManager().loadUser(UUIDOfOfflinePlayer).get()
.data().contains(Node.builder("My Permission").build(), NodeEqualityPredicate.EXACT).asBoolean()

and if user has this permission it works. But if user has group which has permission it returns false.
How can I check if player has permission or is in a group which has permission?

nocturne elbow
woven topaz
#

thanks. It's working 🙂

inner cradle
#

How to give player rank using lp api?

unreal mantle
#

By getting the users data, then adding the group node to them

inner cradle
#

o

inner cradle
unreal mantle
#

Yeah

inner cradle
#

oo

unreal mantle
#
public static boolean isPlayerInGroup(Player player, String group) {
    return player.hasPermission("group." + group);
}

Is the example from the wiki.

turbid solar
#

i’d use isPermissionSet

#

iirc hasPermission also returns true if you are op or have *

unreal mantle
#

I personally use my own custom method lol

inner cradle
#

How to get group node

#

Group group = instance.getApi().getGroupManager().getGroup(" WHAT TO PUT HERE ");

turbid solar
#

the group name?

karmic shadow
#

^^

turbid solar
#

lowercase

#

idk if it matters but groups are lowercase

inner cradle
#

what group name

#

like the display name

unreal mantle
#

...

inner cradle
#

these?

unreal mantle
#

The name of the group you want to get...

inner cradle
turbid solar
inner cradle
#

please tell me here

unreal mantle
#

We have...

#

Multiple times

inner cradle
#

;--;

unreal mantle
#

You. Use. The. Group. Name. Of. The. Group. You. Want. To. Get.

inner cradle
#

wait

#

i want to grant them rank but only for 7 days

#

please omega just help me with this

#

please

turbid solar
#

add an expiry to the node

inner cradle
#

let me try

turbid solar
#

d;lp Node#expiry

slate deltaBOT
#
@NonNull
B expiry(@Nullable TemporalAccessor expiry)```
Description:

Sets the time when the node should expire.

Parameters:

expiry - the expiry time

Returns:

the builder

inner cradle
#

this means 7 days right

turbid solar
#

yes

#

(pretty sure)

inner cradle
#

100% sure

unreal mantle
#
Node node = Node.builder("some.node.key")
        .value(false)
        .expiry(Duration.ofHours(1))
        .withContext(DefaultContextKeys.SERVER_KEY, "survival")
        .build();
#

That's the example from the wiki.

inner cradle
#

omega

#

wait i know it

#

Nvm

turbid solar
#

i don’t do dm support

inner cradle
#

o

#

can you tell me here

#

powercas

fringe torrent
#

👀

turbid solar
#

ask the question here

fringe torrent
#

-> Don't PM or @tag anyone directly. (there lots of other people in the channel that may be able to answer your question)

inner cradle
#

can you tell me the expire method in NodeBuilder needs the time in miliseconds or just Duration.ofDays(7)

turbid solar
#

you can use the duration method

inner cradle
#

ok

calm mauve
#

Ich frage mal so direkt, kann hier jemand deutsch? Xd

#

Brauche hilfe

karmic shadow
#

^java.lang.NoClassDefFoundError: me/lucko/luckperms/api/LuckPermsApi
at de.pattyxdhd.lucktab.LuckTab.loadLuckPerms(LuckTab.java:77) ~[?:?]
at de.pattyxdhd.lucktab.LuckTab.onEnable(LuckTab.java:48) ~[?:?]

calm mauve
#

Jaja danke xD

#

What was just written in is my problem. I don't know how to get the latest API version. can someone help me?

#

I'm talking about maven by the way xD

karmic shadow
#

Jestzt du^^

fierce cove
karmic shadow
#

ehm

fierce cove
#

Now i in process of otimizing it

#

As much i can

high siren
#

paper discord

fierce cove
karmic shadow
turbid solar
#

change the HashMap to a Map

#

something something api compatible if you later want to change it to say a LinkedHashMap or whatever

nocturne elbow
#

Anyone know how i can convert all luckperms groups and permissions to my new rank core?

nocturne elbow
#

No because no one knows your rank core :p

#

Like we can't tell you how to do X to Y without knowing anything about Y

nocturne elbow
#

And hes gonna sell the rank core too

#

Right...

karmic shadow
#

Lolololol

nocturne elbow
#

ok.

#

I don't really know how you expect people to tell you how to actually use your own ranks system

#

Like sure I can tell you how you can get data from LP, but I can't tell you how to put that same data in your rank core because no-one knows anything about it

#

ok.

ember trout
#

Is it possible to check player permission if player is offline? (I'm using mongodb, so maybe somehow using database?)

turbid solar
#

load user

#

cached data

ember trout
#

Ok, I have it, thank you!

charred heath
#

Hi, I'm trying to list all the servers in the network to add the ones with a similar name to the server key in a context. I was using:
api.getContextManager().getStaticContext().getValues("server")
but that only returns the current server. Is there a way to do this? I only started yesterday so I might miss something obvious.

nocturne elbow
charred heath
#

But now I'm hoping that someone knows a cleaner solution.

nocturne elbow
#

LuckPerms does not have that information of all "server contexts"

#

And looping through all nodes does not necessarily guarantee you to get them all either, e.g. if I have a server with LP server setting "limbo" or whatever, but there are no nodes with server=limbo as context, then you won't get that one

#

Looping is probably the easy way out nonetheless

ashen nexus
#

Is UserDataRecalculateEvent called when a player joins or do I need to also subscribe to UserCacheLoadEvent for that?

nocturne elbow
#

It should be called on data recalculate yeah

nocturne elbow
#

Theres is getSource for UserPromote and demote event, but i can't find the source or executor for NodeMutateEvent. Im unsure on how to get it

nocturne elbow
#

trying to get the user, or if console sent the command to change somebody's permission

#

the one who ran the command

#

Yeah that's not something LP provides, as not all node changes are done with commands

#

Depending on the platform you're using you could hook to some event that's called before the command runs but, you'd need to do the command parsing yourself, and maybe keep track of whose nodes were changed and combine that with the other LP events..

#

mmm okay thanks

mellow spire
#

hihi

nocturne elbow
#

If you don't want to depend on LP directly, I guess so

mellow spire
#

Ok, I can add net.luckperms:api as a compileOnly dependency to my fabric mod to use the luckperms api then right?

nocturne elbow
#

Yep

mellow spire
#

alright cool :D

quartz current
#

Hi! Could anybody tell me how I can listen for a group rename event or something like this?

polar garnet
#

how do I get a list of groups and their prefixs?

torn wolf
polar garnet
polar garnet
#

thanks

tardy bone
#

Hi, how do I see if one of player's parent groups has a certain permission?

#
private List<Player> WeightedList()
{
    List<Player> players = new ArrayList<Player>(Bukkit.getOnlinePlayers());
    List<Player> playersToRandomize = new ArrayList<Player>();
    for (Player player : players)
    {
        if (PlayerParentGroupHasPermission("some.permission"))
        {
            /do something
            playersToRandomize.Add(player);
        }
    }
    return playersToRandomize;
}
turbid solar
#

just the parents or also the users perms?

#

or just use the bukkit api since you’re using that already

#

hasPermission or isPermissionSet

tardy bone
#

I've tried hasPermission but since the rank is the one having the permission set it does not work

nocturne elbow
#

It definitely does work, that's the entire point of inheritance

tardy bone
#

I know it should but it didnt

nocturne elbow
#

Then something in the permissions setup is "wrong"

tardy bone
#

It didn't work until I set the permission to the player

nocturne elbow
#

You can check with lp user <user> permission check <permission> to see what the final value is, and where it's coming from

nocturne elbow
tardy bone
#

but player is in the group with permission

nocturne elbow
#

Can you send an /lp editor link?

tardy bone
#
nocturne elbow
#

what's the player name you're checking this for? "admin"?

tardy bone
#

TEXAPlayer

tardy bone
nocturne elbow
#

can you run and screenshot lp user texaplayer permission check avatar.nonchoosable?

tardy bone
nocturne elbow
#

and it's working

tardy bone
#

let me see again

nocturne elbow
#

it's not working for admin (user) because none of their parent groups have the permission, and neither does the user itself

tardy bone
#

I put this in a scheduled task

private List<Player> WeightedList()
{
    List<Player> players = new ArrayList<Player>(Bukkit.getOnlinePlayers());
    List<Player> playersToRandomize = new ArrayList<Player>();
    for (Player player : players)
    {
        if (player.hasPermission("avatar.nonChoosable"))
        {
            System.out.println(player.getName());
        }
    }
    return playersToRandomize;
}
#

the scheduled task occurs for every 5 seconds

nocturne elbow
#

okay

tardy bone
#

in two minutes the name is not mentioned

nocturne elbow
nocturne elbow
#

put prints in between. at the start etc

tardy bone
#
private List<Player> WeightedList()
{
    System.out.println("entered weighted list");
    List<Player> players = new ArrayList<Player>(Bukkit.getOnlinePlayers());
    List<Player> playersToRandomize = new ArrayList<Player>();
    for (Player player : players)
    {
        System.out.println(String.valueOf(player.hasPermission("avatar.nonChoosable")));
        if (player.hasPermission("avatar.nonChoosable"))
        {
            System.out.println(player.getName());
        }
    }
    return playersToRandomize;
}
#

i'm trying now

nocturne elbow
tardy bone
#

wait a moment, the result of the command is unstable because the plugin does manage player groups each cycle, so give me a moment I do stop that

nocturne elbow
#

what

tardy bone
#

the plugin is supposed to set a parent group to a random player each cycle working with some kind of weights through permissions. That all works, now I'm trying to make the player who already has the group not be chosen again but I can't

#

I've seen why this does not work

#

thanks

nocturne elbow
#

ah cool

tardy bone
#

the thing is I'm removing last player's group before choosing another one

fierce holly
#

hey stupid question

#

how do you install the api?

main dagger
#

you dont

fierce holly
#

i was under the impression you have to have the api on file for maven to make the dependency

main dagger
#

the api is part of the plugin already, its not an additional thing

fierce holly
#

like you do for spigot

#

oh, so I just need to install the plugin somewhere?

main dagger
#

thats not installing, but yeah you do need to that

fringe torrent
#

You'd need to add it to maven no?

#

As a depend?

fierce holly
#

oh im an idiot

#

just had to rerun maven with the dependency included

cunning tiger
#

Heya, I am looking to get the highest group a player has from a specific track. I don't see any exposed way from the API to get the tracks a user is on, any ideas?

nocturne elbow
#

hm yeah there's no "built-in" way to do that

nocturne elbow
#

Not the prettiest solution but :') gotta make do

cunning tiger
#

rip was hoping I didnt need to do that

#

oh well - thank you :)

nocturne elbow
#

err, check for each of the player's parents if it's contained in the track you want*

upbeat berry
cunning tiger
#

ah thanks - I already got it

fresh flame
#

Hi !

I'm using the luckperms API and I have a question

I want to get the highest (with weight) group in a track for a player

Thank you very much !

fresh flame
#

Pls ping me, thx 😄

fringe torrent
#

@fresh flame

fresh flame
fringe torrent
#

You asked to be pinged

#

I obliged

fresh flame
#

^^

#

You are a kid

fringe torrent
#

Yessir

fresh flame
#

Hey,

How can I instant get changes ?

When I update a player query (add a group), this is not update with my code (I'm trying to get the next track group)

This is my code

   public static String getNextOnTrack(Player player){
        LuckPerms luckPerms = LuckPermsProvider.get();
        @Nullable Track track = luckPerms.getTrackManager().getTrack("skygrades");

        if (track == null || track.getGroups().size() <= 1) {
            return "track == null";
        }

        List<Group> groups = luckPerms.getPlayerAdapter(Player.class).getUser(player).getNodes(NodeType.INHERITANCE).stream()
                .filter(n -> track.containsGroup(n.getGroupName()))
                .distinct()
                .map(n -> luckPerms.getGroupManager().getGroup(n.getGroupName()))
                .collect(Collectors.toList());
/*
        if (groups.size() != 1) {
            return "size != 1";
        }*/

        return Strings.nullToEmpty(track.getNext(groups.get(0)));
    }

I have the return mousaillon but I already have this group, I need to have the next (moucheur)

This is my track → https://prnt.sc/mElN2bYbclLt

Thank you very much !

nocturne elbow
fresh flame
#

fix with /lp user Teyir promote skygrades

#

Bc normally I just /lp user Teyir parent add GROUP

nocturne elbow
#

and how are you calling that method you sent above?

fresh flame
#

userUtils.getNextOnTrack(player)

#

it's static

#

I can call this method however

#

(sorry for my bad english)

nocturne elbow
#

can anyone tell me a free 247 hosting pls?

ancient sable
#

Hello, how are you?

#

Is there a way to export luckperms data in general into yaml files?

#

Because im doing a plugin which should get all the current ranks and permissions from Luckperms

turbid solar
#

you should use the api

ancient sable
#

Allright but what specific?

#

Because my goal is to implement my permission plugin a way of importing from other plugins. That why im asking

turbid solar
#

!api

frank driftBOT
turbid solar
#

read the java docs

#

get loaded groups, users etc

#

then convert data to your stuff

ancient sable
#

Oh lmao

#

Too much work

#

But thanks

turbid solar
#

would be way harder by doing it using config files

ancient sable
#

No

#

Its more easy

#

You can just do:

On luckperm: /lp export ranks
On my plugin: /perms import ranks

#

In fact i think its better idea

fringe torrent
#

asks for help from people that know their stuff
<Gets told how to do it
Am gonna do it a different way anyway

ancient sable
#

I ask if they have a better way than mine. But meh

fringe torrent
#

Your first mistake is calling groups ranks

ancient sable
#

Arent the same?

turbid solar
#

if you say it’s a better idea go ahead

#

gl with parsing everything

clever zodiac
#

honestly the best idea is a middle-ground

#

see if you can use LP to parse the file for you and give u what you want

#

that allows them to not have LP installed, only have an old export, but still require little on your end

tranquil gorge
#

How can I check how long much time is remaining on a group or permission that was settemp with the api

pulsar nacelle
#

I want to get max possible number from permission using API. How do I do it? Example: player has permissions whatever.3, whatever.10, and whatever.100. I want to get the highest number from "whatever.#" permission.

#

note: The player is offline

#

note2: I cannot check every possible permission from 1 to 100 because 1. This will cause a lot of lag since I will be checking many player at once (in async ofc) and 2. I cannot determine what max number it can be. It can be 0, 1 or even 1000.

nocturne elbow
#

Well, if it's async it won't cause lag unless you're blocking & waiting for the result on the main thread
But that you're describing is what meta nodes and metadata are for, arbitrary data in a key -> value fashion, see:
https://luckperms.net/wiki/Developer-API-Usage#store-and-query-custom-metadata
https://luckperms.net/wiki/Developer-API-Usage#retrieving-metadata
And about the player being offline you'd need to load the User first, see https://luckperms.net/wiki/Developer-API-Usage#loading-data-for-players

#

Do note that meta nodes are specific kind of nodes, you can't arbitrarily query for my-key.some-value permissions, they are meta.key.value and have specific commands lp user/group .. meta set key value and a specific node type MetaNode too, but they allow for this map-like lookup in the cached data

pulsar nacelle
#

I need help with API... again.
So I want to search all users with meta "test" set.
This line is working only when player has meta directly attached to itself. Not working when player is inheriting meta "test" from group they have. How to get all users which have meta "test" inherited from group OR attached directly to the user?

prisma trout
#

Hey all, was hoping I could get some advice for an issue I'm running into.

I have a chat system where the player's 'chat format' is stored within the LuckPerms meta. So, for example, group default has a value at chat.format set to "<gray><name>: <white><message>" (this is a MiniMessage string using TagParsers to set name and message).

Every group has their own chat.format value, so I call UserManager#loadUser to look into a user's cached data for chat.format. As I understand it (and the jd's suggest), this will look into the group data as well. The loadUser method called every time a player sends a chat. So far, this has worked really well, but only 99% of the time.

At random intervals (as far as I can tell, I've been trying to nail this down for a while but never found a way to recreate it consistently), the loadUser method returns the user object like normal, but the cached data returns null for the data at chat.format. I'm not sure why this is happening (and I've confirmed it's LP because I've been printing out the result of chat.format and it is indeed returning null whenever this issue is triggered).

The full code for the method that loads their prefix format is here: https://gist.github.com/kadenscott/430ab80065da6e03b5b987fc8e6f0826

If anyone has any ideas, would love to hear them. (Maybe loadUser isn't the right method to use here?)

Running LuckPerms v5.4.21
This server is running Paper version git-Paper-333 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: 9fd870d)
jaunty pecan
jaunty pecan
#

loadUser performs a DB lookup each time, which you probably don't want

prisma trout
#

ahhhhh

#

Interesting, thank you

turbid solar
#

only if the user is offline no?

jaunty pecan
#

no - always

prisma trout
#

Because I have to account for a scenario where LuckPerms may not have loaded the User if the user isn't present on the server (I'm doing some discord->minecraft bridge shenanigans and I still need to load the user format for messages coming from a Discord player who's maybe not online), I assume it would be better to run loadUser and cache the object

#

Oh, getUser will work for offline users too?

jaunty pecan
#

sure that makes sense

#

in which case, try getUser first, then call loadUser after only if getUser returns null

prisma trout
#

Got it, that makes sense, thank you Luck

jaunty pecan
#

👍

wind moth
#

How to get the highest group of a user?

#

I have two groups, admin and default

#

why returns user#getPrimaryjGroup always default?

wild whale
#

Because default has the highest weight

#

Bigger number = higher weight

compact wave
#

How can I set a temporary rank via the api?

zenith linden
#

https://sourceb.in/OHwOR2I2cC

Is it possible to check if the player is offline, I need to be able to send (other plugin) commands to give them money or whatever when the command /checkandrankup (player) (rankfrom) (rankto) happens

wheat lake
#

Bukkit.getOnlinePlayers() or similar for each platform.
And check if the player is not in this list

shadow scaffold
#

Hi, is there a way to get the default-contexts on API?
I can only see a method for static-contexts

nocturne elbow
#

Yeah there's QueryOptions.defaultQueryOptions which uses the default contexts

shadow scaffold
#

Thank you 🙂

compact burrow
#

what's the permission in luckperms Bungee?

turbid solar
#

what?

compact burrow
#

i linked the plugin in mysql

#

with lobby and bungee

turbid solar
hoary helm
#

So I'm working on a project that will be using the upcoming forge version being added by a still in progress Pull Request. Trying to understand how pure LuckPerms would have for stuff like the hasPermissions method. The only example I could find involves bukkit in some way.

marsh falcon
#

hey, i want to get all the prefixes that the player has, which api should i look at, i can't find it

main dagger
hoary helm
#

I"m not aware of any.

main dagger
#

iirc the permissions api isnt actually merged into forge yet, so there probably wouldnt be anything other than like the example usages on the proposal/pr/whatever forge uses

marsh falcon
#

hey, i want to get all the prefixes that the player has, which api should i look at, i can't find it

pastel brook
#
        val node = NodeMatcher.key("meteor_location")
        luckPerms.userManager.searchAll(node).get().forEach {
            luckPerms.userManager.loadUser(it.key).thenAcceptAsync { user: User ->
                user.data().remove(Node.builder("meteor_location").withContext("server", "earth").build())
            }
        }

is this valid? apologize in advance for kotlin. am attempting to remove this permission node from everyone in the db, offline or online

hybrid panther
#

seems correct? is it not working?

pastel brook
#

haven't tested it, just haven't used completable futures before

#

am testing it now

hoary helm
#

So curious about something. I looked over luckperms a tiny bit and noticed something that implies along side permissions you can also include tiny pieces of data attached to the player.

pastel brook
#

oh i just realized i am doing what i put above wrong. how can i find out every user, online & offline, that contains a permission? not just online players?

#

i was under the impression userManager#searchAll does that, but I am not getting that result

nocturne elbow
#

That's what searchAll does yes

#

Though instead of using the loadUser function you'll make better use of UserManager#modifyUser, as it re-saves the user data to storage

#

Another word of advise: instead of doing searchAll(node).get() you should use .thenAccept, searchAll will lookup for the node in storage so it runs that async, and get/join will block current thread until that is done which is not super ideal

hybrid panther
#

advice *

nocturne elbow
#

thanks

hybrid panther
#

no problem!

pastel brook
#

that makes sense, thanks!

swift saddle
#

Any idea to set an user parent group using the API?

#

I want to change the player group when something happen.

#

User user = luckPerms.getUserManager().getUser(uuid);
This is How I can get the user

#

Then to add him to a group and remove him from his previous group?

carmine nova
#

Hello i have this error when i get the prefix of a user in bungeecord

the uuid is 333a2478-9711-4006-a17d-1f958f8d06f1

User user = Main.luckPerms.getUserManager().getUser(uuid);
String prefix = user.getCachedData().getMetaData().getPrefix();
frank driftBOT
swift saddle
#

"user" is null

carmine nova
#

yes

swift saddle
#

Maybe the user is Offline

carmine nova
#

i'm online

swift saddle