#luckperms-api

1 messages · Page 38 of 1

prime glacier
#

Thank you

turbid solar
#

me = confused, it gets the permission on NodeAddEvent, but it doesn't show in /lp user powercas_gamer permission info

brittle kayak
#

using Maven/intelliJ
I'm a little lost as to what to do here. Version is giving me error "Dependency 'net.luckperms:api:5.2' not found "

nocturne elbow
#

Ctrl + Shift + O?

brittle kayak
#

oh, what did that do?

nocturne elbow
#

Refresh the maven project

#

Or something along those lines

#

¯\_(ツ)_/¯

brittle kayak
#

okay cool, thanks

#

I'm looking to get a list of all players in a group (online or offline). Is there a method for that? I can't seem to find anything.

#

Never mind, I found it. api.getusermanager().searchAll()
for those searching in the future

crystal sonnet
#

@turbid solar try pinging Luck about it

frank driftBOT
#

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

nocturne elbow
rustic laurel
#

/ban

crystal sonnet
#

Lol

uncut ice
#

Is there no feature for getting directly all players from specific group

#

It could be good to cache all uuid, but idk

#

Or a method like Group#loadAllUsers

nocturne elbow
#

You can call UserManager#searchAll(NodeMatcher) for that

#

And search for the InheritanceNode you want

uncut ice
#

ok ty

inland yacht
#

Hi

nocturne elbow
#

Hi

inland yacht
#

How i can do an action on player change group?

nocturne elbow
#

You subscribe to the NodeAddEvent, check that the event target is a user and the node is if type INHERITANCE

#

!api IIRC the second link explains how to subscribe to events

frank driftBOT
inland yacht
#

Oh ok ty

inland yacht
#

@nocturne elbow how to get the uuid from the event?

frank driftBOT
#

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

inland yacht
#

ups

nocturne elbow
#

check that the event's target is a user
then you cast to User and get the uuid

inland yacht
nocturne elbow
#

yeah?

inland yacht
#

no way to get :c

nocturne elbow
#

check that the event's target is a user

inland yacht
#

how

nocturne elbow
#

target instanceof User?

inland yacht
#

ohhh ok

#

i am noob

#

i can do this or not?

nocturne elbow
#

no

#

a PermissionHolder (the event's target) can either be a User or a Group

inland yacht
#

oh ok

#

and this?

nocturne elbow
#

yus

inland yacht
#

oks

nocturne elbow
#

That is after checking that it's a user I presume

inland yacht
#

yes

nocturne elbow
#

nop

#

That'll return uuh.. something, but you're looking for the node's key

#

If you want to test the node's type, check that the NodeType is of NodeType.INHERITANCE

inland yacht
#

say always true xd

nocturne elbow
#

==

inland yacht
#

oh

#

ready

#

so node.getkey returns some good yes?

nocturne elbow
#

??

inland yacht
nocturne elbow
#

yes

inland yacht
#

ok ty

cerulean magnet
#

Can i aska question that may not be appropriate over here cuz im not sure

nocturne elbow
#

is it about the LP API?

cerulean magnet
#

sort of

nocturne elbow
#

ask away

cerulean magnet
#

It's conflicting with my plugin which uses bungee chat API for action bar

nocturne elbow
#

okay

cerulean magnet
#

I could give your th error

nocturne elbow
#

and?

#

well you could

#

will you?

cerulean magnet
nocturne elbow
#

how is this conflicting with your plugin? this is strange luckythonk

cerulean magnet
#

especially since the Stacktrace doesnt give anything about my plugin

nocturne elbow
#

!paste the entire latest.log ig

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!

cerulean magnet
#

ok 1sec lemme redownload

#

i just redownloaded Luckperms and it seems to work for now

#

idk what happend

nocturne elbow
#

me neither

cerulean magnet
#

must have been using an outdated version

crystal sonnet
#

Corrupted file

inland yacht
#

hi

#

any event of luckperms when a player rank change?

nocturne elbow
inland yacht
#

yes bot nodeaddevent dont come when i do parent clear or in editor

#

what event i need use?

turbid solar
#

how are you trying to check rn?

#

also NodeAddEvent will work if you do it correctly

inland yacht
#

i need check when editor change a rank of a player, when you use parent clear

nocturne elbow
#

NodeAddEvent will trigger...... when you add a node, not when you clear or remove

#

For those you have NodeRemoveEvent and NodeClearEvent iirc

inland yacht
#

and when i edit the groups by editor?

nocturne elbow
#

I'm not exactly sure but those should do. Check the javadocs, they contain lots of useful info; play around with the events, experiment, that way you'll know for sure

inland yacht
#

link?

nocturne elbow
#

📌

halcyon tapir
#

Uh. hi,
I'm confused with the API. If I want to remove permission I do this?
api.getUserManager().getUser(uuid).getNodes().remove("island.own")

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook has some examples on how to add/remove permissions afaik

frank driftBOT
halcyon tapir
#

Oh, there it is. I saw this sometime ago but couldn't find it. Thanks

#

Hm.

api.getUserManager().getUser(uuid).getNodes().add(Node.builder("island.own").build());

doesn't seem to wrok

turbid solar
#

Gotta save the user

halcyon tapir
#

oh .-.

weak coral
#

@crystal sonnet Well I'll start to learn Java then haha. Thanks for the help! It shouldn't be too hard.

crystal sonnet
#

Minecraft plugins are not the place to learn Java

#

And working with the API even more so

weak coral
#

🙇‍♂️

#

Maybe I should ask a friend who knows then. Oh boy why every Idea I have needs to be so hard to implement 😂

nocturne elbow
#

!api

frank driftBOT
hushed osprey
#

Hello I'm trying to put a manager position on it but the tag is on master and I don't know how to fix it could help me?

turbid solar
#

??

hushed osprey
#

A minute

nocturne elbow
fleet halo
#

yo fefo congrats on the mod promo

rustic laurel
#

no congratulations allowed

worldly pewter
rustic laurel
worldly pewter
#

ok, tanks

graceful ocean
#

Any dev online? This isn't related to your plugin although I know you guys have bash scripts.

#

Why does the following not work in a bashcript

#

sudo rm -rf ./Servers
sudo rm -rf ./Plugins
sudo rm -rf ./BuildTools

turbid solar
graceful ocean
#

nevermind froget the #!bin/bash

nocturne elbow
#

!api Check the second link in the embed

frank driftBOT
nocturne elbow
#

In particular the one that says something "Difference between online and offline users" or something like that

raw shadow
#

When I try to give a person a permssion with the api I get this result FAIL_ALREADY_HAS even though the person as no perms ```LuckPerms api = provider.getProvider();
User user = api.getPlayerAdapter(Player.class).getUser(playerMC);
...
String lpGroup = plugin.getConfig().getString("roles." + role.getName());

DataMutateResult result = user.data().add(Node.builder("group." + lpGroup).build());
System.out.println(result);```

nocturne elbow
#

Node.builder("group." + lpGroup)
might want to use an InheritanceNode.Builder instead, so you don't have to deal with the "group. bit (if that changes some time, InheritanceNode.Builder won't break (it won't change, but still, it's there for a reason lol))

