#luckperms-api

1 messages · Page 20 of 1

long moon
#

links to a repo which isn't the spigot repo

proud sparrow
#

Hello, how can I get player's group with the api?

#

?

long moon
#

API docs are linked in the header, the API usage guide also covers how to use the API for various things

shell cargo
#

So

#

I am missing a lot of functions for the api

#

For example parent clear, group remove and add

#

Also the possibility to get a editor link via api is missing

long moon
#

Read the docs on working with nodes, can't really say what you're missing other than expecting methods which do it for you

shell cargo
#

Ok delete was added, create also

#

But editor is missing

long moon
#

web editor also likely isn't considered API, but take a look at how the editor commands work

shell cargo
#

And rename

#

Well i solved the issues that i had, in a other way 🤔

#

Read the log file, and execute commands

long moon
#

Or you learn how to manipulate the nodes properly...

shell cargo
#

Nah

#

My solution works kinda fine, only the feedback is kinda buggy, but i solve that problem to

proud sparrow
#

@long moon I tried but i don't know how to get player rank with the highest weight

kind crystal
#

I need help with the API. I'm trying to get a user's set prefix for a chat plugin I'm making. I'm first testing this and then moving to vault.. I can't seem to find any methods for this tho.

long moon
#

Ref the api usage docs on the wiki

dire atlas
#
Contexts contexts = LuckPerms.getApi().getContextsForPlayer(e.getPlayer());
String prefix = cachedData.getMetaData(contexts).getPrefix();```
#

@kind crystal

kind crystal
#

Ahhhh I see.

kind crystal
#

Welp I'm stuck. I'm getting so eu compatible types in my IDE

#

Says required me.lucko.luckperms.api.chaching.UserData

Found: me.lucko.luckperms.api.User

Don't know why since I even got it imported.

#

Let's me cast to api.caching.UserData

Change the var cached Data to api.User or migrate to api.User

kind crystal
#

That worked! Thanks

nocturne elbow
#

how can i get a users group to a string?

long moon
#

get the users group nodes by filtering them out of their own nodes, then create a string with their names

nocturne elbow
#

how would i get the user group nodes :/

long moon
#

The API docs go over interacting with nodes

nocturne elbow
#

I may have misslooked i will try again xD day 4 at figuring this out lol

long moon
#

On the wiki, see the sidebar, there is a usage API which has examples on how to toy with the API and stuff

#

I'm stuck on a severly underpowered laptop, so I'm somewhat limited in tryna lookup stuff myself \o/

nocturne elbow
#

ohhh

#

Finding a players group

#

🤦

#

Thank you for your help 😄

#

Gonna have to figure out this if (player.hasPermission("group." + group)) {

proud sparrow
#

why metaData.prefix returns null?

#

How can I get user highest prefix

nocturne elbow
#

Hey there i need help because im a beginner in dev...!!
String query = "SELECT expiry FROM luckperms_user_permissions WHERE uuid LIKE '416a0bf3-5682-475d-9da5-8d96bd55ae98' AND permission LIKE 'group.donate'";
i cant get the right answer
the data value are corret and the sql answer is good so i get the unix_timestamp
but in java i get only this
com.mysql.jdbc.JDBC42ResultSet@49e78d6a
is any body here...??

neat jackal
#

What are you doing with the query? Why are you reading data directly from the database?

lucid rapids
#

hello, little question, my plugin has tons of commands and each one has a permission, do i need to add specific implementation to every single permissions plugin or is the basic implementation of permissible#hasPermission(permission) enough?

#

or should i use Vault as an abstract layer?

#

(please ping me if you reply)

proud sparrow
#

hasPermission is enough imo

fierce nebula
#

(With LuckpermsAPI)

fair crag
#

Hi all !
you have already tried to block the use of a mod with luckperms, because I can not find an id to block its uses ... (it's for the mod customnpc) ??

west rune
#

i need help with something plz anyone

gaunt pine
#

Me me me

slate zenith
#

.

crystal sonnet
#

@charliestenslay#2769 just ask

normal hedge
#

How do I check if a player has a certain permission?

#

User#hasPermission(Node node)

#

Don't know how this Node works

#

???

crystal sonnet
#

Yup that would work

#

@normal hedge the question is, why do you need that?

#

Just use the permission check of the platform

#

Only exception would be for offline players

normal hedge
#

Im making a level system based on permissions

#

There are also ops or * users

#

so thats why the Player#hasPermission(String permission) doesn't work

crystal sonnet
#

That doesn't really matter here

#

Then your server setup is broken

normal hedge
#

Well it works now lol

crystal sonnet
#

It's kinda funny that yo learned why you're not supposed to use * or OP @normal hedge

#

😛

normal hedge
#

That is for sure

#

but its for a commission and the client wants to use op lol

nocturne elbow
#

any way to get the users parent groups that are shown when running /lp user info

#

i used the example from the documentation using nodes but that also returns inherited groups

brave oak
#

Hey, im trying to make a staffchat plugin currently and wanted to incorporate luckperms into it to setup permissions, how would i go about doing that?

dire atlas
#

elaborate

brave oak
#

so im new to setting up luckperms on plugins, i made a custom staffchat plugin for bungee but want to use luckperms to assign permissions to groups for the plugin

#

i read that i have to put in the luckperms api dependency, but then what?

crystal sonnet
#

@nocturne elbow there are a few different methods to get player nodes

#

One of them returns only the directly assigned nodes

#

@brave oak so you want to give people certain permission when a command is ran?

brave oak
#

yeah basically i have a command /sc <message> which allows the user to talk in a "staff chat", i want to setup permissions so only staff can use that command and view it

#

but im not sure how to setup luckperms in my plugin

#

its a custom made bungee plugin

crystal sonnet
#

Do you want to give people permissions or check permissions?

brave oak
#

check for permissions

crystal sonnet
#

You don't need LP for this

#

Just use the built in permission check method

brave oak
#

wait... sorry i meant to say give certain people permission to use the command

#

my bad

crystal sonnet
#

Please make up your mind

#

You have been flip flopping back and forth

brave oak
#

ok sorry let me start from the beginning, so i made a custom staffchat plugin for bungee and i want to implement luckperms into it to give certain players access to the command which is /sc

crystal sonnet
#

Now to make it very very clear:
Do you want to:

  • See if a player has permission to use the staff chat?
  • Give the player the permission to use the staff chat?
brave oak
#

give the player permission to use staff chat

crystal sonnet
#

So you have an extra command for that then?

brave oak
#

no i do not have a command to give players permissions currently

crystal sonnet
#

Then how are you planning on giving the permissions?

#

Though in any case it's typically better to let server admins just set permissions instead of doing it for them

nocturne elbow
#

Oh okay I’ll check out the docs, thanks @crystal sonnet

frank driftBOT
#

Hey zbk! Please don't tag staff members.

nocturne elbow
#

fine

hybrid dawn
#

Is there a way to give people access to a group? I only see a way to set the primary group, but can't seem to find a way to actually add a group to them.

proud sparrow
#

@hybrid dawn /lp user (nickname) parent add (groupname)

hybrid dawn
#

Through the API I mean. I'm making a plugin and I want to be able too manage the permissions alongside LP

azure latch
#

@hybrid dawn you need to look at the docs. Look at the NodeFactory

hybrid dawn
#

NodeFactory doesn't help me, as far as I can tell there's no way to add a user to a group using the api

proud crypt
#

Adding a user to a group is the same as adding a group.<groupname> permission node

dark valley
#

I thought doing group.groupname was the equivalent of perm inheritance Turbo

proud crypt
#

Exactly

#

It's the same thing lol

dark valley
#

I see

neat jackal
#

Isn't there some sort of NodeFactory#makeGroupNode method?

jolly sorrel
#

How do you guys give players permission to teleport and for the other person to /tpaccept or /tpdeny

#

Do I need a a extra plugin for that with luck perms or luck perms can do that

dark valley
#

isnt that essentials?

jolly sorrel
#

Is it?

#

wut

#

@crystal sonnet @thorny echo help pls haha

frank driftBOT
#

Hey T-rex! Please don't tag staff members.

jolly sorrel
#

My bad

dark valley
#

Im 99% sure its essentials that does it

#

EssentialsX to be precis

jolly sorrel
#

do I need luck perm for it?

dark valley
#

Essentials is a plugin that does loads. Luckperm just handles permissions

#

So essentials has like, essentials.tp (i think) and you would add that to luckperms

jolly sorrel
#

So I need luck perm to give my players essential commands

dark valley
#

Yes

jolly sorrel
#

and the command that I type is essentialx?

dark valley
#

The plugin is called EssentialsX

broken vine
#

Do i need luck perm for Skyclaim ?

dark valley
#

Guys luckperm just handles permissions that other plugins have

broken vine
#

Why Skyclaim don't work when luckperm isn't here

dark valley
#

are you using sponge

broken vine
#

Yes

dark valley
#

Ah i think sponge stuff with luckperms is a bit different

#

im not sure as i know nothing about sponge

broken vine
#

Ah and how i can get the permission

#

On luckperms.conf ?

long moon
#
  1. Wrong channel; 2):
#

!usage

frank driftBOT
tame epoch
#

for super lobby for the leader board how do i put my rank is it %rank%?

idle seal
#

Mal eine Frage. Was sind die dependencys für die luckperms bungee api?

crystal sonnet
#

Keine? @idle seal

#

Versterhe deine Frage nicht ganz

idle seal
#

Für die luckperms Bungee API braucht man doch bestimmt andere maven dependencies also für die luckperms Bukkit API

#

Und ich bräuchte die maven dependencie von der luckperms Bungee API

nocturne elbow
#

Spittin facts

cursive dove
#

Hoffe dass das der richtige Chat dafür ist. Weiß jemand was ich eigebenen muss damit jemand nicht abbauen kann ( z.B. Visitor Rolle )

neat jackal
#

Meinst du mit der API?

cursive dove
#

Ich?

#

Oder Spark

neat jackal
#

Dich

cursive dove
#

Ach so :D mit welcher API 😬

#

Ah

#

Ne eigentlich nicht

#

Kann sein dass es der falsche Chat war

neat jackal
#

Vermutlich schon

#

Heißt nicht umsonst #api

cursive dove
#

Ja..naja trotzdem danke

crystal sonnet
#

@idle seal es gibt nur eine platformunabhängige API

#

Und die ist standalone

#

Also ohne weitere Abhängigkeiten

#

Was auch völlig normal für eine API ist

idle seal
#

Ja okay, weil bei der einer Methode ein Fehler kommt wenn ich sie ausführe. Auf den spigot Server habe ich die gleiche Methode und da geht sie

neat jackal
#

Und welcher Fehler?

idle seal
#

Ja schicke ich gleich ich hatte vorhin noch keine Zeit um an PC zu gehen

idle seal
#

ach egal habe den fehler gefixt

blazing pewter
#

Hello ! 😄 How can I check if a player has an permission , by the User object ( for using in the LoginEvent* ) ? I got the syntax <User>.hasPermission() but i ask me a "Node". What is this Node , and how can I get it ?

neat jackal
#

A node is a permission. You can make Nodes using the NodeFactory

crystal sonnet
#

@blazing pewter pretty sure the player has their permission data already loaded at that stage and you can just use the platform permission check

blazing pewter
#

I can't because I haven't the ProxiedPlayer object at this stage (LoginEvent) , so I doesn't have the hasPermission method of ProxiedPlayer

#

I will try to understand how NodeFactory works Tobi , thanks you ! 😄

#

And.. I'm sorry I forgot to say that it's for BungeeCord and not Spigot

crystal sonnet
#

I think you can get it, but yeah

languid pike
#

Nah. During the regular old LoginEvent you only get a PendingConnection. You want PostLoginEvent for the ProxiedPlayer

nocturne elbow
#

im very confused and prolly just being stupid bc its early but how do I check for a players group with

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

Do I do like
getPlayerGroup(player, something);
?
azure latch
#

Well, you should check if the player has a group with

 Player#hasPermission("group." + AGroupName);```
