#luckperms-api

1 messages · Page 37 of 1

midnight wharf
#

Thank you for all of the help

nocturne elbow
#

Neato

nocturne elbow
#

i would like to give perms to use tnt and lava. how do i do that? i only have essentialsX and Luckperms. i already deleted antibuild

wild whale
#

This channel is for support for using the LP developer api. You want #support-1

nocturne elbow
#

ah ok tnx

dull egret
#

how can I add LuckPerms as a dependency for bungeecord?

nocturne elbow
#

The same way you would for bukkit

#

Only difference is that you would get an instance of LuckPerms through the LuckPermsProvider instead of the service manager

dull egret
#
<dependency>
        <groupId>net.luckperms</groupId>
        <artifactId>api</artifactId>
        <version>5.2</version>
        <scope>provided</scope>
    </dependency>
#

so I have to put that in pom.xml?

nocturne elbow
#

Yes

dull egret
#

😫

#

thank you

frank driftBOT
#

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

dull egret
#

sorry

nocturne elbow
#

@rustic laurel 2

zinc shuttle
#

How would i go about getting if a user is in a temporary group and if they are in a temporary group removing them from it?

#

user.data().remove(InheritanceNode.builder().group(group).build());
does not remove them for some reason

nocturne elbow
#

they have to match:
node key
node value
node expiry
node contexts

#

but you can specify for it to only take one (or rather say, not all of those) into account

#

!javadoc look for NodeMap#remove, there should be a method that takes a predicate or something

frank driftBOT
nocturne elbow
#

last link 👆

zinc shuttle
#

How many api's are there for this thing?

nocturne elbow
#

it's one single api lol don't know what you're asking really

zinc shuttle
#

theres no way for me to remove group by group name?

nocturne elbow
#

they have to match:
node key
node value
node expiry
node contexts

but you can specify for it to only take one (or rather say, not all of those) into account

#

!javadoc look for NodeMap#remove, there should be a method that takes a predicate or something

zinc shuttle
#

ah

#

ok

zinc shuttle
#

so i have user.data().contains(Node.builder("").build(), NodeEqualityPredicate.ONLY_KEY); but i don't know what they key should be..

nocturne elbow
#

Well 1. If you want to remove a parent group, use InheritanceNode.builder instead, and 2. in the builder you put in the group name

zinc shuttle
#

user.data().remove(InheritanceNode.builder().group(group).build());?

nocturne elbow
#

Yeah, although IIRC you can simply .builder(group) too

zinc shuttle
#

user.data().remove(InheritanceNode.builder().group(group).build()); doesnt remove temporary groups

nocturne elbow
#

-_-

#

so i have user.data().contains(Node.builder("").build(), NodeEqualityPredicate.ONLY_KEY); but i don't know what they key should be..
Add the predicate part

zinc shuttle
#

I want to remove.. i was testing with contains and forgot to switch it

#

@NonNull DataMutateResult remove(@NonNull Node node);

#

remove doesnt take a NodeEqualityPredicate either

nocturne elbow
#

Uuuhhh

#

Huh????

zinc shuttle
nocturne elbow
#

NodeMap#clear then I think

zinc shuttle
#

Where would i put that..

nocturne elbow
#

.data().clear(...), check the javadocs for

NodeMap#clear
That method see the arguments, that one for sure does take a predicate

zinc shuttle
#

Uh

#

nvm i fixed it

#

Im arleady using the nodemap..

nocturne elbow
#

I know

#

That's what .data returns

zinc shuttle
#

won't .clear clear all the data for the user?

nocturne elbow
#

Not if you use it properly, check its arguments

zinc shuttle
#

clear

void clear()

Clears all nodes.
#

Theres some others aswell

nocturne elbow
#

There are other clear methods, I'm sure

zinc shuttle
#

but thats what i want yes?

nocturne elbow
#

Yes, you have to give the built node to the NodeMatcher + tell it to compare keys only

zinc shuttle
#

it wants a context set

#

not a node..

nocturne elbow
#

Because it can clear several nodes based on context

zinc shuttle
#

How do i use a context set?

#

i purposefully avoided those

nocturne elbow
#

Iirc PermissionHolder (i.e. User & Group) has a method to retrieve the current context set

zinc shuttle
#

Isnt that permissions at that point?

#

Wont anything with all permissions (*) have the highest rank to that

nocturne elbow
#

Huh?

zinc shuttle
#

Permissions..

#

Its a permission holder

nocturne elbow
#

A PermissionHolder is something that can have nodes

#

i.e. Users and Groups

#

Both of those can have permissions

zinc shuttle
#

oh

#

So how would i use a permissionHolder?

nocturne elbow
#
ImmutableContextSet contexts = user.queryOptions().contexts();

Or something like that, that's the context you'll pass to the clear method

zinc shuttle
#

queryOptions doesnt exist

nocturne elbow
#

getQueryOptions?

zinc shuttle
#

Whats the predicate version of NodeEqualityPredicate.ONLY_KEY?

nocturne elbow
#

See NodeMatcher

zinc shuttle
#

so something like this?
user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(group));

nocturne elbow
#

Looks good

#

Wait no

zinc shuttle
#

so this will only remove the group?

nocturne elbow
#

Is group the built InheritanceNode??

zinc shuttle
#

is now

#

user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(InheritanceNode.builder().group(group).build()));

#

group is just a string

#

that is passed

nocturne elbow
#

Then yeah, it will remove all nodes that are parent groups for that group, regardless of expiry, contexts and value

zinc shuttle
#

so do i still need? user.data().remove(InheritanceNode.builder().group(group).build());

nocturne elbow
#

...... no

zinc shuttle
#

i really hope this works lol

nocturne elbow
#

Try and see

zinc shuttle
#

it does not

nocturne elbow
#

Are you saving the user data?

zinc shuttle
#
        User user = loadUser(player);
        if(user == null){
            Bukkit.getLogger().severe("user " + player + " does not exist.");
            return;
        }
        user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(InheritanceNode.builder().group(group).build()));