#

but that's not the issue anyway

#
  1. Are you saving the user data after modifying it?
  2. Screenshot /lp user <user> parent info
  3. Print out the group name too
#

Debugging is vital

raw shadow
#

I Got it to work when i switched the the Inheritance

#

Thank you so much

crystal sonnet
#

@nocturne elbow you can always just call user = userManager.loadUser(uid).join();

#

If the user is loaded this works just the same as user = userManager.getUser(uid);

#

If not then it loads it in

#

You're welcome

nocturne elbow
#

hey is there some kind of wiki for lucko's helper api?

sudden pelican
halcyon tapir
#

Hi, I'm getting NPE for line with getUser().getNodes() ```java
for (Player p : Bukkit.getOnlinePlayers()) {
if (seconds > 0) {
LuckPerms api = LuckPermsProvider.get();
Node owned = Node.builder("island.ownA").value(true).build();
if (api.getUserManager().getUser("" + p).getNodes().contains(owned)) {
scoreboard(p);
}
}

while in another class it works perfectly, what can be the issue?
crystal sonnet
#

What on earth is getUser("" + p)?!

halcyon tapir
#

Uh, getUser() is @Nullable User getUser(@NonNull String username)

crystal sonnet
#

I know

#

But you’re not passing the username

halcyon tapir
#

Oh, OH

crystal sonnet
#

In any case use the UUID

#

And please move the stuff you don’t need to create every loop outside of it

halcyon tapir
#

Wdym, for ```java
LuckPerms api = LuckPermsProvider.get();
Node owned = Node.builder("island.ownA").value(true).build();

crystal sonnet
#

Yes

halcyon tapir
#

Alright, works, thank you

crystal sonnet
#

And you can additionally also store the user manager in a variable outside the loop

teal hill
#

Hi, how to remove group? couldn't see in wiki maybe im dumb

#

or just a node with group.name set to false will be enough?

crystal sonnet
#

Can you elaborate?

#

@teal hill

teal hill
#

i want to remove specify groups from all players

#

and apply them to that server specify

#

i mean remove global group, add specified server group

#
            luckPerms.getUserManager().loadUser(player.getUniqueId()).thenAccept( user -> {
                for (Group group : user.getInheritedGroups(user.getQueryOptions())) {
                    if (!map.containsKey(group.getName()))
                        continue;
                        user.data().remove(Node.builder("group." + group.getName()).build());
                        user.data().add(Node.builder("group." + group.getName())
                        .withContext(DefaultContextKeys.SERVER_KEY, map.get(group.getName()))
                        .build());
                }
            });
        }```
#

just write this

#

currently testing.

#

looks like didn't worked

teal hill
crystal sonnet
#

You need to remove the group node

teal hill
#

looks like theres a inheritancenode

crystal sonnet
#

That’s the one

teal hill
#

and, "group." is needed?

crystal sonnet
#

And you should use that to add them to a group as well

crystal sonnet
teal hill
#

Thanks ^^

crystal sonnet
#

You’re welcome

nocturne elbow
#

How do I get all the nodes of a player's primary group?

crystal sonnet
#

Well you get the primary group of the player and then get all the group's nodes

nocturne elbow
crystal sonnet
#

Then use the groupmanager to get group object...?

nocturne elbow
#

Ok got it thanks

crystal sonnet
#

You're welcome

cedar citrus
#

@rugged hedge could hello help me to configure MyQL?

frank driftBOT
#

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

cedar citrus
#

Deen could hello help me to configure MyQL?

turbid solar
#

Api related?

cedar citrus
#

As well ?

nocturne elbow
#

#

Does this have anything to do with the LuckPerms API?

cedar citrus
#

Can someone send me the file the way to configure the Database by MySQL

#

Yes

nocturne elbow
#

Oh well

#

How is this related to the developer API? I fail to see that

rugged hedge
#

I'm the last person anyone should ping over sql configuration lol

nocturne elbow
#

Hello

#

Can you help me with luck perms

turbid solar
#

Api related?

uncut ice
cerulean magnet
#

where in the luckperms code would this class be? me.lucko.luckperms.lib.adventure.text.serializer.bungeecord.SelfSerializable$AdapterFactory.create

nocturne elbow
#

it's from a dependency downloaded and relocated at runtime, it isn't bundled in the core jar

cerulean magnet
#

oh ok

#

thanks anyways

nocturne elbow
#

..... if you are having an issue or getting an error.. paste it lol

cerulean magnet
nocturne elbow
#

right..... I think I remember? it only did that with your plugin installed too?

cerulean magnet
#

yea i ran command with my plugin

#

and this trigger

#

s

timber reef
#

Is there a way to get everyone with x group?

nocturne elbow
#

yes

timber reef
#

How?

nocturne elbow
#

lemme uuh

#

And for the NodeMatcher you'd want to match an InheritanceNode (presumably by key only)

timber reef
nocturne elbow
#

Simpler yet: NodeMatcher.key(InheritanceNode.builder("vip-idk").build())

timber reef
#

aah thy 🙂

primal atlas
#

I'm trying to run LP v5.2.44 in my dev environment with SpongeForge and LP is throwing a java.lang.NoClassDefFoundError error during FMLPreInitializationEvent and not loading. Full error: https://pastebin.com/raw/Zs7DZWTU
Could anyone help with this?

frank driftBOT
#
Invalid Paste!

The paste link you sent in is invalid or expired, please check the link or paste a new one.

primal atlas
nocturne elbow
#

!libsdir

frank driftBOT
#
LuckPerms dependencies

LuckPerms requires several libraries in order to operate. If you're getting a startup error such as NoClassDefFoundError, ClassNotFoundException or "Unable to load dependency...", stop your server, delete the /plugins/LuckPerms/libs/ directory and start it up again.

primal atlas
#

Sorry, I should have said that first; I did delete the /luckperms/libs/ directory (I don't believe there is a /plugins/ with SpongeForge) and restart the server and am still getting the error :/

nocturne elbow
turbid solar
#

Send startup log in #general 1 or 2

primal atlas
turbid solar
#

?

nocturne elbow
#

@nocturne elbow this is not the place for random slurs tho

#

"?"?

thorny crown
#

I need help! I installed EssentialsX Chat (latest update), Vault and LuckPerms but prefix dosen't work

sudden pelican
hardy sedge
#

Hi just a question, have there been any breaking API changes within the last weeks/months, for adding and removing group notes. Just wanna resolve an issue report and remove possibilities.

nocturne elbow
#

nope

#

You can either take my word for granted or go see the changelogs in the commits history which I suggest you do instead lol

hardy sedge
#

Na, your word is enough, just got resolved, had nothing to do with LP ... I knew it

#

Sorry for anoy...

nocturne elbow
#

no worries!!

hardy sedge
#

Thanks of course

hushed oxide
#

How do i check if a player has a perm using luckperms api?

#

Sorry, player is offline and it's bungee

turbid solar
#

Load user

#

!api

frank driftBOT
hushed oxide
#

Wait

turbid solar
#

!coobkook Might have a example

frank driftBOT
#

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

hushed oxide
#

Just what code to check it?

turbid solar
#

!cookbook

frank driftBOT
hushed oxide
#

Well

#

I have a question

#

If player never joined before

#

It can still fetch the perms?

turbid solar
#

Should yes not sure

nocturne elbow
#

If loadUser "loads" anything, it'll only have the default group as parent

#

Well, since you can use UUIDs in commands I would assume it would work like that?

hushed oxide
#

what is the bungee dependency?

turbid solar
#

Whut?

hushed oxide
#

dependecy for maven

#

bungee version of luckperms

turbid solar
#

!api

frank driftBOT
hushed oxide
#

there is only for bukkit

turbid solar
#

No?

#

Works on all server softwares

hushed oxide
#

ok

#

how do I check if player has a perm?

turbid solar
hushed oxide
#

public static LuckPerms lpapi = LuckPermsProvider.get();

#

I get an error

#
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:328)
    at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:235)
    at net.md_5.bungee.BungeeCord.start(BungeeCord.java:271)
    at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
    at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