nocturne elbow
#

I dont want to check them 1 by 1

neat jackal
#

Well, what do you want to achieve?

nocturne elbow
#

i want to check what rank the user has

neat jackal
#

Well, can't you just use Player#hasPermission then?

nocturne elbow
#

I don't want to check for each group individually

long moon
#

Get their own nodes

#

Then, filter out their group nodes

#

(Pretty sure this is covered in the API usage guide on the wiki)

nocturne elbow
#

yes I was asking how to use that and they all just told be to use has permission

#

thank you

long moon
#

Can we pleeease have the API usage guide in the channel description or something? People seem to gloss over it far too often and ask questions which are already answered in that guide

brazen pewter
#

I've been trying to use the luckperms placeholder for prefix with EssentialsChat, but it just isn't work

crystal sonnet
#

It seems like you're justr trying to configure EssentialsChat, am I right @brazen pewter?

oak sphinx
#

can i check alreay has permission on NodeAddEvent?

jovial breach
#

Is it possible to obtain the players rank via the bungeecord?

mint path
#

?

dusky wagon
#

Witch event triggert if i set a player a new parent?

#

Pls tag me for the answer

magic anchor
#

I created a plugin that installes other of my plugins as APIs. The Problem is, LuckPerms does not find the permissions of the plugins. (ik, i can search for the perms manually but luckperms is easier). When I install the other plugins, I use the pluginmanager and load them. Reloading/Restarting does not help, because the APIs get reinstalled to have always the newest version. Any Ideas how I can reload the system that recognizes the permissions with the luckperms API? If it is kind of hard, please private msg me to not spam this chat :)

NOTE:
I enable the APIs after the server has loaded and before the server is done enabling

crystal sonnet
#

@magic anchor permissions that have been checked end up in LP’s list of known permissions

#

So you can just go around and make sure the plugins check their permissions

#

And I’m 99% sure that is not exposed in the API

#

Alternatively I think you can tell the API directly what your permissions are

magic anchor
#

@crystal sonnet but how?

frank driftBOT
#

Hey DasBabyPixel! Please don't tag staff members.

crystal sonnet
#

I’m not sure how the method is called. But check the Javadocs

#

I’d take a look in the permission manager

magic anchor
#

I think I found something...

#

the InjectorPermissionMap

#

but I have no Idea how to get the instance ._. probably will require deeper researching

#

I hate to do stuff like that, but I'll probably insert the new permissions via reflection API. The PermissionRegistry class is as far as I can tell not implemented in the API. Thats kind of unfortunate, but oh well

crystal sonnet
#

@magic anchor that’s what an API is

#

The implementations are in the actual plugin

#

And yes the PermissionRegistry class sounds exactly like the class you need

#

Get an instance and use it

mortal bobcat
#

Is there an event when you set the parent of a player?

mortal bobcat
#

?

mortal bobcat
#

?

nocturne elbow
#

UserDataRecalculateEvent

#

NodeAddEvent

#

for example

#

i prefer 2nd

eternal bloom
#

why is NodeAddEvent not firing?

#

is it supposed to fire when i set a permission for a player/group?

eternal bloom
#

why is that event handler throwing errors?

mortal bobcat
#

@nocturne elbow and how can I obtain the player from the 2nd event

azure latch
strange ore
#

Hi i have a question.
i have just set up a server using Spigot, with the luckperms plugin installed. However i cant seem to get the permissions for the groups right. Everytime i try to set it so that certain players in a group can not change gamemode, it doesnt work. I have tried a lot of different commands.... Its probably a very easy thing, but i cant seem to figure it out...

azure latch
#

!verbose

frank driftBOT
azure latch
#

Use that to find the right permission to set

strange ore
#

thanks~!

strange ore
#

yo thanks so much!!! its all fixed thanks to the github!

drowsy moon
#

I can't get the prefix from metadata, but why idk.

crystal sonnet
#

@drowsy moon 2 things

#

a) you code doesn't match with the errors

#

The lines are way off

#

b) Is the player offline? (never mind)

eternal bloom
#

is there an example for a listener for LuckPerms custom events

atomic sapphire
#

@eternal bloom I'm not sure if I get what you are asking for but I am using this in my class constructor

LuckPerms.getApi().getEventBus().subscribe(UserDataRecalculateEvent.class, this::onUserRecalculateEvent);

and the method that I put inside there:

private void onUserRecalculateEvent(UserDataRecalculateEvent e) {
}
#

Question: I am using user.inheritsGroup(group); to check if a player is inside a specific group but this seems to not check temporary groups/parents. How can I achieve that?

eternal bloom
#

