#luckperms-api
1 messages · Page 34 of 1
although modifyUser is advised
Permission nodes is a type of node
Inheritance nodes is another type of node
Everything is a node at the end of the day, different types, but all nodes
Node is just another term for permission
eeh....
Oh in that sense
I mean feel free to correct me, but I don't see a difference between PermissionNode and Node (other than the name)
Or maybe I'm just missing something...
InheritanceNode#builder
yeah apparently i don't have jdk 8 lol
yeah might be me being dumb
"References to interface static methods are allowed only at source level 1.8 or above"
Show me the code please lol
I'm just doing InheritanceNode.builder()
I mean feel free to correct me, but I don't see a difference between PermissionNode and Node (other than the name)
Or maybe I'm just missing something...
Maybe a PermissionNode doesn't, but a RegexPermissionNode or a WeightNode do
Besides, it's senseless for you to change the "value" (true/false) of a weight node or a meta node just because they are nodes
It does make sense if they are permission nodes or regex permission nodes
I'm just doing InheritanceNode.builder()
screenshot pleaaaase
Or check for wildcards in non-permission nodes
I got it fixed, just had my eclipse project properties wrong lol
oh okay
Ah, got you there, thanks Fefo
They would be "specifications" with their own parsing and setting and stuff
Besides, it's senseless for you to change the "value" (true/false) of a weight node or a meta node just because they are nodes
And that's something I don't like from the editor (in which I made an issue here https://github.com/lucko/LuckPermsWeb/issues/307)
@proud crypt for when 👀
Generally I meant that you can just aswell do permission set group.groupname true etc. as it's also just a permission
Yeah I get that, it's more of a node set rather lol but the string you put in there is the one that will go to the holder, regardless of the actual type
Are we at the level of "is a node a permission?" or "is a permission a node?" xd
UserManager um = LuckPermsProvider.get().getUserManager();
User user = um.getUser(loopPlayer.getUniqueId());
user.data().add(InheritanceNode.builder("group1").build());
But yeah as a permission is something true/false, and a node is just... a string then I guess?
Even in the suggestion it shows <node> rather than <permission> lol
Looks correct (even tough #getUser may cause issues if the user is not loaded)
And don't forget to save!
This feels right
remember to saveUser
yeah, that brings me onto the modifyUser, which does it for you, right?
How would I integrate this with modifyUser?
Exactly
yeah, that brings me onto the modifyUser, which does it for you, right?
it loads it from storage if not loaded and saves it, all for you
Tobi will explain :)
I've looked for it, I can't find anything on modifyUser except for the commit on github :S
oops, consumer I mean
Consumer means a lambda
Ok, I'm too bad at Java, it doesn't mean that directly, but a lambda works there.
Consumer, Function, Supplier, Callback
All fancy words for "a method in an object"
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/AddPermissionCommand.java#L48 take a look at the example again, the (User user) -> { /* Code here */ } part
I did just spoon here
I learned a valuable lesson
I've been programming for about 4 or 5 years and I've never been exposed to lambda before
I hope not from me, whatever you learned from me: forget it
xDD
Really fun: JavaScript callbacks
lambdas are just "inline" "anonymous" methods
You don't make a special method for it in your class
yeah i looked it up, can't believe I've never seen it before
So they don't have a name per se
How do I make it so people can warp everywhere but certain warps
With the developer api?
Use more refined permissions?
It’s essentials
Why are you asking in this channel?
Where should I ask for plug in support
At the plugin's support channels
!moss has beloved Jason who can help you
Make sure you are using EssentialsX and Vault for prefixes. For any other issues with Essentials, you should seek support in either #general or the official EssentialsX support Discord.
I've added a suffix with a priority of 50
Can I remove said suffix only using the priority?
Can I just use
user.data().remove(SuffixNode.builder(null, 50).build());
?
No you can’t. However there is a node matcher
How does one add context (in my case I want to only add the permission for 30 minutes) to a permission node?
String permission = "cmi.command.fly";
Node node = Node.builder(permission).build();
this.luckPerms.getGroupManager().modifyGroup("default", (Group group) -> {
group.data().add(node);
});
Doesn't the node builder take context?
And contexts isn't what you're looking for Node.builder(permission).expiry(long, TimeUnit).build();?
@hard oar 👀
Hi
@nocturne elbow 👀
🤔
3qm
3am
Sleep
Mayb
[00:27:43 ERROR]: [BurstTags] BurstTags v1.0 attempted to register an invalid EventHandler method signature "public void com.morais.tags.handler.TagsHandler.onRankUpdate(net.luckperms.api.event.user.track.UserTrackEvent)" in class com.morais.tags.handler.TagsHandler```
I'm getting this error for no reason
public class TagsHandler implements Listener {
public TagsHandler(BurstTags plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
//update method, to big to post
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
update(event.getPlayer(), "a ", " b");
}
@EventHandler
public void onRankUpdate(UserTrackEvent event) {
Player player = Bukkit.getPlayer(event.getUser().getUsername());
if (player != null)
update(player, event.getGroupTo().get() + " ", " " + event.getGroupFrom().get());
}
}```
LP events are not handled through the bukkit event bus
LP has it's own event bus
Learn how to use the LuckPerms API in your project.
thanks
or in the cookbook, pinned
It was fast
The very last section
thank you
@nocturne elbow @wild whale You guys deserve the tag
Hey Arroz! Please don't tag helpful/staff members directly.
What's the event to check if a player changes rank?
I tried
UserPromoteEvent
and
UserTrackEvent
NodeAddEvent
Is what you're looking after
the key
is the player
uhm what? no?
Then how can I check
what was the player who changed the rank
"rank"
First you'll want to check if the event was applied on a user
Then you get the node, and check if the node type is NodeType.INHERITANCE (means that they got a group node added)
getTarget?
for what..
I want to get
the player name
First you'll want to check if the event was applied on a user
Then you get the node, and check if the node type is NodeType.INHERITANCE (means that they got a group node added)
And then you can get the target, yes
Uhm I'll give it a try
You're fast
lol
uh
event.getTarget().getIdentifier().getName()
This will return
the player name?
Javadocs are pinned.
PermissionHolder.Identifier#getName returns a UUID for Users, not their name
event.getTarget().getFriendlyName() ?
Gets a friendly name for this holder, to be displayed in command output, etc.
read the long description
Does anyone know how to make people appear on the server with a specific rank?
nono
..................
ok
Are the groups from luckpermsapi.getCachedGroups() sorted in any particular order?
So when I loop through them and checking if a player has the group permission that it gets the main group perhaps?
what?
Is the list of groups that you get from that method sorted in any particular order? By weight or smth?
Or is it random for example: default, admin, builder, donater
Where did you get this getCachedGroups method?
I can't seem to find it neither in LuckPerms nor GroupManager
luckPerms.getGroupManager().getLoadedGroups()
Sorry, I thought I memorized it correctly, was too lazy to open up my IDE
I don't think it's sorted in any order in particular, but you shouldn't rely on that one specifically for that. What is it exactly you're trying to do?
Get the players group. In the new api there is no method for that. The recommended way is to use smth like this:
for (String group : possibleGroups) {
if (player.hasPermission("group." + group)) {
return group;
}
}
return null;
}```
But for admins with all perms they would be in all groups.
Or operators
That's... a way I really don't suggest using lol because the possibleGroups has to be sorted how you want it to already
And yes there is a way to get the groups a holder inherits sorted by weights
I know
PermissionHolder#getInheritedGroups(QueryOptions) is what you're looking after
That will then get me a sorted list of inherited groups by weight?
Or do the queryoptions decide that which is my second question. What do the queryoptions do? I have never understood that
That will then get me a sorted list of inherited groups by weight?
Ai thanks, I'm bad at reading 😄
And they QueryOptions basically dictate what things will and will not be taken into consideration when resolving a... well... query
For example, does it take contexts into account, server context, world context, does it resolve the inheritance, etc
And non_contextual will not take into account any contexts? How would that work then?
Just ignore worlds, servers and such?
Ai okay, good that I only have global stuff and a tiny server
Thanks for your assistance!
@ripe token What's wrong with the getPrimaryGroup call?
is there some methode to get the group were Player is in?
Yes, User#getPrimaryGroup()
Oh, ok I will try it when I am at home.. Because the other option with the permissions es bad I think
Is there also an option to get the configured Prefix from the Config?
I am new on LuckPerms and my time is about 2houers on a day, so I prefer ite to ask before search…
what do you mean from the config?
But for admins with all perms they would be in all groups.
@ripe token
why would you give the admins all perms?
Because people tend to give * which I highly discourage
¯_(ツ)_/¯
Same
cuz only 2 ppl have that
why only console?
avoid some future problems
lik
Hello, im trying to give a user a permission with context. It should read the servers and worlds for the permssion and add it to the node. The Permission node gets addet as it should, but without any context for server or wold. What am i doing wrong?
public void addPermission(Player player, String nodeString, long duration, String[] servers, String[] worlds){
PermissionNode node = PermissionNode.builder(nodeString)
.value(true)
.expiry(duration, TimeUnit.HOURS)
.build();
for(String s: servers)
node.toBuilder().withContext(DefaultContextKeys.SERVER_KEY,s).build();
for(String w: worlds)
node.toBuilder().withContext(DefaultContextKeys.WORLD_KEY,w).build();
User user = loadUser(player);
DataMutateResult result = user.data().add(node);
api.getUserManager().saveUser(user);
}
When you re-call .build(), you're not re-building the current Node, you're "creating" a new one
I suggest you build the node at the very end and work with the same builder you create at the beginning till you actually build it
@tender tree
I also suggest you put all of that inside UserManager#modifyUser, it will load and save the user for you and it will also run the action you want to do asynchronously
Thank you very much. Now it works more. But still not as intended. It only adds worlds. It doesnt add any Servers. And the servers array is not empty. Also it somehow doesn't find the modifyUser method in the last row
This will load the user, run the code you put in there and save it
userManager.modifyUser(uuid, user -> {
// Build node blah blah
// user.data() blah blah
});
@nocturne elbow Ah yes. Because searching is inconvenient to you, you inconvenience others. How considerate of you
@tender tree you can’t have multiple worlds or servers in one node
savage
It’s gotta be said
Ok now i got everything to work i guess. The problem was that i used api version 5.0 for gradle, cuz thats the version displayed at https://luckperms.net/wiki/Developer-API#gradle . In this Version modifyUser is not implemented yet. I now figured out that there is 5.1 Also i testet my Plugin on a Bukkit only Server. Thats why the Server Context didnt work. Thank you for helping
If the server context works or not has nothing to do with what kind of server you’re running. It only depends on the server name you’ve defined in the LP config @tender tree
And I’ll reiterate but you can’t have multiple of the same context (key) per node.
So setting two world contexts overrides the first.
Well i tried it with "global" which was defined in the config but it didnt work unless i made a 2 server bungee network
Now that i have 2 sub servers i can add both to the context and multiple worlds
Then you did something wrong. How many servers you have has no effect on if something is working or not
Now that i have 2 sub servers i can add both to the context and multiple worlds
@tender tree for the third time. No you cannot. At least not in a single node
Each key can only have one value
uhm idk bout the api, but you can add several contexts of the same key to a node, both the editor and commands let you
I end up with this
By executing this (which is what i want)
public void addPermission(Player player, String nodeString, long duration, String[] servers, String[] worlds){
api.getUserManager().modifyUser(player.getUniqueId(), user -> {
PermissionNode.Builder builder = PermissionNode.builder(nodeString);
builder.value(true).expiry(duration, TimeUnit.HOURS);
for(String s: servers)
builder.withContext(DefaultContextKeys.SERVER_KEY, s);
for(String w: worlds)
builder.withContext(DefaultContextKeys.WORLD_KEY, w);
PermissionNode node = builder.build();
user.data().add(node);
});
}
But it didnt add any server to the context (even if i tried to add only one server to the context and nothing else) until i set up a bungee network with two subservers
Damn. Did I really miss that change?
Multiple values for context keys must’ve come somewhere between 5.0 and 5.1
Because I know for a fact that at least in the early 5.0 versions that wasn’t possible
lol sure
And why does luckyperms not work??
bcu you dk how to use it ofc
LuckPerms provides a verbose command to help you find out what permissions a command/plugin is checking.
I did this command
and in any case, plaeas move to #support-1 or #support-2
Can you help me???
Lol
I stg the ppl at luckperms are the most clueless of them all
The users
Poor helpers
Wot
Nothing personal
loll
says larry... the one that trolled at Multiverse discord
part of the troll was to go in the wrong channel :) but yea sure
@remote sky since I lost brain cells and it was in #luckperms-api that’s a warning from me.
I’m being serious
:(
Especially because it was in this channel
I wanna add a permission node to a player with context how do I do that?
I am pretty confused looking at the wiki

Like this?
lgtm
Learn how to use the LuckPerms API in your project.
Ok fixed that
If this doesn't relate to the developer API #support-1 or #support-2 is where you should go :d
oh ok
hello o/ small question, i am trying to use the API to bulk add a bunch of permissions (somewhat like a feature to automatically add player-only commands for my plugin). i saw the wiki to use data() and add the permission node, but that takes only 1 node as a parameter. is there no better way like a bulk-add, or will i have to invoke the same method on all nodes?
if it's the latter, i assume #data() is immutable (like all other components) so i can re-use it, correct?
Well just call add multiple times
And I believe there's also addAll which lets you add a collection
And the object data returns is mutable (else you couldn't add stuff to it, duh)
add appears to be the only method, there isn't addAll
And the object data returns is mutable (else you couldn't add stuff to it, duh)
oh well i thought it runs on side-effects, like it just queues LuckPerms and doesn't change by itself
Even if that was the case you could still reuse the base object
Unless there would be some very weird stuff
hey sorry to bother all but I rework a late pluning but he use import me.lucko.luckperms.api.caching.MetaData; but I not find it or find the rework like ```import me.lucko.luckperms.api.User; to ->import net.luckperms.api.model.user.User;
what?
Mm I explain badly --'
import me.lucko.luckperms.api.caching.MetaData;
this import not work
Yeah that's old api, v4
yess
You want to know which one is it in v5.1, right?
I think what you're looking for is net.luckperms.api.cacheddata.CachedMetaData
okay thanks I will try it ^^
can we get the group options/meta via sponge permission api?
!api
Learn how to use the LuckPerms API in your project.
@nocturne elbow you need to save the changes
how?
!aoi
Sorry! I do not understand the command !aoi
Type !help for a list of commands.
!api
Learn how to use the LuckPerms API in your project.
How to change(remove and add) user's parent group via LuckPerms api?
load the user, grab the group object, and add it to a user
How to add Group to User? (API 5.1)
Learn how to use the LuckPerms API in your project.
Thank you! it worked😊
You’re welcome
whats the difference between MetaNode#getMetaKey() and Node#getKey()?
is the meta key always the same as the normal node key?
Nope, the node key is the entire string of the node and its value is the true/false state
Whereas the meta node is like this meta.<key>.<value>, the meta key is the piece in the middle (which is NOT the node key)
the node key is the whole thing then?
Yeah
No idea lol
im trying to save a multiplier
is this channel for assistance
with the developer api yes
where would i got for assistance with the lp editor
alright thank you
UserManager::saveUser does not send user ping to another server. So, How to send user ping when update user data via api?
Hello, can I ask how I can remove group of user with server context? Here is how I have tried to do that, but it removes only groups without any context.
current_node.getContexts() is redundant, just forgot to remove it
What do you think group.getNodes() returns?
i thought it returns some permission node representations that can be used in data.remove() but it looks like I was wrong
hey team we are having an issues with luckperms, where each time we do a reload of luckperms this error pops up
would anyone know what might be the issue?
im happy to send over the config file, if needed as well
Reloading the config isn't recommended. Just restart the server
Also wrong channel
oh sorrry!
?whois @split pilot
Me
You
how do you get access to the console?
How do you delete a suffix?
i tried looking in the history but i couldn't find it
all of it doesn't work
with luckpermsAPI?? @true condor
LuckyPerms has a api?
lol read the channel info
are you using it?
yes
if are you are using it.... then you should know what it is used for lol
i didnt read it all i did was download it
k means you hvae no clue whats an api and thus not using it
simple, you code plugins?
no
then you are no using luckperm api lol
in that case, ask in #support-1 or #support-2
can i do
{
"bat.kick.global":true,
"bat.ban.global":true,
"bungeechat.mute":true,
"bungeechat.unmute":true,
"bungeechat.spy":true,
"bungeechat.alert":true,
"bungeecord.command.list":true,
"bungeecord.command.server":true,
"bungeechat.helpop.recieve":true,
"Phoenix.Notification":true,
"prison/essentials.tp":true,
"prison/auction.admin.expire":true,
"prison/areashop.teleportall":true,
"prison/areashop.unrent":true,
"prefix.0.\u00264[Admin]":true,
"suffix.0.\u00264":true
}
or?
........
false
where is that screenshot from?
screenshot?
sry, the json/ list of perms*
huh
how do i put in {
"bat.kick.global":true,
"bat.ban.global":true,
"bungeechat.mute":true,
"bungeechat.unmute":true,
"bungeechat.spy":true,
"bungeechat.alert":true,
"bungeecord.command.list":true,
"bungeecord.command.server":true,
"bungeechat.helpop.recieve":true,
"Phoenix.Notification":true,
"prison/essentials.tp":true,
"prison/auction.admin.expire":true,
"prison/areashop.teleportall":true,
"prison/areashop.unrent":true,
"prefix.0.\u00264[Admin]":true,
"suffix.0.\u00264":true
}
where are you gettin this list from ^
2016
lol
yup
okay how do i delete a suffix in the editor?
or how do you remove a suffix from a player?
for editor its a perm node suffix<weight>.<suffix>
and for the record, you are not using luckpermsAPI lol
what is the weight?
move this to #support-1 or #support-2
@true condor the API is for integrating plugins with LuckPerms. It’s for programming.
If you don’t know what it is, then it’s not for you.
If you have questions about using LuckPerms, then ask in #support-1 or #support-2
how can I query the group of the player with the LuckPerms api
The User class has many methods you can use
if (permissionEntity.isInGroup("Admin")) {
Considering a player can have multiple groups you'll need to elaborate what you want
Get the groups list and check if the target group is in there
!api
Learn how to use the LuckPerms API in your project.
The Javadocs are linked pretty far up in the first link
i have 2 Questions
- is there a way to link roles to discord
- And does any one know a good forms for minecraft servers
Hi there,
I read api for how to get a user
User user = luckPerms.getUserManager().loadUser(who);
but what is luckPerms.? I can't find how to get this in the api guide,
(Sorry I'm not good at java, i'm learning)
!api it should be right at the top of the Developer Usage page
Learn how to use the LuckPerms API in your project.
Actually no, it's on the normal API page then
I don’t think you should be working with MC plugins when you’re just learning Java
Hello, the NodeAddEvent dont got called on the spigot, if the node was added on bungee
The Proxy and the Spigot are synced by sql
Which Event can i use?
Or can i toggle it, that the event got called
@crystal sonnet
Hey Blyrex! Please don't tag helpful/staff members directly.
There might be a sync event
What is the name of the event?
Nothing works.....
It works, when im using the /lp command
But it dont works with /lpb
Have you set up a messaging service?
SQL?
Like when you run a lpb command does a message pop up in the spigot console?
set the messaging service to sql in all LP configs
Did you restart the servers?
Me neither
Did none of the sync events work?
And well looking at your code
That the network ones couldn't have worked
Because sync events aren NoteMutate events
Yes, i have tried the MutateEvent
Yes, removed this early
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/event/log/LogReceiveEvent.html
This is the event you want to listen to
"Called when a log entry is received via the MessagingService"
Log entry is the wrong thing @nocturne elbow
"Called when a log entry is received via the MessagingService"
What is that for then?
Log entries
Am I doing something wrong?
https://gist.github.com/02Miki/5c45df86237182ac91b37f8f6ab2368c
After reboot those nodes just get removed
return RanksManager.instance.getLP().getGroupManager().getGroup("default");
}```
this is the other method
!api
Learn how to use the LuckPerms API in your project.
Hi there,
I'm working on a simple plugin which I've nearly finished, however I'm wanting to add/remove permission nodes from the users after running certain commands.
I've practically copied the code which is listed on the wiki however I've into an issue when attempting to load the user. when using getUserManager() it's giving me a nullpointerexception and I am unable to figure out why that is, I'm running a local test server in which I am the only user (this I don't see why that would stop it from working).
I am wondering whether this is an obvious mistake on my part or it is something else.
A few things to check:
- Make sure you have LuckPerms installed
- Make sure you (soft)depend on LuckPerms in your plugin.yml
- Make sure you don't have the API shaded in your jar (meaning make sure the API classes are not in your jar)
- Make sure you don't try to get the API instance before your onEnable
@plucky aurora
- Yes LP is installed
- Yes I've added it as a depend in the plugin.yml
- The LuckPerms.jar is added in the build path, no classes are copied into my plugin
- I've added the luckperms setup in the onEnable method
Well you're supposed to use the API jar, not the LP jar
And then just to be sure you need to figure out what exactly throws the NPE or in other words figure out what is null
Okey I'll download the api jar, that could cause the issue.
UserManager userManager = lp.getUserManager(); This line causes the exception.
I'll send the github link
https://github.com/ELgamerETS2/EarthServer/tree/master/src
The error occurs in https://github.com/ELgamerETS2/EarthServer/blob/master/src/me/elgamer/earthserver/utils/Permissions.java Although Main.java may be the reason it doesn't work.
Good. That means lp is null
Ok. Where do you set lp in the Main class?
(I have it open btw and see the issue. Trying to guide you there)
lp is set in the Permissions class LuckPerms lp = Main.getLuckPerms();
is that the same lp?
yes
It's in the line before the on that causes the exception
What?
LuckPerms lp = Main.getLuckPerms();
UserManager userManager = lp.getUserManager();```
How should I be setting it up in the Main then?
You haven't answered my question yet
Are you sure
I mean you're declaring a new one there
I don't get your question
I asked if the LuckPerms lp = ... is the same lp as the one declared in the Main class as public static LuckPerms lp = ... on line 29
Well it should be
Why does that sound like an insult lol
It's not. That's an honest question
ik lol
My only previous experience with Python and Java is from 1 uni module.
Ok. Then welcome to scopes
Redeclaring a variable in a scope shadows the old one
So if you declare a variable and it lets you, while another exists with the same name, you just (locally) overrode that name
Let me give you an example
Build and Run your code instantly. Online-Ide is a quick and easy tool that helps you to build, compile, test your programs online.
Without running, can you predict what the code will output?
oh yes, I didn't notice that func2() was different from 1
Ok. So what will the output be?
1 1 3 then
Correct
Now why doesn't func1 change the value of num?
I mean I'm clearly setting it to 2 there, right?
It's creating a new num for that method
Correct
So now compare that to your setUpLuckPerms
Do you see anything wrong there?
ah yes
Awesome 🙂
stupid me 😄
No problem
I has referring to a near identical method called setupPermissions()
and stupidly forgot to change it
Thanks for the help
You're doing it correctly there
Now I'll see if it works
yes that's good enough
since I haven't been able to test any of the other stuff yet
Okey surprisingly everything after that worked
Good
What chat plugin should i use?
!chat
LuckPerms is only able to send information to formatting plugins so that they display them properly. LuckPerms does not put the prefix in front of your name, you need a chat formatting plugin to do it, and you need Vault. Same goes for the tablist! If the information appears correctly when you run /lp user <user> info, LuckPerms is doing its job!
also note, wrong channel, use #support-1 or #support-2
Hi, if i set permisions in the web editor, and then apply in minecraft, they doesn't work... how do i fix this
??
could someone help?
you're not asking in the right place. hint: read the channel topic
thank you
Is there a way to set a prefix to a specific server using the PrefixNode builder?
Thanks!
Np
If the user is offline, you need to load the user from storage
@ornate owl
This is also a real example of putting that into actual usage https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetOfflinePrefixCommand.java
which event let's me listen if a user has a group added/removed, I am guessing NodeAddEvent and NodeRemoveEvent. If so, does NodeRemoveEvent get called when NodeClearEvent is called?
I am guessing NodeAddEvent and NodeRemoveEvent
Correct, you'd check the node and target types for your needs
does NodeRemoveEvent get called when NodeClearEvent is called?
No, NodeClearEvent gets called when you run aclearcommand (... parent clear...,... parent cleartrack...,... permission clear...,... meta clear...)
Whereas NodeRemoveEvent gets called when you remove nodes one by one
@junior jay
yup, i read it. Thanks
Are LuckPerms events not in sync?
I wouldn't know for sure but I'm confident they run asynchronously
I didn't mean that, i mean - are they sent in batches? like i removed a group from a user and it doesn't call the event but when i do another change like adding/removing another group, both events get called.
If so, how can I make not wait for another change to occur and then call the events
I didn't mean that, i mean - are they sent in batches? like i removed a group from a user and it doesn't call the event but when i do another change like adding/removing another group, both events get called.
No, they are called as they happen. Picture this: you want to do something when a player breaks a block, the event gets queued but not called until, say, the world is saved; you want to do things when a block is broken but instead you'd be doing them when the world saves.
If so, how can I make not wait for another change to occur and then call the events
You could listen to the event normally and add it to a queue/stack (any collection that accepts duplicates will do), and then when a certain something happens (a certain event gets called) you'd process the whole queue
How can I create a group node with 5.1.26?
I've found Node.builder but what is the key?
InheritanceNodeBuilder is what you're looking for
I cant find it?
Then user#getNodes()#add(node) , right?
yeah
And userManager#saveUser ?
correct
if you're loading the user from storage (userManager.loadUser) I suggest you run all the operations in one big asynchronous runnable
Okey thank you very much
np
How can I get support in spanish?
Ideally you would just use a translation service, and ask in the correct channel - this channel is for support regarding the luckperms developer api.
or, you could wait until someone who speaks spanish comes along
Uh sorry, ty
Please do not reset your nickname to the unclickable monstrosity it is currently. There is a reason you were renamed
Im so sorry xd
can anyone help me, please? I have three servers, two servers are spigot and third server is BungeeCord, LuckPerms don't function on second server, but on first server it function, so I don't know how to repair it 😦
this is a channel for using luckperms developer api, if you are not using it then ask in #support-1 or #support-2
sorry
If a user has a permission or its value?
With the developer API?
I mean ... If not, #support-1 is the place for that
.bold(true)?
api.getUserManager().modifyUser(player.getUniqueId(), user -> {
PermissionNode node = PermissionNode.builder(nodeString).value(true).build();
user.data().remove(node);
});
So i have this code. I want to remove a permission node (obviously). But it only removes the permssion only when the node matches exactly whith the node i want to remove (with context and all that stuff). Is it possible that it ignores the context and just removes every permission with that node?
what a great question
I guess you could getNodes(NodeType.PERMISSION), then filter the ones that match the key and remove the resulting ones from the data?
It works thank you. Thats what i endet up with:
api.getUserManager().modifyUser(player.getUniqueId(), user -> {
Collection<PermissionNode> nodeCollection = user.getNodes(NodeType.PERMISSION);
for(PermissionNode node: nodeCollection) {
if(node.getKey().equals(nodeString)) {
user.data().remove(node);
break;
}
}
});
coolio
Hey, I'm trying to add edit a meta node for a user with a plugin, and when I run user.data().add(node) it returns successful but running /user <name> meta info shows that the nothing has changed. Any idea why that might be?
More code to make it more clear what I'm doing:
MetaNode node = MetaNode.builder("nick", name).build();
// Sets the players metadata Bukkit.getLogger().info("Node Addition:" + user.data().add(node).toString());```
Did you save the user?
How would I do that?
Ah, thought there would be something like this but couldn't find it. Cheers
Hi, how to solve a problem when UserManager from LuckPerms is null?
Do you get any exception? How do you get LuckPerms?
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
api = provider.getProvider();
}
I have this
and the api throws NullPointerException when I try to get a user
when are you trying to use the API
later, I have a class that has that API
and in that class
I use API in a method to get a user
like that:
User player = userManager.getUser(mcId);
userManager is null
and userManager is the API
did you ever set user manager?
let's see the full context
Okey so
- I get the API
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
api = provider.getProvider();
}
- I create an object with the API as the parameter
CommandListener listener = new CommandListener(api);
- Then inside the COmmandListener I have a method
that gets the user by API
User player = userManager.getUser(mcId);
public CommandListener(LuckPerms api) {
this.userManager = api.getUserManager();
}
here's the constructor
and later I checked it and it turned out that userManager is null
that doesn't sound right
user manager is setup and constructed during the construction of the API, and should always be something
that's why I'm concerned
it sounds like the null here is actually the API
in that case, you tried getting it too early
what do you mean by too early?
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
api = provider.getProvider();
}
isn't that enough?
I am using spigot
you need to initialize the API at least in onEnable and not onLoad, as that's when LP initializes the API
more precisely, you should have a dependency declaration to ensure you also run after Luckperms
I am initializing the API in onEnable, however I'm not sure about dependency declaration
how does it look like exactly?
just the typical plugin.yml setup
should I make LuckPerms depend?
your plugin should depend on LuckPerms
sounds about right
Okey, UnknownDependency 😦
error
I get LuckPerms with gradle
So, is the name "LuckPerms" fine?
that should be it
I mean, next thing to check then is if LP is even installed on that server
so in my plugin i need to get a list of all permissions that start with a certain string. To do this, I was getting the user's primary group and adding permissions from that to a list that i would then check for. The problem with this is that if a player is in the default group and another group, it ends up selecting the default group as the primary group.
What im asking is this: Is there a way to get a list of groups a player is in?
please ping me if you respond
awesome, that looks like exactly what I want! ty
The problem with this is that if a player is in the default group and another group, it ends up selecting the default group as the primary group.
That sounds like a bad weights setup honestly if you're not expectingdefaultto be the primary one
@ember hedge 😉
That returns the same set of nodes as the ones used by LP for tab completion, etc
thanks, but I need all permissions that a player has
ah your original question lead me to believe otherwise
in which case, you want user.resolveInheritedNodes
does anyone know how to get a list of the groups the player inherits?
i would need all of their groups, not just their primary groups.
User s = Main.getLuckPerms().getUserManager().getUser("chriisto");
System.out.println(s.getInheritedGroups(s.getQueryOptions()) + "");
gives me this result. i need the actual names of the groups tho.
likely because you're returning a raw object that uses the Object toString()
how would i go about fixing that?
what you could also see is that it's a list of api groups
have you tried doing anything with what is returned by getInheritedGroups
no i haven't
getInheritedGroups returns a collection
while something like Group group = s.getInheritedGroups(s.getQueryOptions()); is looking for a singular group
so that doesn't work ^
fixed my problem. got it to work with
for(Group groups : s.getInheritedGroups(s.getQueryOptions())) {
System.out.println(groups.getName());
}
thanks for the pointers!
I spent like an hour on the wiki trying to figure out how to add a user to a group in my plugin and I can't figure how? Can someone please assist me? 🙂
@shell portal
That's a neat example of exactly what you need
Except for the clear part
hi hi, is there a methode to get the max weight of a user ? or I have to keep my dirty
adaptater.getPermissionData(p).getPermissionMap().entrySet().stream().mapToInt(e -> e.getKey().startsWith("weight") ? Integer.valueOf(e.getKey().substring(7)) : 0).max().orElse(0)```
what in the world is that
well for starters, what do you mean by "max weight of a user"?
users themselves don't have weights
only groups, prefixes and suffixes do
you want to get the weight of the most weighted inherited group?
yeaaa
so.. give me a minute lmao
you want only from the groups inherited directly or the indirectly inherited ones too?
if the player have multiple parent / groups, I want to get the higher weight
of them
And that's what I did
i got every node, filrer and map it, then get the higher
But I hope something exists in the API to do that
I mean you can use this https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/PermissionHolder.html#getInheritedGroups-net.luckperms.api.query.QueryOptions-
You give it a QueryOptions based on what you need (take a look into that) and it will be sorted tho
then you extract the weight off the group
.>
just have to learn how it works
adaptater.getUser(p).getInheritedGroups(/* idk what to set */ null).stream().mapToInt(group -> group.getWeight().orElse(0)).max();``` I know I am incredible
/* idk what to set */ well definitely not null
adaptater.getUser(p).getInheritedGroups(QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build()).stream().mapToInt(group -> group.getWeight().orElse(0)).max();``` this api won't allow me to sleep
take into account that like it is now it will also include groups inherited indirectly (say I have vip+ and vip+ has vip and that one has member, it'll include vip and member as well)
so, what would I set there ? 
check the flags link above
but I can just get everything just like I did
mhm
it seems it isn't what u expect >.>
for some reason using api.getUserManager().getUser(playerName) works well with players on java edition, but when I lookup a bedrock player on my server, it returns null (my server has bedrock and java crossplay, and for some reason /lp user (user) info works for all players but not this)
what are you using for bedrock to java crossplay?
nope
I'm trying to use luckperms as a uuid fetching system
but the java player was online
getUser requires the user data to be loaded
but the problem is I don't know their uuid
what does /lp user (user) info do?
because it works with offline players
LP has mappings of names -> uuid
But you shouldn't rely on another plugin for getting someone's UUID
Thought of Bukkit.getOfflinePlayer(String)?
thats depreciated I though?
It's deprecated but that's because it can potentially cause a request to mojang's servers, and if ran on the main server thread it can cause lag
the thing is I want to get a bedrock player's uuid
and thats not on mojangs api
so I was thinking of using luckperms
potentially
If the player has joined before, it won't
The server will load it from local storage
Make sure to check OfflinePlayer#hasJoinedBefore() before getting the UUID
np
When i try to remove a user's group using this: it doesnt remove it am i doing it right (No Errors in console, and yes the user is online)
Node node = InheritanceNode.builder(rank).build();
lpapi.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
user.data().remove(node);
lpapi.getUserManager().saveUser(user);
});
lpapi.getUserManager().saveUser(user);
The idea ofUserManager#modifyUser(UUID, Consumer<User>)is that it loads and saves the user into storage for you so you might as well want to remove that :p
ok
But that's not the issue lol
lol
NodeMap#remove(Node) will remove the node if all of it matches exactly, that is:
* key
* value
* context
* expiry time
And it'll only work if the user itself contains the node directly, it won't remove it if a group the user inherits has the node
the user has the group
In the case of key and value it's no issue since it's an inheritance node
(unless it's set to false for some reason lol)
it isnt
mm are you testing this rn?
yes
Mind showing me a screenshot of /lp user <user> parent info and the name of the group you want to remove?
And the full snippet of code that runs the modifyUser too
method, class, whatever
hm do me a favor
I'm assuming the hooking is correct bc "No Errors in console"
quick question. sorry to interrupt.
target is an offline player, and the if statement is firing, and i'm not sure why. this works when the player defined by User is online.
Just because it's not null doesn't mean it's online
Maybe you/another plugin loaded the user data from storage
So getUser won't return null in that case
@clever lake curious, what's the input of strings?
also. when that player joins it i guess loads the data? because when they leave (offline) it won't return null
could we see more context there
so i guess theres just no data to get yet
Anyhow, Moose, do me a favor and add System.out.println(rank) in your takeRank method
that also works
(and check console when that runs see what it prints)
ok
also. when that player joins it i guess loads the data?
yes
so no data has been loaded, so how am i supposed to get it?
UserManager#loadUser(UUID)
mm Moose try turning that lowercase
idk if it's case sensitive tbh
that worked tysm.
np
still doesnt remove the rank even when i make it lowercase
perhaps there's trailing whitespace
nope
lp group dev info?
hmm the node builder makes it lowercase anyway
I'm assuming you're running a command for that, right?
to run the takeRank function?
Anyhow, Moose, do me a favor and add
System.out.println(rank)in your takeRank method
doSystem.out.println(player.getName())
just to make sure you're targeting the player you're thinking you're targeting
(I'm using the same inputs for giveRank and that works)
What does user.data().contains(node, NodeEqualityPredicate.EXACT) return?
UNDEFINED
for dev group?
for the user
:|
and only 3 of thoses prems have a use / plugin checking for them
brah wtf
perhaps the data just isn't synced? I'm clueless at this point
checked the code, everything should be fine with that
after a restart should the data sync
I mean, you can try /lp sync first
I mean the user is online and modifyUser loads it if it isn't loaded already
I mean, you can try /lp sync first
doesnt work
also api version 5.1 and luckperms version 5.1.106
try the sync then see what the data contains value states
still undefined
using that is true
this may sound dumb
but is dev somehow acting as default?
aka the undeletable group
users can not have default if they have other groups
ahh, forgot that part
you can delete dev
for some reason, using bukkit.getOfflinePlayer didn't seem to work on non mojang users. Is there anyway I can get the mapping of player to uuid through luckperms api?
euh.. ngl that's a weird setup you got right there but AFAIK it should work fine if the player has joined before
soooo.... yeah no idea
Is there anyway I can get the mapping of player to uuid through luckperms api?
I am not sure but I don't think you can
what about if I somehow hook into the plugins core?
because all the classes are public
I mean you could do that but I personally won't provide any support for it bc it's not supposed to be used from the outside (that's what an API is for) ¯\_(ツ)_/¯
ah I see
how would you go at giving a user temporary group using the api?
InhertiancdNode.bulder("rankname").expiry(inputs here); (for thee node)
how to import luckperms using gradle
!api
Learn how to use the LuckPerms API in your project.
i followed it but it doesnt seem to be importing properly
explain more
like its in my build.gradle file and i refreshed it to install the luckperms but when i try to import it the class isnt found
!paste your gradle and how you import the luckperm class
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!
i dont see you importing luckperms in your code at all tho, iirc its like import net.luckperms.api.LuckPerms;?
it says it cannot be resolved
I was going to ask about fabric but i know how to use the search box
You go i509VCB! Not gonna ping ya o-o
@wet grove I just remembered that there's this (you still shouldn't rely on other plugins for this) https://javadoc.io/static/net.luckperms/api/5.1/net/luckperms/api/model/user/UserManager.html#lookupUniqueId-java.lang.String-
@haughty solar that method is also probably what you want
If you got the UUID instead of the username https://javadoc.io/static/net.luckperms/api/5.1/net/luckperms/api/model/user/UserManager.html#lookupUsername-java.util.UUID-
how do you check if the group exists in the db?
I literally linked that above
but not the user, the group is what i want to check if the group exists in the database doesnt necesarrily mean the user should have the group
Oh a group
Just GroupManager#loadGroup(String)
If it returns null it doesn't exist
¯\_(ツ)_/¯
ok ok thanks
Mb it does not return null bc:
a) it returns a CompletableFuture
b) it gets populated with an optional
And c) "Returns an empty optional if the group does not exist."
So yeah don't trust me, trust the docs @shell forge
@wet grove I just remembered that there's this (you still shouldn't rely on other plugins for this) https://javadoc.io/static/net.luckperms/api/5.1/net/luckperms/api/model/user/UserManager.html#lookupUniqueId-java.lang.String-
@haughty solar that method is also probably what you want
Thank you!
thanks
Is it possible to use the messaging system configured in luckperms from another plugin ?
Alguien que hable español sabe como sacar la variable para la compatibilidad de rangos con mi plugin?
Ejemplo: luckperms.getRanks
O que metodo se usa?
La qué de qué....
xdxd
Resumen, tengo un plugin y la pregunta es como hago para que el rango de un usuario se muestre en la scoreboard
Eso te va a devolver el grupo primario del usuario
@potent oasis not that I know of... what are you planning to do? Sounds nefarious
Gracias 
Well, instead of use an other system of messaging/broadcast (like bungeecord messaging but need someone on the server, redis or rabbitmq) why not use the configured system of luckperms
I mean, you could try and see how it is implemented and used in LP and imitate it, although I'm sure a bit of googling might solve it
yea i searched a bit in the code, but expect someone could know which method use to send and register a listener for that here 
I mean it depends on your needs, platform and platform availability 🤷♂️
well, just send and listen raw message, I saw there is some an Messager abstract class but didn't find out how to get it, will search more
"just send and listen raw message" highly depends on the messaging system used
I mean plugin messaging is one of the options
in fact we use sql, and don't really want to use redis or something else just for messaging, so I have to use (or copy) the way that luckperms use sql as a messaging system
I suggest you either copy it complying with the license or google a bit on how to do it and make it yourself sticking to no license (other than the ones already having a role)
just curious, why is sql messaging not sufficient?
it is
but
why would I implement something in my plugin if it is already implemented in luckperms
Because it is implemented for LuckPerms?
what??
connection to sql server
LuckPerms uses 10 connections to the sql server
lol
haha
Does anyone have an idea why the user in this case don't get the rank? There is no error in the console
Is the user online?
He got kicked before saveUser
Thats might be why he didnt
Why save the user twice
Oh
In any case I suggest you start printing stuff, like if the group is available, the expiry time, the time unit, etc etc.
okay
And I also suggest you use UserManager#modifyUser, it will load and sync the user data from storage, run the provided action and save it for you, all of it asynchronously too