Caused by: java.lang.IllegalStateException: The LuckPerms API is not loaded.
    at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:50)
    at me.bluetree.razeempire.Bungee.Main.<clinit>(Main.java:22)```
turbid solar
#

Add lp as depend or soft depend

hushed oxide
#

it's bungee

turbid solar
#

Yes

#

Same Thing

nocturne elbow
#

did you add LP as a dependency in your bungee.yml/plugin.yml?

hushed oxide
#
  - "Luckperms"```
#

doesn't work

nocturne elbow
#

it's LuckPerms

#

not Luckperms

#

capitalization matters

hushed oxide
#

still

#

same error

nocturne elbow
#

try softdepends instead of softdepend

turbid solar
hushed oxide
#

same error

turbid solar
#

What did u put in it

hushed oxide
#

LuckPerms

turbid solar
#

Whole Thing

nocturne elbow
#

just share the entire plugin.yml

hushed oxide
#

softdepends: ["LuckPerms"]

#

`name: RazeEmpire
version: no version
main: me.bluetree.razeempire.Bungee.Main
author: BlueTree

softdepends: ["LuckPerms"]`

turbid solar
#

Uppercase the d

#

softDepends:

nocturne elbow
#

ngl bungee.yml sucks ass

hushed oxide
#

same error

nocturne elbow
#

also, how are you managing your dependencies? maven? gradle? "external libraries"?

hushed oxide
#

maven

nocturne elbow
#

send your pom

#

paste it there

hushed oxide
#

k

nocturne elbow
#

hm

turbid solar
#

Open the jar and send the plugin.yml

nocturne elbow
#

when are you calling LuckPermsProvider.get()?

#

or where

hushed oxide
#

it's static

nocturne elbow
#

should be inside onEnable

#

that's the issue

turbid solar
#

Static loads it at runtime doesnt it? (Before lp loads)

hushed oxide
#

then, how to get user perms from other classes?

hushed oxide
nocturne elbow
#

every plugin's main class is initialized even before their constructors are called

#

way before onEnable

#

and the LP API object is available since onEnable

nocturne elbow
#

just call LuckPermsProvider.get inside onEnable

hushed oxide
#

fixed

nocturne elbow
#

coolio

hushed oxide
#

java.lang.NullPointerException

#

User onlineUser = Main.lpapi.getUserManager().getUser(p.getName());

#

this is null it seems

#

this is when player is logging in

nocturne elbow
nocturne elbow
#

uhm..... there is no player object to get on PreLoginEvent

#

it's before they log in

#

so the ProxiedPlayer object is null

hushed oxide
#

Oh

#

Umm

#

Bungee problems

#

Then

#

I need mojang api

#

Anyone know how to use it?

nocturne elbow
turbid solar
#

Can't you use login or join event?

hushed oxide
#

JoinEvent no

nocturne elbow
#

why not

hushed oxide
#

I want player kicked before joining

turbid solar
#

Login then

nocturne elbow
#

PostLoginEvent?

hushed oxide
#

will this work?

turbid solar
#

Try and see

nocturne elbow
#

uhm.... you do realize you can load the LP User object without the need of a ProxiedPlayer

#

right?

#

just UserManager::loadUser(uuid)

hushed oxide
#

Oh lol

#

Forgot

#

does getNodes contain * perm?

nocturne elbow
#

if it's explicitly set, yes

#

it will only return the nodes that are set

#

either to true or false

hushed oxide
#

I want to check if it contains it and it is true

#

CompletableFuture<User> userLoadTask = Main.lpapi.getUserManager().loadUser(e.getConnection().getUniqueId());

#

this is null

#

how?

nocturne elbow
#

Q: with the api, that is the event called when a parent is added to a user?

#

NodeAddEvent

uncut ice
#

Only if the player never joined before

crystal sonnet
#

Well is it null or is the code throwing a NullPointeeException? Huge difference

hushed oxide
#

@crystal sonnet it throws a NPE

crystal sonnet
#

Well that means something returns null that shouldn’t you need to find out what

hushed oxide
#

Well

#

When does luckperms load a user?

crystal sonnet
#

Wait

#

You’re doing that when a player joins?

hushed oxide
#

Log in

#

LoginEvent

crystal sonnet
#

Use the async join event with a normal priority and then LP has the user loaded

hushed oxide
#

Well

#

I dont want JoinEvent

#

I want it before player logs in

#

Because it will kick him if he is not staff and maintaince is on

crystal sonnet
#

That’s before the player logs in

#

Again. Use the async login event

#

Or join event

#

*async join event

#

Only one of those exists

#

That is the right one

hushed oxide
#

And how to check if the user has perms after it?

crystal sonnet
#

At that point permission data is loaded

hushed oxide
#