why is this not working: ```
@Override
public void init() {
LuckPerms.getApi().getEventBus().subscribe(LuckPermsBridge.class, this::event);
}

private void event(LuckPermsEvent e) {
    // do stuff
}
#

whats org.checkerframework.checker.nullness.qual.NonNull

crystal sonnet
#

@eternal bloom the first parameter needs to be the class of the event you want to handle

eternal bloom
#

does the class need to implement anything?

atomic sapphire
#

Question: I am using user.inheritsGroup(group); to check if a player is inside a specific group but this seems to not check temporary groups/parents. How can I achieve that?
Do you know how, BrainStone?

crystal sonnet
#

@eternal bloom no. It's the event you want to listen to

#

@atomic sapphire I don't. But have you checked the Javadocs?

eternal bloom
#

it says i need to cast LuckPermsBridge.class to @NonNull Class<T> but org.checkerframework.checker.nullness.qual.NonNull doesnt exist

crystal sonnet
#

Ignore the nonnull

#

LuckPermsBridge is not an event

#

LuckPermsEvent is one on the other hand

#

@eternal bloom

eternal bloom
#

i think i get what your saying

crystal sonnet
#

I hope so

#

I'm running out of ways to explain it differently

eternal bloom
#

yep

#

thx

atomic sapphire
#

It says

Check to see if this holder inherits another group in the global context.
"Global context" simply means an empty context set.
This method only checks for direct inheritance - one hop up the inheritance tree.

for #inheritsGroup(Group) so I would assume that it includes temporary groups. Because when I don't make it temporary the method returns true of the group

marble fulcrum
atomic sapphire
#

You can get the global context using Contexts.global(); or use Contexts.of(...)

marble fulcrum
#

Thanks!

ionic smelt
#

is the API for luckperms the same from spigot to nukkit? (Ignore question in #support-1 )

crystal sonnet
#

@ionic smelt yes it is

long wyvern
#

Hey is there's any way so I can get the same permission result as this?

#

Currently using this code and I didn't get the same result

#

I've parented my self to a group called Hello and that group has a permission csl.limit.vip

#

using my code it shows the permission

#

but when I check it using the permission info commands on luckperms it didn't show the csl.limit.vip

#

nvm

#

fixed by using List<LocalizedNode> permissions = new ArrayList<>((Set<LocalizedNode>) user.getEnduringPermissions());

nocturne elbow
#

how can i get all members from a specific group?

nocturne elbow
#

i need a list from everyone who is for example in "vip" group

crystal sonnet
#

@nocturne elbow online or online and offline players?

nocturne elbow
#

both, everyone who is in the group

crystal sonnet
#

That's difficult

#

Or at least resource intensive

nocturne elbow
#

okay

crystal sonnet
#

You'd need to load every known player and check if they are in that group

nocturne elbow
#

i have a temporary group, how can i check the duration with the API?

fossil trench
#

I've got a question, been setting everything up for the first time, switched over from group manager and I think I got everything all set up right. I got the default group switching over to the group I want as the default, Beginners. That's working fine so far but there's some commands and other things that they can still use that I don't want them to.
For instance creating a essentials warp sign or using the gamemode command.
I don't particularly know what's happening here or how to fix it so they can't.

crystal sonnet
#

@nocturne elbow iterate over the nodes the player has, check if it
s the node you want and get the remaining time from it

fossil trench
#

Oh sorry. Re-post it there?

crystal sonnet
#

Yes

nocturne elbow
#

what event should i use to get the group when someone does /lpb group admin setweight

marble fulcrum
#

getGroupManager() first
then get the group

#

LuckPerms api is not working for me. This code does not effect (does not give rank or send log message) and does not give any errors:

Main:

public static LuckPermsApi luckPermsApi;
public void onEnable() {
    RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
        if (provider != null) {
            luckPermsApi = provider.getProvider();
        }
}```

Other class:
```java
    private void setPrimaryGroup(UUID user, String rank){
        User LPuser = Main.luckPermsApi.getUserManager().getUser(user);

        LPuser.setPrimaryGroup(rank);

        Main.luckPermsApi.getUserManager().saveUser(LPuser);
    }```

Also in plugin.yml:
```yml
depend: [Vault, LuckPerms]```
crystal sonnet
#

@marble fulcrum setting the primary group does not give a player a group

#

It only determines which of all the groups the player has is the primary one

#

Check the wiki for examples on how to add or set a group

marble fulcrum
#

Why this is not working?

    private void givePerms(UUID user, String perm){
        User LPuser = Main.luckPermsApi.getUserManager().getUser(user);
        Node node = Main.luckPermsApi.getNodeFactory().newBuilder(perm).build();
        LPuser.setPermission(node);


        Main.luckPermsApi.getUserManager().saveUser(LPuser);
    }```
crystal sonnet
#

You're getting the user, creating a node (read you are creating an object that says "If given to a player they have that permission") and then don't add that node to the player and then save it

nocturne elbow
#

when getting the users parent group inside of NodeAddEvent it will return the value before the node was added. is there a way around this?

#

ex user gets admin added, getParentGroup() will return default in the event

marble fulcrum
#

How can I make that work?

azure latch
#

@nocturne elbow can you show us the code? If your doing anything asynchronously, that will also do this. Even if you use a BukkitRunnable, this will occur since they are scheduled for the next tick as a minimum

nocturne elbow
#

nothing is asynchronous in the listener

crystal sonnet
#

@marble fulcrum there's a method on the user to add a permission node

nocturne elbow
#

nvm i was calling something async, is there a way to delay the async task until the event has "finished"?

#

it has to loadUser unfortunately

robust loom
#

is there an event for when an user switches groups? like on parent add/remove

proud crypt
#

Node add event maybe?

robust loom
#

so i should check if the permission starts with group.?

proud crypt
#

I believe that will work

#

Not a Java developer so I've never used the API, there could be a better method but that's all that comes to mind

digital jetty
#

To know if a user has a permission, it must be done like that ? :

return this.lpUser.hasPermission(SaoArms.luckPermsApi.getNodeFactory().newBuilder(permission).build()).asBoolean();```
azure latch
#

That should work yeah

digital jetty
#

Okay thanks

marble fulcrum
#

Oh its working but why it does not send any log message lol

left badger
#
    private void onUserPromote(UserPromoteEvent event) {
        ProxiedPlayer player = event.getPlayer(event.getUser().getUuid()); //how do i do this correctly
        if (player != null) {
            player.sendMessage(new TextComponent(ChatColor.GOLD + "Your group has been moved from " + event.getGroupFrom().get() + ChatColor.GOLD + " to " + event.getGroupTo().get() + ".");
        }
    }```
Is there a way that I can get the ProxiedPlayer? I'm quite new at all of this so I'm not sure if i am even doing this right lol
I am trying to send a message to the user letting them know they have been promoted, so I need a way to get the player. Also making this as a bungee plugin
left badger
#

^ please @ me if you reply thanks

crystal sonnet
#

@left badger There's a Bungee method to get the player from the UUID

#

Just google it

left badger
#

ok

left badger
#

so i just got back from school, so i can actually look now, but are you recommending using the default way of getting the player uuid, and then getting the bungee player from that?

    private void onUserDemote(UserDemoteEvent event) {
        Player player = Bukkit.getPlayer(event.getUser().getUuid());
        if (player != null) {
            player.sendMessage(ChatColor.GOLD + "Your group has been moved from " + event.getGroupFrom().get() + ChatColor.GOLD + " to " + event.getGroupTo().get() + ".");
        }
    }```
This is the way that is outlined in the API docs, so wouyld I have that and then using that get the bungeecord player from that uuid?
crystal sonnet
#

@left badger keep in mind you’re on bungee. Not bukkit

#

So use the bungee API to get the proxied player

#

Should be very similar

left badger
#

ok thats what I thought

#

sorry I was confused

#

also are there events for when a user gets added a rank, or their rank gets set? I couldn't find those anywhere

marble fulcrum
#
        User LPuser = Main.luckPermsApi.getUserManager().getUser(user);
        Group group = Main.luckPermsApi.getGroup(rank);
        Node node = Main.luckPermsApi.getNodeFactory().makeGroupNode(group).build();
        LPuser.setPermission(node); 
        Bukkit.broadcastMessage(group.toString() + " ja " + node.toString()); //debugged and it got right node but it's not giving it

        Main.luckPermsApi.getUserManager().saveUser(LPuser);
    }```

Hmm... Its getting right node but it does not give that to player
Can somebody help me with that?
brave saffron
#
parents:
- ii
- king:
    expiry: 1574681226```
How to get this contents in java?
pd.getStringList("parents") returns only "ii"
brave saffron
#

?

proud crypt
#

King isn't a string

azure latch
#

That's what it's supposed to do

#

You'd have to do getStringList("parents.king") iirc

brave saffron
#

isSet("- king") returns false

long moon
#

This channel is for questions about the LP api, not bukkit; But, basically, that's a MapList

brave saffron
#

This is from lp yaml configuration, so is related

#

So how to get contents of "king" when I check for "parents"?

long moon
#

actually, am not 100% sure that's a maplist; best option I got at this point is to iterate over the parents list and see what the heck the configuration system considers that

#

(Also, if you /reaaaallly/ want relevance to the API, why are you not just using the API?)

brave saffron
#

I want to migrate from luckperms automaticly, luckperms offers only migrate to luckperms

long moon
#

Use the LP api to pull all the info?

brave saffron
#

I got all users as yaml, and will add permissions/ranks by yaml

#

Then I would need to have 2 permission plugins in the online server

long moon
#

Only while migrating

brave saffron
#

Won't that mess everything up?

#

having 2 permission plugins in the server?

long moon
#