//        user.data().remove(InheritanceNode.builder().group(group).build());
        api.getUserManager().saveUser(user);
    }```
#

Thats the entire method

#

Unless the saving is different than the normal saving method, it should be saving

nocturne elbow
#

Looks good...

#

I'll test later, I'm not on a computer rn so ye

zinc shuttle
#

ah

#

if someone knows a fix please @ me 🙂

nocturne elbow
#

how would i make groups colored and get their color through the api?

#

uuuhh.... you mean the prefix? the display name? a meta?

#

that they have the color of their group

#

probably either a) color code at the end of the prefix or b) a meta key whose value is the color code

#

hm

#

which one is the better way?

#

intended way

#

¯_(ツ)_/¯

#

If I know I'll reuse the color code on its own in other places, I would use meta

#

because i want to use it in my plugin lol

#

and idk how to get meta and the color code of the prefix

#

so i wanna make sure where to start seatching for that stuff

#

and what i look for

#

well getting "the color code of the prefix" doesn't make much sense

#

hm what if i just use the complete prefix?

#

prefixes/suffixes can have multiple formatting codes applied to them

#

hm what if i just use the complete prefix?
that would work, yeah

#

ok perfect. Do you know how i do get the prefix of a group?

#

!cookbook see the example commands in here 👇

frank driftBOT
nocturne elbow
#

k thanks

zinc shuttle
#

What's the method to change the hovertext of the player count?

obtuse jolt
#

I doubt that is luckperms api related?

zinc shuttle
#

I know that it's not. It was more directed to pisonmaster

round phoenix
#

Hi !
I would like to create my own command which would take the information given by the command / lp user DjeyMute permission info
Can you help me ? I would especially like to recover the time left in the permission I give to my players

wild whale
#

Gonna need a bit more info on that, what specifically do you need help with?

round phoenix
#

Because if a player makes the command / lp user DjeyMute permission info the result is not very pretty ^^

#

So I would like to create my own command that retrieves the permission information and the time left to customize ^^

wild whale
#

I understand the goal, but I don't understand what specifically you need help with

round phoenix
#

I am unable to retrieve the permission and time information: /

#

Because I would like to create a whole explanatory sentence and integrate this information into it

wild whale
#

I am unable to retrieve the permission and time information: /
In what way?

round phoenix
#

In fact I would like my players to make a new order more adapted to that, there is no problem.
But in this sentence I would like for example to say "You have permission" ... "for" time "

wild whale
#

Again, I understand the goal. What part of the LP side do you need help with

round phoenix
#

This is why I would like to know how to retrieve the 2 information (permission + time) to be able to make my order and my personalized sentence and make the order prettier for my players.

#

Again, I understand the goal. What part of the LP side do you need help with
@wild whale To retrieve the permissions and time information given by the command /lp user DjeyMute permission info

wild whale
#

!api

frank driftBOT
round phoenix
#

I have already tried to understand but I am French and I am having a lot of trouble I was counting on you to help me and give me some information ^^

wild whale
#

If we already have the info on our wiki, what could be gained by me repeating what it says, besides wasting both of our time

round phoenix
#

But how do you get your information from "The basics of Node" ?

#

Because if I understood well its with that that I must recover the information?

nocturne elbow
round phoenix
#

You have a tutorial to get the info from "user.getNodes (). Stream ()" ?
Because I really don't understand how to do ...

nocturne elbow
#

Check out the JavaDoc to see the methods that Node has (e.g. hasExpiry and getExpiry)

#

The nodes themselves is just bundled information, it does not print the data for you

#

That you have to retrieve from them and format them nicely as you please

low rune
#

Hey^^
I'm currently searching for an event which gets called every time a group is added/removed from a player or when his meta data gets changed.
I need this for updating his pre- and suffix whenever it gets changed with LuckPerms.
Which is the most suitable Event for this?

crystal sonnet
#

@low rune is there any reason you're not letting LP handle the prefixes?

low rune
#

Maybe I formulated my message wrong :D
That's what I do, but I want to change it in the tablist (re-assign him to a suitable team) so he does not have to rejoin.

crystal sonnet
#

I see

#

I think there's a node change event

#

Or a permission recalculate event

#

Check the descriptions and play with them to see which one is right

low rune
#

Ah, yes. I forgot that groups basically just are permission nodes

#

like group.GROUPNAME

crystal sonnet
#

Yes

low rune
#

Alright. So, when I have a prefix with the weight 100 in a group I'm inheriting and then set another prefix with the same weight on my personal user data. Which one is preferred?

crystal sonnet
#

I think that's pretty much random

nocturne elbow
crystal sonnet
#

I mean there is a pattern to it, but it's not documented and can change at any time @low rune

low rune
#

You need to depend on LuckPerms @nocturne elbow

crystal sonnet
#

From what I remember it's sorted alphabetically currently

nocturne elbow
#

i do?

low rune
#

You do.

nocturne elbow
#

i got it in my pk.xml file

crystal sonnet
#

Or softdepend

#

xml?

low rune
#

So that the LuckPerms plugin loads before your own one

nocturne elbow
#

yeah, not luckperms is not on the server

crystal sonnet
#

What?

low rune
#

Then you can't use it thinkingo

crystal sonnet
#

Is LP on the server or not?

nocturne elbow
#

so i am checking if luckperms is present and THEN i get the singleton

crystal sonnet
#

Well then you are currently doing it wrong

nocturne elbow
#

, but as its not present it shouldn't attempt to load it

crystal sonnet
#

You need a wrapper class to store the instance in

#

This isn't LP this is Java itself

#

And only invoke the wrapper class (which then accesses the API) when the API is present

nocturne elbow
#

Thonk ok

#

gonna try that

low rune
#

From what I remember it's sorted alphabetically currently
Alright. I kind of hoped that the one which was set to the user directly would be preferred, but okay. Thank you^^

crystal sonnet
#

Just give the user one a higher weight then

low rune
#

Yeah. I'm developing the plugin for a server I work at so I have to speak with the corresponding people but shouldn't be that a big deal.

crimson ferry
#

Help?

#

Where can I get the right Jar that I need?

#

Also I got it now this far.

nocturne elbow
#

!api See the first link for that (where it says "Adding LuckPerms to your project")

Where can I get the right Jar that I need?

frank driftBOT
crimson ferry
#

Hm

obtuse jolt
#

you are using maven/gradle to build your plugin right?

crimson ferry
#

Maven

#

How do I fix this?

glad hill
#

send your pom.xml

crimson ferry
frank driftBOT
crimson ferry
#

Ok

#

There is it.

crystal sonnet
#

Well you haven't added the API to it

crimson ferry
#

How do I do that?

crystal sonnet
#

!api

frank driftBOT
crimson ferry
#

Ah

#

Thx

crystal sonnet
#

You're welcome

crimson ferry
#

Can anyone help me?

crystal sonnet
#

!ask

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
crimson ferry
#

I want that my Tablist is Sorted based on the Weight of the Luckperms Group the User has.

crystal sonnet
#

What are you having issues with?

crimson ferry
#

Idk how to do it.

crystal sonnet
#

What of it?

crimson ferry
#

About all

crystal sonnet
#

We're not here to tell you how to do things

crimson ferry
#

😦

crystal sonnet
#

GIve it a try and when you can't make any progress ask about a specific problem here

#

Assuming it's LP related

nocturne elbow
#

I mean it is expected you know at least how to make a working plugin tho....

#

The LP API isn't the best place for starters to learn Java tbh, can be a bit daunting at first

crystal sonnet
#

MC isn't a place to start with Java either

crimson ferry
#

How can I get the Prefix of an Group?

turbid solar
#

!api

frank driftBOT
turbid solar
#

!coobook this might have some examples

frank driftBOT
#

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

turbid solar
#

Uh

#

!apicookbook

frank driftBOT
#

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

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

There

crimson ferry
#

Ok.

crimson ferry
#

Thx

crimson ferry
#

How can I get only the ID of the weight of an Group?

turbid solar
#

What?

crimson ferry
#

(I dont want it so: OptionalInt[20] , I want it so 20)

turbid solar
#

#getAsInt

crimson ferry
#

Ok.

turbid solar
#

(I think)

crimson ferry
#

Its not letting me.

turbid solar
#

gr.getWeight().getAsInt() ?

crimson ferry
#

Ok ima try.

turbid solar
#

Well?

crimson ferry
#

Its giving me now this out

#

Before there was standing that thing with OptionalInt[20]

turbid solar
#

Cus you havent set a weight

crimson ferry
#

Uh all groups of me having a weight?

turbid solar
#

Default doesnt

#

Why cant you just use OptionalInt?

crimson ferry
#

Because I need only want the Number.

#

Because I wanna do a Tablist Sort System, that the Users are being sorted in the Tablist.

crimson ferry
#

Ok

fallen basin
#

Hey,

im using the LuckPerms Bungeecord API and im aksing, how get get a duration of a player how long he will has his group

ty

nocturne elbow
#

Haha dude

nice

spaces

obtuse jolt
#

...

nocturne elbow
#

cant you just use placeholderapi?

fallen basin
#

but if i dont want to use the placeholderapi?

turbid solar
#

I dont think you can use papi on bungeecord

nocturne elbow
#

that's......... the point......... of using the api for this

#

hhahahhaa i didnt read bungeecord fuck me the cones are talking

fallen basin
#

So theres the point, im using bungeecord

nocturne elbow
#

yeah my point was the cones are talkin man, my bad

crystal sonnet
#

@crimson ferry OptinalInt is a standard Java class and frankly you should know how to handle it

#

And if not your IDE will show you methods you can call.

#

Hell google is a thing too

low rune
#

Hey^^
I want to remove all prefix nodes from a user that have a particular weight. Do I really have to loop through every node the user has and check if it with prefix. and has the wanted weight or is there a more idiomatic way?

#

I already tried the PrefixNode with specifying the prefix value * as I know it from the commands, but that doesn't work either

rustic laurel
#

!bulk

frank driftBOT
rustic laurel
#

you could use this

#

and just call a bulkupdate kek

nocturne elbow
#

No need for bulk.. you can removeprefix <weight> lol

rustic laurel
#

>:(

#

damn fefo being smart or something

nocturne elbow
#

What a shame

low rune
#

Yeah but I need to do it with the API

rustic laurel
#

yeah fefo has your answer

#

@nocturne elbow explain better thanks

nocturne elbow
#

Pointing fingers is fun, huh

#

lol anyway

#

Do I really have to loop through every node the user has and check if it with prefix. and has the wanted weight [...]?
Most definitely not, you can get nodes per certain type (see: https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/model/PermissionHolder.html#getNodes-net.luckperms.api.node.NodeType- and https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/node/NodeType.html). For example, I can

Collection<InheritanceNode> parentGroupNodes = someHolder.getNodes(NodeType.INHERITANCE);

In your case, you would do something similar but with prefix nodes instead of inheritance ones. The resulting collection would have all the holder's own prefix nodes, you would filter out those that do not have the weight you want to remove, and the final collection has the nodes you do want to remove; for each one of those, call NodeMap#remove on the holder's data

#

Ooooooooor you can call NodeMap#clear(Predicate<Node>) on the holder's data and as predicate, check that the node is a prefix node and that it has the weight you want to remove

low rune
#

Ah, that sounds straightforward. I will go with the second solution. Thank you!

nocturne elbow
#

I'd go for the second alternative lol

#

I would dispatch a command from console lol but ¯_(ツ)_/¯

low rune
#

Predicates are just so clean ComfyBlob

crystal sonnet
#

It’s funny because that still just iterates over all nodes 😜

nocturne elbow
crystal sonnet
#

?

nocturne elbow
#

it's cut off

crystal sonnet
#

Not sure where you see that

magic bone
#

Hi I'm trying to understand why I can't get the setPrimaryGroup method to work

#
Bukkit.broadcastMessage(ChatColor.BLUE + "UUID Match Detected: " + ChatColor.WHITE + player.getDisplayName());
            user.setPrimaryGroup("default");
            Bukkit.broadcastMessage(ChatColor.RED + "Attempted to set group of " + ChatColor.WHITE
                    + player.getDisplayName() + ChatColor.RED + " to " + ChatColor.WHITE + "default");```