Also, does bungee load the ProxiedPlayer when AsyncLoginEvent?

turbid solar
#

LP loads the user on loginevent priority low

crystal sonnet
#

What platform are you making that plugin for?

turbid solar
#

Bungee ^

hushed oxide
#

Yes Bungee

crystal sonnet
#

Well then the login event is right

#

As bungee has no async event

#

But yes the data has been loaded at that point

#

And people telling you wrong information based on assumptions they made because you didn’t even mention what platform you’re using is 100% on you

hushed oxide
#

How to fetch nodes after the loginEvent?

turbid solar
#

Can't you just use ProxiedPlayer#hasPermission?

crystal sonnet
#

Yes he can

hushed oxide
#

PROXIDPLAYER IS NOT ADDED TO THE LIST YRY

#

YET"

crystal sonnet
#

You can get it from the event

hushed oxide
#

Umm..

#

How?

#

e.getPlayer is not even a method

turbid solar
#

Get connection, get uuid?

hushed oxide
#

Then?

turbid solar
#

Then get a proxiedplayer instance

#

Then check for perms

hushed oxide
#

It returns null

#

Cause player is not online yet

turbid solar
#

Then use luckperms to check

hushed oxide
#

That is what i am doing

turbid solar
hushed oxide
#

Do i need to load the user?

turbid solar
#

Dont think so but you can if you want

hushed oxide
#

Well, how do i check?

#

Last time

#

Luckperms got a database error

turbid solar
#

!paste log then

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!

hushed oxide
#

How do i get the user by the name?

obtuse jolt
#

the player / user object should have a getName method?

hushed oxide
#

Wdym

#

I am new to LP API

obtuse jolt
#

you dont need lp api to get the user name tho

hushed oxide
#

No, how to get the nodes from the begging?

turbid solar
#

Get nodes or check if they have a permission?

obtuse jolt
#

actually right, what is your end goal?

hushed oxide
#

Nodes contains the perms..

#

Checking if player is staff while they didnt join yet

#

LoginEvent

turbid solar
#

Yes

#

Get the connection

#

From that get their uuid

#

Then load/get the user using LP api

#

Then check if they have the permission

hushed oxide
#

How to get the connection?

turbid solar
#

....

hushed oxide
#

Please, i am new

turbid solar
#

event.getConnection()

hushed oxide
#

Oh

#

Its from the event

#

Then

obtuse jolt
hushed oxide
#

How to load the user and check if they have perms?

turbid solar
#

!api

frank driftBOT
obtuse jolt
#

you know you dont need lp api to check if player has permissions right

hushed oxide
#

PROXIEDPLAYER IS NULL

crystal sonnet
#

@hushed oxide there is a login event on the bungee that has a player

#

Use that

hushed oxide
#

Another LoginEvent?

crystal sonnet
#

There are a few for different stages during login. Yes

hushed oxide
#

What is it?

#

PlayerLoginEvent?

crystal sonnet
#

I don’t know by heart

#

You have to look yourself

#

Just take a look at the Javadocs

hushed oxide
#

@crystal sonnet PreLoginEvent okay?

turbid solar
#

Try it

#

If you can get a proxiedplayer then yes

jaunty pecan
hushed oxide
#

Thanks Luck!

left hornet
#

Weirdly enough, LuckPermsProvider.get() is throwing an exception even though it's being called after LuckPerms is loaded (I know this since this is called when running a command, so there is no reason why it shouldn't be loaded)
LuckPerms: v5.2.47 on Bungeecord

turbid solar
#

Paste code in a hastebin

left hornet
#

Hope that suffices, lemme know if it doesn't

turbid solar
#

Whats the error you get?

left hornet
#

The "LuckPerms API has not been loaded" exception, as expected when calling it before it has loaded

#

however that is not the case atm

turbid solar
#

What version of LP is on the server?

left hornet
#

LuckPerms: v5.2.47 on Bungeecord

#

I can confirm LuckPerms is working fine by the way

nocturne elbow
#

@left hornet

#

might want to make that compileOnly...

left hornet
#

Yeah I noticed now

#

I was about to give it a try, thanks though :D

#

Just to make sure, getUser(uuid) works for only online users or does it work for offline users as well?

turbid solar
#

You need to load it first

#

If the player is offline

left hornet
#

Should I always load or check if offline then load?

nocturne elbow
#

just loading works fine

left hornet
#

k thanks :)

#

But it seems to work, so that was probably it

#

thanks

nocturne socket
#

How do i get the colored meta name of a Group? Group#displayName returns null and Group#friendlyName returns a basic string with no capitalization or coloring. Please help!

nocturne elbow
#

You mean the prefix?

#

Because the group's displayname isn't the prefix

nocturne socket
#

Thanks

#

Hmm, seems to throw a no method exception (i decided user prefix was what i was looking for rather than "group" prefix)