You'd migrate and then remove LP

brave saffron
#

Migration can take time

long moon
#

You can't actually have a live production server with two permission plugins, they'd conflict

#

Reading the data files directly won't change anything there

brave saffron
#

Will

#

Then server can be only, and players that want to get back their permissions/rank can do that by a command any time

#

This way server will have only 1 permission plugin, and everything will be done by my plugin

long moon
#

Basically, if that's yourr oute, best advice I've got is to load up the config in a plugin and use a breakpoint or something to dive into the configuration so you can work out how the crap bukkit represents that

brave saffron
#

I think I got it

proud crypt
#

why would you want to migrate away from luckperms 🤔

brave saffron
#

@proud crypt LuckPerms loads data on AsyncPreLoginEvent without checking, if the player was allowed to join. When getting 1500+ bots per second, this crashes the server

frank driftBOT
#

Hey AsVaidas! Please don't tag staff members.

brave saffron
#

Having another permission plugin, that keeps in memory or loads player information after confirming, that he can join, will benifit the server

#

Now i had 5 crashes today, it is not acceptable with 50+ players online

proud crypt
#

why not contribute to LP instead of making something else?

brave saffron
#

If I would know how, I would do that

#

Now I know how to code, not how to use github

#

Or maven

#

Or these things

proud crypt
#

you need to learn git as a developer

brave saffron
#

I will

proud crypt
#

version control is super important

brave saffron
#

But learning and using 1 time is two different things

proud crypt
#

especially if you want to make a career out of it

brave saffron
#

If I try now to make changes, I succed and after that won't use it for a long time, what would be the benifit?

#

suceed*

#

English is not my language...

#

When I will need github daily, then yea, my priority will be to learn how to use github. For one time it's pointless

jaunty pecan
#

the reason LP loads data regardless of the cancellation status of the event is:

#

once an event is cancelled - that's not necessarily permanent

#

we've had issues in the past with plugins which cancel events early on in the event handling, only to uncancel them later

#

the result of which is that the player connects to the server but doesn't have any of their permissions data loaded

#

obviously bad ^

brave saffron
#

Yea, but can't LuckPerms recheck that on PlayerJoinEvent?

jaunty pecan
#

the current compromise is that LP will load data for players regardless, and then unload it later if it turns out the player didn't actually join

#

by the time the PlayerJoinEvent is called, the data is already loaded

brave saffron
#

I know

#

Or maybe I just don't know how permissions works

jaunty pecan
#

the data has to be loaded during the asyncprelogin event

#

because that's the only asynchronous login event - basically a requirement if you want to load stuff from a database before a player actually "logs in" to the server

brave saffron
#

Well that crashes the server, 1500+ connections to the H2 database is too much for luckperms

jaunty pecan
#

understandable

#

1500 is a lot!

brave saffron
#

I know

#

Sometimes it reaches 2000

jaunty pecan
#

my suggestion would be to address the root cause

#

i.e. enable online-mode

#

or get a bot protection plugin which blocks connections before the server begins to handle them

brave saffron
#

Yea, then the server is dead, after the first week only 2-3 players would log in

#

This is the main our contry problem

jaunty pecan
#

or get a bot protection plugin which blocks connections before the server begins to handle them

brave saffron
#

Maybe you know one?

jaunty pecan
#

I don't unfortunately

#

Never had the need to use one

brave saffron
#

Tried searching for at least code part that does that, didn't find anything

#

Those, which was suggessted by staff, denys join on asyncprelogin

#

And I think all antibots does that

#

It's the esiest way

brave saffron
#

Yea, after switching had bots again, zero effect

#

Sad to go away from luckperms

#

Now luckperms-gui will be abandoned

uncut panther
#

How do I get the prefix of a group of a player.
Please dont send met the github docs. I've read them and they alle dont work for me

uncut panther
#

okay no reaction

fierce dew
#

I'm trying to use lucko's helper to download a lib and it always throws me NoDefClassFoundException. How does luckperms do that without giving a single error?

#

hello can someone help please

crystal sonnet
#

@fierce dew what class is not being found?

fierce dew
#

and I get a NoDefClassFoundException at com.mrivanplays.icf.ICFCommand

#

@crystal sonnet u here

frank driftBOT
#

Hey MrIvanPlays! Please don't tag staff members.

crystal sonnet
#

So are you downloading the jar that contains that class?

fierce dew
#

helper should do it for me

#

but at these conditions it doesn't want to

crystal sonnet
#

Are you making helper download that jar?

#

Well it downloads them

fierce dew
#

have you seen the code? of course i do

crystal sonnet
#

Nothing ever said it would inject them in the class path/ClassLoader

fierce dew
#

it doesn't even make the plugin load because that error is being thrown at load

crystal sonnet
#

You gotta make sure to not reference that class directly until it has been downloaded and injected

#

That's not the lib's fault

#

That's how Java works

fierce dew
#

then mister java master, explain, how can the program inject it before the class was loaded ?

crystal sonnet
#

You inject it before it is loaded

fierce dew
#

how you do that while that class is the first loaded by the system

crystal sonnet
#

The easiest way to do it is to use a helper class that then actually references the class

fierce dew
#

that helper class will also get loaded before the lib was loaded

crystal sonnet
#
@MavenLibrary(
    groupId = "com.mrivanplays",
    artifactId = "icf",
    version = "1.1.2",
    repo = @Repository(url = "https://dl.bintray.com/mrivanplaysbg/mrivanplays/"))
public class MainClass extends ExtendedJavaPlugin {

  @Override
  public void enable() {
    Helper.enable();
  }

private class Helper {
  public static void enable() {
    TestCommand testCommand = new TestCommand();
    CommandManager commandManager = new CommandManager(this);
    commandManager.registerCommand(testCommand, "testcommand");
  }
}
}
#

And no. It won't

fierce dew
#

k it somehow worked

crystal sonnet
#

It's not like I know how that shit works or anything

#

So clueless about everything

uncut panther
#

I tries ceveral times

#

but wont work

#
public class ChatListener implements Listener {

    public Main plugin;
    private LuckPermsApi luckPermsApi;
    
    public ChatListener(Main main,LuckPermsApi luckPermsApi) {
        
        this.plugin = main;
        this.luckPermsApi = luckPermsApi;
        
    }
            
    @EventHandler
    public void onChat(AsyncPlayerChatEvent e) {
        
        Player player = e.getPlayer();
        MetaData metaData = user.getCachedData().getMetaData(player);
        
        String group = luckPermsApi.get
        e.setFormat(group[0] + " " + player.getDisplayName() + "§7: " + e.getMessage());
    }
    
}

I wnat to format my chat for players
This is what I have ( does not work and I know there are errors..)

uncut panther
#

Okay I have it fixed

#

kind off

#
@EventHandler
    public void onChat(AsyncPlayerChatEvent e) {
        
        Player player = e.getPlayer();
        User user = luckPermsApi.getUser(player.getUniqueId());
        UserData cachedData = user.getCachedData();
        
        MetaData metaData = cachedData.getMetaData((Contexts.allowAll()));
        
        String prefix = metaData.getPrefix();
        e.setFormat(prefix + " §8" + player.getDisplayName() + "§7: " + e.getMessage());
    }

but after a reload or restart. it says my prefix is 'Null' and i need to regive me the group.
any solutions?

azure latch
#

The only thing I can think of is that UserData is null, but then MetaData would throw an NPE

#

The only way I can think of doing this without an NPE is by getting the players highest group, then getting it's prefix. However, are there any errors in the console when you reload @uncut panther?

uncut panther
#

I know what went wrong. When i created the server i transdered the confog from luckperma aswel. As so the paremt group that everuone gets aswell. And since im running a new databse that group does not exist. Therefor the null

obsidian mauve
#

@uncut panther Hi xD

marble fulcrum
#

Will this also remove temp perms? .unsetPermission(node)

#

How can I remove temp permissions / temp groups?

marsh flame
#

How do I grab a players prefix, with ProxiedPlayer? I am using bungeecord.

crystal sonnet
#

The same way you’d do it on Bukkit

#

Or the other platforms

uncut panther
#

I'll send my code in a minute

#

@marsh flame

#
    @EventHandler
    public void onChat(AsyncPlayerChatEvent e) {
        
        Player player = e.getPlayer();
        User user = luckPermsApi.getUser(player.getUniqueId());
        UserData cachedData = user.getCachedData();
        
        MetaData metaData = cachedData.getMetaData((Contexts.allowAll()));
        
        String prefix = metaData.getPrefix();
        e.setFormat(prefix + " §8" + player.getDisplayName() + "§7: " + e.getMessage());
    }
marble fulcrum
#

BrainStone, Can you help me with my question above?

crystal sonnet
#

No it doesn’t.

#