ember axle
#

Alguno que hable español?

#

Necesito ayuda

crystal sonnet
#

@magic bone the setPrimaryGroup method selects which of the groups a player has is to be considered their primary one.

#

It doesn’t add or remove other groups

#

!api

frank driftBOT
crystal sonnet
#

!cookbook

frank driftBOT
magic bone
#

Alright I'll keep digging, thank you!

crystal sonnet
#

No need. Just read what I sent you. The cookbook contains examples for many things including how to get the prefix

magic bone
#

Oh most certainly then lol.

crimson ferry
#

Is there a User Rank Change Listener ?

#

Or how can I execute stuff when a User gets their Rank Changed?

nocturne elbow
#

NodeAddEvent should do the job, make sure the target is a user and the node is of NodeType.INHERITANCE ig

crimson ferry
#

Ok?

#

I'll try and tell you if I get to work with it or not. 🙂

crimson ferry
nocturne elbow
#

Doesn't it have a getTarget method or something?

crimson ferry
#

Ohh now I saw thx.

#

Thanks. 🙂 It works now.

nocturne elbow
#

you spelt Listener wrong @crimson ferry

obtuse jolt
#

I mean thaat shouldt affect as long at the spelling is consistently wrong lol

#

since its just a class name

nocturne elbow
#

Yeah but it makes me mad that its spelt wrong

boreal cypress
#

say the player has example_meta how do i get the value of this meta?

turbid solar
#

question, can i make a pr to the cookbook repo?

prime siren
#

hey all, quick question. I'm using this
DataMutateResult result = user.data().add(Node.builder("plugin.groupname").build());
to add people to a group, am I doing it wrong? It works fine in some instances but not others? ie, if group name has 3 at the end, it doesn't work but exact same code without the 3, it works.
DataMutateResult result = user.data().add(Node.builder("plugin.groupname3").build()); (example)

crystal sonnet
#

@turbid solar what would you like to add?