#
java.lang.NoSuchMethodError: 'net.luckperms.api.cacheddata.CachedMetaData net.luckperms.api.cacheddata.CachedDataManager.getMetaData()'
at com.elytraforce.bungeesuite.localchat.model.ChatPlayer.getOnlineGroupName(ChatPlayer.java:52) ~[?:?]```
#

(running bungee)

#

nvm as it would turn out running outdated versions of luckperms will lead to errors

river lance
#

What is the right way to change an existing entry?

NodeMap groupData = lpGroup.data();
Node wscClanGroupID = MetaNode.builder(WSCclanGroupID, Integer.toString(group.getGroupID())).build();
Tristate isWSCclanGroupIDExisting = groupData.contains(wscClanGroupID, NodeEqualityPredicate.ONLY_KEY);
if (isWSCclanGroupIDExisting == Tristate.TRUE) {
    // update wscClanGroupID ?
    groupData.
} else { // UNDEFINED
    // add wscClanGroupID !
    groupData.add(wscClanGroupID);
}

Find and delete the existing Node or is there a way to change it?

nocturne elbow
#

remove the existing one and add the new one

#

also, keep in mind that ONLY_KEY refers to the entire node's key, not the meta key (in the case of a MetaNode it would be the entire meta node "string")

river lance
#

so all MetaNodes not only my WSCclanGroupID ?

nocturne elbow
#

no, you remove the existing one for WSCclanGroupID and add the new one

#

Nodes are immutable, so you can't "modify" them or "replace" them

#

Replace is basically just remove and add

river lance
#

ok thanks

#

Basicly this way?

Node wscClanGroupID = MetaNode.builder(WSCclanGroupID, Integer.toString(group.getGroupID())).build();
groupData.clear(node -> node.equals(wscClanGroupID, NodeEqualityPredicate.ONLY_KEY));
groupData.add(wscClanGroupID);
nocturne elbow
#

also, keep in mind that ONLY_KEY refers to the entire node's key, not the meta key (in the case of a MetaNode it would be the entire meta node "string")

#

what does NodeMap#clear take as argument?

river lance
#
    /**
     * Clears any nodes which pass the predicate.
     *
     * @param test the predicate to test for nodes which should be removed
     */
    void clear(@NonNull Predicate<? super Node> test);
nocturne elbow
#

try giving it NodeMatcher.metaKey(wscWhatever)

#

although

#

yeah

river lance
#

Thanks you

river lance
#

Yay, it works ❤️

chilly aspen
#

Is there a way i could check what the expiration milliseconds are on a temporary group applied to a user?

crystal sonnet
#

Yes

chilly aspen
#

LuckPerms.getApi().getUser(player.getUniqueId()).getTemporaryPermissionNodes() by chance?

crystal sonnet
#

Yes. Then filter for inheritance nodes and you’re golden

chilly aspen
#

😮 ty!

crystal sonnet
#

You’re welcome

nocturne elbow
#

Is that a method? CH_facewhy

#

getTemporaryPermissionNodes

chilly aspen
#

it is in my sponge jar :3

#

4.x

nocturne elbow
#

bruh

#

wth

chilly aspen
#

we're running old 😛

nocturne elbow
#

I can tell...

wild whale
#

isn't sponge stable like 8.x?

#

!latest and lp is on 5.2.x

frank driftBOT
#
Latest version

5.2.49

crystal sonnet
#

Sponge is on 7.3

#

8.x is the 1.13+ branch they’re still working on

chilly aspen
#

Yeh. Pixelmon is on 1.12.2 though

crystal sonnet
#

In any case you really should update

#

LP that is

chilly aspen
#

Yeah. I brought it up to the guy that has it like that, but guess it breaks some stuff

#

think he has some mixins for it or something

#

but yeah, i agree lmao

crystal sonnet
#

Mixins in a plugin?!

#

JFC

chilly aspen
#

lmao

crystal sonnet
#

In all honesty

#

The only thing I can think off that could even remotely require a mixin would be getting the forge permissions API to work with LP

#

Well the actual solution to that is using an up to date Sponge version. Because that was added about a year ago

chilly aspen
#

Yeah im not relatively sure what exactly he does with LP

crystal sonnet
#

Awful things

chilly aspen
#

I can only imagine.

crystal sonnet
#

I’d almost be willing to bet money that whatever he’s doing has long been added to either sponge or LP

#

In any case you should ask what on earth he is doing with Mixins

chilly aspen
#

lemme ask for ya

crystal sonnet
#

And if you know feel free to let me know. I can let you know if it’s necessary or if there is a better way

#

As 9/10 times there is a better way

chilly aspen
#

cause i build core around the old lp
and updating it will be a nightmare

#

no mixins i suppose

crystal sonnet
#

If updating the API is a night mate then boy must that code suck

#

It’s such a straightforward process

#

And hell

chilly aspen
#

hes nto wrong
problem is i do most of my shit with mixins rather than via the api

crystal sonnet
#

If needed there’s an extension that will add APIv4 support to LP5

crystal sonnet
#

Any issues related to that are self inflicted and totally unnecessary

chilly aspen
#

yea, i think he can handle anything that does decide to come up for him though

crystal sonnet
#

Frankly interfacing with a plugin through Mixins is so much harder and more time consuming than just using the API

#

It’s like competing in a car race but instead of using a car you decide to walk and drag a ship anchor with your neck

crystal sonnet
#

Thanks for the nightmares. That’s by far the worst thing I’ve heard all year

#

I’m done

obtuse scroll
#

using mixins is actually faster in a closed env instruction wise than using the api (nanoseconds but it makes a difference when making thousands of calls)

crystal sonnet
#

So a few ms are worth your sanity?

obtuse scroll
#

its a closed enviroment

#

the base for the mixins is the same mod that every plugin has access to

#

just casting to an accessor is much easier than you think

rustic laurel
#

FERRIS

#

Holy hell I've missed ya

crystal sonnet
#

Well now you’re stuck with an outdated version that has lost the editor and has known security issues

#

Congrats

#

Certainly worth it

obtuse scroll
#

security issues we fix intenally

#

editor im self hosting

#

not that big of an issue

#

and yeah been a while larry :p

crystal sonnet
#

JFC

rustic laurel
crystal sonnet
#

This is anything but ok

#

On so so so so so many levels

#

Like in all honesty

#

Did you benchmark it?

obtuse scroll
#

per basic commands its on average 300ns slower however for internal lookups which we do allot its on average 15-20ns faster

crystal sonnet
#

Ok. How many thousand lookups per second do you do?

obtuse scroll
#

depends on the queries request size and playercount at that time (*41 servers)

wild whale
#

I mean server count has no impact on the calls to LP

crystal sonnet
#

Absolutely

#

But in any case. When ns are significant just use an internal cache

#

And I mean you do know that LP 5 had some significant performance improvements, right?

#

Regarding the cache:
GriefPrevention/GreifDefender does so many lookups that it tanks performance. So their solution was to use internal caches. Which gained significantly more time than any direct accessor through a Mixin ever could

obtuse scroll
#

prob true however its not a priority to update as it stands prob will in the future but meh for now

crystal sonnet
#

Utter insanity

rustic laurel
#

hey, be nice :p

obtuse scroll
#

hes not wrong lol

rustic laurel
#

it was a working fix then, and if it works it works. don't see the huge deal with it being harder to do or not working the utter best way

crystal sonnet
#

I’d rather be forced to work with Node for the rest of my life than to touch that code base with a stick

#

So I’m being as nice as I can be

crystal sonnet
#

This is far beyond “it works”

#

Oh and @obtuse scroll the performance improvements for v5 were so significant that GD had a few test builds with their internal cache disabled.

#

But they decided to keep it because it’s still faster

#

But no longer needed

#

That’s a hole you dug yourself in. Good luck getting out of it

obtuse scroll
#

not so much a hole

#

would prob take maybe 3 hours to update the internals the rest of the core can work around the change without issue shurg just a matter of doing it

crystal sonnet
#

If you’re tasking other devs to interface with LP you should

#

The new API is significantly better

obtuse scroll
#

also out of curiosity what is the lowest spongeversion support by v5?

#

it support 7.0.4 still or 7.3+?

rustic laurel
#

5-8

#

iirc

#

all the sponge

nocturne elbow
worn barn
#

do any one know how i can let people with out OP do different commands as i have chosen?

turbid solar
#

With the api?

worn barn
#

sry i wrote i wrong chat

lusty path
#

how do i have ppl join a group i cant get my friend in a group because idk how.

obtuse jolt
#

you are coding a plugin?

lusty path
#

i made a group and idk how to inv ppl

obtuse jolt
#

sound like you are not

uncut ice
river lance
#

me again...

var optionalMetaNode = group.getNodes(NodeType.META).stream().filter(NodeMatcher.metaKey(LuckPermsMetaKeys.WSCclanGroupID)).findAny(); // No result
var optionalMetaNode = group.getNodes(NodeType.META).stream().filter(node -> LuckPermsMetaKeys.WSCclanGroupID.equals(node.getMetaKey())).findAny(); // one result

I thought that should return both the same result?

#

LuckPermsMetaKeys.WSCclanGroupID = "WSCclanGroupID"

nocturne elbow
#

welp, LuckPermsMetaKeys.WSCclanGroupID.equals(node.getMetaKey()) is case sensitive that's for sure

#

I wonder what NodeMatcher.metaKey(LuckPermsMetaKeys.WSCclanGroupID) does bts

#

@river lance could you run /lp export --upload and send me the code so I can test it on the same dataset as yours?

nocturne elbow
#

Hola, alguien español/spanish?¿

#

o i speak inglish?

#

Hola si 02eyes

#

O no

#

xd

#

es que tengo un problema

#

y para que se que es pero no

#

xd

#

no se si es no cheat plus o luckperms

#

a si que estoy viendo

#

?? me parece que #support-1 es un canal más apto a menos que tenga que ver con la API

#

ehhh

#

vale

#

es que general

#

no es de soporte

#

entonces como no vi

#

un canal de soporte

#

vine aqui

#

no vi la descripcion xd

#

ok

#

gracias

uncut ice
#

Hallo, was ist denn hier los!

turbid solar
#

What?

tepid spruce
#

Speak english dammit

#

Does someone know why adding a permission to a group doesn't actually save it?

nocturne elbow
#

are you saving the group?

tepid spruce
#

That may be the issue indeed

#

I'll check

#

ty

#

Ait lovely

#

ty

nocturne elbow
#

you're welcome

tepid spruce
#

Ahahah sorry, it's my first time working with the lp api

#

it's awesome

nocturne elbow
#

is neat

tepid spruce
#

Indeed it is

river lance
#

Fefo any new Idea with the metanode matcher over the night ?

nocturne elbow
#

didn't test yet

river lance
#

Ok..

ancient sable
#

Is it there directly link to a blog/page that talk about luckperms dependency manager?

crystal sonnet
atomic nacelle
#

Hey,
I pasted the code to Obtaining an instance of the api in my class, but I get following error. What can I do to repair this error?

nocturne elbow
#

You are missing a ; at the end of the line right above

#

lmao

turbid solar
#

Also, light theme

nocturne elbow
#

That is 100% part of the problem reversed_fingerguns

atomic nacelle
#

in the first line?

nocturne elbow
#

the first line in that image, yes

atomic nacelle
#

thx

#

then i had to add an ; { at the end of the first line and a } after that whole thing from the website

nocturne elbow
atomic nacelle
#

so there is no error

nocturne elbow
#

uuh you don't need to add those braces

atomic nacelle
nocturne elbow
#

screenshot the entire thing please

atomic nacelle
#

If I remove the part of Luckperms, there is no error

turbid solar
#

Put it under onenable

#

In*

nocturne elbow
#

Yeah the whole snippet from the website has to be inside your onEnable

atomic nacelle
turbid solar
#

Whole ss

atomic nacelle
#

fixed it

#

thx

nocturne elbow
#

oooookay

crystal sonnet
#

Java 101

tribal wave
#

ooOOOoohhh 👻 arrAAAyys 👾👻

#

shaaallow copieees 👾👾👾👻👻

#

idk

nocturne elbow
#

probably something to do with the case sensitivity, Luck will know :d

obtuse jolt
#

when it output code as messages

nocturne elbow
#

oh yeah xD I do that when debugging in game

obtuse jolt
#

how do you do that tho

nocturne elbow
obtuse jolt
#

ah loll

#

i thought there was some special tool

nocturne elbow
#

lol no

river lance
#

Yay, thanks for testing 😁

uncut ice
ebon osprey
#

since 5.0 ive got confused i knew how too use 4.0 but not new one

nocturne elbow
#

did you just update the dependency and none of the code?

ebon osprey
#

i have but the dev api i dont know how to get Use Lp as im using bungeecord its a bungeecord plugin and it doesnt like it for some reason

wild whale
#

!bungee

frank driftBOT
wild whale
#

wait

#

!api

frank driftBOT
wild whale
#

ignore the !bungee lol

ebon osprey
#

it doesnt accept the Bukkit one

#

lol

nocturne elbow
#

"the bukkit one" what

#

there is one universal API

ebon osprey
nocturne elbow
#

well yes I mean

#

is that a surprise?

rose shell
#

I would like to know how I can pull players from just one group and show them in the chat to whoever performs the command.

rose shell
#

Any example of how I could do it?

nocturne elbow
#

Not for that method exactly, but you can check some general API usage examples

#

!cookbook

frank driftBOT
nocturne elbow
#

!api might want to give the first two pages a read too, I do suggest it

frank driftBOT
rose shell
#

Thanks.

upbeat jackal
#

Hi !

#
LuckPermsProvider.get().getUserManager().modifyUser(target.getUniqueId(),
                    user -> user.data().add(Node.builder("essentials.fly")
                            .withContext("modifier", "accumulate")
                            .expiry(min, TimeUnit.MINUTES).build()));
#

Is this how you add the modifier "accumulate"?

nocturne elbow
#

No, the temporary modifier is not a node context

#

Iirc the NodeMap#add method takes an argument for that behavior

#

!javadoc

frank driftBOT
upbeat jackal
#

Thanks !

nocturne elbow
#

just interested where did you read this out

jaunty pecan
#

hidden in a stackoverflow thread

#

there's a lot of other bs on that question, idk why that one isn't the accepted answer

velvet tartan
#

Im using the dev api for chat formatting for my server, and i want to use node metadata to mark prefixes as staff or not so in certain situations itll show the highest-priority non-staff prefix instead of just the highest-priority. I got the api working to sort and filter by metadata, but now I dont know how to actually set the metadata for a prefix with commands/editor.

nocturne elbow
#

I dont know how to actually set the metadata for a prefix with commands/editor.
what

velvet tartan
#

theres no command to set metadata for a node

#

like ingame

#

only metadata for a user/group

nocturne elbow
#

Nodes don't have metadata

velvet tartan
#

but in the api it has metadata

nocturne elbow
#

Metadata are nodes

#

Ooooooh I think I know what you mean

velvet tartan
#

Node#getMetadata

nocturne elbow
#

That's eccentric

velvet tartan
#

?

nocturne elbow
#

Well give me a minute, I don't know the entirety of the API all the time lol

#

Thing is, what you're presenting are different things

#

User/group metadata are MetaNodes

velvet tartan
#

yea

nocturne elbow
#

Node metadata is different

velvet tartan
#

i know its different i was just saying for the commands

nocturne elbow
#

As far as I know you can't "access" the node metadata

#

But again I think you're mixing two different things

#

What are you trying to achieve

velvet tartan
#

nope Im not referring to the group and user metadata. i know its nodes for those.

#

Im trying to put metadata on prefix nodes

#

like actual metadata

nocturne elbow
#

Yeah

#

There is no command for that

#

That's why it's an API thingu

velvet tartan
#

ok so ill have to write a command to do it in my plugin i guess?

nocturne elbow
#

You are guessing right

velvet tartan
#

ok

nocturne elbow
#

There are heaps of stuff not accessible from commands tbh

#

Like transient nodes

#

That would be neat to have tbh

turbid solar
#

Whut are those?

nocturne elbow
#

Data which expires automatically at the end of a session. (when a user logs off)
This data is never saved to the backend storage provider.

turbid solar
#

Oh thats nice

tribal wave
#

those actually sound really useful....

onyx blade
#
@Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
        Player player = (Player) commandSender;
        Main.getInstance().args.put(player.getUniqueId(), strings[0]);
        LuckPerms api = LuckPermsProvider.get();
        Inventory inv = Bukkit.createInventory(null, 18, "§8Set Rank");
        int i = 0;

        for(Group groups : api.getGroupManager().getLoadedGroups()) {
            if(groups.getDisplayName() != null) {
                inv.setItem(i, new ItemBuilder(Material.WOOL).setName(ChatColor.translateAlternateColorCodes('&', groups.getDisplayName())).setLore("§8§m------------------------", "§8» §7Prefix: " + Objects.requireNonNull(groups.getCachedData().getMetaData().getPrefix()).replace('&', '§')).toItemStack());
                i++;
            }
        }
        player.openInventory(inv);


        return false;
    }``` hey so i have this code to show all my ranks in a menu but i would like to put the ranks in order depending on their weight. Someone knows how to do it ?