The easiest way to remove temp permissions is to iterate over the given permissions and check if the node has the permission you want and is temporary. Then pass that node to the unset function

#

Alternatively check the Javadocs if it indeed does also remove temp permissions if you just pass a node with the permission

violet knoll
#

Hey! 🙂
I wanna change a users group via the LuckPerms API.
But the group new is not set.

My code: https://hasteb.in/diguyuze.lua

What is my mistake?

marble fulcrum
#

Thank you got it!

#

lusu007 I guess you need to make group node?

violet knoll
#

Hey thanks for your reply. But I fixed itt 🙂

atomic sapphire
#

Is there an official API I could use in my standalone application (LuckPerms storage set to mysql) to check groups'n stuff?

crystal sonnet
#

@atomic sapphire no there is not

atomic sapphire
#

ok thanks

surreal comet
#

How I set someone group?
I want to make a plugin that switch the player beetwen their rank and staff

crystal sonnet
#

There's a developer guide on the wiki @surreal comet

proud crypt
#

!api

frank driftBOT
surreal comet
#

Why the javadocs doen't have a search bar, find something in there is pretty hard.

spare torrent
#

what repository do i have to add so that intellij can find luckperms api?

#

I copied the maven

            <groupId>net.luckperms</groupId>
            <artifactId>luckperms-api</artifactId>
            <version>5.0</version>
            <scope>provided</scope>
        </dependency>```
#

alright I changed the version to 4.4.31 and it still is not able to resolve it

misty hinge
#

@spare torrent what happens if u add this

#

to ur POM

#
            <id>luckperms-repo</id>
            <url>https://repo1.maven.org/maven2/me/lucko/luckperms/luckperms-api/4.4/</url>
        </repository>```
spare torrent
#

still does not work

misty hinge
#

it does for me?

spare torrent
#

Should I just share all my maven code?

#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>VertX</groupId>
    <artifactId>InvitationPromotion</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <!-- This adds the Spigot Maven repository to the build-->
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>

        <repository>
            <id>luckperms-repo</id>
            <url>https://repo1.maven.org/maven2/me/lucko/luckperms/luckperms-api/4.4/</url>
        </repository>

    </repositories>

    <dependencies>
        <!--This adds the Spigot API artifact to the build -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.14.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

        <!--This adds the Bukkit API artifact to the build -->
        <!-- Do not include this in the pom.xml file if the Spigot API is already added -->
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.14.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>


        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>luckperms-api</artifactId>
            <version>4.4.31</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>
misty hinge
#

works fine here

#

¯_(ツ)_/¯

spare torrent
#

yep it works

misty hinge
#

;p

#

google best friend xD

spare torrent
#

Someone should update the api tutorial to use me.lucko.luckperms and version 4.4 and to show what repo url they need to include

#

this includes a broken link to their maven repo

#

but thank you so much for your help!

misty hinge
#

wait

#

lmc something

spare torrent
#

Cuz, if you just follow that tutorial it wont work

misty hinge
#

wtf

#

i found a bug

#

lol

spare torrent
#

you see it?

misty hinge
#

5.0 is never released

crystal sonnet
#

That's because the API v5 isn't released just yet

misty hinge
#

on maven central

#

lmao

crystal sonnet
#

The page is prepared for that

misty hinge
#

why doesnt it say the old one then

#

until its released

crystal sonnet
#

Not sure

#

It will be released this week if I'm not mistaken

misty hinge
#

lol

#

we both uses a diff site

#

the one i use

#

xD

crystal sonnet
#

@spare torrent the link tells you how to include it

#

The one I posted

spare torrent
#

oh thx

#

oooh i see it now

crystal sonnet
#

Though tbh unless it's urgent to implement it, wait until v5 is released

#

The API is very different

#

And better

spare torrent
#

how much work will it take to rewrite it for the new api if i write my plugin with the old one?

crystal sonnet
#

About as long as you took to write it originally

spare torrent
#

oof

crystal sonnet
#

You essentially will need to start over

spare torrent
#

when is v5 coming out?

crystal sonnet
#

As I said, this week I think

#

Can't promise it though

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

@dire atlas have a look at the API documentation here

dire atlas
crystal sonnet
#

Be aware that some things might not work at this very moment because the docs are being prepared for the v5 release which should be later this week

#

Yup that looks right

dire atlas
#

This will give me a map with all metadata from all ranks, sorted by weight

#

right?

crystal sonnet
#

Not sorted by weight, but else, yes

#

This will give you all meta data that applies to the player with the given context

dire atlas
#

alright

prime glacier
#

Are there some events like PlayerChangeGroup event?

prime glacier
#

?

prime glacier
#

Is there a way to get the priority id from an Prefix in Luckperms???

storm zephyr
#

http://stu.pidme.me/p?id=M8Q5QUC Api isn't found, unless I have the wrong repo its simply not there

        <repository>
            <id>central</id>
            <url>https://repo1.maven.org/maven2</url>
        </repository>

Cool Picture

#
        <dependency>
            <groupId>me.lucko.luckperms</groupId>
            <artifactId>luckperms-api</artifactId>
            <version>4.4</version>
            <scope>provided</scope>
        </dependency>

does work though, but with this version the example usage doens't work http://stu.pidme.me/p?id=FvDSs9S

Cool Picture

misty hinge
#

@storm zephyr 5.0 isnt published yet

storm zephyr
#

so the 4.4 is what I should use?

misty hinge
#

yes

storm zephyr
#

Alright

#

5.0 was what the git wiki showed so I assumed it'd be that 😛

proud crypt
#

He was planning on releasing it this week I believe. The wiki only just got updated.

storm zephyr
#

Yeah I saw it was changed 2 days ago

misty hinge
#

the wiki kinda confuses people rn

storm zephyr
#

I only needed to simply add a player permission, server-specific which I was able to find by simply looking at the jar maven downloaded, so I got everything in the end

storm zephyr
#
    private void addPermission(Player player, String serverName, String permission) {
        System.out.println("adding permission `" + permission + "` to user " + player.getName() + " on server " + serverName);
        Node node = LuckPerms.getApi().buildNode(permission).setServer(serverName).build();
        System.out.println(LuckPerms.getApi().getUser(player.getUniqueId()).setPermission(node).wasSuccess());
    }

I have this simple method, passing correct arguments and it prints "true" in console indicating that #wasSuccess() returned true, and the permission works until the user relogs. Am I forgetting something? Are there api docs for v4.4, if so where can I find those because the wiki is documented for v5

crystal sonnet
#

@storm zephyr you need to save the changed being made

storm zephyr
#

how do I do that?

crystal sonnet
#

I think it's called save on the user object

#

Or similar

#

though in any case, I'd highly suggest you do not work on this right now

#

As the completely reworked API v5 should be released this week along the plugin v5

storm zephyr
#

This can be a temporary solution, I just migrated from UPerms to LP and need to update my core plugin, before I can go online again

crystal sonnet
#

Ah I see

#

Then yes

storm zephyr
#

can't find any save method, looking in the javadocs

#

Ok I found UserManager#save(User), trying that now

#

Yeah that did it, awesome

crystal sonnet
#

👍🏼

#

A few notes

#

While the v5 API will be drastically different, there's an extension for v5 that will bridge the old API to the new one. So you'll be able to upgrade the plugin, and don't have to worry about updating your core plugin at the same time

storm zephyr
#

Awesome, though I can roll both updates out in the same restart

crystal sonnet
#

Sure

#

However you prefer

storm zephyr
#

Alright, thanks for the help, 'appreciate it

prime glacier
#

Why nobody is helping me???

misty hinge
#

@prime glacier i think people dont read all messages

crystal sonnet
#

@prime glacier yes you can. I don’t know how exactly but you can

misty hinge
#

question. is it possible with the API to set the chatformat

proud crypt
#

I'm going to say probably not?

#

That's not a thing LP is designed to do.

misty hinge
#

rip

crystal sonnet
#

Your chat plugin takes care of the chat format @misty hinge

misty hinge
#

^ thats the point. Im gonna make them myself

crystal sonnet
#

Then your custom chat plugin is in charge of formatting the chat @misty hinge

#

LP does not format the chat

nocturne elbow
#

I need help for LuckPerms, how do you do LuckChat and the Chat Prefix ?

#

For nukkit

misty hinge
#

@nocturne elbow LuckChat isnt updated

#

Discontinued LuckChat

harsh tide
#

i need help i got an null pointer exeption when i try to get the group of some body

storm zephyr
#

LuckPerms.getApi().getUser(p.getUniqueId()).getPermissions() does this return all permissions for a player, or only permissions specifically set to them?

harsh tide
#

but i need the group for a tab plugin and chat

misty hinge
#

when will V5 api be public

jaunty pecan
#

it's public now 🙂

misty hinge
#

ur a god Thanks!

crystal sonnet
#