#

@prime siren are those group permissions from another plugin?

prime siren
#

I realise where Iw as going wrong, it should be "group.<groupname>" not "<anything>.<groupname>"

#

apologies, rookie mistake

crystal sonnet
#

Btw you should use the inheritance node @prime siren

prime siren
#

sorry, what does that mean? XD

crystal sonnet
#

Use the class InheritanceNode

prime siren
#

oh I see

#

just curious, what is the reason that should be used?

crystal sonnet
#

Because that is intended to be used to add groups

prime siren
#

ohhh I see

#

thank you for explaining, i'll check this one out

crystal sonnet
#

Then you just do InheritanceNode.builder("<groupname>")

prime siren
#

ahh i see, seems alot easier

crystal sonnet
#

That's the point

prime siren
#

yeah 😄

turbid solar
#

@turbid solar what would you like to add?
@crystal sonnet bump api to 5.2 and fix the open issue on the repo (small one)

rustic laurel
#

Yeah go for it I say

#

If it's not poorly done you're likely to get it merged

turbid solar
#

done

magic bone
#

Would there be an easier way to remove all nodes from a user?

crystal sonnet
#

Easier than what?

nocturne elbow
#

than calling 4 methods?

magic bone
#

yeah

#

I've only gone to remove one node at a time so far

magic bone
#

I feel ridiculous

tight kiln
#

Is there a way to change a user parent (group) using the luckperms api?

crystal sonnet
#

Of course

#

!api @tight kiln

frank driftBOT
tight kiln
#

well i didnt get reading the doscs... i see how to add / remove a permission but not a group

obtuse jolt
#

the node for group is group.<groupname>

tight kiln
#

oh thx I didnt know that so if I want to change a player group I need to remove all the grop.node that he has and a the new one right?

crystal sonnet
#

You can just check for InheritanceNodes

#

Every parent is a InheritanceNode

tight kiln
#

but in the InheritanceNodes if i am right i will get also the groups that the parent of the user has

crystal sonnet
#

Then there’s also the cookbook with examples

#

!cookbook

frank driftBOT
tight kiln
#

but I only want to remove / add him in a new grop

crystal sonnet
#

Not if you just get the directly assigned nodes instead of the resolved nodes

tight kiln
#