crystal sonnet
#

You can use streams to sort them

onyx blade
#

i never used stream

#

i should is wich one ?

crystal sonnet
#

@onyx blade

onyx blade
#

yes

crystal sonnet
#

Neither

#

You first need to sort them

#

And then for each

onyx blade
#

how can i sort them

#

like this ?

obtuse jolt
#

yea then you need to code the comparator, so java know how to sort it

#

unless the group object already implement Comparator interface, not sure about that

onyx blade
obtuse jolt
#

there are plenty of online documentation of it

#

tbh, I hate to say but just google how to use them

trim pike
#

Heya,

We made a disguise plugin which allows you to disguise as a player.
I'm using the luckperms API to get the uuid of a user by name, and to get (or load if get returns null) a user, and then we get his group by doing:
User user = ColdDisguise.getInstance().getLuckPermsAPI().getUserManager().getUser(uuid);
This does in this case not return null, and if it doesn't return null I'm seeing what his primarygroup is (for now just a simple sys out):
System.out.println(user.getPrimaryGroup());
But when doing this it sometimes gives this error:

12.12 15:57:22 [Server] WARN java.lang.NullPointerException: value
12.12 15:57:22 [Server] WARN at java.util.Objects.requireNonNull(Objects.java:228)
12.12 15:57:22 [Server] WARN at me.lucko.luckperms.common.api.implementation.ApiUser.getPrimaryGroup(ApiUser.java:75)
12.12 15:57:22 [Server] WARN at me.nick.colddisguise.command.DisguiseCommand.lambda$setMetadata$2(DisguiseCommand.java:102)
nocturne elbow
#