@storm zephyr check the Javadoc of the method

#

Also I'd recommend you use API v5

#

Much better

storm zephyr
#

yeah I will be upgrading soon

misty hinge
#

oh

#

sadness

crystal sonnet
#

The package changed @misty hinge

#

It's now net.luckperms

#

As you can see in Luck's link

misty hinge
#

update wiki

#

¯_(ツ)_/¯

crystal sonnet
#

@ripe thorn the wiki guy to the rescue

misty hinge
#

;p

#

no

#

ok wait

#

my brain farted for a moment

ripe thorn
#

@crystal sonnet huh?

proud crypt
#

update wiki

ripe thorn
#

tells me a lot

misty hinge
#

this new api makes my brain fart

ripe thorn
misty hinge
#

thanks andre xD

#

also can someone help me out

#

how am i supposed to get the API now with v5

#

i had luckPerms = LuckPerms.getApiSafe().orElse(null); but that is obv not working anymore

crystal sonnet
#

!api

frank driftBOT
misty hinge
#

^ didnt seems to help me

#

or im being blind aha

crystal sonnet
#

@misty hinge ???

#

Be aware that everything changed

#

All classes are now in a different package

misty hinge
#

i noticed that

#

i think i just need to redo this line of code

#
        // Get LuckPerms API
        try {
            luckPerms = LuckPerms.getApiSafe().orElse(null);
        } catch (Throwable e) {
            getLogger().emergency("Unable to get LuckPerms API! Disabling...");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
#

thats my only issue im facing rn ;p

#

(i use nukkit btw)

#

idk if that rly matters

#

nvm solved it

dark robin
#

wait

#

pfft

#

ah

#

fixed

dark robin
#

How am i supposed to return both prefixes of a player as a string?

#

i'm using the track rank stacking thing

ashen remnant
wispy harness
#

Thts DeluxeChat's fault, they didn't update the API yet,

#

so i should say use the older version of LP till DeluxeChat fixed it or make an issue towards Deluxechat.

#

@ashen remnant

ashen remnant
#

oh ok

crystal sonnet
long wyvern
#

Is there's any replacement for Contexts.global(); ?

tight brook
#

Trying to obtain an instance of the api, but when I use the Bukkit ServicesManager, it says that LuckPermsApi can't be resolved to a type

#

Using LuckPerms 5.0.3

neat jackal
#

RegisteredServiceProvider<LuckPerms>?

tight brook
#

thanks

#

On the api page, it says to use this code to check if a player is in a group

    return player.hasPermission("group." + group);
}```
But is there a way to check if they are in a particular group, not using permissions but if they actually are in a group
fiery fossil
#

Being member of a group is represented by a permission group.<groupname>
So this function does actually check if they are a member of this group

tight brook
#

Yeah, but the permission "*" would make this redundant, as it would say you were in that group, even if you weren't

fiery fossil
#

I'm not sure whether it would. Even so, it's not recommended to use "*".

#

But yeah, you're right, giving "*" permission also extends to group.anything. It's not treated specially in that regard.

dim mirage
#

If a user has multiple suffixes active, what will metaData.getSuffix() return for that user?

crystal sonnet
#

@fiery fossil @tight brook did you actually check that? I think there’s an exception for internal/functional nodes

#

And the reason it’s recommended to do it like that is because the code to cleanly check if the player is in a certain group is around 20 lines

tight brook
#

Yeah when I checked it didn’t matter when I was opped or had the * permission

gray pier
#

I just installed LP and I am having an issue with players not being able to break/build in world? I can't find the source of the problem

untold rose
#

Do you have EssentialsProtect/Anti-Build installed?

crystal sonnet
astral willow
#

how do you assign multiple groups using the api

crystal sonnet
#

Did you check this?

#

!api

frank driftBOT
astral willow
#

Yes obviously

proud crypt
#

did you try a loop

crystal sonnet
#

I mean all you do is add multiple group nodes to a player

bright tapir
#

Seems like everything in !api is kind of outdated for v5.0 (some classes don't even exist anymore), I'm just doing super simple things (just adding a player to a group, getting a player prefix, and getting a player suffix) so I'm just wondering how I could do that in v5.0?

astral willow
#

!api

frank driftBOT
astral willow
#

@bright tapir i agree

jaunty pecan
#

it's been moved to a new location

bright tapir
#

thanks :)

wet obsidian
#

If you were running luckyperms with spongeforge on a singleplayer world how would you give yourself access to it ?

proud crypt
#

I'm curious, why would you need a permission system on a single player game?

bitter gulch
#

Hey

#

is it possible to update bulk though the API?

#

Trying to reset everyone who has a rank from b-z

#

(is a prison server)

bright tapir
#

Howdy.

#
public static String getPlayerPrefix(Player player) {
        User user = Objects.requireNonNull(luckPerms.getUserManager().getUser(player.getUniqueId()));

        QueryOptions queryOptions = QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build();

        CachedMetaData metaData = user.getCachedData().getMetaData(queryOptions);
        return metaData.getPrefix() == null ? "" : metaData.getPrefix();
    }
#

I've got this little method that's returning null no matter what. What am I doing wrong in terms of the API?

bitter gulch
#

works for me

#

(thats for the group)

bright tapir
#

I'm using v5 API though, you can only pass in QueryOptions for getMetaData.

bitter gulch
#

ooof

bright tapir
#

We don't even have Contexts anymore ;p

bitter gulch
#

O_O

#

yeah was trying to update to v5 but ran into some problems :p

bright tapir
#

The wiki isn't much help because that's outdated too, I'm trying to mash it together using the Javadoc however I'm not really sure the intended usage.

bright tapir
#

I'm going to bet the QueryOptions is invalid or something

crystal sonnet
#

@bright tapir the wiki should be updated

#

!api

frank driftBOT
bitter gulch
#

Uh yeah so Uh like I was asking any quick way though the api / commands to remove users who have groups b-z

bright tapir
frank driftBOT
#

Hey TehBrian! Please don't tag staff members.

bright tapir
#

Oh, whoops, sorry.

#

But uh just take a look at that, you can see there's a CachedData#getMetaData(contexts) but in v5's API, #getMetaData doesn't accept contexts, it only accepts QueryOptions.

crystal sonnet
#

Hm. I see

#

I haven’t used the new API yet so I can’t help

#

I’d suggest raising an issue on the Wiki Repo

bright tapir
#

Alright, thank you.

crystal sonnet
#

👍🏻

nocturne elbow
#

how to get prefix of player in a bungeecord plugin? (for join/leave messages at proxy level)

nocturne elbow
#

I found how to do it, but weirdness is, using same code in a spigot server outputs different prefix than using same code in bungeecord

#

it gets player's personal prefix in bungee, not the group's

#

while it gets group's in spigot.. really weird

crystal sonnet
#

Is the output the same for both /lpb user <user> meta info and /lp user <user> meta info?

nocturne elbow
#

Hello, how can i give temporary rank through api? Is there a method for that?

#

I mean, there is something like JAVA @NonNull DataMutateResult setPrimaryGroup(@NonNull String group);

#

But i don't know, how can i handle it with temporary things, do i need to store the time that it was given, to the time i want to remove it? (ping me if you know answer)

bright tapir
#

Hi there. Until the wiki is updated with the new API, is there anyone who could help me update this little tiny method?

public static String getPlayerPrefix(Player player) {
        User user = Objects.requireNonNull(luckPerms.getUserManager().getUser(player.getUniqueId()));

        QueryOptions queryOptions = QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build();

        CachedMetaData metaData = user.getCachedData().getMetaData(queryOptions);
        return metaData.getPrefix() == null ? "" : metaData.getPrefix();
    }
#

I'm pretty sure the QueryOptions are wrong but I'm really not entirely sure how to use them.

#

Thank you.

#

Also, if anyone responds, please ping me :)

crystal sonnet
#

@nocturne elbow have a look here:

#

!api

frank driftBOT
crystal sonnet
#

When building a node, you can make it temorary

nocturne elbow
#

Okay thanks

nocturne elbow
#

I'm using a translator. Can I ask you a question here?

#

My Folder

#

Enter the server and enter /lp help or command.

nocturne elbow
#

I found a way. I'm terribly sorry.

#

😂

sudden kelp
#

Hi, looking into 5.0 and got some of our plugins adapted, but what would be the replacement for this one?
node.get().getSecondsTilExpiry()
I can get the instant but no idea how I would easily get the remaining seconds

#

Also getAllNodes got replaced by resolveInheritedNodes? But how would I use that one. I need all nodes that a player has(+ inheritances)

crystal sonnet
#

Did you have a look at this:

#

!api

frank driftBOT
crystal sonnet
#

Also it should be easy to google how to get the time difference between an instant and now @sudden kelp

halcyon pebble
#

These API changes are killing me :(
is the wiki fully updated with the 5.0 stuff?
because this is not working how I expected it to and the return values of the methods are different types

#

CachedPermissionData doesn't even have getPermisssionValue

swift portal
#

I gave up x)

proud crypt
#

Winners never quit

swift portal
#

So, how can I use "QueryOptions" ?

halcyon pebble
#

well hopefully someone will either update the wiki or tell me the solution 🙂

proud crypt
#

It's being worked on

#

(I can't help with API as I'm not a Java developer)

umbral axle
#

What's the 5.0 equivalent of User#inheritsGroup()?

jade vine
#

was the api remade recently or what happened

halcyon pebble
#

v5.0 changed the API from v4.0
There is a compatibility expansion but I'd rather just upgrade my API methods
unfortunately I can't figure out what I'm doing wrong and still haven't gotten a reply or any help 😦

karmic seal
#

would someone mind helping me add luckperms API to a plugin?
i want to change the way it checks for permissions to use permissionData.getPermissionValue("some.permission.node");
which as i see is a luck perms only thing, and i would need to import the api, but i dont know how to do that, and the tutorials i see are of no use to me really, cause its not my plugin from scratch

crystal sonnet
#

@karmic seal why?

fierce dew
#

idk if this should be here, but for some reason commodore doesn't want to work for me at 1.14.4

#

here's my code

#
    public static void inject(JavaPlugin plugin, PluginCommand command) {
        System.out.println(CommodoreProvider.isSupported());
        if (CommodoreProvider.isSupported()) {
            Commodore commodore = CommodoreProvider.getCommodore(plugin);
            commodore.register(command, LiteralArgumentBuilder.literal("test")
                    .then(RequiredArgumentBuilder.argument("123", StringArgumentType.string()))
                    .then(RequiredArgumentBuilder.argument("bool", BoolArgumentType.bool())));
        }
    }
#

and when I run tab completion does nothing

#

(should open that link in browser as gifs doesn't get displayed in discord because discord is stupid and checks link endings and not content types)

fierce dew
#

@jaunty pecan sorry for ping, any idea what's wrong?

frank driftBOT
#

Hey MrIvanPlays! Please don't tag staff members.

nocturne elbow
#

In the new API, does the GroupDataRecalculateEvent get thrown when a group is deleted?

remote salmon
#

Hey, I am trying to create a rank expiry command for my players, but I can't find how to get the expiry date in the API. Thanks sincerely parrot

crystal sonnet
#

Try to get the node object the player has (by iterating over them until you find the right one) and then you get the expiry time from that node @remote salmon

remote salmon
#

but how do I get the expiry time from the node

remote salmon
#

lol, I was looking for the javadoc and couldnt find it

#

thank you herold

crystal sonnet
#

As a tip. Make sure to include the source or javadoc jar in your IDE

#

Then you get Javadocs on hover

hushed condor
#

guys has anyone had issues with dynmap v3.0-beta-5-218 with the luckpermsapi cause i am getting NoClassDefFoundError?

#

[Server thread/ERROR]: Error occurred while enabling dynmap v3.0-beta-5-218 (Is it up to date?)
java.lang.NoClassDefFoundError: me/lucko/luckperms/api/LuckPermsApi
at org.dynmap.bukkit.permissions.LuckPermsPermissions.create(LuckPermsPermissions.java:26) ~[?:?]
at org.dynmap.bukkit.DynmapPlugin.onEnable(DynmapPlugin.java:848) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.14.4.jar:git-Paper-233]

turbid solar
#

Did you try adding the legacy api extension?

hushed condor
#

yes that doesn't help

turbid solar
#

Then i don't know, did you tried the Dynmap support? (If they have one)

hushed condor
#

There support form is a weight loss program filled peace of garbage

crystal sonnet
#

@hushed condor how did you install the legacy api extension?

hushed condor
#

as stated above "yes that doesn't help"

turbid solar
#

How did you install

hushed condor
#

what lol download from the spigot page??

crystal sonnet
#

Erm no

hushed condor
#

oh sorry cant read lol

#

this form

crystal sonnet
#

Yup

#

How did you install it?

hushed condor
#

i downloaded the jar and made the folder

#

then restarted after i uploaded

crystal sonnet
#

You put the jar file in that new folder, right?

hushed condor
#

yes

crystal sonnet
#

I’m asking because it appears as the adapter isn’t loading

hushed condor
#

i have used it before for another plugin

#

is there a command to check?

crystal sonnet
#

Not that I’m aware of

hushed condor
crystal sonnet
#

There’s a newer one

turbid solar
#

think you spelled the folder wrong

#

extensions should be it

hushed condor
#

lol

#

i did let me change that

crystal sonnet
#

And weird. The link points to 1.0.0. I’ll check if there’s an update

#

When I’m on my computer

hushed condor
#

feature request add the command to check loaded extensions

turbid solar
hushed condor
#

dnymap works now lol thanks for the help on another plugin i also messaged the owner about the api update

tropic jewel
#

how do you check if a user has a node with the new api?

#

before it was just user.hasPermission(node)

#

are you supposed to use user.getNodes().contains(node)?

crystal sonnet
#

Is that method gone?

tropic jewel
#

yes, LP does no longer have that method

hardy violet
#

Is this not supposed to work?
LuckPerms luckPerms = LuckPermsProvider.get(); Node permission = luckPerms.getNodeBuilderRegistry().forPermission().permission("permissionhere").build(); luckPerms.getUserManager().getUser(player.getUniqueId()).getNodes().add(permission); luckPerms.getUserManager().saveUser(luckPerms.getUserManager().getUser(player.getUniqueId()));

astral willow
#

I am having trouble adding luck perms api to my gradle build
i have

    mavenCentral()
dependencies {
 compile 'net.luckperms.api:5.0'  ```
