#luckperms-api
1 messages · Page 46 of 1
why when i use setPrimaryGroup(args[0]); nothing changed in the game and in the database ?
That's not what I asked, please re-read my messages
i want to change the primary group
and there is a method in the api setPrimaryGroup
but it's not effect any thing
Do you want to change the user's parent groups?
no primary group
By default the primary group is the parent group with highest weight
So you would need to either:
a) change the group weight and make it the highest
or b) change this setting which may have unexpected or unintended side effects https://github.com/lucko/LuckPerms/blob/528d668bc6fee6e824d639585a713b51c427be3f/bukkit/src/main/resources/config.yml#L290-L301
i understand now sorry for misunderstanding.
If you want to change the user's parent groups (which will in effect change the primary group), there is an example in the cookbook repo for it
Please use https://paste.lucko.me to send files in the future. I have automatically uploaded message.txt for you: https://paste.lucko.me/LkgADRHx3m
Use equalsIgnoreCase and screenshot /lp listgroups
yes my server is crasht i cannot be started
welp
what do you mean?
!weights
LuckPerms allows you to set weights in order to determine the priority of certain nodes, like permissions and even prefixes. A higher weight number is a higher priority.
bruh....
...
sorry< but my question
yes
wait patiently
there are other people asking for help and I only have two hands and a single pair of eyes
xD!
what's so funny
nvm
emilyy is the best
emilyy is the best
You can take as example the "SetGroupCommand" to start somewhere https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java
With a few modifications
ik that but how can i set time?
First: not clearing the inheritance nodes the user has
Second: adding an expiry to the node (see the method .expiry(Duration) in the node builder)
okay thank u
i didn't found it
this is me from another pc;
I prefer your pfp :d
i don't know him
the method is in the node builder, not after you built it
so like InheritanceNode.builder(group).expiry(...)
i understand thank you emilyy
yw
emilyy the Duration is in seconds or millseconds or in timestamp
There are several expiry methods, you can use the one that takes expiry(long duration, TimeUnit unit) (TimeUnit is an enum I believe)
With the api?
So no
and the EssentialsSpawn
I codet a little plugin with luckperms and since i updatet the version of Luckperm on my 1.12.2 paperspigot server to the newest i got this error https://paste.lucko.me/IeqiutAsSZ. What could I do?
is it just a problem with the version? or is there a newer version of the api?
!upgrade
Read about upgrading LuckPerms from v4 to v5.
changed nothing ... same error and i´m using in my plugin the latest version of the api
Did you add LuckPerms to your (soft)depend in the plugin.yml?
@steel gull if you're still having this issue please send the whole logs/latest.log + plugin.yml + the relevant code
ok thanks but i didnt found time to test it yet but i think that was my problem
Oki
Hi, I have a problem that is a little complicated
Now I have 5 ranks
Owner
- Admin
- Builder
- Member
- default
I was given permission to the rank of Default and the inheritance to the rank of Member, after which the inheritance status from the rank of Member to Builder permissions The default does not come to the rank of Builder Why?
uh what is this to do with the api?
ahh wrong chat.
Hello,
I am trying to make a levelling system. If a player gets enough XP, he levels up and that sets his prefix to Level (his new level).
Thats how I tried to do it using this method in one of my classes:
|| public static void setPrefix(String name, String string) {
Node node = Node.builder("prefix.0." + string).build();
api.getUserManager().getUser(name).getNodes().add(node);
api.getUserManager().saveUser(api.getUserManager().getUser(name));
} //usage in any other class is (class).setPrefix("examplePlayer1", "§8[§c§lLevel 2§8]");||
but it does not work. The player will not have any other prefixes on him (except the one in his primary group, but no prefixes on the user him/herself).
So.. how do I set a prefix using lpApi?
It does not add the permission "prefix.0.xxxx" at all.
!api
Learn how to use the LuckPerms API in your project.
look into PrefixNode
also take note of the weight that you set, by default, only highest weight is shown
PrefixNode node = PrefixNode.builder(100, "[Some Prefix]").build();
the args of the builder(int, string) seem to be incorrect as ide is marking the builder method as en error and wants me to leave the () empty
either your ide has some issues, or you are using an old version of lp api
oh wait its prefix first then priority lol
nah, just in there its builder(priroity, prefix)
yeah
vice versa
open a PR to fix that in the wiki, the dev will probably response in a few days
alright
Oh, now it finally works.
The cause was that i was using api.getUserManager().getUser(user).getNodes().add(node);, but should be api.getUserManager().getUser(user).data().add(node);
thanks:)
also, is there a way of removing all prefixes an user has on him/herself, when the users group.xxxx changes?
you can just query user for all prefix node and remove them
well the problem is that I need to remove all prefixes when a group is changed by the DiscordSRV plugin, which synces groups between discord and minecraft
when a role is changed and replaced by an another one on discord, you get the new role ingame but it wont remove ur prefixes (if you have any)
honestly, why cant you just set prefix in the group?
if its not possible and you want to do this, just listen to the event that inheritance node of user changes, and delete the prefix from there
cuz i thought itd be easier to do using some event. I found some on the wiki but they dont either offer what node was added, or to get the target users nickname.. or at least the events that I tried (NodeAddEvent and then UserDataRecalculateEvent)
nickname?
oh i just realised something, maybe i dont need to get the nickname from e.getTarget() (PermissionHolder)
yea you should do that
havent tried that yet but ill better ask cuz it feels wrong to me, im new to the lp api
e.getNode().toString().contains("group")
will this work? check if the node is group.xxxx
wot that not how you do thingsd
lol
its like doing int x = 1, if (x.toString() == "1")
you should get the node and check if the type is of NodeType.INHERITANCE
if it is, that means its a group.xxx node?
basically yea
alright
its a more robust way of doing things
well... i tried using NodeAddEvent with debug messages and it doesnt seem to be reacting to DiscordSRV's role syncing (which basically just adds group.xxxx if you get the xxxx role on discord
found UserDataRecalculateEvent on github, but i cant get the node from there (or maybe im just too blind)
how is discord plugin adding permissions?
issit like through an automated lp command?
Also how are you registering the event? its different from normal bukkit events btw
I did not know about the registering.. imma try it rn
alright so discordsrv uses Vault to add assign groups
wait what is that
i dont know what am doing wrong, but the NodeAddEvent still doesnt work for me:
||public class LpListener {
private final Main main;
private final LuckPerms luckPerms;
public LpListener(Main main, LuckPerms luckPerms) {
this.main = main;
this.luckPerms = luckPerms;
}
public void register() {
EventBus eventBus = luckPerms.getEventBus();
eventBus.subscribe(this.main, NodeAddEvent.class, this::onNodeAdd);
}
private void onNodeAdd(NodeAddEvent e) {
Bukkit.getPlayerExact("Vojtiisek").sendMessage("test message");
if (!e.isUser())
return;
Bukkit.getPlayerExact("Vojtiisek").sendMessage("test message222");
User target = (User) e.getTarget();
this.main.getServer().getScheduler().runTask(this.main, () -> {
if (e.getNode().getType().equals(NodeType.INHERITANCE)) {
for (Node node : e.getTarget().getNodes()) {
if (node.getType().equals(NodeType.PREFIX))
e.getTarget().data().remove(node);
}
}
}
});
}
}
||
I dont even get the "test message" and "test message222" messages, when my group.xxxx changes (the old one gets removed and the new one is added)
discordsrv is a plugin for integrating discord with a mc server, vault is a really popular api for doing stuff with permissions and economy i think
ah thx
i literally copied this class and corrected it a bit and it does not work.. do I do something else? Other than creating that listener class?
cuz it doesnt say so on the wiki
Send code
thats it
the spoilered text
Are you initializing the class?
well, at least im trying to
LpListener lpListener = new LpListener(this, api);
lpListener.register();
in onEnable
And?
still nothing
alright
!paste your code here
Seeing a paste of the problem makes everything so much easier! Use https://paste.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!
Btw
uuuuuuuuuuuuuuuh
ok it does not initialize the LpListener class at all
register() method does not work
none of the System.out.printlns work
Can you try makijg the 2nd LpListener all lowercase
So LpListener listener = new LpListener(...)
how does that have effect
Then listener.register
but alright
am i registering it correctly?
idk the lp api tbh
and im not a pro java programmer
did not do any
How can I remove prefix with specific weight?
I'm trying to create a custom prefix command, /prefix <prefix> will set the player prefix, and when they run /prefix only, the custom prefix will got removed.
you can just query user for prefix nodes and check its weight with PrefixNode#getPriority
user.data().clear(NodeType.PREFIX.predicate( prefixNode -> prefixNode.getPriority() == 2000));
``` like this?
if you can identify your custom prefix with priority 2000 yes
okay, this is how I do it. https://paste.helpch.at/vetuxesige.cs
hm tbh all that async/futures/scheduler mixture is likely to not go very well
if you already have the User object, there is nothing to worry about in regards to doing things async
so it's okay not to run async if I already get the User object asynchronously?
Once you get the user object you don't really have to worry, unless you want to do something after calling UserManager#saveUser/modifyUser or delegate something to the server main thread, etc
In essence: you can just do this https://paste.lucko.me/Mb4uY7DjB7
yw
you need to save the user after adding/removing the prefix right?
Yes
aight, cool
Hello, If a player has not joined the server ever, would the UserManager.loadUser(hisUUID) return null? or just a user with the default group?
The latter
Hello! How can i remove custom player prefixes on group change?
!cookbook
There is an example in here for listening to a "user change group" (NodeAdd/RemoveEvent) event, in there you'd get the user data and remove the prefixes you want // clear based on whichever predicate you consider appropriate for your "custom" prefixes
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Thank you very much!
if you had any issues, dm me. I just completed that thing and it works
How do I get a full name of the permission node?
i mean, for example get "essentials.spawn" from a node
node.toString()?
if I am not wrong there is a getKey() method
yeah there is, so this returns the node itself?
i mean, the permission name or how to call it
heyo
im playing with luckperms api atm
and i'd like for the permission updates to be instant but for some reason they are only applied upon relogging
i tried the solution in this issue to no avail
same problem occurs, only relogging applies the permission
here's my code
Bukkit.broadcastMessage("added permission " + "hardcoregames." + kitInfo.getKitLowercase(kits));
Node node = Node.builder("hardcoregames." + kitInfo.getKitLowercase(kits))
.value(true)
.expiry(Duration.ofHours(24))
.build();
user.data().add(node);
HardcoreGames.getLuckPermsInstance().getUserManager().saveUser(user).thenRun(() -> {
HardcoreGames.getLuckPermsInstance().getMessagingService().ifPresent(service -> {
service.pushUserUpdate(user);
});
});```
Thanks for any help and if you do respond please ping me ^^
you are on a bungeecord network with permission stored on an sql database?
Nope, the main server I’m testing this on is on bungee but on my local server which isn’t on bungeee it doesn’t work either. I’m not using sql either
ok, right after adding that permision with your code, can you run /lp user USER permission check hardcoregames.kitnamehere
and send the screenshot
Sure thing
[08:26:24 INFO]: [LP] Permission information for hardcoregames.worm:
[08:26:24 INFO]: [LP] - clew2 has hardcoregames.worm set to true in context global.
[08:26:24 INFO]: [LP] - clew2 does not inherit hardcoregames.worm.
[08:26:24 INFO]: [LP]
[08:26:24 INFO]: [LP] Permission check for hardcoregames.worm:
[08:26:24 INFO]: [LP] Result: true
[08:26:24 INFO]: [LP] Processor: common.DirectProcessor
[08:26:24 INFO]: [LP] Cause: None
[08:26:24 INFO]: [LP] Context: (dimension-type=overworld) (gamemode=survival) (world=hungergames)
probably your kits plugin isnt updating
yea but definitely not relogin as you described
sorry wdym
same problem occurs, only relogging applies the permission
I don’t think it can be this, typing the check command updates it for the player while online
The lp check command
Oh btw I’m checking permissions with Player#haspermission
Do you reckon switching to User#hasPermission might fix it?
Hey simo! Please don't tag helpful/staff members directly.
That would work fine
how do i recall the player's group (p1)?
yeah, which is why im so confused haha. user perm check didnt work either 😢
You mean getting the player's parent groups? I believe there's a method for it, resolveInheritedGroups or something
I have to get the group with the highest priority of the player (p1)
!API
I suggest you read the 2 main general API usage pages, they contain useful information such as getting a User instance from a player etc
Learn how to use the LuckPerms API in your project.
Then getPrimaryGroup should suffice
okay, thanks
emily, do u have any idea of how i can resolve this problem? my adding of perms to user wont work unless the player relogs
Game game = Game.getSharedGame();
if (game.getAllKitsFree()) {
return true;
}
if (kits == Kits.NONE) { return true; }
User user = HardcoreGames.getLuckPermsInstance().getUserManager().getUser(p.getUniqueId());
if (user != null && hasPermission(user, "hardcoregames." + getKitLowercase(kits))) {
Bukkit.broadcastMessage("has permission " + "hardcoregames." + getKitLowercase(kits));
}
if (user != null) {
return hasPermission(user,
"hardcoregames." + getKitLowercase(kits));
}
return false;
}
public boolean hasPermission(User user, String permission) {
return user.getCachedData().getPermissionData().checkPermission(permission).asBoolean();
}```
this is how i check for perms
final LuckPerms api = LuckPermsProvider.get();
KitInfo kitInfo = KitInfo.getSharedKitInfo();
Bukkit.broadcastMessage("added permission " + "hardcoregames." + kitInfo.getKitLowercase(kits));
Node node = Node.builder("hardcoregames." + kitInfo.getKitLowercase(kits))
.value(true)
.expiry(Duration.ofHours(24))
.build();
api.getUserManager().modifyUser(user.getUniqueId(), (User user1) -> {
user1.data().add(node);
});
api.getUserManager().saveUser(user).thenRun(() -> {
HardcoreGames.getLuckPermsInstance().getMessagingService().ifPresent(service -> {
service.pushUserUpdate(user);
});
});
//HardcoreGames.getLuckPermsInstance().runUpdateTask();
}```
this is how i give the perm
only works if offline upon login, or if online and perm given only works on relog
If you give me 10 minutes or so sure, can't read very comfortably from discord mobile
User rank = LuckPermsProvider.get().getPlayerAdapter().getUser(p1).getPrimaryGroup();
I don't like this
No worries, thank you
You need to pass the Player class to getPlayerAdater
Please lmk if u have any ideas
how?
Player.class
Cannot resolve symbol 'Player'
User rank = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(p1).getPrimaryGroup();
What dependency is Player.class?
I assume you're coding for Bukkit
no, bungeecord
Then pass the Class for whichever class you work with a player object
PlayerClassName.class
But I use bungeecord, I don't get that class
Which class do you use when working with player objects on bungeecord
ProxiedPlayer if I understand what you mean
Then you pass ProxiedPlayer.class, that will give you a Class object, which is what getPlayerAdater expects
You need a variable named group which you don't have.....
.getUser() what should i put inside?
The ProxiedPlayed object
Please read your own code
Your LuckPerms variable is named api
Not luckPerms
You also don't have a groupName variable
User user = LuckPermsProvider.get().getPlayerAdapter(ProxiedPlayer.class).getUser(p1).getPrimaryGroup();
so?
getPrimaryGroup does not return a User
I shoot myself...
n0
This is way beyond the LuckPerms API or the PEX API
This is basic Java knowledge
I can link you a few courses, guides and documentations for learning Java if you want me to
so what? 😟
Can you people please disable reply pings?
getPrimaryGroup does not return a user, your IDE should tell you what the return type is
hint hint, it returns a String
String groupName = "moderator"; idk, maybe it's in a command you get it as a command argument, there is no one singular way but you need a String groupName
String user = LuckPermsProvider.get().getPlayerAdapter(ProxiedPlayer.class).getUser(p1).getPrimaryGroup();
so?
String rank = LuckPermsProvider.get().getPlayerAdapter(ProxiedPlayer.class).getUser(p1).getPrimaryGroup(); should the player's highest group return to me?
modifyUser already saves the data for you, you should call this:
...modifyUser(...
// add node
).thenRun(() -> {
HardcoreGames.getLuckPermsInstance().getMessagingService().ifPresent(service -> {
service.pushUserUpdate(user);
});
});
although since you already have the user object you can quite easily just
user.data().add(...);
...saveUser(user).thenRun(() -> {
HardcoreGames.getLuckPermsInstance().getMessagingService().ifPresent(service -> {
service.pushUserUpdate(user);
});
});
that is default behavior yes
what
when exporting the plugin with Maven this comes out
I uploaded this with Maven
package net.luckperms.api does not exist
.-.
I can't help you with the lack of Java knowledge and experience, this is not general development support, there are tons of servers out there you can get basic help with that, using the LuckPerms API requires some Java knowledge and so do we in any of these guilds:
The Coding Den: https://discord.gg/code
HelpChat: https://discord.gg/helpchat
Developer Den: https://discord.gg/Jbm4xXvC
in the code it goes, when exporto no
TecnoFra please paste your pom.xml in a paste site and send the link here
!pasteit
Seeing a paste of the problem makes everything so much easier! Use https://paste.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!
And also describe step by step the way you are building your plugin too
you didn't add luckperms as a maven dependency
And you should also declare the bungeecord-chat dependency as <scope>provided</scope>, you probably don't want to shade that into your plugin, can lead to some nasty issues
so?
looks good
what need I to define as softdepend for luckperms ... the api name? the Filename of the Luckpermsversion?
i try and get the same error just like without it as softdepend
Seeing a paste of the problem makes everything so much easier! Use https://paste.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!
first is the important thing of the plugin.yml the last the errormessage that the console shares
- LuckPerms, not -LuckPerms
ok ..
yaml is a bitch but that's how lists work on it
no such luck for me 😦 this is what i wrote ``` final LuckPerms api = LuckPermsProvider.get();
KitInfo kitInfo = KitInfo.getSharedKitInfo();
Bukkit.broadcastMessage("added permission " + "hardcoregames." + kitInfo.getKitLowercase(kits));
Node node = Node.builder("hardcoregames." + kitInfo.getKitLowercase(kits))
.value(true)
.expiry(Duration.ofHours(24))
.build();
api.getUserManager().modifyUser(user.getUniqueId(), (User user1) -> {
user1.data().add(node);
}).thenRun(() -> {
api.getUserManager().saveUser(user);
HardcoreGames.getLuckPermsInstance().getMessagingService().ifPresent(service -> {
service.pushUserUpdate(user);
});
});```
im assuming this is correct right? or did i miss something
also, typing /lp user (name) check permission (permission name here) updates the perms and it works in that case
but never from the command itself
you are not supposed to run saveUser and modifyUser together
modifyUser already saves the user
ah
either one or the other
perhaps soemthing like this?
KitInfo kitInfo = KitInfo.getSharedKitInfo();
Bukkit.broadcastMessage("added permission " + "hardcoregames." + kitInfo.getKitLowercase(kits));
Node node = Node.builder("hardcoregames." + kitInfo.getKitLowercase(kits))
.value(true)
.expiry(Duration.ofHours(24))
.build();
user.data().add(node);
api.getUserManager().saveUser(user).thenRun(() -> {
HardcoreGames.getLuckPermsInstance().getMessagingService().ifPresent(service -> {
service.pushUserUpdate(user);
});
});```
err
that saves it twice..
something like that instead maybe?
that doesn't save it twice?
that saves it once and it looks good
oh yeah just edited it, accidently put two save funcs xP
nope, didnt work :/ this is really confusing
still only works on relog
are you running that code on the server or on the proxy?
it runs on a certain command from console
with no errors or anything
on the server or on the proxy?
so on the server i believe
okay, screenshot /lp info please
sure thing
does luckperms have dev builds? maybe this is something fixed in more recent versions
there is no concept of "dev builds" really, each commit has its own build you can find at https://luckperms.net/download but keep in mind that yes, the "release" on spigotmc is not as updated as the one in the LP website
are you testing this on a network or in a single server only..?
i've tried on localhost and on my online server
same results
at least im pretty sure its luckperms fault because i think my plugin is handling the perms fault, but unsure of why
ill check my depends rq
yep, not a depends problem either
everything's up to date and whatnot
gonna try a clean build on 5.3.37
no luck :/
wait
i just found something
if i run the command twice, it updates the previous perm but not the first one
can you show all of the relevant code? how you actually get to give the permission and where you check for it
https://paste.lucko.me/
sure thing
i apologize in advance for terrible formatting
i can fix that if its too much trouble to read
@nocturne elbow hate to bother you, but have you had a chance to look at my code yet?
Hey 🇨🇳中華人民共和国への栄光🇨🇳! Please don't tag helpful/staff members directly.
oop, sorry
Hi guys, has anybody started working on an implementation of fabric-permission-api on top of vanilla commands ? (Please mention me in replies)
its not up to luckperms to do it, you probably should ask fabric discord on it
I know but there still is a chance someone here has done it
@sonic canopy see #support-1 📌
I didn't look into it in full detail yet but I wasn't able to reproduce the issue, I'll see if later on I can give you some really simple sample code that works for me for you to test
Sounds great, thanks so much
so I'm trying to create an addon for a skyblock plugin to allow for permissions to be granted to a specific set of people, but I don't want to actually add the permission to the player, since that is pretty janky, and if you revoke it could remove permissions gotten other ways.
is there an easy way to make another section like "groups"?
uh yeah that's literally what groups are for lol
well no I don't want to be in the buisness of creating 100s, or 1000s of groups
I'd prefer if it was a seperate section
since groups would make everything confusing af
I mean what you just described are groups
You could name it whatever you want, that is the definition of a group
Whether it's named "group" or "another section" sounds like you'd still need to use hundreds or thousands of them
What is this for exactly
Maybe granting the permissions to the players directly isn't as bad as you'd think, who knows
thats why I don't want to add them to groups, since it would clog up everything
but then for example, what if someone already has permission x, then their island gets it, then they leave the island?
now what
how do I know not to remove it
what?
if someone has permission x, and then their island gets it, then it would just assign it twice.
then if they leave the island, they shouldn't lose the perm, since they had it beforehand
so you want to do like "island-granted" permissions or something?
or what do you mean by "a specific set of people"?
well yeah, a team of people are on an island
maybe I could create something that luckperms checks on player login? and give it a list of permissions
but that are only temporary
they're not located anywhere, luckperms just knows its there. kind of like there were 2 permission handlers
what??
well I'm trying to make it not interfere with normal permissions at all
its just on top of normal perms
I'm having a hard time understanding what is it you're wanting to achieve in the first place
basically make a way to grant a specific island an achievement, that Luckperms takes into account when deciding if someone has permission to do something, without granting it to the user themself, since that interferes with normal permissions
that sounds a whole lot like a group per island
is that what you're trying to avoid?
yes
since think about how much that would be if you had 100 islands
and for example, my server has 800 islands registered.
I don't really want to make the web interface useless for example
i c
so in the end what you're trying to avoid is saving the data within LP's storage, right?
well, not necessarily. idrc how its stored, but I'm willing to store it myself, if that makes things easier
Hm well I'm thinking of two possibilities
I take that back, I can think of one way only:
Use the transient node map; this is like the regular node map of the permission holder with the difference it is not saved to storage (see the documentation for PermissionHolder#transientData()). This would require for you to save the perms yourself and add them to the user's transient node map on UserLoadEvent.
Imagine a permission holder (group/user) has two permission maps, basically this
private final Map<String, Node> normalMap; // this one is saved in storage
private final Map<String, Node> transientMap; // this one is not saved in storage
This has the advantage in your case that whatever you put in the transient node map does not directly interfere with the regular node map, but it is taken into account when calculating permissions.
The only disadvantage is what I said above:
This would require for you to save the perms yourself and add them to the user's transient node map on
UserLoadEvent
ok, cool. that was the idea I had, but I had no idea if it was possible
will it appear in the LP editor or anything?
I don't think it will, no
yw
actually, is it possible to add something to the UI?
like another section
I assume not, but idk I might as well ask
(The Web UI)
or a separate UI like the player only one
huh?
like a web editor for islands. its a far-fetched idea, but idk
Well... you can kinda do something, but I don't think it mixes well with transient nodes, /lp editor <node prefix> will create an editor filtering users (not groups) that contain a node that starts with said prefix, so say for instance if I do something like /lp editor group.jr- that would bring up all users that have the group jr-moderator and jr-helper, just to put an example.
Again:
I don't think it mixes well with transient nodes
Since the data uploaded to the web editor is exclusively the one in storage
ah, got it. maybe a web editor api at some point? :p
yw
I'll add that to my endless "add to api" to-do list
or I'll just open an issue and do nothing about it :^)
:p that works
Any luck with this?
(No pun intended) haha
I'll have to read that some other day but this is the code I tested https://paste.lucko.me/R6xM7Cg1yu and these are the results for the following commands:
/testplugin givePermission some.permission
/testplugin checkPermissionPlayer some.permission
/testplugin checkPermissionUser some.permission
/testplugin removePermission some.permission
/testplugin checkPermissionPlayer some.permission
/testplugin checkPermissionUser some.permission
hey so am adding a chat format system in my plugin and I was wondering on how to get a group prefix?
pretty easy
!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.
Is there a way to check with luckperms api for all player ranks
So not only primary group
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
alr thx
is there a vault discord? I need help with the api of vault
No
wut u need help with
How do you use LP API to give a player temporary permission, not time limited. I mean it won't save?
Can't use Nukkit's internal permission system since installing LP messes that up
You can use the examples in here as base https://github.com/LuckPerms/api-cookbook
But instead of using .data() you use .transientData()
also, you can use the internal system too
PermissionAttachments
lp supports them just fine
at java.util.Objects.requireNonNull(Objects.java:246) ~[?:?]
at me.lucko.luckperms.nukkit.inject.permissible.LuckPermsPermissible.addAttachment(LuckPermsPermissible.java:247) ~[?:?]
at cn.nukkit.Player.addAttachment(Player.java:533) ~[server.jar:?]
at cn.nukkit.Player.addAttachment(Player.java:528) ~[server.jar:?]
at zen.nukkit.permission.shop.Utils.Util.givePermissions(Util.java:63) ~[?:?]
at zen.nukkit.permission.shop.Menu.User.UserMenu.lambda$userMenuWindow$3(UserMenu.java:75) ~[?:?]
at zen.nukkit.permission.shop.Utils.MenuAPI.window.ModalWindow.triggerUpperClick(ModalWindow.java:87) ~[?:?]
at zen.nukkit.permission.shop.NukkitEventListener.onDataPacket(NukkitEventListener.java:43) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
This happened when I tried to use internal system with LP installed
And my code was as simple as this
PermissionAttachment attachment = player.addAttachment(Core.instance);
command.getPermissions().forEach(permission -> attachment.setPermission(permission, true));
player.recalculatePermissions();```
Not sure if I did something wrong or LP did something but that didn't work well
Permission isn't null without LP on
LuckPermsPermissible
requireNonNull
Oh boy
why is that even a thing... does that exist in Bukkit too?
no
Pretty sure not.
just a random nukkit change
Should I just use user.transientData().add(); then?
And how do you add add negative permission?
keep using your current code
to set negative permissions, use false instead of true for the value
https://github.com/lucko/LuckPerms/commit/228687b7411389a6287176c8a5020c5f20e9ca10 will fix the problem you have
I meant using LP but I guess that won't be needed anymore
you might as well keep using permissionattachments, it's easier
(for what you're trying to do, anyway)
well, it depends :p
there are times where the permissionattachment API isn't enough
anyway, that build is live now
!download
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Nukkit and Velocity.
Thanks 🙏🏻
Hey. Got time helping me? I am using Chatessentials and luckperms, ranks and prefixes are set up and done. And i have added myself to the group i want to be in. But the rank still does not show up ingame.. I got no clue how to solve this
- Use the appropriate support channels
- Don't reply to unrelated messages just to ping, please read #rules #1
- See below
LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!
Sorry.
How can i clear player's specific MeteNode?
user.data().remove(xxx);
What should i write here
Take a look at the MetaNode.builder()
If you want to use remove(Node) you need to pass the same one (key, value, expiry and contexts)
So i need to build exactly the same MetaNote to remove it?
If you want to remove by key you should use clear(NodeMatcher), take a look at NodeMatcher.metaKey(String) or .metaKey(MetaNode)
hm?
Oh that yeah
Hopefully it will be fixed by v5.4 but as of now either navigate the javadoc "manually" instead of searching or remove that bit there from the URL
Yes? That's what you need
Uhmmm sorry
!api I suggest you read these two pages @nocturne elbow
Learn how to use the LuckPerms API in your project.
!cookbook and here's an example plugin if you want to take a look at a "real" example
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Hello is there a way to get the prefix from a group?
I'm making my own plugin and I want to show the lp prefix in front of the name
something like this but instead of health I want to use the prefix and for that i need a ^part of the api I assume
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("showhealth", "health");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setDisplayName("/ 20");
for(Player online : Bukkit.getOnlinePlayers()){
online.setScoreboard(board);
online.setHealth(online.getHealth()); //Update their health
}
so that would be for example [member] Nauss
String prefix = metaData.getPrefix(); ?
Yes
Well I'll try that
What's the best way for obtaining an instance of the API for Bukkit?
So I would put that in the main class of my plugin?
Yeah that's fine
uhh
did you like miss a semicolon on the previous line or smt
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
wait
it looks like your are doing a if statement outside any method or constructor
which is not how java works
You can use anonymous labels as well, but those are weird
Should be able to initialise it in the constructor
Though because Bukkit, that is not recommended iirc
so where would i put this?
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
you should just do RegisteredServiceProvider<LuckPerms> provider; in class field
uhu
ifs your plugin's main class put setting the lp instance in the onEnable() method
or not you can put in the constructor of the class
if all these are very unfamiliar, then you probably want to look at java and oop fundamentals first
Well yea i had some strange code and i was wondering where to place it
And I'm looking for some code to add a lp prefix to minecraft nametag
I don't know if I'm completely dumb rn, but I have the following in my dependencies:
But still, I do not have anything LuckPerms-related being tab-completed
btw, mavenCentral() is in the repos
Okay, I just am dumb. restarted the ide, everything working

I was wondering if there's any reason why would luckperms api sometimes return null as user for players who are online, should I just add a null check and ignore it?
from what context are you calling getUser?
it should 100% always return a user for a player that is online
of course, it's possible that player objects stick around after the corresponding player disconnects, e.g. if stored in some collection and not cleaned up, among lots of other possibilities
i'm calling it in a repeating task and in join event, don't know which case was this
bukkit's Player#isOnline returned true
I want to know when /lp user <player> parent set <group> is executed
What I tried: I tried using NodeAddEvent but i couldn't get enough information about event. (like user's uuid)``` luckperms.getEventBus().subscribe(this.plugin, NodeAddEvent.class, this::updateGroups);
I want to know when
/lp user <player> parent set <group>is executed
what does this mean?
Is there any event when user's parent changed.
yeah
what information you need?
user's uuid would be enough
d;lp NodeAddEvent
public interface NodeAddEvent
extends NodeMutateEvent```
NodeAddEvent has 2 super interfaces, 2 methods, and 1 extensions.
Called when a node is added to a holder
NodeAddEvent#getTarget
Then theres no way to get uuid in Permission Holder ,_,
then i think you can cast to Player
after checking its instance of Player ofc
yeah sure
using names gross
sorry not Player
its User
see this ^^ for code example
ok will check rn ^^ thx
already done same thing 😹
if it's a user it'll return their UUID, if it's a group the groups name
thx both ^^ this helped a lot
yea but probably better to use User#getUniqueId()
this*
since it returns a UUID object instead of string
Which event is called if a user get a new group or the old group was removed?
same question 😹
here you are
NodeAddEvent and NodeRemoveEvent and see that link yea ^^
ok, thx how can i get the player name or uniqueid in this event?
.
thx
How would I get a list of users whos primary group is xyz via the API?
!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.
perfect, thanks
For velocity, is it save to check a user's group on LoginEvent?
!sql
Sorry! I do not understand the command sql
Type !help for a list of commands
Hi what's the API event for permission updates pls?
I'd like to update a player's display name when their permissions change
NodeMutateEvent
NodeAddEvent and NodeRemoveEvent if you want to do specific actions for those
But Mutate covers both
Learn how to use the LuckPerms API in your project.
Explained in the first two links
Ah ty
!cookbook There are also some usage examples 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.
yeye when their prefix changes
... okay
yeah ig that works actually
it's not necessarily related to permissions being added/removed
Hello. I need to simultaneously get the player and the group that is assigned to him through the command /lp <user> player parent set <group>. What event do I need to listen to for this?
I tried to do this using NodeAddEvent, but this event allows you to get only one thing - either the group or the player. Or I’m dumb and don’t know how to use it correctly. I tried:
public void onNodeAdd(NodeAddEvent event) {
User user = null;
Group group = null;
if (event.getTarget() instanceof User) {
user = (User) event.getTarget();
}
if (event.getTarget() instanceof Group) {
group = (Group) event.getTarget();
}
System.out.println(user + " " + group);
}
but group is null. However, it was obvious, but I did not know what else to try. 😄
Anyway, who can help and tell me how to get the player and the group assigned to him at the same time?
The target is the User, and when setting a parent group you add an InheritanceNode, check if the event's Node is an InheritanceNode
And how can I get the group from this node?
InheritanceNode#getGroupName()
Then you can get the group from it with the GroupManager
oh, i've got it
thanks you very much!
@cedar dagger please don't misuse the channels
not sure where to ask questions
ok
how can I get highest inherited group/parent of a player?
or is it always at the top of inherited group collection (User#.getInheritedGroups)
for ex. if a player has role C, which is a parent of role B, and B is parent of A
how do I get role C?
player has role C
C in that case is the only direct parent group and if the config file is default it's also the primary group
how would i get the groups of an offline player? i see how to do it with an online player in cookbook, but PlayerAdapter does not work with OfflinePlayer.class
i know how to get an offline user, but the getInheritedGroups method takes QueryOptions. I don't know how to make that without PlayerAdapter
QueryOptions.builder(QueryMode)
then QueryOption.Builder#build()
or just PermissionHolder#getQueryOptions() if you don't want anything fancy (contexts etc)
ah, user.getQueryOptions, ty
d;lp User#getNodes
@Unmodifiable @NonNull
default Collection<Node> getNodes()```
Gets a flattened view of the holders own Nodes.
This list is constructed using the values of both the normal and transient backing node maps.
It may contain duplicate entries if the same node is added to both the normal and transient node maps. You can use getDistinctNodes() for a view without duplicates.
This method does not resolve inheritance rules.
a collection of the holders own nodes.
how can i check if someone has a certain meta (including inherited nodes?)
bc im very confused atm
public static @Nullable String getMetaValue(UUID uuid, String key) {
User user = null;
try {
user = luckPerms.getUserManager().loadUser(uuid).get();
} catch (Throwable thr) {
thr.printStackTrace();
}
if (user == null) throw new IllegalStateException("user is null!");
return user.resolveInheritedNodes(NodeType.META, user.getQueryOptions())
.stream()
.filter(NodeMatcher.metaKey(key))
.findFirst()
.orElse(null)
.getMetaValue();
}
how can I make it be null if the person doesn't have the meta key?
CachedMetaData?
Something like luckPerms.getPlayerAdapter(/* player class */).getMetaData(player).somethingSomething(metaKey)
yw :)
nothing i was being very stupid
d;lp getUserManager().getLoadedUsers()
public interface Group
extends PermissionHolder```
Group has 1 super interfaces, 3 methods, and 1 extensions.
An inheritable holder of permission data.
d;lp UserManager#getLoadedUsers
@Unmodifiable @NonNull
Set<User> getLoadedUsers()```
Gets a set of all loaded users.
a Set of User objects
how do I add and remove a player's group?
!cookbook there's an example for that 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.
not exactly that, but between the example repo and your IDE suggestions, that's more than enough of a hint to know what to do lol
You can set prefixes, suffixes and other meta data in LuckPerms for players and groups. Note that LuckPerms does not manage chat. You need to use another plugin to show prefixes/suffixes in chat.
!temp
Sorry! I do not understand the command temp
Type !help for a list of commands
help
If you know how, please mention me
d;lp User#getInheritedGroups
@Unmodifiable @NonNull
Collection<Group> getInheritedGroups(@NonNull QueryOptions queryOptions)```
Gets a collection of the Groups this holder inherits nodes from.
If Flag.RESOLVE_INHERITANCE is set, this will include holders inherited from both directly and indirectly (through directly inherited groups). It will effectively resolve the whole "inheritance tree".
If Flag.RESOLVE_INHERITANCE is not set, then the traversal will only go one level up the inheritance tree, and return only directly inherited groups.
The collection will be ordered according to the platforms inheritance rules. The groups which are inherited from first will appear earlier in the list.
The list will not contain the holder.
a collection of the groups the holder inherits from
queryOptions - the query options
is querying for a permission via the luckperms api, several times a minute heavy?
or should i do that via the bukkit api
(please ping me when you reply)
Probably fast with LP? But I doubt it's a big difference @granite marlin
so it isnt heavier than bukkit api right?
Shouldn't be
gibt es die möglichkeit sich den group suffix zu holen?
is it possible to get the group suffix?
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
!api
Learn how to use the LuckPerms API in your project.
Load the user
Does User#getCachedData().getMetaData().getMetaValue(key); not get inherited meta?
afaik it returns whatever is shown in /lp user <user> info
I mean in reality it's the other way around, what's shown in user info is what it gets from the cached metadata
oh it works now weird
What's the supported ChronoField units in the Instant class of the Expiry?!
I tried NANO_OF_SECONDS and that returned 0. I just want the seconds duration of the temp group
(Please ping me when reply)
Yes, I just used ur method above to get the expiry of the inherted group of the player.
Instant expiry = user.getNodes(NodeType.INHERITANCE)
.stream()
.filter(Node::hasExpiry)
.map(Node::getExpiry).findFirst().orElse(null);```
I didn't put any contexts for the temp group, I set it by:
/lp user myName parent addtemp VIP 3d
by "context" I mean "what's the context of your question"
what do you want to get exactly?
I want to know how can I get the seconds from the instant duration because I want to calculate it to days
or how can I get the days directly
Instant.get(ChronoField.WHICH_ONE);
I believe there is a Node#getDuration() method, returns a Duration between now and the expiry instant
getExpiryDuration
well, The Node#hasExpiry() will return true when the duration is set right?
mhm = yes
oh thanks didn't know it
https://nexus.lucko.me/repository/maven-central/
Can we use this maven central mirror repository in our own projects? its says for we ask so....
ehm I guess Im here
You can just include mavenCentral() as a repository
It should include it then I believe
@brave lion
<repository>
<id></id>
<url>https://repo1.maven.org/maven2/net/luckperms/api/</url></repository>
what shall i write into <id> field?
I am using code of luckperms to make a similar dependency manager
And it was there saying that maven didnt like we use maven central to CDN
And it also said there I shouls first ask for permission before using his repo so...
As I cant create my own mirror rn...
Iirc its fine to use luckos for yoir own use
But for bigger you need to contact him
I mean its a public plugin
But its only in 100 servers rn...
So should I contact him or its fine?
I'd contact him
Are DM open?
Not sure, check https://lucko.me/contact
Ok gonna try
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
d;lp UserManager#loadUser#join
@NonNull
default CompletableFuture<User> loadUser(@NonNull UUID uniqueId)
throws NullPointerException```
Loads a user from the plugin's storage provider into memory.
the resultant user
uniqueId - the uuid of the user
NullPointerException - if the uuid is null
5.3.42
!update
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Nukkit and Velocity.
Why this wont change the primary group?```
User user = api.getUserManager().getUser(p.getUniqueId());
user.setPrimaryGroup("rookie");
api.getUserManager().saveUser(user);```
Because by default the primary group is calculated based on your parent group list
If you're trying to change the parent group, I suggest you check this out, it has an example just for that https://github.com/LuckPerms/api-cookbook
getUserManager().getUser(player.getUniqueId()).getPrimaryGroup(); is the color of the group included in the returned string?
It returns the group name
how can i get the color of the group?
Where did you set the colour?
is that not possible with luckperms? Im just new to the API and the server admin configured the plugin... I think anywhere exists a config file with the data i'll ned
LP doesn't have any sort of storage for a color for a group. Depending on how the admin set it up, it could be in the prefix, in the group name, stored in a meta, etc
You can use meta nodes
Okay thank you, that was helpful.
what plugin name shall i add if im using Luckperms on bungeecord in my plugin yml, just depend: ["LuckPerms"] ?
Yeah
manager.getAdvancements().forEach(adv -> {
Group group = luckPerms.getGroupManager().getGroup(adv.getName().getKey());
luckPerms.getUserManager().modifyUser(offlinePlayer.getUniqueId(), (user) -> {
Node node = InheritanceNode.builder(group).build();
user.data().remove(node);
});
});``` so i have this removing all related groups when i need to, but it only removes a portion of the groups for some reason (i assume because it's trying to remove them all asynchronously)
wondering if maybe this would do it more linearly and cause less problems java luckPerms.getUserManager().modifyUser(offlinePlayer.getUniqueId(), user -> { manager.getAdvancements().stream() .map(Advancement::getName) .map(NameKey::getKey) .map(luckPerms.getGroupManager()::getGroup) .map(InheritanceNode::builder) .map(Builder::build) .forEach(user.data()::remove); });
Yeah just put the forEach (and subsequently the getGroup etc) inside the modifyUser
That stream chain might be a bit overkill 😆
But it'll do the job
hi sorry, i can't understand the api written in the wiki. How can I do that if the player is in the "founder" group he does ...
If you just want to see if a player has a group, using the vault api is probably easiest
I have to do that if the highest group of the player is "founder" he does things
"founder" is an example, then I have to do with other groups
whats the best way to get the highest value of a permission, lets say i have a permission (bank.create.x) where x is an Integer value, whats the best way to get the highest x val
None with LP, that is just a regular permission LP does not distinguish from others, of course you can use streams to filter map etc but that's not something LP will do
Although you should really be using meta nodes for that
Essentially a key-value pair actually optimized for those kinds of lookups, check out the MetaNode and MetaNode.Builder
You can also specify in the LP config how a certain set of meta keys will be sorted (by value, by inheritance, etc. I don't remember the exact setting name, you can probably just Ctrl F "meta")
could I not get all nodes (aka permissions) starting with bank.create?
do you mean this String metaValue = user.getCachedData().getMetaData().getMetaValue("some-key");
Yeah
I mean you can get all nodes and filter those that start with whatever, but that is a regular permission node, not a meta node
ohh so I just save lets say 12 into a key and I can always get that? I am guessing that is persistant aka permanent?
Yeah meta nodes are like any others, with the difference LP optimizes for those lookups
I mean they are stored as strings
You can just Integer.parseInt, after all you know what to expect
so this is my method ```Java
public int getMetaDataInteger(UUID uuid, String key){
User user = luckPerms.getUserManager().getUser(uuid);
CachedMetaData metaData = user.getCachedData().getMetaData();
return metaData.getMetaValue(key, Integer::parseInt).orElse(0);
}``` but I get `java.lang.NoSuchMethodError: 'java.util.Optional net.luckperms.api.cacheddata.CachedMetaData.getMetaValue(java.lang.String, java.util.function.Function)'`
the error is on the return metaData#...
Screenshot /lp info
Yea I just noticed I have a pretty old version, I just updated and will retry
how would I return a specific meta type that a group or user has?
this is what I have from trying to read the javadocs but I feel like its wrong
Uh what are you trying to accomplish exactly?
im trying to get a defined meta from a player
like when you add a meta type to a group im trying to get that meta and then do something to the players that have that meta if that makes any sense
So you're trying to get the value for that meta key, right?
yes
Can I see how you're giving it in the first place?
like ingame or code?
Code
The issue with that is the idea is to predefine the meta ingame and then the code picks it up and dose the things its suppose to or would it be better to define it in code?
Uh I'm not exactly sure what you mean but I just want to see the part you add the node to the user and how it's being done
ah ok
Its suppose to be called when a command is ran
though again I dont think I did it right either
Yeah okay I see
Okay so the way you get the value from a user's metadata is basically like that: user -> getCachedData -> getMetaData -> getMetaValue(metaKey)
Keep in mind that getMetaValue can return null in the case of no value being present for that key
(also remember to save the user when adding the node :d)
thank you adding null checkers should fix that issue and ill remember : D
dose this work??
You should be able to not pass anything to getMetaData (not null, just nothing, no arguments)
If not make sure you're targeting an up-to-date API version, 5.3 is the current one
ok
hello everyone! I'm able to connect to the API and get the sender of a command's permissions. I want to see if a permission's value is true in the context of the world that the player is issuing the command. I'm not seeing an obvious solution, but I'm probably overlooking it. Any help is appreciated!
What have you tried?
You could just use the bukkit CommandSender#hasPermssion method tho?
again, I can grab the sender's permissions no problem. The issue is say I have a permission that in the context of a particular world is false, but in the context of another world is true. As I loop through and obtain the user's permission nodes, I also want to check to see if it is true or false in the context of the current world.
I'm sure I'll have to pass in the current world information for comparision, but how do I get that permission node's context information and value (true or false)?
Why do you need to check the specific permission for the world the player is currently in?
What's preventing you from doing player.hasPermission(perm)?
@lyric ferry
how would I check if a user has or inherits a specific group?
I see examples for listing all of them etc but was hoping there was something direct
d;lp permissionholder#getinheritedgroups
@Unmodifiable @NonNull
Collection<Group> getInheritedGroups(@NonNull QueryOptions queryOptions)```
Gets a collection of the Groups this holder inherits nodes from.
If Flag.RESOLVE_INHERITANCE is set, this will include holders inherited from both directly and indirectly (through directly inherited groups). It will effectively resolve the whole "inheritance tree".
If Flag.RESOLVE_INHERITANCE is not set, then the traversal will only go one level up the inheritance tree, and return only directly inherited groups.
The collection will be ordered according to the platforms inheritance rules. The groups which are inherited from first will appear earlier in the list.
The list will not contain the holder.
a collection of the groups the holder inherits from
queryOptions - the query options
i suppose you can use this @twilit jasper ^
@nocturne elbow nothing. I can do that easily. That's not the question, however. I'm looking for more than if they have the node, I'm also looking to see if the value is true for the current context
Hey N1ghtBreak3r! Please don't tag helpful/staff members directly.
Isn’t that what hasPermission will return alr as long as you have luckperms installed correctly?
Unless you are saying you want to get the context value or smt
ok. So to put it in full context, I am creating a plugin that works with help files. As part of the plugin, I need to see what groups the sender belongs to. This part is very easy to accomplish. However, there may be group nodes that exist in the player's list but are false for the world that they are in (for example, the group Factions exists in their list but it is currently set to false because they are not currently in the Factions world - this prevents them from having the factions permissions in the current world). In my plugin I only want to display the help files for the commands that they have access to based on the world that they are in.
Right now I can see the .txt files that list the commands for Plot world and Factions world but they are in the Plot world and should not see the Factions. My question is if there is a method I can import that allows me to see if the group node is currently false so that way I can tell my plugin to not display that factions help file as an option for the user to choose from.
If the parent group has a world context, they will not inherit it if they are not in said world
Also group nodes set to false don't really have an effect
How are you currently checking all this?
How do I subscribe to offline user parent updates?
NodeAddEvent/NodeRemoveEvent/NodeMutateEvent
Check that the target is a User and that the node type is of NodeType.INHERITANCE
d;lp GroupManager#createAndLoadGroup
@NonNull
CompletableFuture<Group> createAndLoadGroup(@NonNull String name)
throws NullPointerException```
Creates a new group in the plugin's storage provider and then loads it into memory.
If a group by the same name already exists, it will be loaded.
the resultant group
name - the name of the group
NullPointerException - if the name is null
Thx, if will be a problem, I will write 😉 Sry for my English
Can I make in programming my permissions? Not in the game
!cookbook has 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.
Well yeah.. who else?
It seems Player#hasPermission() can't catch Luckperms temp permission..
How can I catch it?
if (!p.hasPermission("jobs.boost.all.all.1.2") || !p.hasPermission("jobs.boost.all.all.1.5")
|| !p.hasPermission("jobs.boost.all.all.2")) {
return ChatColor.GOLD + "Test" + ChatColor.WHITE + " : " + ChatColor.RED + ChatColor.BOLD + "✘";
} else if (p.hasPermission("jobs.boost.all.all.1.2")) {
return ChatColor.GOLD + "Test 1.2" + ChatColor.WHITE + " : " + jobs120pNode.getExpiryDuration().toMinutes();
} else if (p.hasPermission("jobs.boost.all.all.1.5")) {
return ChatColor.GOLD + "Test 1.5" + ChatColor.WHITE + " : " + jobs150pNode.getExpiryDuration().toMinutes();
} else if (p.hasPermission("jobs.boost.all.all.2")) {
return ChatColor.GOLD + "Test 2" + ChatColor.WHITE + " : " + jobs200pNode.getExpiryDuration().toMinutes();
}
I tried
But It always return "✘"
Are you sure you have (or inherit) all of the 3 permissions?
Yep
I tried other forms of code, but it didn't work too.
if (p.hasPermission("jobs.boost.all.all.1.2")) {
return ChatColor.GOLD + "Test 1.2" + ChatColor.WHITE + " : " + jobs120pNode.getExpiryDuration().toMinutes();
} else if (p.hasPermission("jobs.boost.all.all.1.5")) {
return ChatColor.GOLD + "Test 1.5" + ChatColor.WHITE + " : " + jobs150pNode.getExpiryDuration().toMinutes();
} else if (p.hasPermission("jobs.boost.all.all.2")) {
return ChatColor.GOLD + "Test 2" + ChatColor.WHITE + " : " + jobs200pNode.getExpiryDuration().toMinutes();
} else {
return "X";
Do you give the permissions to the users themselves or are they inherited?
I use /lp user (nickname) permission settemp (permission) true (time) command.
Alright run and screenshot:
The output of whatever that is ^ (command, event, anything that triggers that)
/lp user <user> permission info
/lp user <user> info
Also what are those jobs***pNode variables exactly..? Where are they coming from
Using this form of code
And variables from PermissionNode
PermissionNode mc150pNode = PermissionNode.builder("mcmmo.perks.xp.50percentboost.*").build();
PermissionNode mc200pNode = PermissionNode.builder("mcmmo.perks.xp.double.*").build();
PermissionNode mc300pNode = PermissionNode.builder("mcmmo.perks.xp.triple.*").build();```
Like this
Uh I need the full output of the commands as well
Please use https://paste.lucko.me to send files in the future. I have automatically uploaded message.txt for you: https://paste.lucko.me/vAeetToH9j
I couldn't understand what kind of command you are saying because my English is not good. but, I brought the LP information command.
So you checked the result of the mcmmo one, right?
yes
I mean as far as I can see it's working as intended
You are checking for hasPermission("mcmmo.perks.xp.triple.*"), not "mcmmo.perks.xp.triple" which is what you have
No worries
Can I make permission in my program?
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.
Guys how set player group in luckperms api i have this code:
api.getUserManager().loadUser(player.getUniqueId()).get().setPrimaryGroup("vip"); api.getUserManager().saveUser(Objects.requireNonNull(api.getUserManager().getUser(player.getUniqueId())));
!cookbook has an example iirc
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
yes it work but, it not delete old group player:
its not work
what about it doesn't work?
Player has primary group - default not deleted..
hm, screenshot /lp info
uh this is not general LP help, this is for API help (programming), which more often than not it does not involve direct user usage :d
the whole thing please
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Nukkit and Velocity.
I know but I think that he can do this in the editor
I mean yes of course you can but maybe they are doing a plugin that automates some stuff, or gives ranks based on achievements or whatever
hm?
I don't
Yes it work thx ❤️
Can this also be done on a Bungeecord or not? Cause it seems that this does only get triggered when the desired player is online?
How would I set meta with a server context? I'm using the example as shown here https://luckperms.net/wiki/Developer-API-Usage#setting-metadata
events are not propagated throughout the network if that's what you're asking
it will only fire wherever it originated
if you want to detect it in other LP instances you should listen to LogReceiveEvent I believe and "manually" parse the contents of the logged action
check the withContext methods in the NodeBuilder (while you're building it, before it's built)
Alrightyy
thank you! lastly, I am trying to perform a lookup of a meta value on a server context, how would I find meta values on a User that have the server context?
if(p.getSubjectData().getOptions(SubjectData.GLOBAL_CONTEXT).containsKey("my_meta_value")){
I want something like this but it takes in to account server context with LuckPerms.getServerName()
ok so i believe it is
user.getCachedData().getMetaData(QueryOptions.contextual(???));
but i'm unsure on how to get a ContextSet to go inside where i have marked ???
nvm found it on docs https://luckperms.net/wiki/Developer-API-Usage#the-basics-of-context
If you're only wanting to get a single ContextSet with a single key/value, check out ContextSetFactory.immutableOf(String key, String value)
Hey guys so I'm trying to use the SuffixNode Node in the API, it all works fine and is adding the Suffix correctly. However, after restarting the server the suffixes disappear for some weird reason. Is there anyway to prevent this?
Are you saving the user?
As soon as you typed that I saw it on the API, that's what I was missing. Let me try it now 😄
Yep works. Thank you!
Does User.getCachedData() only work if the User has logged in since server has been online? Even if they have logged in previously? I'm getting nullpointer when running .getCachedData().getMetaData() on a User that hasn't logged in yet since restart (but has previously).
How do I access the metadata for Users that haven't logged in yet to have their data cached, but have previously logged in so have records in LP database?
List<Node> metaNodes = user.data()
.toCollection()
.stream()
.filter(node -> node instanceof MetaNode)
.filter(node -> ((MetaNode) node).getMetaKey().equals("my_meta_key"))
.collect(Collectors.toList());
am i missing an easier way 😄
getCachedData will work regardless of if the user is online or not
Are you loading it first?
How would I load it? Sorry i'm relatively new to the API 😅
Just so you know, you don't store User instances in fields and variables indefinitely
You load the user, use it inside the relevant methods and then just forget about it (save changes if necessary)
Check out the 2 main API pages on how to load user data for offline players and all that
!api
Learn how to use the LuckPerms API in your project.
Those first 2 links
!cookbook this repo has a few examples you might find useful for seeing "real life usages"
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
How do I change parents of players? I can't find the Node for this?
!cookbook has 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.
thx
Anyone know why MAven wont grab my luckperms api
IntelliJ screwed up like twice. Its not grabbing Luckperms XD
!api make sure you're going about this the right way- follow the steps on here
Learn how to use the LuckPerms API in your project.
yep