to get (or load if get returns null) a user
Why not just load it? If it's already loaded it'll return it immediately

trim pike
#

You don't want to load a user if he's already loaded I think

#

It sounds naughty

#

But you're saying that's completely fine?

#

So the get method is only if you're sure the player is online or something?

hollow yew
#

hello

nocturne elbow
#

I guess yeah, or maybe in a situation for example in an event where you can't wait for the data to be loaded so you just get it, if it's null you yeet

trim pike
#

Ah makes sense, I think this fixed my issues after a bit of testing

#

Cheers!

hollow yew
#

I got the player prefix using the API, but the result was null

trim pike
#

Show us the money

hollow yew
#

my code:

nocturne elbow
#

Use hastebin pls 😬

hollow yew
#

oh

#

ok

#

but my code is very small

#
package com.meddiproject.meddiproject;

import net.luckperms.api.LuckPerms;
import net.luckperms.api.model.user.User;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.RegisteredServiceProvider;

public class nick implements Listener {
    @EventHandler
    public void onClick(PlayerInteractAtEntityEvent e) {
        Player p = e.getPlayer();
        Player entity = (Player) e.getRightClicked();
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            LuckPerms api = provider.getProvider();
            User user = api.getPlayerAdapter(Player.class).getUser(p);
            String prefix = user.getCachedData().getMetaData().getPrefix();
            if (entity.getType().equals(EntityType.PLAYER)) {
                ItemStack inv = entity.getInventory().getHelmet();
                String clickedName = entity.getName();
                if (inv.getType() == Material.CARVED_PUMPKIN && inv.getItemMeta().getDisplayName().equals("Маска грабителя")) {
                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.MAGIC + prefix + clickedName));
                } else {
                    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(prefix + clickedName));
                }
            }
        }
    }
}
#

prefix is null

#

result: null playername

#

pls help

nocturne elbow
#

Well do you have a prefix in the first place?

hollow yew
#

да

#

есть

#

oh

#

sorry

#

yes, i have

turbid solar
#

Screenshot

#

!userinfo

frank driftBOT
#
Please take a screenshot!

Seeing a screenshot makes everything so much easier!

For prefixes not showing up in chat:

/lp user <user> info.

For database errors:

Server console: /lp info | Proxy console: /lpb info.

turbid solar
#

First one

#

On a user where it returns null

hollow yew
#

sec

#

im find the error

#

return the player who clicked's prefix

#

but i need the entity

#

prefix

turbid solar
#

U need to convert colors urself

hollow yew
#

Thx for all!

#

The question is not about the LuckPerms API: how can I stop the execution of a scheluder in my code?

#

my code:

#

Messages are repeated cyclically, but I only need to check the time in the world to do this

obtuse jolt
#

scheduleSyncRepeatingTask is a Deprecated as well, unless you are using an old bukkit api