mossy surge
#

I'm unable to get a luckperms instance:

[22:13:19 ERROR]: Error occurred while enabling MyPlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
#
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
    if (provider != null) {
      luckPerms = provider.getProvider();
    }
#

I also have a softdepend on LuckPerms and I've observed LuckPerms loading before my plugin:

softdepend:
  - LuckPerms
#

And LuckPerms are added to my plugins folder with my plugin:

chrome sage
#

net.luckperms:api:5.0

mossy surge
#

And my pom:

        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.0</version>
            <scope>provided</scope>
        </dependency>
turbid solar
#

Update your luckperms ingame

mossy surge
#

@turbid solar you respond to me or the one before?

turbid solar
#

You

mossy surge
#

What do you mean by updating ingame? I just downloaded a fresh copy of luckperms jar from spigot resource page.

turbid solar
#

Spigot is outdated almost always

mossy surge
#

🙃 thx, I'll check that

nocturne elbow
#

@tropic jewel I don't know if im doing it right but I am using the following:

if (user.data().contains(node, Node::equals) == Tristate.TRUE) {
     user.data().remove(node);
     luckPermAPI.getUserManager().saveUser(user);
}
nocturne elbow
#

for groups do forInheritance().group("group.[group-name]")

#

instead of /forPermission().permissioN()

#

huh actually I think the group builder adds the "group." part for you

#

so just put the name

tropic jewel
#

I ended up just collecting all the groups and checking if the group is in the collection

#

as I couldn't figure out how to check for temporary groups in the new API, it was already a hassle to do it in the previous one

astral willow
#

I am having trouble adding luck perms api to my gradle build
i have

    mavenCentral()