is grop.name not directly from the user? (like user#getDistinctNodes())

#

@crystal sonnet thx for the support I have now got it

bright sierra
#

Hello how can I put that when they enter my server i put a range by default whit Lukperms??

obtuse jolt
#

i dont think that is a dev api question?

#

ah yea double posting

bright sierra
#

can help me?

crystal sonnet
#

You’re welcome @tight kiln.
And it’s InhertanceNode. Not InheritedNode 😉

obtuse jolt
nocturne elbow
#

Hi i got a question. So i am getting a players prefix: CachedMetaData metaData = this.plugin.luckpermsWrapper.luckperms.getPlayerAdapter(ProxiedPlayer.class).getMetaData(player); 67            String prefix = metaData.getPrefix() == null ? "" : metaData.getPrefix();
But the issue is that it looks at the end like this:

#

Which is pretty weird

#

And im also wondering why its sometimes colored differently.

#

Like the Spieler prefix isn't colored, but the team prefix is

#

Does anyone have an idea what the issue might be?

crystal sonnet
#

!cookbook @nocturne elbow check here for how to properly get the prefix

frank driftBOT
crystal sonnet
#

Oh wait

#

Never mind

nocturne elbow
#

This is the way

crystal sonnet
#

That’s the way

nocturne elbow
#

Described there

#

Yeah

crystal sonnet
#

Anyways it looks like the prefix gets applied twice

nocturne elbow
#

But why or how

crystal sonnet
#

Have you tried it without your code?

#

Chances are another plugin is already adding the prefixes

nocturne elbow
#

Then its just the player?

#

I don't think so

crystal sonnet
#

Give it a try

nocturne elbow
#

Hm

crystal sonnet
#

You’ll never know

nocturne elbow
#

Ok

stark chasm
#

Am I able to set a players rank via bungee with the api?

crystal sonnet
#

Yes of course @stark chasm

#

If the bungee instance of LP is properly synced to the other servers it will propagate. Though it’s recommended that you trigger a networksync after you’ve done all changes

stark chasm
#

Is there a way I can go about giving ranks to players who have possible never joined?
I am also using geyser so I wonder if it would be possible to give ranks to people with dashes at the start of their name

turbid solar
#

Use their uuid

crystal sonnet
#

Was gonna type the exact same thing 😂

stark chasm
#

But with geyser they don't have a mojang-supplied uuid so it's impossible to guess it

obtuse jolt
#

then you have to write some custom plugin that can give ranks on first join

crystal sonnet
#

Well ask the Geyser guys how they generate the UUIDs

#

I know they are consistent

potent thorn
#

Correct.

#

We generate the UUID based off of the Xbox UUID @stark chasm.

stark chasm
#

Oh okay right

#

So if I lookup the Xbox account and get the uuid I can then set the group?

potent thorn
#

Yes, but the problem is that you need an API key for that.

stark chasm
#

Ah.

lone dagger
#

i wanna join someones server

obtuse jolt
#

not the place to ask

boreal cypress
#

how do i get the value of example_meta?

nocturne elbow
boreal cypress
#

is it okay if the value is int?

nocturne elbow
#

Well it returns a string so you'll have to Integer.parseInt

boreal cypress
#

ah make sense thx

boreal cypress
#

it doesnt work it just spam a bunch of errors

#

does this work on forge?

#

it seems it doesnt like EntityPlayerMP.class

nocturne elbow
#

well LP doesn't run natively on forge

#

it runs on sponge

#

so it takes a sponge Player

boreal cypress
#

yah but my plugin is pure forge

nocturne elbow
#

Alternatively, you could get the user data from the UserManager using the player's UUID instead

boreal cypress
#

how to do that?

nocturne elbow
#

!api Check the "API Usage" link, it has a section for retrieving a User instance

frank driftBOT
boreal cypress
#

kk thx

uncut ice
#

I want to integrade LuckPerms into Another Platform, i only need to activate the databaseconnection and the api, no commands

#

And add a player into the Cache

#

Can somebody Help me?

obtuse jolt
#

I suggest you look into the luckperms code if you really want to.

uncut ice
#

Ye But i dont know what is important

turbid solar
#

Everything

uncut ice
#

I think somebody who knows the Code really Good can Help me.

#

I only Need the connection and the api

nocturne elbow
#

I mean, everything that is inside the common module is important, you can't just skip bits from it

#

it is the implementation of the api

uncut ice
#

Ok, i can Try it.....

nocturne elbow
#

And you have to make your plugin/mod in your platform to "initialize" the common module. I do suggest you take a look at any of the platform implementations, a simple one, see what LP bungee does to get the common module working

uncut ice
#

Ok, LuckPerms Bungee is the simplest one?

obtuse jolt
#

(tho i wont consider any of luckperm's code simple loll)

nocturne elbow
#

Not sure tbh, but you will have to attach your plugin to the platform's permission api

#

And delegate the things it does to the common package

uncut ice
#

On this platform arent really permission checks

obtuse jolt
#

if there isnt permission check... then why implement luckperms on it tho?

uncut ice
#

I want to Check groups and More thinks only With the api Directly

nocturne elbow
#

What is this "platform"?

uncut ice
#

CloudNet module

nocturne elbow
#

So what you'll have to do is attach to CloudNet's permission system and delegate the checks to LP

#

Unless I'm getting something wrong, but the platform implementations of LP (bukkit, bungee, sponge, etc) all they do is listen/attach/inject to the platform's permission system and delegate the tasks to the "common package"

#

Unless maybe what you want is to implement the api in cloudnet, basically "removing" LP but having its api

#

That..... that is a task

uncut ice
#

Im not Using CloudNet Perms...

nocturne elbow
#

Okay, let's step back all the way

#

What is it you want to achieve

#

What is your end goal

uncut ice
#

To use the LuckPerms API on this level in other Modules

#

To check Meta, Groups etc on this Level

#

My Command Manager runs there for Multi Proxy

#

In a Module

nocturne elbow
#

Okay.. if I'm getting this right, you want to include LP into CloudNet but not for permissions checking?

uncut ice
#

Yes, into a Module for CloudNet, to Use the lp api in other modules

#

Not for permission checks like on bukkit or bungee

nocturne elbow
#

Well the process is pretty much the same except for the "attach to the permission system" part. You'll have to write an implementation that initializes LP and.. a lot of stuff tbh. I still do suggest you check one of the existing platform implementations (like Bungee) and see how it does it. After all LP is too complex to simply "make it work" 😨

#

Unless I'm getting something wrong and Luck will come to the rescue and correct me 🙏

uncut ice
#

I Try it. Thank you

uncut ice
jaunty pecan
#

you can just return null

uncut ice
#

ok

uncut ice
#

Need I this Service?

uncut ice
#

this class isnt included in luckperms bungee

nocturne elbow
#

It's from one of many of the libraries/dependencies downloaded at load time

#

Need I this Service?
Depends, that is if you want several instances in a network to be in sync

uncut ice
#

hm, how can i download this

nocturne elbow
#

I mean the part that contains the dependencies management is inside the common package, you probably need to initialize it somehow... unsure tbh

#

Luck is the one that could help you the most here ;p

wild whale
#

LuckPermsPlugin or LuckPermsBootstrap probably inits it

nocturne elbow
#

Mm

wild whale
#

This is where I'd pull out find in path

nocturne elbow
#

Lol ye

uncut ice
#

What can I do?

turbid solar
#

AbstractLuckPermsPlugin does it dependency management on load() method and iirc you implement both AbstractLuckPermsPlugin & LuckPermsBootstrap?

uncut ice
#

ye

turbid solar
#

sentence made no sence

uncut ice
#

wait

wild whale
#

huh. Did you know that off the top of your head or did you look it up powercas lol

turbid solar
#

have it open

nocturne elbow
#

He is lying

#

He has the entirety of LuckPerms memorized

#

Line by line

#

Even empty lines

uncut ice
#

I called the Method in the Method hmm xD

#

Now the libs are downloaded

uncut ice
#

It works! Thank you for your help!

#

How can I check a permission from a group?

nocturne elbow
#

!cookbook You can check some real world api usage examples in the "api-cookbook" repository

frank driftBOT
uncut ice
#

There isnt something with this

nocturne elbow
#

Then what is it exactly you need?

uncut ice
#

I want to check if a player has a permission in a method

#

With the api

nocturne elbow
#

Tbh I don't know why you considered jumping straight to implementing LP on a platform before knowing how to operate with its API xD

uncut ice
#

Because on Bukkit or BungeeCord I could use the integrated Permission Check

crystal sonnet
#

Frankly I agree. If you need to ask these kinds of things you really shouldn't be trying to implement LP. It's not easy or trivial

uncut ice
#

But it works now 😅

crystal sonnet
#

Until you run into the next issue

nocturne elbow
#

I'd expect a CCE before an NPE in that situation lol

uncut ice
#

😅 How can I check the highest Permission Group from a player

#

There is no really example for it afaik

crystal sonnet
#

Working very well I see

uncut ice
#

Yes

#

Very well

uncut ice
#

!queryoptions

frank driftBOT
#

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

uncut ice
#

!help

frank driftBOT
#
Available commands:

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

!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!tracks
!translations
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki

uncut ice
#

!wiki

frank driftBOT
crystal sonnet
#

!api

frank driftBOT
uncut ice
#

Can someone explain to me what QueryOptions are?

#

!queryoptions

frank driftBOT
#

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

turbid solar
#

read the javadocs

#

probably explains it, or wait till someone who knows can explain it

weak trellis
#

how to setup luckperms?

turbid solar
#

can you like not ask in 5 channels

weak trellis
#

how to setup luckperms?

#

I don't get it

turbid solar
crystal sonnet
#

@uncut ice did you read the Javadocs?

uncut ice
#

Yes

crystal sonnet
#

Ok. what are you struggling to understand then? @uncut ice

uncut ice
#

Ok. what are you struggling to understand then? @uncut ice
@crystal sonnet I found it.

#

But why returnes the Method false? I have the * perm

uncut ice
#

Problem solved

crystal sonnet
#

Ok

#

What was it?

uncut ice
#

My check was ```hasPermission("permission") {
Player#sendMessage("No Perms!");
}

#

I forgot the !

#

Big uufff

turbid solar
#

! where

uncut ice
#

In front of the hasPermission !hasPermission

#

So I wanted to return when the player didnt has the perm

#

And not when the player has the perm

#

My failure

crystal sonnet
#

Btw why are you using the API for permission checks instead of using the platform permission checks?

uncut ice
#

Because this platform has no integrated permission check

crystal sonnet
#

Fair point

uneven radish
#

Hello, i have a bungeecord server network and players can buy temporary permissions. I used the api and the examples for that. But sometimes the permissions dissapear after some minutes.

And it just affects the temporary permissions.

crystal sonnet
#

Well make sure to save the changes and to also trigger a network sync

uneven radish
#

So but i thought it syncs automatic over the network, bc it works the most time :D

And it just affects the temp nodes

crystal sonnet
#

Yes it kinda syncs. But it doesn't inform the other servers

#

Best to also trigger a network sync

uneven radish
#

And it is possible, that the permissions is completely gone after some server switches?

crystal sonnet
#

Well that's certainly odd

#

Though hard to say exactly

#

What version of LP are you using btw

uneven radish
#

Latest from spigot. I know latest is no answer but im just at the smartphone

#

How to trigger that network sync? Ill try it with that

crystal sonnet
#

!update

frank driftBOT
crystal sonnet
#

Don't know by heart. You need to figure that out

uneven radish
#

Okay thanks, will try it with that

latent stone
#

Is there a way to access the ranks using the LuckPerms api?

crystal sonnet
#

Yes

latent stone
#

How so?

crystal sonnet
#

!api

frank driftBOT
latent stone
#

I am creating an api to access LuckPerms api so I can change ranks using Discord. This documentation doesn't provide any information that could help with my situation.

nocturne elbow
crystal sonnet
#

I found it covers everything at least on a basic level

#

There's also this:

#

!cook

frank driftBOT
#

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

crystal sonnet
#

!cookbook

frank driftBOT
latent stone
#

Thanks.

crystal sonnet
#

You're welcome

latent stone
#

giveMeADamnUser is one of the methods. Whoever made this might want to touch back up on it

#

Very nice.

crystal sonnet
#

¯_(ツ)_/¯

jaunty pecan
#

what's the problem?

uncut ice
#

The Problem is, there is no problem

open kiln
#
// Remove and add new rank
PFRanks.lpApi.getUserManager().modifyUser(p.getUniqueId(), user -> {
// Add the permission
user.data().add(PermissionNode.builder("group."+rank).withContext(DefaultContextKeys.SERVER_KEY, server).build());
user.data().remove(PermissionNode.builder("group."+lastRank).withContext(DefaultContextKeys.SERVER_KEY, server).build());
});

I haven't used the api b4 does this look right to add and remove a group? This does not seem to work for me.

turbid solar
#

did you save the user? ( i think you need to do that)

nocturne elbow
#

modifyUser saves it for you

open kiln
#

^

nocturne elbow
#

also, you should use an InheritanceNode.Builder instead of a PermissionNode one

#

for parent groups that is

open kiln
#

ok so that could be why its not removing/adding parents?

nocturne elbow
#

Keep in mind that when removing nodes with that method, it has to match all its qualities:

  1. key
  2. value (true/false)
  3. all contexts keys and values
  4. expiry time

i.e. it has to be the exact same node

nocturne elbow
#

but you should use an InheritanceNode for parent groups ;p

open kiln
#

its also not adding so I will try the changes and see if they work then check back if it does not! Thanks guys!

turbid solar
open kiln
#

Ill take a look

sterile sage
#

How can I get the name of the highest Role a User has?

#

And how can I find a user?

crystal sonnet
crystal sonnet
frank driftBOT
sterile sage
#

I'm already on the API Website

#

But I can't figure it out, how to use it

crystal sonnet
#

Well what are you struggling with?

#

It's all explained

sterile sage
#

Because it won't let me import the right things

crystal sonnet
#

You need to add the dependency to your project

sterile sage
#

I can't get the userManager

#

How can I add the dependency?

#

I imported the jar into my buildpath

turbid solar
#

you should really use something like Maven or Gradle tho

sterile sage
#

Ohh

crystal sonnet
#

Which jar btw?

sterile sage
#

xD

sterile sage
crystal sonnet
#

The normal plugin jar or the API jar?

#

Which did you add?

sterile sage
#

I had the normal plugin jar

turbid solar
#

add the api

#

not plugin jar

sterile sage
#

I already switched that

#

a couple secs ago

turbid solar
nocturne elbow
#

oki

sterile sage
#

😦 Cannot make a static reference to the non-static method getUserManager() from the type LuckPerms

wild whale
#

get an instance

#

!api

frank driftBOT
sterile sage
#

I don't understand it 😦

turbid solar
#

please read the wiki lol

crystal sonnet
#

Well according to the error you clearly not well versed with Java

sterile sage
#

I am

crystal sonnet
#

Clearly not

sterile sage
#

I started coding with java this february

#

I'm not an expert

#

and this is the first time I'm working with the lp api

crystal sonnet
#

That error you're getting is a Java error

#

Has nothing to do with the LP API

sterile sage
#

Okay :/

crystal sonnet
#

I don't mean to be mean

#

But MC modding (includes plugin) is not the place for Java beginners

#

And the LP API requires a fair bit of additional knowledge

#

Now to prove me wrong in my assessment that you're not experienced enough with Java to work with the LP API there are two things you need to do:

  • Fix that issue by yourself (Google of course being allowed)
  • Figuring out how to get a user instance from the API (as that's documented)
sterile sage
#

I figured it out ^^"

crystal sonnet
#

Good job

sterile sage
#

Btw ^^ I made my first working economy system in february ^^

crystal sonnet
#

Following a tutorial?

sterile sage
#

Nope

#

:3

crystal sonnet
#

Not bad

long aurora
#

I need help

crystal sonnet
#

!ask

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
turbid solar
#

dont double post ty

long aurora
#

Where is the permissions page

turbid solar
#

!permissions

frank driftBOT
long aurora
#

okok

#

Thx

sterile sage
#

I started with NodeJS a couble years ago. So I already knew the basics ^^

crystal sonnet
#

@long aurora this channel is for questions about the API only. Use #support-1 or #support-2 for general LP support questions. And only one

crystal sonnet
long aurora
#

okok

sterile sage
#

How can I get the primaryRole after the player joined? (I know how to get the role, but I get an error, when the user joins)

#

(It's a nullPointerException)

#

!paste

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ 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!

sterile sage
wild whale
#

As you can imagine, the error is useless without the associated code

sterile sage
#

I can imagine that

#

so I already pasted my code into the bytebin ^^

wild whale
#

why are you .tostring()ing the UUID

sterile sage
#

I learned it this way

wild whale
#

mmk well I bet that's the cause

#

remove that .toString on the UUID, see if it works

sterile sage
#

Thanks xD ❤️

#

Is there a way to get the DisplayName of the primary Role?

#

I can't find something at the moment :/

#

figured it out ^^

young sentinel
#

heh?

crystal sonnet
#

@young sentinel this channel is for support with the LP API. #general would be better suited

young sentinel
#

oh damn

#

wrong channel

#

srry

inland yacht
#

hi

#

i need help

#

java.lang.IllegalStateException: API is not loaded.
at me.lucko.luckperms.LuckPerms.getApi(LuckPerms.java:54)

turbid solar
#

Need code

inland yacht
frank driftBOT
#

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

turbid solar
#

Show me the code where you're loading the luckperms api

#

!paste in here btw

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ 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!

inland yacht
turbid solar
#

!api

frank driftBOT
inland yacht
#

but what is the error?

turbid solar
#

the api is not loaded

inland yacht
#

i need put the jar in plugins folder?

turbid solar
#

you need luckperms on the server.. yes

inland yacht
#

yea i have but the api jar

#

i need in plugins folder?

turbid solar
#

No, you need the luckperms plugin on the server

#

also make sure your plugins loads after LuckPerms

inland yacht
#

how?

turbid solar
#

is it a bukkit plugin?

#

or bungee?

inland yacht
#

bungee

turbid solar
#

add softdepends: [LuckPerms] in your bungee/plugin.yml

inland yacht
#

the same error

turbid solar
#

Can you send your full code?

nocturne elbow
#

That usually happens when you shade the api into your plugin (when you compile the lp api jar into your plugin)

#

@inland yacht make sure you are not doing that

#

You can quickly check that by opening your plugin with 7zip or winrar

inland yacht
#

i'm using the legacy api

#

is ok?

turbid solar
#

Why

nocturne elbow
#

If you are currently, actively writing the plugin, you should use the API for the latest version (v5.2) instead of a deprecated, unsupported legacy API

inland yacht
#

what is this error?

#

i copy from github

crystal sonnet
#

¯_(ツ)_/¯

#

You're not even hovering over it

inland yacht
crystal sonnet
#

Have you ever used an IDE before?

#

Or even programmed before?

inland yacht
#

yes 2 years

crystal sonnet
#

Man those years were wasted if you don't even know that you can hover over red squiggly lines in IDEs to have them show you an error message as to what's wrong

inland yacht
#

Yes, I knew it ._.

crystal sonnet
#

Apparently not

inland yacht
#

but I want to know what I have to put there because according to the guide that error should not appear

crystal sonnet
#

Could you ... like ... idk ... hover over the error and screenshot the message?

#

Like that might help us identify what's wrong here

inland yacht
crystal sonnet
#

Looks like the example is outdated

#

But frankly you shouldn't need that method anyways

#

Just use permission checks of the platform

inland yacht
#

it does not work for me since I need to see if a user has a permission even though they are not connected

crystal sonnet
#

Well

#

Then find out what argument the function is expecting

#

And I might be able to help

jaunty pecan
#

@inland yacht make sure you are depending on api version 5.2

inland yacht
#

works if my server has plugin version 5.0 or i need update?

turbid solar
#

You should use the latest version

inland yacht
#

ok ty

#

i need change some on my server for update to 5.2? like config or something

turbid solar
#

Just the jar

inland yacht
#

ok bro ty

#

help pls

crystal sonnet
#

You are not depending (or softdepending) on LP in the plugin.yml

#

You were told how to fix that before

inland yacht
#

i do it

turbid solar
#

Screenshot line 26 in Main

#

Whole class actually

nocturne elbow
inland yacht
nocturne elbow
#

Make it softdepend

#

Not softdepends

#

I always forget which one of the two Bukkit uses but the one it does not, Bungee does

#

md5 smh

inland yacht
#

same error 😦

turbid solar
#

Can you send a hastebin of the whole code?

#

(not bytebin)

inland yacht
turbid solar
#

try moving LuckPermsProvider.get(); in the onEnable()

inland yacht
#

ok

#

same error :c

viral lion
#

Is that saying unknown source for the constructor?

#

I am still kind of a beginner at java but I know that that could mean that the class isn’t defined

#

Idk tho

turbid solar
#

@inland yacht send error & code again

inland yacht
#

another class is equals

crystal sonnet
#

You're kidding, right?

turbid solar
#

you didn't do what I asked

crystal sonnet
#

You were told to to move the LuckPermsProvider.get(); to the onEnable(). But you didn't do it

inland yacht
#

sorry i paste wrong

#

error on sheduler

turbid solar
#

Don't see anything LP related there

inland yacht
#

yes look

nocturne elbow
#

Keep in mind that UserManager#getUser may return null if the user is offline

#

It does in most cases

turbid solar
#

load the user first ^

inland yacht
#

oh yea

#

solved ty

inland yacht
#

i can't check a permission if the player is not online with the api?

nocturne elbow
#

Sort of, since there will be no active user contexts to apply

#

But you absolutely can if you load the user

crystal sonnet
#

Instead of getUser(uuid) you just use loadUser(uuid).get(). But make sure to be async, else it'll cause lag

inland yacht
#

ok ty

uncut ice
#

Dont use get(), use thenAccept() with the consumer

crystal sonnet
#

Either are fine

#

Really depends on your code

#

And since they want to get a return value and don’t want to modify data getting the object is the right move here

drowsy bobcat
#

can someone help me ive got a problem. I just downloaded luck perms for my server but whenever i do /lp editor i get the following message in the website :There was an error loading the data. Either the URL was copied wrong or the session has expired.
Please generate another editor session with /lp editor. However i dont even copy the link i just click it so no way the url is wrong

turbid solar
obtuse jolt
#

sighs... those double, triple posters again

drowsy bobcat
frank driftBOT
#

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

crystal sonnet
nocturne elbow
#

smh why is it such a serious issue 🤣

crystal sonnet
#

It wastes people’s time

obtuse jolt
#

says the one that ask someone to run powershell wininit

nocturne elbow
#

what does that have to do with posting in multiple channels lol

crystal sonnet
#

Not sure about you Timmeh but I just love taking the time to type out a comprehensive response to someone’s question just to be told that it was taken care of already

nocturne elbow
#

No, what Ben said

obtuse jolt
crystal sonnet
#

I could’ve spent the time doing other more useful things. Like watching paint dry

nocturne elbow
frank driftBOT
#

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

nocturne elbow
#

Was having a simple joke

obtuse jolt
#

yep i was just joking too 🙂

crystal sonnet
#

Get a room you two

nocturne elbow
#

Excuse me?

drowsy bobcat
#

changing the lp version wouldnt fix that problem would it

turbid solar
#

No

#

#general btw as it's not api or lp related

nocturne elbow
#

running powershell wininit would though

spring orbit
#

Hello.
I try to get the prefix from the users when they log in, but I don’t understand how to do it.

I use LuckPerms in Bungeecord, and I try to get this prefix in spigot.

Can someone help me?

turbid solar
#

You need luckperms on spigot aswell to get it there

spring orbit
#

So, I need to put the spigot plugin and it will be good ?

turbid solar
#

Yes you will also have to sync

#

!sync

frank driftBOT
spring orbit
#

I managed to get the group back, but it sends me the name of the group. How can I get the name with the colors?

prime glacier
#

How can I init. the BungeeAPI of LuckPerms ?

#
if (provider != null) {
    LuckPerms api = provider.getProvider();
    
}```
#

The most of this classes aren't in the bungeeCordAPI

turbid solar
#

you can use the singleton

prime glacier
#

LuckPermsProvider.get ?

turbid solar
#

ye

prime glacier
#

Thank you.

#

One more question.. how can I add a prefix node to a player ?

turbid solar
#

!api

frank driftBOT
rustic laurel
#

Also maybe

#

!cookbookk

frank driftBOT
#

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

rustic laurel
#

!cookbook

frank driftBOT
prime glacier
#
            user.data().remove(node);

Is this the correct way to remove all prefixes with the priority 101?

crystal sonnet
#

No. Use the clear method

prime glacier
#

How?

#

I only want to remove the prefixnodes with priority 101

crystal sonnet
#

You can pass a filter to the clear method

inland yacht
#

hi i need help with this

#

ignore the user = user xd

#

the error is in get()

turbid solar
#

hover over it

#

Will loadUser(UUID) throw an error if you try to load someone whilst their online?

crystal sonnet
#

No

#

It'll just return instantly instead of loading

nocturne elbow
#

I think .get may throw some interruption exceptions or something

crystal sonnet
#

I'm amazed at how you still don't know how to properly show errors, nor know how to fix them yourself. Typically just takes googling

nocturne elbow
#

Which.. tbf rarely happens lol

crystal sonnet
#

Yeah a try catch to throw a runtimeexcption will certainly do

nocturne elbow
#

catch Throwable :^)

crystal sonnet
#

No. I mean you catch whatever it is and rethrow it wrapped in a RuntimeException

nocturne elbow
#

aaa yea

crystal sonnet
#

Because that's an unchecked exception and those don't need to be handled

#

@inland yacht

inland yacht
#

i solved

#

i have this error on load

turbid solar
#

That sounds like something for general 1?

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook this might have some examples

frank driftBOT
crystal sonnet
#

@pine mantle the consumer could be a lambda or a function capture

#

Java 101

#

(Especially considering this has been in Java for actual ages)

blazing robin
#

I haven't found the entry about refreshing the prefixes in the wiki, could you help me please?

crystal sonnet
#

!api check the meta section

frank driftBOT
blazing robin
#

i need the code.

crystal sonnet
#

Well there’s no explicit method

#

But with a tiny bit of programming knowledge that should be trivial to piece together

crystal sonnet
#

I’m not here to spoonfeed you

turbid solar
#
    @Override
    public void addPermission(UUID uuid, String permission, boolean value) {
        Node node = Node.builder(permission).value(value).build();

        luckPerms.getUserManager().modifyUser(uuid, (User user) -> {
            user.data().add(node);
        });
    }

this should work.. right?

prime glacier
#

I've only used user.data().add

#

Not with modifyUser

crystal sonnet
#

Oh look! Someone just volunteered to be the server’s coding slave. Awesome ^^

rustic laurel
#

cas you'll end up wasting many years

wild whale
#

YAY CAS

turbid solar
#

that was actually a question

crystal sonnet
#

Ah

#

Yes

#

That will work

turbid solar
#

oh it just did

#

worked after doing it 10 times

prime glacier
#

So I have to use modifyUser?

crystal sonnet
#

That’s a possibility

#

Certainly doesn’t hurt

turbid solar
#

I'm confused, my code only works 30% of the time

prime glacier
#
                User user = luckAPI.getUserManager().getUser(player.getUniqueId());
                Node node = PrefixNode.builder(oldPrefix, 101).build();
                user.data().add(node);
                luckAPI.getUserManager().saveUser(user);``` That's how I've done it
#

But it doesn't update the prefix instandly. I always have to rejoin

#

I use this Tab plugin

crystal sonnet
#

@turbid solar well is it on a bungee network?

frank driftBOT
#

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

turbid solar
#

yes, but I'm checking & adding if they have the permission on the spigot server

crystal sonnet
#

Don't forget to network sync

prime glacier
#

powercas_gamer is this tab plugin coded by you

turbid solar
#

??

#

No?

prime glacier
#

Oh

#

I thought

crystal sonnet
#

@prime glacier make sure to network sync

prime glacier
#

Ahh, you think this is the problem?

crystal sonnet
#

Yes

prime glacier
#

What's the method to sync?

crystal sonnet
#

It's documented

prime glacier
#

Where?

crystal sonnet
#

!api

frank driftBOT
turbid solar
#

I think I'm going insane, can't figure out why it's not working 35% & I'm sending the update

rustic laurel
#

async problems?

turbid solar
#

?

crystal sonnet
#

Are you adding multiple permissions at once?

turbid solar
#

no

#
Utilities.log("getting prefix");
        sender.sendMessage(Utilities.getInstance().getPermissionHandler().getPrefix(uuid));
        Utilities.log("adding permission 'testing' to " + uuid);
        Utilities.getInstance().getPermissionHandler().addPermission(uuid, "testing", true);
        Utilities.log("getting primary rank");
        sender.sendMessage(Utilities.getInstance().getPermissionHandler().getRank(uuid));
        Utilities.log("getting suffix");
        sender.sendMessage(Utilities.getInstance().getPermissionHandler().getSuffix(uuid));
        Utilities.log("checking if " + uuid + " has the permission 'testing'");
        sender.sendMessage(Utilities.getInstance().getPermissionHandler().hasPermission(uuid, "testing") ? "yes" : "no");
#

executing that for testing

#
@Override
    public void addPermission(UUID uuid, String permission, boolean value) {
        Node node = Node.builder(permission).value(value).build();

        luckPerms.getUserManager().modifyUser(uuid, (User user) -> {
            user.data().add(node);
            luckPerms.getMessagingService().get().pushUpdate();
        });
        luckPerms.getMessagingService().get().pushUpdate();
    }
``` this adds the permission
prime glacier
#

Is it getMessagingService#get#pushUpdate ?

nocturne elbow
#

Well that second pushUpdate is a bit redundant

#

But it should be pushed after it's saved, not even inside the modifyUser consumer

#

lemme

#

sec

turbid solar
#

That still doesn't explain why it only works like 40% of the time doesnt it?

nocturne elbow
#

Maybe

#
userManager.modifyUser(uuid, user -> {
  // do stuff
}).thenRun(() -> messagingService.ifPresent(MessagingService::pushUpdate));
#

Test that thoroughly, should do the job ig 🤷

#

If it doesn't, we'll have Brainstone in here in a matter of minutes lmao

turbid solar
#

I'll test tomorrow

nocturne elbow
#

no

#

now

#

🔫

turbid solar
#

In bed smh

nocturne elbow
#

🔫🤠

crystal sonnet
#

How fast after running this are you checking the permissions?

nocturne elbow
#

Brain

#

Hi

nocturne elbow
#

(implying that messagingService is the optional the API returns)

crystal sonnet
#

Yes it does. At least I believe

turbid solar
prime glacier
nocturne elbow
#

yes