mint folio
#

Will API work on BungeeCord Server?

nocturne elbow
#

yes

uneven radish
#

hey, is it possible to give a player an temporary permission which just counts when the player is online?

nocturne elbow
#

Not with LP alone

#

And no, I don't know of any plugin that adds that feature

uneven radish
#

thanks

tribal wave
#

wait isn't that the transient permission node stuff you were talking about, fefo

#

or am i misunderstanding

nocturne elbow
#

No, what they were asking is basically a temp node that only counts time when the user is online. Thing is, temp nodes aren't based on time, but on an expiration date

tribal wave
#

aaah i took what he said to mean that it only counts as true when they're online

#

by the way is there a spot in the wiki for transient nodes

#

i actually may have a use for them somewhere but i don't know where to even start learning about them 😦

nocturne elbow
#

"learning"? thonk

#

They are just like any regular permission but aren't saved to storage

#

Just add a transient perm node on user join. Can't you do that?

#

Yesn't, there still has to be a system in place to remove it after some time online

#

And for that matter you can just use a normal node PES_SadShrug

#

Ah sorry I thought cerexus meant a node that is only added to the user when they join, and stays added to that user until they disconnect.

tribal wave
polar moon
#

How can I set user prefix ?

sudden pelican
#

!cookbook

frank driftBOT
polar moon
#

oh thanks

#

@sudden pelican and how can I reset their nick to the group default one ?

sudden pelican
#

if you reset their prefix then it'll show the prefix from whichever group they're already in

polar moon
#

so how can I set their prefix to group one

hollow yew
#

hello

#

this is again i

#

ny code doesn't work

#

I think the problem is in "if(prefix == null)

#

pls help me

nocturne elbow
#

send the error @hollow yew

hollow yew
#

it is dont work

#

just dont work

crystal sonnet
#

@hollow yew what's happening?

#

Like it's hard trying to debug code without knowing what's happening when you run it

obtuse jolt
# hollow yew it is dont work

how is it not working...? I suggest you start putting debug messages and see the output at various points of your code...

hollow yew
#

when I click on a player with the right mouse button the message is not displayed

crystal sonnet
#

Try to debug it with either a debugger or debug print statements @hollow yew

turbid solar
#

Yes

fierce dew
#

how do i listen for a user group change

turbid solar
#

NodeAddEvent i think?

fierce dew
#

ill try with NodeMutateEvent

nocturne elbow
#

not that one D:

#

NodeMutateEvent is not a callable event per se, it's just an interface for NodeAddEvent and NodeRemoveEvent (and I think NodeClearEvent?), and those are callable events

#

"group change" is just remove then add, so yeah you're wanting to listen to NodeAddEvent

fierce dew
#

how do I check if the added node is a group one

nocturne elbow
#

Check that the node type is of type INHERITANCE

turbid solar
#

!cookbook

frank driftBOT
nocturne elbow
#

those two questions were literally my first ones when I came into this channel lmao

fierce dew
#

what uuid does UserManager#searchAll return as a map key>

#

a player uuid?

nocturne elbow
#

Yeah the user UUID

fierce dew
#

thats what I need :)

#

@nocturne elbow any idea?

frank driftBOT
#

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

fierce dew
#

@frank drift can u please shut up

nocturne elbow
#

jk

#

sooo InsectPvPCore.java:57 line 57, which one is it

fierce dew
#

I already mentioned it

#

.searchAll(

#

never had such an issue with lambdas and stuff

nocturne elbow
#

line 57 is exactly .searchAll(?

fierce dew
#

yup

nocturne elbow
#

tbh I suggest you make methods for those lambdas and reference the methods instead

fierce dew
#

ok

nocturne elbow
#

i.e. put the code they do in a separate method that takes as argument what the lambda takes and the return value what it would return

#

will prolly make it easier to debug

fierce dew
#

yes i know

#

i have a lot of experience but i never had anything like that before

#

literally the same

#

doesn't even reference the method

nocturne elbow
#

wdym?

fierce dew
#

58 is yet again searchAll

nocturne elbow
#

lol I should have read the error sooner, by the looks of it a regular Predicate won't do, you have to use a NodeMatcher

#

class [lambda blah blah] cannot be cast to class blah.blah.ConstraintNodeMatcher

fierce dew
#

oh so i need to force it to create a NodeMatcher

#

i can probably guess

#

yet another jvm optimisation

nocturne elbow
#

what does the jvm have to do with it

fierce dew
#

you know the jvm sometimes optimises

nocturne elbow
#

LP expects a NodeMatcher

fierce dew
#

inlining and stuff

nocturne elbow
#

Not a regular predicate

fierce dew
#

yeah ik but why does the jvm try to use a predicate

nocturne elbow
#

Because it extends predicate?

#

¯_(ツ)_/¯

fierce dew
#

yet again error

jaunty pecan
#

it's not clear I admit, but those methods require you to use one of the matchers returned by the static methods in NodeMatcher

#

you can't create your own

#

(this is because under the hood these get converted into sql queries)

fierce dew
#

bruh

#

so I should either use the builder or the present static methods @jaunty pecan

frank driftBOT
#

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

jaunty pecan
#

you just pass NodeMatcher.key(InheritanceNode.builder(...))

#

instead of your predicate

fierce dew
#

aha smart boi

jaunty pecan
#

LP can then convert that into an SQL query: WHERE perm == "group.whatever"

#

but it can't if you just give a lambda :p

fierce dew
#

yeah then the process would be much slower

jaunty pecan
#

well yeah, would require loading the entire db into memory

#

which would be bad

#

there ya go - intellij ides will give a warning if someone else tries to do the same in future :))

uneven radish
#

hey, how can i set the parent group with the api and call a network sync?

#

Should be this or? User u = MineconomyWorld.luckPerms.getUserManager().getUser(p.getUniqueId()); u.setPrimaryGroup("test"); MineconomyWorld.luckPerms.getUserManager().saveUser(u);

turbid solar
#

!cookbook has examples, you also need to add the group itself not just set primary

frank driftBOT
turbid solar
#

!api

frank driftBOT
uneven radish
#

so my code is wrong?

nocturne elbow
#

The primary group is pretty much irrelevant and only matters for things like Vault

#

By default it's the parent group with highest weight

#

What you want is to clear all the user's nodes of type INHERITANCE and then add the one you want (since users can have more than one parent group)

uneven radish
#

so i did that now `// Remove all other inherited groups the user had before.
user.data().clear(NodeType.INHERITANCE::matches);

        // Create a node to add to the player.
        Node node = InheritanceNode.builder(group).build();`
#

but the player is still in default group too

#

but i dont want that