dependencies {
 compile 'net.luckperms.api:5.0' ```
tropic jewel
#

though this doesn't work if the group is inherited from a different one

nocturne elbow
#

how did you check temporary groups in the old one?

#

I never figured it out

#

does your collection method work on temporary groups for the new API?

tropic jewel
nocturne elbow
#

also for anyone wanting to support both:

private IPermission selectLuckVersion(Plugin plugin){
    String versionString = plugin.getDescription().getVersion();
    String[] parts = versionString.split("\\.");
    double totalValue = 0;
    double valueMult = 100;
    for(String part : parts){
        double partValue = 0;
        try {
            partValue = Integer.parseInt(part) * valueMult;
        } catch (Exception e){
            //do nothing
         }
        totalValue += partValue;
        valueMult *= 0.1;
    }

    return totalValue >= 500 ? new Permission_LuckPerm5() : new Permission_LuckPerm4();
}
#

I wrote some logic to get the current version

tropic jewel
#

it does, just not for inherited groups

nocturne elbow
#

ok so for the old API I have to check two nodes.

for the new one should I use this:

#
        return user.data().contains(node, Node::equals) == Tristate.TRUE;
#

or do I need to do something else to get temporary groups as well?

tropic jewel
#

user.data().contains(node) didn't work for me with temporary groups

nocturne elbow
#

huh

#

maybe it has something to do with the node

#

I bet I have to check two different nodes

tropic jewel
#

it also didn't work the old way because it was comparing the expiry time

nocturne elbow
#

but expiry time didnt matter in 4.0?

tropic jewel
#

yes, you only had to set a expiry so it creates a temp node but the time didn't matter

#

what I didn't look into yet is how to collect the parent groups too like if group2 is a parent group of group1

nocturne elbow
#
Node node = luckPermAPI.getNodeBuilderRegistry().forInheritance().group(troop.getGroup().toLowerCase()).build();
        Node tempNode = luckPermAPI.getNodeBuilderRegistry().forInheritance().group(troop.getGroup().toLowerCase()).expiry(10L).build();
        return user.data().contains(node, Node::equals) == Tristate.TRUE || user.data().contains(tempNode, NodeEqualityPredicate.IGNORE_EXPIRY_TIME) == Tristate.TRUE;
#

use user.data().contains(tempNode, NodeEqualityPredicate.IGNORE_EXPIRY_TIME))

tropic jewel
#

ah thanks, I will try that out

#

I assume that ignore expiry time just means it will not compare the time but still respect if the assigned group has expired

sour basalt
#

is there a way i can give a player a permission through another plugin?

tropic jewel
#

@sour basalt use the api or run the command

sour basalt
#

use the api

#

like say i wanted to give a player "luckperms.*" how would i do that through the api

tropic jewel
#

should be explained on the github wiki

sour basalt
#

its not and if it is is there a way for you to show me where (if it is there i cant find it)

tropic jewel
sour basalt
#

i cant find it

nocturne elbow
#

look up in this chat

#

I wrote out the code for removing a node

#

just replace .renove(node) with .add(node)

sour basalt
#

thank you very much

nocturne elbow
#

np

tropic jewel
#

@nocturne elbow just tried the data contains but it doesn't work for inherited parent groups either

nocturne elbow
#

so It wont recognize a group node check if the user has a group that inherits the permission of the target group?

#

will the inherited group show up under the parents list when you do /perms uer [user] info?

#

sorry im not too familiar with how luck perms works

tropic jewel
#

it doesn't show up there but under the group itself /perm group [group] info

nocturne elbow
#

ah. Well I guess for how im using the plugin, I dont want it to check

#

I think your best bet is to check all the groups nodes for children

sour basalt
#

im getting an error 'cannot resolve getNodeBuilderRegistry in LuckPermsApi

nocturne elbow
#

your sure you have a 5.0 jar?

#

the one from spigot is 4.0

sour basalt
#

me?

nocturne elbow
#

yea

#

I cant think of any other reason you would not be able to resolve the method

sour basalt
#

im using intelijso i dont know what version im using

nocturne elbow
#

huh. I am also using InteliJ, but I usually download the jar then add it to my project as a provided dependency.

#

I dont really know the other ways of accessing the classes, but your imports should start with net instead of me

#

if they start with me then your using the old api

sour basalt
#

oh ell there is a plugin you can get on it which add all the dependencies

astral willow
#

I am having trouble adding luck perms api to my gradle build
i have

  mavenCentral()
dependencies {
compile 'net.luckperms.api:5.0'  ```

"3rd time ive tried getting help with this now"
#

Here is my exact gradle build

plugins {
    id 'java'
    id 'com.github.johnrengelman.shadow' version '4.0.4'
}

group 'HyskiesPrison'
version ''

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
    maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/sonatype-nexus-snapshots/' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.11.2-R0.1-SNAPSHOT'
    compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
    implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1'
    compileOnly fileTree(dir: "jars", include: "*.jar")
    compile 'net.luckperms.api:5.0'
} ```
crystal sonnet
#

@astral willow what’s the error?

#

And compileOnly is the better choice

astral willow
#

@crystal sonnet No error just wont compile the api

frank driftBOT
#

Hey Milkmaid! Please don't tag staff members.

crystal sonnet
#

@astral willow it won’t compile the API

#

It will just include it

astral willow
#

well it wont include it

crystal sonnet
#

How can you tell?

astral willow
#

when i try and use the api in my source code its erroring out bc the api is not there but i will try compileOnly

crystal sonnet
#

Is it throwing errors in the IDE or when compiling with gradle?

astral willow
#

compiling

crystal sonnet
#

And what’s the full name/path of a class you’re trying to use?

#

@astral willow

astral willow
#

the name of the class?

#

@crystal sonnet would u like to see the error when i try to build it?

frank driftBOT
#

Hey Milkmaid! Please don't tag staff members.

astral willow
#
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find net.luckperms.api:5.0:.
     Required by:
         project :```
crystal sonnet
#

There you have an error.....

astral willow
#

yes just found it

#

thats the build error

crystal sonnet
#

It’s net.luckperms:api:5.0

astral willow
#

xD thanks

#

* Where:
Build file 'C:\Users\zachx\floobits\share\zachx\HyskiesPrison\build.gradle' line: 22

* What went wrong:
Could not compile build file 'C:\Users\zachx\floobits\share\zachx\HyskiesPrison\build.gradle'.
> startup failed:
  build file 'C:\Users\zachx\floobits\share\zachx\HyskiesPrison\build.gradle': 22: expecting '}', found ':' @ line 22, column 30.
         compileOnly net.luckperms:api:5.0
                                  ^

  1 error
crystal sonnet
#

Put it in ' of course...

astral willow
#

jesus you got me confused

crystal sonnet
#

Or " if you prefer

misty hinge
#

whats the best way to get a users group + the prefix

#

for a AsyncPlayerChatEvent method

dusky wagon
#

how can I get the prefix for the new api?

steel edge
#

Did you get it? I also need to know @dusky wagon

worthy sorrel
#

uhm someone have a current expantion for PlaceholderAPI? seems to be acting funny, I was on 4.4.16 Spigot had 4.4.1 as the latest build
LuckPerms-Bukkit-4.4.1
PlaceholderAPI-2.10.4
expansion 5.0

swift portal
#

What should I do if I receive a node for a user and I want to delete it

crystal sonnet
#

@swift portal there should be a method on the user to remove a node

swift portal
#

user.getNodes().remove(node) ?

crystal sonnet
#

And that error is the server freezing

#

What did I say?

swift portal
#

what should it be ?

crystal sonnet
#

Don’t you have tab complete in your IDE?

swift portal
#

I do, but I already tried those :

                        user.getNodes().remove(n);
                        user.data().remove(n);
                        user.getData(DataType.NORMAL).remove(n);
#

I'm maybe dumb, and that's a thing that we have to consider

crystal sonnet
#

On the user object itself

#

All those methods return copies of the data

swift portal
#

I'm so dumb...

#

Btw it's 1:30am

crystal sonnet
#

So it is here

swift portal
#

But what should I do ?

crystal sonnet
#

user.removeNode?

#

As I’ve mentioned four times now, try finding the remove method on the user object directly

swift portal
crystal sonnet
#

And delete?

swift portal
#

same here

crystal sonnet
#

(Saying that there is no such method would help btw 😉 )

#

Then I don’t know

swift portal
#

No problem, I think I should sleep so maybe someone would know when I'll wake up

swift portal
#

@crystal sonnet do you think you can tag someone to help me ? ^^"

frank driftBOT
#

Hey Bakalexis! Please don't tag staff members.

crystal sonnet
#

@jaunty pecan

brazen spire
#

Is there a way to modify the prefix with the api like "&6VIP" -> "&l&6VIP" (or reverse to "&l&6VIP" -> "&6VIP"? I want to modify the key without touching metadata and context.
With LP4.x I used:

api.buildNode(n.getPermission().replaceAll("&l|&o", "")).copyFrom(n).build();```
But with the recent changes I don't see a good way to do that.
brazen spire
#

can nobody help me?

proud iron
#

Do luckperms contains Player Group Change Event? or Player Permission Change Event

brazen spire
raven mason
#

How can I set a user's primary group

#

are groups case sensitive

crystal sonnet
#

Yes they are

#

But setting the primary is pointless because it is automatically calculated (except under very very rare conditions)

#

I'm gussing you want to either add or set a group

raven mason
#

set

crystal sonnet
#

Remove all other group nodes and give them the new group node

raven mason
#

bruh

#

there's User#setPrimaryGroup

#

but we gotta do the random other stuff

crystal sonnet
#

As I said the primary group is calculated

#

So setting it does nothing

#

Setting the primary group does not equal to giving the player the group

#

It merely selects which group the player has

raven mason
#

is there like a GroupNode class or something

crystal sonnet
#

There's a node builder

#

WHich should offer to build a group node

raven mason
#

this is confusing

crystal sonnet
#

Using the LP API is not easy

#

It assumes you know Java

#

And how to read Javadocs

raven mason
#

where the docs at

crystal sonnet
#

!api

frank driftBOT
raven mason
#

I already read that