#luckperms-api
1 messages · Page 37 of 1
Neato
i would like to give perms to use tnt and lava. how do i do that? i only have essentialsX and Luckperms. i already deleted antibuild
This channel is for support for using the LP developer api. You want #support-1
ah ok tnx
how can I add LuckPerms as a dependency for bungeecord?
The same way you would for bukkit
Only difference is that you would get an instance of LuckPerms through the LuckPermsProvider instead of the service manager
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.2</version>
<scope>provided</scope>
</dependency>
so I have to put that in pom.xml?
Yes
Hey Toby! Please don't tag helpful/staff members directly.
sorry
@rustic laurel 2
How would i go about getting if a user is in a temporary group and if they are in a temporary group removing them from it?
these turds:
user.data().remove(InheritanceNode.builder().group(group).build());
does not remove them for some reason
they have to match:
node key
node value
node expiry
node contexts
but you can specify for it to only take one (or rather say, not all of those) into account
!javadoc look for NodeMap#remove, there should be a method that takes a predicate or something
Learn how to use the LuckPerms API in your project.
last link 👆
How many api's are there for this thing?
it's one single api lol don't know what you're asking really
This is what you're looking for btw https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/node/matcher/NodeMatcher.html#key-java.lang.String-
theres no way for me to remove group by group name?
they have to match:
node key
node value
node expiry
node contexts
but you can specify for it to only take one (or rather say, not all of those) into account
!javadoc look for
NodeMap#remove, there should be a method that takes a predicate or something
This is what you're looking for btw https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/node/matcher/NodeMatcher.html#key-java.lang.String-
so i have user.data().contains(Node.builder("").build(), NodeEqualityPredicate.ONLY_KEY); but i don't know what they key should be..
Well 1. If you want to remove a parent group, use InheritanceNode.builder instead, and 2. in the builder you put in the group name
user.data().remove(InheritanceNode.builder().group(group).build());?
Yeah, although IIRC you can simply .builder(group) too
user.data().remove(InheritanceNode.builder().group(group).build()); doesnt remove temporary groups
-_-
so i have
user.data().contains(Node.builder("").build(), NodeEqualityPredicate.ONLY_KEY);but i don't know what they key should be..
Add the predicate part
I want to remove.. i was testing with contains and forgot to switch it
@NonNull DataMutateResult remove(@NonNull Node node);
remove doesnt take a NodeEqualityPredicate either
NodeMap#clear then I think
Where would i put that..
.data().clear(...), check the javadocs for
NodeMap#clear
That method see the arguments, that one for sure does take a predicate
won't .clear clear all the data for the user?
Not if you use it properly, check its arguments
There are other clear methods, I'm sure
but thats what i want yes?
Yes, you have to give the built node to the NodeMatcher + tell it to compare keys only
Because it can clear several nodes based on context
Iirc PermissionHolder (i.e. User & Group) has a method to retrieve the current context set
Isnt that permissions at that point?
Wont anything with all permissions (*) have the highest rank to that
Huh?
A PermissionHolder is something that can have nodes
i.e. Users and Groups
Both of those can have permissions
ImmutableContextSet contexts = user.queryOptions().contexts();
Or something like that, that's the context you'll pass to the clear method
queryOptions doesnt exist
getQueryOptions?
Whats the predicate version of NodeEqualityPredicate.ONLY_KEY?
See NodeMatcher
so something like this?
user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(group));
so this will only remove the group?
Is group the built InheritanceNode??
is now
user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(InheritanceNode.builder().group(group).build()));
group is just a string
that is passed
Then yeah, it will remove all nodes that are parent groups for that group, regardless of expiry, contexts and value
so do i still need? user.data().remove(InheritanceNode.builder().group(group).build());
...... no
i really hope this works lol
Try and see
it does not
Are you saving the user data?
User user = loadUser(player);
if(user == null){
Bukkit.getLogger().severe("user " + player + " does not exist.");
return;
}
user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(InheritanceNode.builder().group(group).build()));
// user.data().remove(InheritanceNode.builder().group(group).build());
api.getUserManager().saveUser(user);
}```
Thats the entire method
Unless the saving is different than the normal saving method, it should be saving
how would i make groups colored and get their color through the api?
uuuhh.... you mean the prefix? the display name? a meta?
that they have the color of their group
probably either a) color code at the end of the prefix or b) a meta key whose value is the color code
hm
which one is the better way?
intended way
¯_(ツ)_/¯
If I know I'll reuse the color code on its own in other places, I would use meta
also why in #luckperms-api lol
because i want to use it in my plugin lol
and idk how to get meta and the color code of the prefix
so i wanna make sure where to start seatching for that stuff
and what i look for
well getting "the color code of the prefix" doesn't make much sense
hm what if i just use the complete prefix?
prefixes/suffixes can have multiple formatting codes applied to them
hm what if i just use the complete prefix?
that would work, yeah
ok perfect. Do you know how i do get the prefix of a group?
!cookbook see the example commands in here 👇
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
k thanks
What's the method to change the hovertext of the player count?
I doubt that is luckperms api related?
I know that it's not. It was more directed to pisonmaster
Hi !
I would like to create my own command which would take the information given by the command / lp user DjeyMute permission info
Can you help me ? I would especially like to recover the time left in the permission I give to my players
Gonna need a bit more info on that, what specifically do you need help with?
Because if a player makes the command / lp user DjeyMute permission info the result is not very pretty ^^
So I would like to create my own command that retrieves the permission information and the time left to customize ^^
I understand the goal, but I don't understand what specifically you need help with
I am unable to retrieve the permission and time information: /
Because I would like to create a whole explanatory sentence and integrate this information into it
I am unable to retrieve the permission and time information: /
In what way?
In fact I would like my players to make a new order more adapted to that, there is no problem.
But in this sentence I would like for example to say "You have permission" ... "for" time "
Again, I understand the goal. What part of the LP side do you need help with
This is why I would like to know how to retrieve the 2 information (permission + time) to be able to make my order and my personalized sentence and make the order prettier for my players.
Again, I understand the goal. What part of the LP side do you need help with
@wild whale To retrieve the permissions and time information given by the command /lp user DjeyMute permission info
!api
Learn how to use the LuckPerms API in your project.
I have already tried to understand but I am French and I am having a lot of trouble I was counting on you to help me and give me some information ^^
If we already have the info on our wiki, what could be gained by me repeating what it says, besides wasting both of our time
But how do you get your information from "The basics of Node" ?
Because if I understood well its with that that I must recover the information?
You have a tutorial to get the info from "user.getNodes (). Stream ()" ?
Because I really don't understand how to do ...
Check out the JavaDoc to see the methods that Node has (e.g. hasExpiry and getExpiry)
The nodes themselves is just bundled information, it does not print the data for you
That you have to retrieve from them and format them nicely as you please
Hey^^
I'm currently searching for an event which gets called every time a group is added/removed from a player or when his meta data gets changed.
I need this for updating his pre- and suffix whenever it gets changed with LuckPerms.
Which is the most suitable Event for this?
@low rune is there any reason you're not letting LP handle the prefixes?
Maybe I formulated my message wrong :D
That's what I do, but I want to change it in the tablist (re-assign him to a suitable team) so he does not have to rejoin.
I see
I think there's a node change event
Or a permission recalculate event
Check the descriptions and play with them to see which one is right
Yes
Alright. So, when I have a prefix with the weight 100 in a group I'm inheriting and then set another prefix with the same weight on my personal user data. Which one is preferred?
I think that's pretty much random
Hi i got a class not found exception when loading my plugin. Doesn't happen on any other platform my plugin supports. (velocity, bungee, spigot)
This is the code i use for loading it
I mean there is a pattern to it, but it's not documented and can change at any time @low rune
You need to depend on LuckPerms @nocturne elbow
From what I remember it's sorted alphabetically currently
i do?
You do.
i got it in my pk.xml file
So that the LuckPerms plugin loads before your own one
yeah, not luckperms is not on the server
What?
Then you can't use it 
Is LP on the server or not?
so i am checking if luckperms is present and THEN i get the singleton
Well then you are currently doing it wrong
, but as its not present it shouldn't attempt to load it
You need a wrapper class to store the instance in
This isn't LP this is Java itself
And only invoke the wrapper class (which then accesses the API) when the API is present
From what I remember it's sorted alphabetically currently
Alright. I kind of hoped that the one which was set to the user directly would be preferred, but okay. Thank you^^
Just give the user one a higher weight then
Yeah. I'm developing the plugin for a server I work at so I have to speak with the corresponding people but shouldn't be that a big deal.
Help?
Where can I get the right Jar that I need?
Also I got it now this far.
!api See the first link for that (where it says "Adding LuckPerms to your project")
Where can I get the right Jar that I need?
Learn how to use the LuckPerms API in your project.
Hm
you are using maven/gradle to build your plugin right?
send your pom.xml
Please use https://bytebin.lucko.me to send files in the future. I have automatically uploaded undefined for you: https://bytebin.lucko.me/arHR9kwUkO
Well you haven't added the API to it
How do I do that?
!api
Learn how to use the LuckPerms API in your project.
You're welcome
Can anyone help me?
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
I want that my Tablist is Sorted based on the Weight of the Luckperms Group the User has.
What are you having issues with?
Idk how to do it.
What of it?
About all
We're not here to tell you how to do things
😦
GIve it a try and when you can't make any progress ask about a specific problem here
Assuming it's LP related
I mean it is expected you know at least how to make a working plugin tho....
The LP API isn't the best place for starters to learn Java tbh, can be a bit daunting at first
MC isn't a place to start with Java either
How can I get the Prefix of an Group?
!api
Learn how to use the LuckPerms API in your project.
!coobook this might have some examples
Sorry! I do not understand the command !coobook
Type !help for a list of commands.
Sorry! I do not understand the command !apicookbook
Type !help for a list of commands.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
There
Ok.
Thx
How can I get only the ID of the weight of an Group?
What?
(I dont want it so: OptionalInt[20] , I want it so 20)
#getAsInt
Ok.
(I think)
gr.getWeight().getAsInt() ?
Ok ima try.
Well?
Its giving me now this out
Before there was standing that thing with OptionalInt[20]
Cus you havent set a weight
Because I need only want the Number.
Because I wanna do a Tablist Sort System, that the Users are being sorted in the Tablist.
Ok
Hey,
im using the LuckPerms Bungeecord API and im aksing, how get get a duration of a player how long he will has his group
ty
Haha dude
nice
spaces
...
cant you just use placeholderapi?
but if i dont want to use the placeholderapi?
I dont think you can use papi on bungeecord
that's......... the point......... of using the api for this
hhahahhaa i didnt read bungeecord fuck me the cones are talking
So theres the point, im using bungeecord
yeah my point was the cones are talkin man, my bad
well, first you load the user/group instance (see https://luckperms.net/wiki/Developer-API-Usage#obtaining-a-user-instance), then you can getNodes(NodeType) (see https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/model/PermissionHolder.html#getNodes-net.luckperms.api.node.NodeType-), filter those that have an expiry and, well, get the expiry instant
@crimson ferry OptinalInt is a standard Java class and frankly you should know how to handle it
And if not your IDE will show you methods you can call.
Hell google is a thing too
Hey^^
I want to remove all prefix nodes from a user that have a particular weight. Do I really have to loop through every node the user has and check if it with prefix. and has the wanted weight or is there a more idiomatic way?
I already tried the PrefixNode with specifying the prefix value * as I know it from the commands, but that doesn't work either
!bulk
Quickly update a large amount of user and group permissions by using the bulkupdate command.
No need for bulk.. you can removeprefix <weight> lol
What a shame
Yeah but I need to do it with the API
Pointing fingers is fun, huh
lol anyway
Do I really have to loop through every node the user has and check if it with
prefix.and has the wanted weight [...]?
Most definitely not, you can get nodes per certain type (see: https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/model/PermissionHolder.html#getNodes-net.luckperms.api.node.NodeType- and https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/node/NodeType.html). For example, I can
Collection<InheritanceNode> parentGroupNodes = someHolder.getNodes(NodeType.INHERITANCE);
In your case, you would do something similar but with prefix nodes instead of inheritance ones. The resulting collection would have all the holder's own prefix nodes, you would filter out those that do not have the weight you want to remove, and the final collection has the nodes you do want to remove; for each one of those, call NodeMap#remove on the holder's data
Ooooooooor you can call NodeMap#clear(Predicate<Node>) on the holder's data and as predicate, check that the node is a prefix node and that it has the weight you want to remove
Ah, that sounds straightforward. I will go with the second solution. Thank you!
I'd go for the second alternative lol
I would dispatch a command from console lol but ¯_(ツ)_/¯
It’s funny because that still just iterates over all nodes 😜
discord smh
?
it's cut off
Not sure where you see that
Hi I'm trying to understand why I can't get the setPrimaryGroup method to work
Bukkit.broadcastMessage(ChatColor.BLUE + "UUID Match Detected: " + ChatColor.WHITE + player.getDisplayName());
user.setPrimaryGroup("default");
Bukkit.broadcastMessage(ChatColor.RED + "Attempted to set group of " + ChatColor.WHITE
+ player.getDisplayName() + ChatColor.RED + " to " + ChatColor.WHITE + "default");```
@magic bone the setPrimaryGroup method selects which of the groups a player has is to be considered their primary one.
It doesn’t add or remove other groups
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Alright I'll keep digging, thank you!
No need. Just read what I sent you. The cookbook contains examples for many things including how to get the prefix
Oh most certainly then lol.
Is there a User Rank Change Listener ?
Or how can I execute stuff when a User gets their Rank Changed?
NodeAddEvent should do the job, make sure the target is a user and the node is of NodeType.INHERITANCE ig
How can I get the user then there?
Doesn't it have a getTarget method or something?
I mean thaat shouldt affect as long at the spelling is consistently wrong lol
since its just a class name
Yeah but it makes me mad that its spelt wrong
say the player has example_meta how do i get the value of this meta?
question, can i make a pr to the cookbook repo?
hey all, quick question. I'm using this
DataMutateResult result = user.data().add(Node.builder("plugin.groupname").build());
to add people to a group, am I doing it wrong? It works fine in some instances but not others? ie, if group name has 3 at the end, it doesn't work but exact same code without the 3, it works.
DataMutateResult result = user.data().add(Node.builder("plugin.groupname3").build()); (example)
@turbid solar what would you like to add?
@prime siren are those group permissions from another plugin?
I realise where Iw as going wrong, it should be "group.<groupname>" not "<anything>.<groupname>"
apologies, rookie mistake
Btw you should use the inheritance node @prime siren
sorry, what does that mean? XD
Use the class InheritanceNode
Because that is intended to be used to add groups
Then you just do InheritanceNode.builder("<groupname>")
ahh i see, seems alot easier
That's the point
yeah 😄
@turbid solar what would you like to add?
@crystal sonnet bump api to 5.2 and fix the open issue on the repo (small one)
done
Would there be an easier way to remove all nodes from a user?
Easier than what?
than calling 4 methods?
Is there a way to change a user parent (group) using the luckperms api?
Learn how to use the LuckPerms API in your project.
well i didnt get reading the doscs... i see how to add / remove a permission but not a group
the node for group is group.<groupname>
oh thx I didnt know that so if I want to change a player group I need to remove all the grop.node that he has and a the new one right?
but in the InheritanceNodes if i am right i will get also the groups that the parent of the user has
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
but I only want to remove / add him in a new grop
Not if you just get the directly assigned nodes instead of the resolved nodes
is grop.name not directly from the user? (like user#getDistinctNodes())
@crystal sonnet thx for the support I have now got it
Hello how can I put that when they enter my server i put a range by default whit Lukperms??
can help me?
You’re welcome @tight kiln.
And it’s InhertanceNode. Not InheritedNode 😉
Hi i got a question. So i am getting a players prefix: CachedMetaData metaData = this.plugin.luckpermsWrapper.luckperms.getPlayerAdapter(ProxiedPlayer.class).getMetaData(player); 67 String prefix = metaData.getPrefix() == null ? "" : metaData.getPrefix();
But the issue is that it looks at the end like this:
Which is pretty weird
And im also wondering why its sometimes colored differently.
Like the Spieler prefix isn't colored, but the team prefix is

Does anyone have an idea what the issue might be?
!cookbook @nocturne elbow check here for how to properly get the prefix
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
This is the way
That’s the way
Anyways it looks like the prefix gets applied twice
But why or how
Have you tried it without your code?
Chances are another plugin is already adding the prefixes
Give it a try
Hm
You’ll never know
Ok
Am I able to set a players rank via bungee with the api?
Yes of course @stark chasm
If the bungee instance of LP is properly synced to the other servers it will propagate. Though it’s recommended that you trigger a networksync after you’ve done all changes
Is there a way I can go about giving ranks to players who have possible never joined?
I am also using geyser so I wonder if it would be possible to give ranks to people with dashes at the start of their name
Use their uuid
Was gonna type the exact same thing 😂
But with geyser they don't have a mojang-supplied uuid so it's impossible to guess it
then you have to write some custom plugin that can give ranks on first join
Oh okay right
So if I lookup the Xbox account and get the uuid I can then set the group?
https://floodgate-uuid.heathmitchell1.repl.co/ is a website that can give you a Floodgate UUID based off of a username.
Yes, but the problem is that you need an API key for that.
Ah.
i wanna join someones server
not the place to ask
how do i get the value of example_meta?
@boreal cypress You can see this example in here on how to get the prefix https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetPrefixCommand.java, it is the exact same process, although instead of calling CacheMetaData#getPrefix() you want to call CacheMetaData#getMetaValue(String) (see https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/cacheddata/CachedMetaData.html#getMetaValue-java.lang.String-)
is it okay if the value is int?
Well it returns a string so you'll have to Integer.parseInt
ah make sense thx
it doesnt work it just spam a bunch of errors
does this work on forge?
it seems it doesnt like EntityPlayerMP.class
well LP doesn't run natively on forge
it runs on sponge
so it takes a sponge Player
yah but my plugin is pure forge
Alternatively, you could get the user data from the UserManager using the player's UUID instead
how to do that?
!api Check the "API Usage" link, it has a section for retrieving a User instance
Learn how to use the LuckPerms API in your project.
kk thx
I want to integrade LuckPerms into Another Platform, i only need to activate the databaseconnection and the api, no commands
And add a player into the Cache
Can somebody Help me?
I suggest you look into the luckperms code if you really want to.
Ye But i dont know what is important
Everything
I think somebody who knows the Code really Good can Help me.
I only Need the connection and the api
I mean, everything that is inside the common module is important, you can't just skip bits from it
it is the implementation of the api
Ok, i can Try it.....
And you have to make your plugin/mod in your platform to "initialize" the common module. I do suggest you take a look at any of the platform implementations, a simple one, see what LP bungee does to get the common module working
Ok, LuckPerms Bungee is the simplest one?
(tho i wont consider any of luckperm's code simple loll)
Not sure tbh, but you will have to attach your plugin to the platform's permission api
And delegate the things it does to the common package
On this platform arent really permission checks
if there isnt permission check... then why implement luckperms on it tho?
I want to Check groups and More thinks only With the api Directly
What is this "platform"?
CloudNet module
So what you'll have to do is attach to CloudNet's permission system and delegate the checks to LP
Unless I'm getting something wrong, but the platform implementations of LP (bukkit, bungee, sponge, etc) all they do is listen/attach/inject to the platform's permission system and delegate the tasks to the "common package"
Unless maybe what you want is to implement the api in cloudnet, basically "removing" LP but having its api
That..... that is a task
Im not Using CloudNet Perms...
Okay, let's step back all the way
What is it you want to achieve
What is your end goal
To use the LuckPerms API on this level in other Modules
To check Meta, Groups etc on this Level
My Command Manager runs there for Multi Proxy
In a Module
Okay.. if I'm getting this right, you want to include LP into CloudNet but not for permissions checking?
Yes, into a Module for CloudNet, to Use the lp api in other modules
Not for permission checks like on bukkit or bungee
Well the process is pretty much the same except for the "attach to the permission system" part. You'll have to write an implementation that initializes LP and.. a lot of stuff tbh. I still do suggest you check one of the existing platform implementations (like Bungee) and see how it does it. After all LP is too complex to simply "make it work" 😨
Unless I'm getting something wrong and Luck will come to the rescue and correct me 🙏
I Try it. Thank you
Why need I this? https://cdn.blyrex.de/s/sIGVSX
you can just return null
ok
It's from one of many of the libraries/dependencies downloaded at load time
Need I this Service?
Depends, that is if you want several instances in a network to be in sync
hm, how can i download this
I mean the part that contains the dependencies management is inside the common package, you probably need to initialize it somehow... unsure tbh
Luck is the one that could help you the most here ;p
LuckPermsPlugin or LuckPermsBootstrap probably inits it
Mm
This is where I'd pull out find in path
Lol ye
What can I do?
AbstractLuckPermsPlugin does it dependency management on load() method and iirc you implement both AbstractLuckPermsPlugin & LuckPermsBootstrap?
ye
sentence made no sence
wait
huh. Did you know that off the top of your head or did you look it up powercas lol
have it open
He is lying
He has the entirety of LuckPerms memorized
Line by line
Even empty lines
!cookbook You can check some real world api usage examples in the "api-cookbook" repository
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
There isnt something with this
Then what is it exactly you need?
This will probably help you with that https://luckperms.net/wiki/Developer-API-Usage#reading-usergroup-data
Tbh I don't know why you considered jumping straight to implementing LP on a platform before knowing how to operate with its API xD
Because on Bukkit or BungeeCord I could use the integrated Permission Check
Frankly I agree. If you need to ask these kinds of things you really shouldn't be trying to implement LP. It's not easy or trivial
But it works now 😅
Until you run into the next issue
I'd expect a CCE before an NPE in that situation lol
😅 How can I check the highest Permission Group from a player
There is no really example for it afaik
Working very well I see
!queryoptions
Sorry! I do not understand the command !queryoptions
Type !help for a list of commands.
!help
!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!formatting
!helpchat
!inheritance
!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!tracks
!translations
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki
!wiki
Learn how to use LuckPerms and all of its features by reading the wiki on GitHub.
!api
Learn how to use the LuckPerms API in your project.
Sorry! I do not understand the command !queryoptions
Type !help for a list of commands.
read the javadocs
probably explains it, or wait till someone who knows can explain it
how to setup luckperms?
can you like not ask in 5 channels
answered in #support-1
@uncut ice did you read the Javadocs?
Yes
Ok. what are you struggling to understand then? @uncut ice
Ok. what are you struggling to understand then? @uncut ice
@crystal sonnet I found it.
But why returnes the Method false? I have the * perm
Problem solved
My check was ```hasPermission("permission") {
Player#sendMessage("No Perms!");
}
I forgot the !
Big uufff
! where
In front of the hasPermission !hasPermission
So I wanted to return when the player didnt has the perm
And not when the player has the perm
My failure
Btw why are you using the API for permission checks instead of using the platform permission checks?
Because this platform has no integrated permission check
Fair point
Hello, i have a bungeecord server network and players can buy temporary permissions. I used the api and the examples for that. But sometimes the permissions dissapear after some minutes.
And it just affects the temporary permissions.
Well make sure to save the changes and to also trigger a network sync
So but i thought it syncs automatic over the network, bc it works the most time :D
And it just affects the temp nodes
Yes it kinda syncs. But it doesn't inform the other servers
Best to also trigger a network sync
And it is possible, that the permissions is completely gone after some server switches?
Well that's certainly odd
Though hard to say exactly
What version of LP are you using btw
Latest from spigot. I know latest is no answer but im just at the smartphone
How to trigger that network sync? Ill try it with that
!update
You can download LuckPerms for Bukkit/Spigot, BungeeCord, Sponge, Nukkit and Velocity.
Don't know by heart. You need to figure that out
Okay thanks, will try it with that
Is there a way to access the ranks using the LuckPerms api?
Yes
How so?
!api
Learn how to use the LuckPerms API in your project.
I am creating an api to access LuckPerms api so I can change ranks using Discord. This documentation doesn't provide any information that could help with my situation.
Is there a way to access the ranks using the LuckPerms api?
I found it covers everything at least on a basic level
There's also this:
!cook
Sorry! I do not understand the command !cook
Type !help for a list of commands.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Thanks.
You're welcome
giveMeADamnUser is one of the methods. Whoever made this might want to touch back up on it
Very nice.
¯_(ツ)_/¯
what's the problem?
The Problem is, there is no problem
// Remove and add new rank
PFRanks.lpApi.getUserManager().modifyUser(p.getUniqueId(), user -> {
// Add the permission
user.data().add(PermissionNode.builder("group."+rank).withContext(DefaultContextKeys.SERVER_KEY, server).build());
user.data().remove(PermissionNode.builder("group."+lastRank).withContext(DefaultContextKeys.SERVER_KEY, server).build());
});
I haven't used the api b4 does this look right to add and remove a group? This does not seem to work for me.
did you save the user? ( i think you need to do that)
modifyUser saves it for you
^
also, you should use an InheritanceNode.Builder instead of a PermissionNode one
for parent groups that is
ok so that could be why its not removing/adding parents?
Keep in mind that when removing nodes with that method, it has to match all its qualities:
- key
- value (true/false)
- all contexts keys and values
- expiry time
i.e. it has to be the exact same node
Maybe, wouldn't know tbh
but you should use an InheritanceNode for parent groups ;p
its also not adding so I will try the changes and see if they work then check back if it does not! Thanks guys!
https://github.com/LuckPerms/api-cookbook/ has some examples btw
Ill take a look
getPrimaryGroup()
!api
Learn how to use the LuckPerms API in your project.
Because it won't let me import the right things
You need to add the dependency to your project
I can't get the userManager
How can I add the dependency?
I imported the jar into my buildpath
Ohh
Which jar btw?
xD
what do you mean?
I had the normal plugin jar
oki
😦 Cannot make a static reference to the non-static method getUserManager() from the type LuckPerms
Learn how to use the LuckPerms API in your project.
I don't understand it 😦
please read the wiki lol
Well according to the error you clearly not well versed with Java
I am
Clearly not
I started coding with java this february
I'm not an expert
and this is the first time I'm working with the lp api
Okay :/
I don't mean to be mean
But MC modding (includes plugin) is not the place for Java beginners
And the LP API requires a fair bit of additional knowledge
Now to prove me wrong in my assessment that you're not experienced enough with Java to work with the LP API there are two things you need to do:
- Fix that issue by yourself (Google of course being allowed)
- Figuring out how to get a user instance from the API (as that's documented)
I figured it out ^^"
Good job
Btw ^^ I made my first working economy system in february ^^
Following a tutorial?
Not bad
I need help
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
dont double post ty
Where is the permissions page
!permissions
A list of permissions used by LuckPerms commands.
I started with NodeJS a couble years ago. So I already knew the basics ^^
@long aurora this channel is for questions about the API only. Use #support-1 or #support-2 for general LP support questions. And only one
Knowing programming typically helps.
okok
How can I get the primaryRole after the player joined? (I know how to get the role, but I get an error, when the user joins)
(It's a nullPointerException)
!paste
Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
As you can imagine, the error is useless without the associated code
why are you .tostring()ing the UUID
I learned it this way
Thanks xD ❤️
Is there a way to get the DisplayName of the primary Role?
I can't find something at the moment :/
figured it out ^^
heh?
@young sentinel this channel is for support with the LP API. #general would be better suited
hi
i need help
java.lang.IllegalStateException: API is not loaded.
at me.lucko.luckperms.LuckPerms.getApi(LuckPerms.java:54)
Need code
?
Hey zAngel! Please don't tag helpful/staff members directly.
Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
!api
Learn how to use the LuckPerms API in your project.
but what is the error?
i need put the jar in plugins folder?
you need luckperms on the server.. yes
No, you need the luckperms plugin on the server
also make sure your plugins loads after LuckPerms
how?
bungee
add softdepends: [LuckPerms] in your bungee/plugin.yml
the same error
Can you send your full code?
That usually happens when you shade the api into your plugin (when you compile the lp api jar into your plugin)
@inland yacht make sure you are not doing that
You can quickly check that by opening your plugin with 7zip or winrar
Why
If you are currently, actively writing the plugin, you should use the API for the latest version (v5.2) instead of a deprecated, unsupported legacy API
?
yes 2 years
Man those years were wasted if you don't even know that you can hover over red squiggly lines in IDEs to have them show you an error message as to what's wrong
Yes, I knew it ._.
Apparently not
but I want to know what I have to put there because according to the guide that error should not appear
Could you ... like ... idk ... hover over the error and screenshot the message?
Like that might help us identify what's wrong here
Looks like the example is outdated
But frankly you shouldn't need that method anyways
Just use permission checks of the platform
it does not work for me since I need to see if a user has a permission even though they are not connected
Well
Then find out what argument the function is expecting
And I might be able to help
@inland yacht make sure you are depending on api version 5.2
works if my server has plugin version 5.0 or i need update?
You should use the latest version
Just the jar
You are not depending (or softdepending) on LP in the plugin.yml
You were told how to fix that before
Make it softdepend
Not softdepends
I always forget which one of the two Bukkit uses but the one it does not, Bungee does
md5 smh
try moving LuckPermsProvider.get(); in the onEnable()
Is that saying unknown source for the constructor?
I am still kind of a beginner at java but I know that that could mean that the class isn’t defined
Idk tho
@inland yacht send error & code again
You're kidding, right?
you didn't do what I asked
You were told to to move the LuckPermsProvider.get(); to the onEnable(). But you didn't do it
Don't see anything LP related there
Keep in mind that UserManager#getUser may return null if the user is offline
It does in most cases
load the user first ^
i can't check a permission if the player is not online with the api?
Sort of, since there will be no active user contexts to apply
But you absolutely can if you load the user
Instead of getUser(uuid) you just use loadUser(uuid).get(). But make sure to be async, else it'll cause lag
ok ty
Dont use get(), use thenAccept() with the consumer
Either are fine
Really depends on your code
And since they want to get a return value and don’t want to modify data getting the object is the right move here
can someone help me ive got a problem. I just downloaded luck perms for my server but whenever i do /lp editor i get the following message in the website :There was an error loading the data. Either the URL was copied wrong or the session has expired.
Please generate another editor session with /lp editor. However i dont even copy the link i just click it so no way the url is wrong
update also #support-1 or #support-2
sighs... those double, triple posters again
yeh i wasnt aware we not allowed chill please
Hey N1kky333! Please don't tag helpful/staff members directly.
You’re not allowed to do that anywhere. If not explicitly forbidden it’s heavily frowned upon everywhere. Basic internet etiquette
smh why is it such a serious issue 🤣
It wastes people’s time
says the one that ask someone to run powershell wininit
what does that have to do with posting in multiple channels lol
Not sure about you Timmeh but I just love taking the time to type out a comprehensive response to someone’s question just to be told that it was taken care of already
No, what Ben said
means you dont take things seriously, nor consider consequence of your actions. 🙂
I could’ve spent the time doing other more useful things. Like watching paint dry
It was off-topic. I can't remember when it ever mattered there
Hey Tim__! Please don't tag helpful/staff members directly.
Was having a simple joke
yep i was just joking too 🙂
Get a room you two
Excuse me?
changing the lp version wouldnt fix that problem would it
running powershell wininit would though
Hello.
I try to get the prefix from the users when they log in, but I don’t understand how to do it.
I use LuckPerms in Bungeecord, and I try to get this prefix in spigot.
Can someone help me?
You need luckperms on spigot aswell to get it there
So, I need to put the spigot plugin and it will be good ?
To sync data between servers, you need to connect each LuckPerms plugin to the same database (for example MySQL) and set up a messaging service.
I managed to get the group back, but it sends me the name of the group. How can I get the name with the colors?
How can I init. the BungeeAPI of LuckPerms ?
if (provider != null) {
LuckPerms api = provider.getProvider();
}```
The most of this classes aren't in the bungeeCordAPI
you can use the singleton
LuckPermsProvider.get ?
ye
!api
Learn how to use the LuckPerms API in your project.
Sorry! I do not understand the command !cookbookk
Type !help for a list of commands.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
user.data().remove(node);
Is this the correct way to remove all prefixes with the priority 101?
No. Use the clear method
You can pass a filter to the clear method
hover over it
Will loadUser(UUID) throw an error if you try to load someone whilst their online?
I think .get may throw some interruption exceptions or something
I'm amazed at how you still don't know how to properly show errors, nor know how to fix them yourself. Typically just takes googling
Which.. tbf rarely happens lol
Yeah a try catch to throw a runtimeexcption will certainly do
catch Throwable :^)
No. I mean you catch whatever it is and rethrow it wrapped in a RuntimeException
aaa yea
Because that's an unchecked exception and those don't need to be handled
@inland yacht
ok
i solved
i have this error on load
That sounds like something for general 1?
!api
Learn how to use the LuckPerms API in your project.
!cookbook this might have some examples
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
@pine mantle the consumer could be a lambda or a function capture
Java 101
(Especially considering this has been in Java for actual ages)
I haven't found the entry about refreshing the prefixes in the wiki, could you help me please?
!api check the meta section
Learn how to use the LuckPerms API in your project.
Well there’s no explicit method
But with a tiny bit of programming knowledge that should be trivial to piece together
How?
I’m not here to spoonfeed you
@Override
public void addPermission(UUID uuid, String permission, boolean value) {
Node node = Node.builder(permission).value(value).build();
luckPerms.getUserManager().modifyUser(uuid, (User user) -> {
user.data().add(node);
});
}
this should work.. right?
Oh look! Someone just volunteered to be the server’s coding slave. Awesome ^^
cas you'll end up wasting many years
YAY CAS
that was actually a question
So I have to use modifyUser?
I'm confused, my code only works 30% of the time
User user = luckAPI.getUserManager().getUser(player.getUniqueId());
Node node = PrefixNode.builder(oldPrefix, 101).build();
user.data().add(node);
luckAPI.getUserManager().saveUser(user);``` That's how I've done it
But it doesn't update the prefix instandly. I always have to rejoin
I use this Tab plugin
@turbid solar well is it on a bungee network?
Hey BrainStone! Please don't tag helpful/staff members directly.
yes, but I'm checking & adding if they have the permission on the spigot server
Don't forget to network sync
powercas_gamer is this tab plugin coded by you
@prime glacier make sure to network sync
Ahh, you think this is the problem?
Yes
What's the method to sync?
It's documented
Where?
!api
Learn how to use the LuckPerms API in your project.
I think I'm going insane, can't figure out why it's not working 35% & I'm sending the update
async problems?
?
Are you adding multiple permissions at once?
no
Utilities.log("getting prefix");
sender.sendMessage(Utilities.getInstance().getPermissionHandler().getPrefix(uuid));
Utilities.log("adding permission 'testing' to " + uuid);
Utilities.getInstance().getPermissionHandler().addPermission(uuid, "testing", true);
Utilities.log("getting primary rank");
sender.sendMessage(Utilities.getInstance().getPermissionHandler().getRank(uuid));
Utilities.log("getting suffix");
sender.sendMessage(Utilities.getInstance().getPermissionHandler().getSuffix(uuid));
Utilities.log("checking if " + uuid + " has the permission 'testing'");
sender.sendMessage(Utilities.getInstance().getPermissionHandler().hasPermission(uuid, "testing") ? "yes" : "no");
executing that for testing
@Override
public void addPermission(UUID uuid, String permission, boolean value) {
Node node = Node.builder(permission).value(value).build();
luckPerms.getUserManager().modifyUser(uuid, (User user) -> {
user.data().add(node);
luckPerms.getMessagingService().get().pushUpdate();
});
luckPerms.getMessagingService().get().pushUpdate();
}
``` this adds the permission
Is it getMessagingService#get#pushUpdate ?
https://paste.deltapvp.net/epozulawuh.sql some logs btw (of me doing the commands)
Well that second pushUpdate is a bit redundant
But it should be pushed after it's saved, not even inside the modifyUser consumer
lemme
sec
That still doesn't explain why it only works like 40% of the time doesnt it?
Maybe
userManager.modifyUser(uuid, user -> {
// do stuff
}).thenRun(() -> messagingService.ifPresent(MessagingService::pushUpdate));
Test that thoroughly, should do the job ig 🤷
If it doesn't, we'll have Brainstone in here in a matter of minutes lmao
I'll test tomorrow
In bed smh
🔫🤠
How fast after running this are you checking the permissions?
Does that look correct?
(implying that messagingService is the optional the API returns)
Yes it does. At least I believe
couple seconds after, but if I wait a few minutes it still isn't there (did with fefo said)
?
yes
ok



