The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
#luckperms-api
1 messages · Page 5 of 1
hi i was wondering how i could get a list of all ranks on a server?
with a command or with java?
java
.map(InheritanceNode::getGroupName)
.collect(Collectors.toSet());```
wait thats wrong
thats users groups i think
will this work?:
Set<Group> groups = luckperms.getGroupManager().getLoadedGroups();
looks like it would try and lmk the outcome
will do!
yep so this worked, i used the code bellow to simply output the names of each rank
Group [] serverGroups = groups.toArray(new Group[groups.size()]);
for (int i = 0; i < groups.size(); i++) {
player.sendMessage(serverGroups[i].getName());
}```
Perfect!
Hi therre! Currently have an issue where my code always runs the first if regardless of which group I'm in. Any ideas?
{
topText = "§a§lTerritory of The Melon Marauders";
if(player.hasPermission("group.pumpkin")) {
bottomText = "§cPillage to your hearts intent!";
}
if(player.hasPermission("group.melon")) {
bottomText = "§aProtect it from intruders!";
}
}
if(regionsNames.contains("pumpkin"))
{
topText = "§6§lTerritory of The Pumpkin Patriots";
if(player.hasPermission("group.pumpkin")) {
bottomText = "§aProtect it from intruders!";
}
if(player.hasPermission("group.melon")) {
bottomText = "§cPillage to your hearts intent!";
}
}```
No matter which team the player is on, it displays the first if statement. swapped it to be sure
Hello I want to give a player a Luckperms Group. Nothing changes with my code. It's on a bungee cord server with mysql as the database
I've already tried that out. Nothing happens either.
are you op or do you have * perm?
That is the correct way yes, additionally, if you want to push the change to the other servers, see #luckperms-api message
What has to go in the variable "CompletableFuture<Void> future"?
Hey guys, quick question, how do you go about using the mod (not the api, I already have that implemented) as a runtime only dependency in forge/gradle? It crashes my server everytime and it would greatly save me time so I don't have to compile the mod and move it to a separate server. I'm getting it from cursemaven with the fg.deobf function
@fast delta y I change the group and send it to the server right?The group exists. Why does not it work?
Hey iloveecobrakai! Please don't tag helpful/staff members directly.
It's currently being ran through a plugin not through myself. but I myself am opped yes
ohh are you saying that since im opped I have all permissions
EYY it works thank you <3
i added this
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>
Have you tried restarting your IDE?
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
do i have to do this
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
bc this dont work for me...
Doesn't work in what way?
using Intelij IDEA I assume?
yep
Have you reloaded maven / gradle in IJ since adding the LP dependency? (in the pom.xml / build.gradle[.kts] there should be a little reload button in the top right)
In the file browser on the left, there should be a "External Libraries" section (or something along those lines), is LP listed under there?
no only my maven and jdk files
right side of the IDE, there should be a maven tab. In it at the top should be a reload project button. Hit it, and see if there's any errors pertaining to LP (it'll take a minute)
"now"*?
yes now
...wat
ok well glad it's working, but if you'd reloaded maven from the pom.xml already that shouldn't have fixed it...
meh whatever if it works it works
true
How can I implement the API for a 1.8.9 server? Is it the same version? (in my plugin i mean)
LP isn't MC version-dependent, it works exactly the same on 1.8.9 and 1.20.1
Alright, thank you
@EventHandler
public void onFirstJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
if(!p.hasPlayedBefore()) {
User user = luckPerms.getPlayerAdapter(Player.class).getUser(p);
user.data().add(Node.builder())
luckPerms.getUserManager().saveUser(user);
}
}
I am not sure what Node should I use If I want to set the player Context
Do you want to set a context on the node, or add a context to the player?
Add a context to a player like the commnad /lp user <user> parent add <group> world=lobby
That's just adding a context to the node, I can understand if I was a bit unclear though
If you're trying to replicate that, you want an inheritance node, but the context stuff is all on the generic Node - all node types support contexts
Ok thanks, I think I understand. Can you myb give me an example please
!cookbook should have one
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
I read the wiki but there aren't any examples of the "context" thing and it's pretty difficult to understand
@EventHandler
public void onFirstJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
if(!p.hasPlayedBefore()) {
User user = luckPerms.getPlayerAdapter(Player.class).getUser(p);
user.data().add(Node.builder("world").context(new ContextSet("lobby")));
user.data().add(Node.builder(luckPerms.get).build());
luckPerms.getUserManager().saveUser(user);
}
}
I am trying to create a new context there is nothing about it in the wiki and I couldn't find any good resource about this
I'm using the latest version of LuckPerms and the API but when I try getting the prefix from the group metadata it returns null (group.getCachedData().getMetaData().getPrefix()). The metadata isn't null so its a problem with the prefix.
Does anyone know what im doing wrong?
K
it should get the group prefix though
oh nvm i used it on the group and its none too
but it shows up above my character and in the tab menu?
nvm i fixed it
Do i need to add luckperms as a dependency (in plugin.yml) to use it in my plugin on onEnable? Otherwise in what event do I load it?
yes
ty
new BukkitRunnable() {
@Override
public void run() {
Group group = luckPerms.getGroupManager().getGroup("mostwanted");
if (group == null) {
this.cancel();
}
group.getNodes().forEach(node -> {
if (node.getType() == NodeType.INHERITANCE) {
group.data().remove(node);
}
});
String playername = PlaceholderAPI.setPlaceholders(null, "%ajlb_lb_notbounties_bounty_1_alltime_name%");
Player p = Bukkit.getServer().getPlayer(playername);
if (p != null && p.isOnline()) {
User user = luckPerms.getPlayerAdapter(Player.class).getUser(p);
user.setPrimaryGroup("mostwanted");
}
else {
Bukkit.getLogger().info("bozo not online");
}
}
}.runTaskTimer(this, 0, 10 * 20);
}
Everything is going well but the player doesn't get the "mostwanted" rank I think I use "user.setPrimaryGroup("mostwanted");" wrong
This is too advance for me lol. How do I save the user?
Does anyone know how I can reset the group member list using the LuckPerms API?
group.getNodes().forEach(node -> {
if (node.getType() == NodeType.INHERITANCE) {
group.data().remove(node);
}
});
This is what I was trying to do but it isn't working
save the group
I added luckPerms.getGroupManager().saveGroup(group); after the code but it still not removing the players from the group
groups dont have players, players have groups
So I need to loop all the players in the group and remove the group from the loop player?
yes
there is also the bulkedit command, im not sure if it does anything special, but you can try looking at that
Thanks I will try 😉
Are you using the LuckPerms API?
If this is not a question about using the LuckPerms API, please use #support-1 or #support-2 instead.
Hii, is if(Data.PermsAPI.getUserManager().getUser(uuid).getCachedData().getPermissionData().checkPermission(permission).asBoolean()) return true; the right way to ask if an offline player has a specific permission?
how can i promote a player with the api?
no, for offline players you need to load the user, see
https://luckperms.net/wiki/Developer-API-Usage#distinction-between-online--offline-players
with the TrackManager, get the Track and promote the user
https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/track/TrackManager.html#getTrack(java.lang.String)
https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/track/Track.html#promote(net.luckperms.api.model.user.User,net.luckperms.api.context.ContextSet)
so how can I ask if an offline player has a permission? I dont get it
thx
Nothing happens when promoting, why is that?
thx for the help
uh there are like 4 or 5 different places where you can achieve that lol
search for "getContext" in the jd https://javadoc.io/doc/net.luckperms/api/latest/index.html
How can promote player with global context?
pass ImmutableContextSet.empty
thx
restart intellij
jesus..
thanksxddd
no
wai
t
not working
I didn't say it, it's still working
why do you have the jda dependency inside?
i want a sync pl
with lp api usage
any1 know what the problem?
reload maven over this
if it still doesn't work then go to "C:\Users<name>.m2\repository\net" and delete the luckperms folder and reload then maven again
thanks, it's working
not problem
can you help me in support 1 since no one else does. since you do look like you know alot about luckperms.
Cross posting is not going to get you a response faster. Keep your questions on the appropriate channel and be patient. Someone will be able to assist you shortly.
im in a hurry tbh sorry if i came out as a inpatient person.
hey how can i get a player rank? Example if player use a "/rank" command plugin reply to user with this msg: "Your rank is: RANK"
@potent birch https://luckperms.net/wiki/Developer-API-Usage
Set<String> groups = user.getNodes().stream()
.filter(NodeType.INHERITANCE::matches)
.map(NodeType.INHERITANCE::cast)
.map(InheritanceNode::getGroupName)
.collect(Collectors.toSet());
i mean to maven project
but i think i found it
thanks again
hello, can someone tell me, or point me right way onto making plugin that will give players permision based on if placeblock event is triggered
I
I need to access the "voicechat=true" context, and I don't see a way of mentioning "player" in getContext in the javadocs
uh yeah you can pass the platform's player type there (Player/ProxiedPlayer/ServerPlayer etc)
what are you confused about? we cant help if you just complain about it seeming hard
im trying to integrate the luckperms API into my server.
In this scenario i am trying to limit the amount of custom homes a player is allowed to have based on their rank. There are 3 ranks, including the default one a player has upon joining the server. A player can have multiple ranks at the same time, and i am trying to receive the highest one they have. for this i use
public String getHighestRank(LuckPerms luckPermsApi, UUID playerName) {
User user = luckPermsApi.getUserManager().getUser(playerName);
if (user != null) {
Optional<String> highestRank = Arrays.stream(SlotConstants.hierarchy)
.filter(rank -> user.getNodes().stream().anyMatch(node -> node.getKey().equalsIgnoreCase(rank)))
.findFirst();
return highestRank.orElse("DEFAULT");
}
System.out.println("user was null, returning default");
return "DEFAULT";
}```, this method returns DEFAULT for any user, no matter of their rank tho. The user was null message (yes, i should use a logger) is not displayed in the console which makes me assume i messed up something else? the ```SlotConstants.hierarchy``` is a String[] defining what ranks are "more important" than others. (i assume there is some nice way of using luckperms for that, but i havent been able to figure that out) ```String[] hierarchy = new String[]{"default", "astral", "nebula", "cosmic"};``` any ideas why it is not working or how to fix it?
i would suggest using meta for this instead. you can assign a meta value for how many homes members of that group can have (/lp group <group> meta set max-homes <number> is the command), and then you can get the meta value for a player using the api ( https://luckperms.net/wiki/Developer-API-Usage#store-and-query-custom-metadata )
the meta values will be inherited from groups the same way permissions are
oh great
you found the method
you sent a screenshot of the exact method you can use
what else do you need lol
how did you make that prefix?
How I can create a new group that inherts from the default group?
Is this actually an API question?
nvm
i'm having a really hard time understanding how to use the API as someone who doesn't regularly use java. how do i get a player's prefix?
i'm trying to make a placeholder that takes the player's heaviest prefix and re-serializes it with Kyori Adventure library instead of using legacy text formatters (&8 &l etc.) cause that's breaking one of my other plugins. i tried changing the prefixes in luckperms to have the adventure format (<gray> <bold>) but it didn't seem to work. i've deleted and redone my code like 8 times and im getting very frustrated. does anyone have any ideas that im missing?
!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.
as for the format, thats not part of adventure, its part of minimessage
you have to pass that through minimessage if you want to get components from it, otherwise it is just raw text
(But MiniMessage is part of adventure)
does the cookbook have a recipe on context?
is there a way to tap into the luckperms API for the username caching?
im hoping for a "pure" uuid/username mapping. Im wanting to utilize it in making my own plugin easier to develop, as I will be storing UUIDs but would rather not have to cache the usernames myself.
the luckperms api is not for using implementation details of luckperms
especially in this case as you can disable luckperms uuid cache in the config
Can I set temporary groups through the API?
not sure how i'd do it, googling it isn't too helpful either
I know I can set their primary group, however not sure about how I'd go about setting temporary groups or if thats even possible
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.
Read more
Example usages
Read the Javadoc
Ahhh thank you 😭 I forgot that groups were also nodes 💀
My bad
???\
How do i get the players primary group?
what do you need it for? players can be in many different groups, so asking "what single group does this player have" may not always be the best idea
Its for when you die it sends a message on discord and it that message i want it so it sends your group (the group with the highest priority)
why not just use their prefix?
!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.
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
I have been looking for some time now and i cant find it
КТО РУСКИЙ
I seem to be having trouble removing a temp permission. I give it with: java Node n = Node.builder(permission).expiry(duration, unit).build(); user.data().add(n);
But then removing it with user.data().remove(n) and also trying user.transientData().remove(n) doesn't work. What am I missing?
Hmm, worth mentioning it's a group.x perm
was trying to set a temp group perm
Nvm, another way about it was getting the node off the user with a key string match and then removing that node
Hello. Is it possible to get a player's group if he is offline?
Can I use LP API in a Bungee plugin? For example to message players with a certain perm and get player's prefix etc
Yes, the LP API is avaliable on any platform that you have a LP plugin installed on.
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
hi all. im trying to use the LuckPermsAPI for my plugin on 1.20.1, but the plugin doesn't run and throws this error in the console: java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms (https://pastes.dev/OaEDOsoSZe)
i added dependency in plugin.yml:
name: Shapey
version: '${project.version}'
main: com.auriny.mc.shapey.Shapey
author: auriny
depend: [LuckPerms]
api-version: 1.19```
i added dependency im pom.xml:
```xml
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>```
i added this in bukkit `onEnable()` method:
```java
private void setupLuckPerms() {
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
@NotNull LuckPerms luckPerms = provider.getProvider();
}
}
@Override
public void onEnable() {
instance = this;
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
setupLuckPerms(); //here is setup method
System.out.println(Bot.bot);
}```
/pl command:
> > pl
> [17:31:52 INFO]: Paper Plugins: (1):
> [17:31:52 INFO]: - Shapey
> [17:31:52 INFO]: Bukkit Plugins: (4):
> [17:31:52 INFO]: - HideNametag, LiteBans, LuckPerms, spark
im using luckpermsapi v5.4 and luckperms 5.4.98 and idk what im doing wrong
please help me!
bump?...
According to the cookbook you can use this to get the LP instance. It's a small difference from what you have. Can you give it a try?
where should i put this? instead of this?
i tried this and still not works... i changed version from 1.20.1 to 1.19.4 and plugin can't start :(
Personally I use a different method to get the LuckPerms API Provider
anyway, my server won't start even with an empty plugin that only has this:
name: untitled1
version: '${project.version}'
main: com.auriny.mc.untitled1.Untitled1
depend: [LuckPerms]
author: auriny
api-version: 1.19
package com.auriny.mc.untitled1;
import net.luckperms.api.LuckPerms;
import org.bukkit.plugin.java.JavaPlugin;
public final class Untitled1 extends JavaPlugin {
@Override
public void onEnable() {
LuckPerms luckPerms = this.getServer().getServicesManager().load(LuckPerms.class);
//or this:
/* @Override
public void onEnable() {
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
}*/
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}```
```xml
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>```
verry strange
yes
you're specificng the dependency thing wrong in it
1 sec
dependencies:
server:
LuckPerms:
load: BEFORE
required: true
that
I believe
oh i'll try now
omg it worked!! thank you!!!!
how to execute something when temp group ends?
i found NodeRemoveEvent but idk how to work with it
that's the right event
check that the node is an InheritanceNode and that it hasExpiry and hasExpired
Hello, I'm currently developing a plugin extension that uses the LuckPerms API. I'm using maven, and on packaging, I'm receiving this error:
https://pastes.dev/1vusproShk
Here is the relevant code which I believe is causing the error:
https://pastes.dev/fvhgg6utUZ
I realize that this is more of a me issue than a problem I'm having with LuckPerms, granted that I can't even package it without an error. Again, this isn't a running on a server, the error arises on maven packaging. I understand if this isn't the right place for this, but if anyone would be able to help me out, it would be greatly appreciated.

Uh oh, sorry :(
can you share your pom config?
I haven't used maven in ages but, do you have a test suite you're running with maven?
I'll be honest, I haven't used maven myself very much, so I'm not even sure what you're talking about. I'll get that pom though.
Here's the pom.xml -> https://pastes.dev/Jr1z48cGP7
I ran with the -e switch, and got the full stack trace: https://pastes.dev/cMlttdabvN
uh yeah no idea lol, I assume it's one of those many maven plugins trying to run stuff at build, but, I don't exactly know what it could be, I see you have annotation processors stuffs (which do run during build) but that's about it
I had it working fine, until I switched to using the user.getNodes().stream() method of reading user data. That's why I'm so confused, because it was working, I changed only that, and now it's broke :/
Thank you for your time and effort though :)
Yup, it packages fine without this https://pastes.dev/fvhgg6utUZ specific section. I'm stumped.
More specifically, these lines,
.map(v -> v.equals(world)).orElse(false))```
When I have it, it doesn't package. If I remove it, it's fine.
thank you, i'll try
how to set a player prefix with the api
setting a player a custom prefix with api
Are you trying to display the prefixes in chat or only set the prefix meta for the group?
LuckPerms does not add prefixes into chat, you need a chat formatter for that.
Is it possible to store a list in a user's meta? I have tried writing a list in the user's YML file (using yaml storage), but it seems to percieve the value as [a,b,c] when I access through a command.
I have the following code:
Map<String, List<String>> meta = user.getCachedData().getMetaData().getMeta();
Which returns the List<String>, which leads me to believe that it's possible to have lists as meta? Not sure, can someone clarify?
reason it returns a multimap is because you can have two meta nodes with the same meta key but different values, for example
meta.discord-role.703975641728548874
meta.discord-role.420316139986485250
but for a single meta node you need to put a single value (a single string)
Ahh I see. Thanks for the clarification! :)
String group = "irregular_militia";
InheritanceNode node = InheritanceNode.builder(group).value(true).build();
User user = LuckPermsProvider.get().getUserManager().getUser(player.getName());
user.data().add(node);``` doing this seems to be quite glitchy. Am I doing it wrong?
That's how I do it, just make sure to
api.getUserManager().saveUser(user);
Is there a way to set the server context with the api?
I mean that what is normaly set via the server config option.
why not just add your own instead of trying to hijack the built-in contexts?
That would also be an idea, I just thought it might make sense to use the "server" context, since I basically just wanted to use the group name from my CloudSystem as the server name.
because i would have to copy the entire luckperms config into all my server templates. if i then want to change a config value, i have to update it again in all 10 templates. but there is a global template which i want to use, i only need to change this one value to the server group name.
I believe you can override settings via system properties and environment variables
which comes in very handy when you're deploying containers
just, uh, I don't remember the props/vars key syntax lol
@fathom talon
luckperms.<config key> for system properties, LUCKPERMS_<uppercase key> for env vars
Hello !!
For the luckperms API is there a way to "freeze" the remaining time for a permission?
Cauz I wanna do a fly systems, that only decrease when a player is fly
Nope, node expiry is stored as a timestamp for when it expires. You'd need to manually push the timestamp to extend the time
That being said, LP only audits temporary permissions every 3 seconds anyways, so using LP to manage time remaining for flight may not be the best option. Might be better to store that data yourself
yup think so too thank you !
Could someone provide an example of using the Luck perms API in a bungee environment, try as I might, I have been unsuccessful in trying to use it
The only platform-specific part is getting access to an api instance, from there everything is the same
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
What is the equivalent to RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); in bungee
first link above ^
The docs do not mention bungee implementation at all and I dont know what would be equivalent to that line.
You'll notice there's 3 options for obtaining an instance, of which only 2 are platform-specific
if i want to use the luck perms api in my own plugin to check if a user has a certain group, etc, is it necessary to do the RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);? I am fairly new to developing in java and plugins, so i am confused by the part written here (obviously you need to be writing your plugin for Bukkit!)
because i see here in the docs it says to use User user = luckPerms.getPlayerAdapter(Player.class).getUser(player); where does the provider come into play there?
provider.getProvideR() would return LuckPerms
oh, alright. thank you!
so in your main class (or wherever) you'd have sometihng like
private LuckPerms luckperms;
onEnable() {
(provider stuff here)
luckPerms= provider.getProvider();
}
great ,thank you
if you just want to check if they inherit a group (either directly or indirectly from a parent of a parent), you can just do a normal permission check for group.<group name>
for the above do you recommend starting at the top and working your way downward for inherited groups?
basically Im trying to figure out their highest group from a track. i am writing a discord bot that when they link it will sync up all of their roles and stuff from mc into the discord so i dont have to manage multiple sets of data
theres probably a way to just get the highest group a player has on a track
is there like a "getHighestGroupFromTrack(Player)" type thing?
theres a "highest on track" prefix/suffix placeholder, so if there is such a thing, that would use it
do i need to go look at the lp source ?
there is %luckperms_current_group_on_track%
how do i use this logic in my code though? i don't want to use a placeholder i just want to get that group object
can look at github.com/luckperms/placeholders
i think this might be it https://github.com/LuckPerms/placeholders/blob/95afaa4717c0abf0d4c5e5787863d53b269021d7/common/src/main/java/me/lucko/luckperms/placeholders/LPPlaceholderProvider.java#L258 -- not sure how to use it
just doing all of the same sorta stuff you'd need to do manually i think. i guess that means there's no helper for it
i think im good though. thank you for pointing in the right direction
unsure on queryOptions though
could you help me understand what the queryOptions are for this particular placeholder query? because I am trying to replicate the logic
i cannot
alright
how can i get a group prefix value
Hi, i wanna know if i add LuckPerms to my server, Can i use the api to connect LuckPerms to my custom website, I'm making an admin tool online that can make a lot of thinks. So, can i use LuckPerms API to connect it to my website, with GET POST etc... ?
Hey how i can check if player has specific group and get expiry time for it using LuckPerms API ????
How do I change not valid username/uuid
LP Standalone has a REST api, though documentation for it is limited
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
Is this api-related or just you having problems with geyser usernames?
Hey, how can i put a player in a group when for example he buy something?
Hi, I have a problem. When a player has the default group and he dies he correctly loses his inventory. But when the player has the founding group he keeps all his inventory, and his stuff is dropped on the ground, is it possible to have help?
Oh sorry
luckperms have a sql support ? or am i do custom with api
and luckperms have a bungeecord or velocity support ? if has can i do custom permisisons per server ?
!network
If you run a BungeeCord network, learn how to correctly setup LuckPerms on all server instances (including Bungee).
Also read:
Syncing data between servers
can u answer me second question ?
!context
You can set a permission or group on a per-world/per-server basis, through what we call "contexts".
Read more
#support-1 for future usage questions
!storage
LuckPerms allows you to store data in a variety of storage types, read about the benefits and drawbacks of each type on the wiki.
Read more
ah ty
Is there any way to remove all the permissions and groups from the player?, currently I am only able to remove everything but group.default
userManager.modifyUser(user.getUniqueId(), (modifiable) -> modifiable.data().clear((node) -> {
if (!nodes.contains(node)) {
nodes.add(node);
plugin.console().send("Removing node {0} from {1}", Level.INFO, node, player.getName());
}
return true;
}));
you can’t remove default group
if they have no perms or groups they’ll have group.default
(any user with zero data will automatically be given group.default, any user whos only data is group.default won't have any data saved)
this is happening and i have no clue why, could anyone help me?
well did you declare luckperms as a dependancy of your plugin?
yes
show where you’re using luckperms
i sent the command
what
idk what you meant
when i use this to add a node, it will add a world context in it. how can i add a node without context.
can someone vc and help me
No, but you can use this channel and tell us what's going on.
i tried
make sure you aren't shading LuckPerms into your plugin
open your jar with 7zip/WinRAR or something, see if you can find LuckPerms classes inside your jar file
it shouldn't
should i just delete it
how are you building your plugin? maven gradle
maven
make Sure you have <scope>provided</scope> in the LuckPerms dependency

hey im new to the luckperms api and im wondering how i can the players current group and then the prefix
I'm writing a plugin which uses the LuckPerms API to display player's prefixes in chat.
To use the LuckPerms instance I use a constructor in my listener class.
private final LuckPerms luckPerms public ChatListener(LuckPerms luckPerms){ this.luckPerms = luckPerms; }
To get it in my onEnable i use
this.luckPerms = LuckPermsProvider.get(); getServer().getPluginManager().registerEvents(new ChatListener(this.instance, this.luckPerms), this);
When I load my plugin the console says that the API isn't loaded yet.
I also tried to retrieve the API instance by using
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); if (provider != null) { this.luckPerms = provider.getProvider(); }
and
this.luckPerms = getServer().getServicesManager().load(LuckPerms.class);
In both ways the class works until i try to get the prefixes, where the console says that luckPerms is null.
How can I solve this?
Sounds like you forgot to register LP as a dependency in your plugin.yml, meaning it's loading after your plugin (and thus no matter how you attempt to get an API instance, there isn't one to get yet)
I've added this to my plugin.yml already
depend: [LuckPerms]
@turbid solar Hello, I don't know if you could help me and I have a multiplatform server and when I try to add a user to a group I get the following "Panda is not a valid username/uuid" the user I want to add to a group is from a cell phone and not if I will have that error with other platforms. Please, I don't know, could you give me a solution or it is not possible at the moment.
Move to #support-1 or #support-2. This is unrelated to the LuckPerms developer API.
Moreover, please don't ping other helpful members. Just ask on the proper channel and be patient. 😀
bruh
Hi. I dont know if someone can help me, but how do you get a paper that when you right click it it gives you an assigned rank as a non-oped player? is it a luckperm command?
you need a plugin to do that. in the future, use #support-1 or #support-2 for support questions
Ok thanks so much
How do I do with my problem, some of my bedrock users have commands to use but other users don't work for them, what can I do?
Keep your questions on one channel please. Do not cross post and use the proper channel at most times.
Hey zincow! Please don't tag helpful/staff members directly.
Now I'm screwed with that, I'm with that damn problem...
my players start to leave because some bedrock players don't have the commands but the other bedrock players do... I mean it's a bug
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
If I give a player a group, like this
/**
* Saves the user
* https://github.com/LuckPerms/LuckPerms/issues/1917#issuecomment-573315508
* @param user
*/
private static void saveUser(User user) {
luckPermsApi.getUserManager().saveUser(user).thenRun(() -> luckPermsApi.getMessagingService().ifPresent(service -> service.pushUserUpdate(user)));
}
/**
* Add a group to the user
* @param uuid The players UUID
* @param newGroup group to add
*/
public static void addGroup(UUID uuid, String newGroup) {
User user = getUser(uuid);
newGroup = newGroup.replace("group.", "");
Node add = InheritanceNode.builder(newGroup).build();
user.data().add(add);
saveUser(user);
}
Theoretically, how quickly does it update bukkits hasPermission() check for a player?
I'm noticing that recently, (this only happens in the last few updates) that it's sending the Level up notification multiple times (sometimes 8 and it runs every second)
this is on the same server the group is added
It should be near-instant, there's a couple caches that need to be cleared and such when a user's permission data change, but this should all be well under a second
will better prifixe work with LPC?
Odd indeed, this was working on 1.19... we closed the server for a month and updated to 1.20 and now its going crazy. We just had like 15 notification spams until the user relogged lol. I can't really figure out whats changed...
Please do not ping reply to me in another channel. Don't crosspost
is it possible to cancel the pre-login processes in luckperms?
uh, why? We load all data in the async pre-login event (the earliest we can), so other plugins have access to it as soon as possible (and so it's loading async, not screwing up the main thread)
using floodgate - trying to block any users that have usernames beginning with "_" (while being java players) from joining and preventing them from creating any lp data or whatever
LP's written so users with only group.default as their data, don't have anything saved. As long as nothing automatically gives them a group/permision, no data will be saved for that UUID
java players might change their name to an existing bedrock player's username and try to join then. no issues would be caused other than the uuid warning, yes?
im sorry if this shit sounds ridiculous. its 4am.
Correct, all LP data is stored under UUIDs
alright. guess we'll just ignore the warning then
uh you might have problems using commands with the usernames, since I don't know what state our username:uuid cache will be in, but LP itself should still function as expected and not swap people's permissions around or anything
this is silly but ok
Is it possible to create custom storage via API?
i dont think theres any docs for it, but you should be able to do that by making an extension
Thx, I found it. Probably this is what i need: https://github.com/LuckPerms/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/storage/implementation/custom/CustomStorageProviders.java
Is there any API method to get a difference between two sets of nodes? My guess is that there is cause the Web Editor shows a diff
I just found the Difference class, but it's not in the API. RIght now I'll just copy it and I made an issue to move the file
im pretty sure the web editor creates a list of changes to execute
yeah the web editor doesn't touch the API, it just sends a list of node changes (as well as any group/track additions/modifications)
guava does have Set<T> Sets.difference(Set<T>, Set<T>), that's pretty helpful in certain situations like this
Is there any way to increase the meta maximum size? We use it for nicknames, but storing long nicknames with hex colors takes quite a bit of space and we've been hitting a limit at around ~150 characters.
It also doesn't seem to report storage failures when it's too big? It just doesn't actually store it in the database, while reporting success in the DataMutateResult.
...that's interesting, that should probably be a bug report.
And yeah, for SQL we've got to declare a maximum node length, which Luck decided on 200 characters apparently. Meta gets stored as meta.KEY.VALUE, so you should have 196 characters for both the key and the value
Ah okay, any way to bump that up in the plugin? Worst case scenario I suppose I could manually edit the table schema, hopefully it doesn't get automigrated back?
Honestly even 512 would be perfect, though with this revelation in mind, I do now realize that we can probably serialize it better, as people really like to have gradient hex nicknames which serializes into a lot of characters lol
194 no?
including the 2 .
yeah, I'd highly recommend using something like MiniMessage which has a much more compact way of doing gradients and stuff (<gradient:FROMCOLOR:TOCOLOR>I'm gradient text!</gradient> <rainbow>I'm rainbow text!</rainbow>). While technically there's nothing stopping you from messing with the schema, the only time people ever have issues with the node max length limit is gradient/rainbow text with a hex code after every character
and yes math is hard apparently cas lol
yeah we were getting around the PlaceholderAPI thing where it would parse colors for you, so we ended up using the super legacy serialization with section symbols.
modern PAPI doesn't do that for you by default iirc?
we do actually use minimessage for putting the nicknames in, but people seem to like defining specific colors for every character instead of using the very convenient gradient syntax, so the problem is still mostly there.
the latest version (2.11.3) does not, correct!
alas this was before that, so we were still struggling a bit lol
ah nope, it was 2.11.2 where they changed it
fair enough. To be honest, instead of messing with LP's schema, it might be easier to just impose a max raw nickname length, and if they hit it, suggest using the proper MM tags for gradient/rainbow in the error message instead
yeah that's also a good idea, I just hadn't really thought about it until after your reply as I figured it wasn't a database storage issue lol
Weird that it doesn't error when the insertion fails!
But thank you for your help, it was very nice to get such a quick reply lol
Yeah, that sounds like a bug, since obviously stuff failing to save should not be reporting a success
!bug
Sorry! I do not understand the command bug
Type !help for a list of commands
!bugreport
Suggestions and Bug Reports
If you would like to request a feature for LuckPerms, or report a bug, feel free to open an issue on GitHub!
Issue Tracker:
why on earth is !bug not a trigger for that
haha
I created a plugin that integrates with the LuckPerms API, but to reflect it on another server, I have to manually use the /lp networksync command. Is there an API that can do this for me?
if you save changes correctly, i believe it should do that automatically
On the server where I ran the plugin, it applied successfully, but it's not being reflected on other servers. When I check with /lp editor on the server where the plugin was run, I can see it's properly applied on that server. However, on other servers, it has not yet been reflected, and I need to reconnect or enter /lp networksync to reflect the changes. Can you help me with this issue?
I'm not good at English, please understand :<
see pins
ok
Hello, is there a reason why sometrack.getGroups() return list of strings instead of group objects? can those strings represent non-existing groups..? or is it completely safe to say that I can just convert all of them into group objects? Thanks
(https://github.com/LuckPerms/LuckPerms/blob/master/api/src/main/java/net/luckperms/api/track/Track.java#L59)
How can I get all users, even those who are offline? I need to know their group.
How can I add a parent group for a user?I just see set primary group,but i don't want that.
Make your method. Just check if the player has a group higher than this, if not, then put a group
uh there's UserManager#getUniqueUsers from which you can get the recorded UUIDs, and then you could load each individual user and do whatever you want; but what are you trying to do exactly? there might be a better way?
you can just add an InheritanceNode to the user's data, see
https://luckperms.net/wiki/Developer-API-Usage#modifying-usergroup-data
https://luckperms.net/wiki/Developer-API-Usage#saving-changes
Groups can be unloaded from the group manager, but they still exist on the track
Not that I've ever seen anyone actually unload a group...
Is there anyway to get listmembers by Group using API? like /lp group <group> listmembers 🤔
look at the source for that command
name: EssentialsCore
version: '${version}'
main: de.marvn.alphaexe.essentialscore.EssentialsCore
api-version: '1.20'
depend: [LuckPerms]
loadbefore: [LuckPerms]
But I still get this error
Please use https://pastes.dev to send files in the future. I have automatically uploaded message.txt for you: https://pastes.dev/t633ulSy1X
I am using LuckPerms 5.4
well do you actually have luckperms installed on the server?
do /lp on the server
I am using paper
name: EssentialsCore
version: '${version}'
main: de.marvn.alphaexe.essentialscore.EssentialsCore
api-version: '1.20'
dependencies:
- name: LuckPerms
required: true
bootstrap: false
load-after:
- name: LuckPerms
bootstrap: false
This is my plugin yml now
nvm got it
dont crosspost
Wrong channel but use mysql
Hi, i just want to ask, which event is fired after expiration?
Command: lp user %player% parent addtemp elite 30d
(ping me on answer please)
NodeRemoveEvent, check for Node#hasExpiry and hasExpired
Thanks ^^
Is there a permalink to download the latest versions of luckperm?
you can use the api to get the latest download link
auto-updating things is generally not recommended
I only make the scripts for ease of use, they never run w/out supervision.
Thank you
Currently in need for some help! 🙂
I'm creating some proson ranks and am currently trying to attach the pplaceholders to my custom scoreboard, but the placeholder isn't working correctly for me
The last picture is of the ranks being in a Track
And the first placeholder used works perfectly! I'm just not sure if I need to include that Argument "track"
Yeah you do, the args column lists any args (all of which will be required). If you don't tell it which track you want the next group on, how will LP know
%placeholdername_arg1[_arg2...]%
so
||this is the wrong channel btw||
blindscore11
This is a PlaceholderAPI lol
#support-1 or -2
This channel is for LP's API. PlaceholderAPI just has API in the name
Hey adamaen! Please don't tag helpful/staff members directly.
Can anyone help me find the documentation on how to download .jar versions from the API?
cant find anything on the wiki but im sure im just missing something
Is this still related to downloading the latest version with a script?
Yessir. I'm looking for the url formatting
I guess I could also just build from scratch as well...
You can grab the latest version from the metadata api, and just pass that version into the Jenkins download link.
https://metadata.luckperms.net/data/version/, and pass the version into this here
https://ci.lucko.me/job/LuckPerms/lastSuccessfulBuild/artifact/bukkit/loader/build/libs/LuckPerms-Bukkit-${VERSION}.jar
oh boy, i love discord.
thank you!!
https://github.com/LuckPerms/metadata-api heres some docs incase anyone else was curious!!
Hello, I need to detect if player has group with the name starting with a prefix. An example:
Role: lspdagent
I want to detect if player has for example role lspdrecruit
so remove the lspd recruit and add lspdagent
this seems like something you should use a track for instead of relying on group names
!tracks
Tracks provide a method for you to promote/demote players along a track (or ladder) of groups.
Read more
hi
how i can set a permission for a user using LuckPerms API?
i found the cookbook, nvm thanks :D
!cookbook too lazy lol
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, I have a problem, I tried many ways to change a player's group, but nothing changes, I tried:
user.setPrimaryGroup(group);
api.getUserManager().saveUser(user);
api.getUserManager().modifyUser(player.getUniqueId(), user -> {
Node node = api.getNodeBuilderRegistry().forInheritance().group(api.getGroupManager().getGroup(group)).build();
user.data().add(node);
});
Hello, I have a problem, I tried many ways to change a player's group, but nothing changes, I tried:
But i'm using a bungeecord server, so i'll have to use lpb command, but in the bukkit console we can't
that works, thank you !
how can i get a list of Player (or OfflinePlayer) from a luckperms group?
Greetings. What's the most efficient way, to check if a user has a certain permission explicitly set (ignoring wildcards), directly or inherited?
LuckPermsProvider.get()
.getPlayerAdapter(ProxiedPlayer::class.java)
.getUser(executor)
.data()
.contains(bypassPermissionNode, NodeEqualityPredicate.EXACT)
``` is this fine or even correct?
Why do you care if it's that explicit permission or a wildcard? This sounds like XY problem and you trying to do something you're not supposed to be
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I get this error somwhow
But this is not LuckPerms as a Plugin
This is my LuckPerms API
this is how i am trying to get group list from a offline player and set hes groups:
and:
java.lang.IllegalArgumentException: Player class org.bukkit.OfflinePlayer does not equal org.bukkit.entity.Player
how can i get a list of groups from an OfflinePlayer?
load the user
!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.
which one?
the offline one
thanks
Hey, I'm currently listening to some Events e.g. NodeAddEvent. I'm already checking for InheritanceNodes, but I need to check if the Event was triggered by parent add or by parent set, is that somehow possible?
those arent the only ways nodes can be added
they can be added via the api or the editor too
or, hell, permission set group.<name> if the admin is going full chaotic evil
when i add luckperms api am i need connect database and create statements for myself or api do this ?
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
how can i take a player offline with the name?
User newUUID = luckPerms.getUserManager().getUser(playerName);
[15:34:56 WARN]: Unexpected exception while parsing console command "coins convert"
org.bukkit.command.CommandException: Unhandled exception executing command 'coins' in plugin Coins v1.4-hotfix
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:172) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:869) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchServerCommand(CraftServer.java:832) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:567) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:529) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1507) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1300) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[patched_1.17.1.jar:git-Purpur-1428]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: name
at java.util.Objects.requireNonNull(Objects.java:233) ~[?:?]
at me.lucko.luckperms.common.api.implementation.ApiUserManager.getUser(ApiUserManager.java:162) ~[?:?]
at it.dominick.coins.database.ConvertOldData.convertOldData(ConvertOldData.java:50) ~[Coins-1.4-hotfix.jar:?]
at it.dominick.coins.commands.CoinsCommand.onCommand(CoinsCommand.java:557) ~[Coins-1.4-hotfix.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Purpur-1428]
... 9 more```
well your playerName variable is null
but you need to load the user, you can get the UUID from the username with the user name too, lookupUuid or something similar, then load the user with the uuid if it's valid
Hey! How can I get the Prefix Value of a Group? I filter for the NodeType Prefix and then I want to map it but I don't if I should use Node::getKey oder something else
groups can have more than one prefix
and prefixes can have contexts so it might not always apply
Yeah, but I know that there only is 1 prefix because it is on my server haha
getcacheddata getMetadata getPrefix
is it possible to get names not all in lowercase? I would like to get the unmodified names
no, LuckPerms stores it all lowercase for storage and quick lookup purposes, not for displaying,
Does DeluxeTags and Luckperms work together?
wrong channel, but https://tryitands.ee
oh shoot mb
Hey, how can I set the parent group of an user in the code?
you can add a parent by adding a node with group.<group name>
users can have more than one parent
!cookbook its probably in here how to add a parent
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
When UserDataRecalculateEvent is called, it is after recalculation or before?
Hey! The nodes of the default group is null when I call it like that:java Group group = this.instance.getLuckPermsAPI().getGroupManager().getLoadedGroups().stream().filter( loadedGroup -> loadedGroup.getName().equals(name) ).findFirst().get(); and when I use getGroup() it returns null but why
I am using BungeeCord btw.
what does tracks mean?
show code
compelte code
this is all my code
I check if group is null and thats all
public Rank(String name) {
Group group = this.instance.getLuckPermsAPI().getGroupManager().getGroup(name);
if (group == null) {
System.out.println("Group is null");
}
}
and to test if its null I use "default" as name
using the api to set someones group
public void addGroup(Player player, String group) {
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
DataMutateResult result = user.data().add(Node.builder("group." + group).build());
if (result.wasSuccessful()) {
luckPerms.getUserManager().saveUser(user);
}
}
``` but it does give the group but it's synced with bungeecord and I don't get the bungee plugin permissions but I get all the other perms
I checked bungee it does have the group
When I reconnect it does work but how to make it so I do not need to reconnect
look at pins
they use a db not flatfile
???
can someone help me with this?
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
declaration: package: net.luckperms.api.cacheddata, interface: CachedPermissionData
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
at raosnetplugins.raosnet.Handlers.PlayerHandler.<init>(PlayerHandler.java:24) ~[RaosNet-1.0.jar:?]
at raosnetplugins.raosnet.RaosNet.onEnable(RaosNet.java:33) ~[RaosNet-1.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.19.1.jar:git-Paper-111]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:477) ~[paper-1.19.1.jar:git-Paper-111]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.19.1.jar:git-Paper-111]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:422) ~[paper-1.19.1.jar:git-Paper-111]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.1.jar:git-Paper-111]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1124) ~[paper-1.19.1.jar:git-Paper-111]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.1.jar:git-Paper-111]
at java.lang.Thread.run(Thread.java:1623) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.luckperms.api.LuckPermsProvider
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[paper-api-1.19.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[paper-api-1.19.1-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
I get this error when I use the luckperms api to get the players prefix in PlayerChatEvent
package raosnetplugins.raosnet.Handlers;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.entity.Player;
import raosnetplugins.raosnet.RaosNet;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.model.user.User;
public class PlayerHandler implements Listener {
private final LuckPerms luckPerms;
public PlayerHandler(RaosNet plugin) {
this.luckPerms = LuckPermsProvider.get();
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
ItemStack item = new ItemStack(Material.GHAST_TEAR);
Inventory inv = player.getInventory();
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.LIGHT_PURPLE + "ITEM_TEST");
item.setItemMeta(meta);
inv.setItem(0, item);
event.setJoinMessage("");
}
@EventHandler
public void onPlayerChatEvent(PlayerChatEvent event) {
Player player = event.getPlayer();
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
String = user.getCachedData().getMetaData().getPrefix();
event.setFormat(playerPrefix + player.getName() + ": " + event.getMessage());
}
}
code
Also the note when building the plugin:
Note: C:\Users\user\IdeaProjects\RaosNet\src\main\java\raosnetplugins\raosnet\Handlers\PlayerHandler.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.
public void addGroup(ProxiedPlayer player, String group) {
User user = luckPerms.getPlayerAdapter(ProxiedPlayer.class).getUser(player);
DataMutateResult result = user.data().add(Node.builder("group." + group).build());
if (result.wasSuccessful()) {
CompletableFuture<Void> future = luckPerms.getUserManager().saveUser(user);
future.thenRunAsync(() -> {
Optional<MessagingService> messagingService = luckPerms.getMessagingService();
messagingService.ifPresent(service -> service.pushUserUpdate(user));
});
}
}
``` ill try this
playerchatevent is deprecated
yeah i figured that but i dont know how to fix it
use AsyncPlayerChatEvent or AsyncChatEvent depending on if you want to only support paper
do you have luckperms installed
thats also deprecated when i use it
shit i forgot to install it
is the bungee depend name "luckperms" or some weird stuff
would you know some bungee event stuff if I dmed you?
i dont do dm support
can you talk anywhere
the waterfall support hasnt responded for couple days
¯_(ツ)_/¯
sorry, i was being dumb and didnt install luckperms sorry
the future stuff doesnt
work
still don't automatically save the stuff
I need to relog
well it kind of works but autocomplete doesnt
what
do u have perms for it
sounds like something isnt refreshing commands correctly then
how to make it work
Hi all! How can I get a group from a context?
Hello, do luckperms groups have some special identifier that stays over renames?
is it possible to turn off the fly of player when the settemp permission to fly is gone ? with the api
ofc its possible. listen for node mutate event, or node remove event, and toggle their flight if the node removed matches your temp permission.
G'day, is there a method for getting a list of users in a primary group (not inheritance) on a certain track?
@fast delta 🥺
(michael pls)
This is what I'm currently doing to get a list of users printed as: "UUID: uuid Player: playername"
Only problem is it's giving me duplicate results due to inheritance. So I need to only get the primary group (which I'm unsure how to do).
final CompletableFuture<Map<UUID, Collection<Node>>> listUsers = luckPerms.getUserManager().searchAll(NodeMatcher.key("group." + groupName));
Pattern pattern = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}");
listUsers.thenAccept(users -> {
for (Map.Entry<UUID, Collection<Node>> entry : users.entrySet()) {
String userString = entry.toString();
Matcher matcher = pattern.matcher(userString);
if (matcher.find()) {
UUID uuid = UUID.fromString(matcher.group());
String player = Bukkit.getOfflinePlayer(uuid).getName();
logger.info("UUID: " + uuid + " Player: " + player);
}
}
});
Why are you extracting the UUID like this?
While the UUID is already given as the key in the map that the luckperms API returns
And this shouldn't give duplicatie results since the UUID of a user can only appear once in the map
It's under a command, so it will list the UUID per group:
averageplayerdata default
UUID: 8f745b1d-e49a-4ddf-8677-920895ede361 Player: lewi_lewi_lewi_
averageplayerdata hunter
UUID: 8f745b1d-e49a-4ddf-8677-920895ede361 Player: lewi_lewi_lewi_
OOHHHH
okay
gimme a sec I think I know how to solve ur problem but I myself am mostly comfortable with the REST API and not with the java one so lemme just check the docs
Okay no sorry I don't have an efficient/easy solution for ur problem I had this flag in my head https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/query/Flag.html#RESOLVE_INHERITANCE but that only applies to permission checks and not for user searches, maybe it would be a good idea to add a simular system like the permissionCheck system for user searches but it does not exist as of now
declaration: package: net.luckperms.api.query, enum: Flag
No worries :)
Figured it out thanks to the wonderful kennytv, my favourite in-hosue german developer
however ~80 lines just to get a list of players in groups (without duplication due to inheritance) is a big yikes
Could you share your code @naive patrol I'm curious
UserManager.searchAll does not take inheritance into consideration tho (more like, it "can't")
does luckperms velocity if hooked up to0 the same db have all the permissions? and same stuff
or is the velocity version different
that question had nothing to do with the api
the api is the same on all platforms
it would say on the wiki if it was different
you raise a great point
Hi-
I have a few things that subscribe to the UserDataRecalculateEvent event, and whenever I call UserManager#loadUser, it gets fired.
I could understand that if loadUser does not use any cached data whatsoever and fetches data from the database every time, however the documentation seems to imply that it does use cached data if it is available.
My question is: If loadUser does use cached data when it's available, is it intended for UserDataRecalculateEvent be fired every time the user fetched?
Thanks in advance -
luckperms api is getting my db informations from luckperms config ?
Not my question.
Hey vasir.l9! Please don't tag helpful/staff members directly.
prank.
okay
javadoc doesn't mention anything about reusing already loaded data 🤔
Loads a user from the plugin's storage provider into memory.
which is correct, that would (and does) trigger the data recalc event
Perhaps adding a separate method that presents as a future, but that will use the cache if available would make sense- for now i'll just write a tool method to do so, but might be a nice feature
out of curiosity, what about that snippet you just shared you see communicates that it might hit the cache first? maybe the wiki needs some rewording but I don't see it
Just the fact that it says if the "player isn't (or might not be) online"
I just kind of expected that if it was intended for use when a player is online, that it would be optimised and use the cache if available
E
someone help me ? im getting this exception and i don't know how to fix this
for add role to player am i use this or setPrimaryGroup ? method idk
Method invocation 'data' may produce 'NullPointerException
this is my code
@Override
public void onGuildMemberRoleAdd(GuildMemberRoleAddEvent e) {
PlayerInfoHandler playerInfoHandler = new PlayerInfoHandler();
PlayerInfo playerInfo = playerInfoHandler.findPlayerByDiscordId(e.getUser().getIdLong());
if (playerInfo == null) return;
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(playerInfo.getName());
User user = LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId());
user.data().add(InheritanceNode.builder("test").build());
LuckPermsProvider.get().getUserManager().saveUser(user);
}```
If I use the Bungee Version of LP, am I able to use the API on the Spigot yet?
!network You should have LP installed on each instance you want to have the permissions configured
If you run a BungeeCord network, learn how to correctly setup LuckPerms on all server instances (including Bungee).
Also read:
Syncing data between servers
ok, thank you very much
2 other admins with * permission (given on join after 2FA) don't want/have the admin role and the punish system checks role hierarchy (e.g. mod can ban a helper but not an admin, helper can ban players but not mods).
Therefore, there's a bypass permission that I want to be explicitly given.
the correct solution is to not give them *
also having "2fa" sounds like a cracked server
Do I need to change the prefix of a group the same way as custom metadata
huh
Hola
alguien habla español ? @everyone
Hello everyone,
I have deployed a Django website for an online Minecraft shop. I have tried using RCON to give items/ranks to users upon purchase, but I've heard that it is insecure. Since I'm not familiar with Java, Minecraft servers, and their plugins, my question is: Is there a better method for giving purchased items/ranks to users? Can a user's rank be changed with a POST request using the LuckPerms API? If so, how can I enable its API? I couldn't find any tutorials for this type of activity.
https://luckperms.net/wiki/Standalone-and-REST-API this may be useful for you.
Can i perform offline permissions check and suffix getting without having the player to join
The method luckperms give (CachedData) only work with pre-cached data
Im wondering if there are other methods
load the user
Oh tyyy ❤️
guys i am trying to use luckperms api:
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>```
and it drops error in inteliij idea
`Dependency 'net.luckperms:api:5.4' not found`
can anybody help me? pls
Have you added LuckPerms as a dependency in your plugin.yml?
i added:
depend: [LuckPerms]
will it work with depend?
yeah
then why it's not working
reload maven, restart intellij
not working, I restarted my computer soo can you help me on dm? because it's long history
thats not really a good reason to take it to dms
okej, then can you help me here?
what does it say when you run mvn dependency:tree on a terminal in the project?
i fixed it rn
reason no reload maven
oh good
Hey I have a problem I'm currently making a Velocity plugin and have LuckPerms in my Depdency tag but the problem is my plugin is getting loaded before luckperms
Does someone know why this happens?
Show where you’re using LuckPerms
use the plugin id
lowercase
plugin IDs have to be lowercase, you shouldn't really be writing the json manually tho, velocity has annotations for that
oh, yeah don't do that in the constructor, get the LP instance in the Initialize event
Having an issue with using LuckPerms Forge as a dependency and launching via runServer. This appears in the console:
java.lang.NoSuchMethodError: 'com.mojang.brigadier.builder.LiteralArgumentBuilder net.minecraft.commands.Commands.m_82127_(java.lang.String)'
at me.lucko.luckperms.forge.ForgeCommandExecutor.onRegisterCommands(ForgeCommandExecutor.java:59)
The method/class referenced in LuckPerms is apparently in a jarinjar file
how do i load user permission and suffix related data
i saw .getData() method
public void querySuffix(final UUID uuid, final StringCallBack callBack){
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
CompletableFuture<User> user = userManager.loadUser(uuid);
String suffix = user.join().getCachedData().getMetaData().getSuffix();
Bukkit.getScheduler().runTask(plugin, () -> callBack.onCallBack(suffix));
});
}
im wondering if it is morally stupid to handle async like this rather than using completablefuture's thenAcceptAsync
LuckPerms Forge 5.4.66 (1.19.2). Server crashes sometimes when a perm is queried, presumably after a player has died/returned from end given the Capability missing for <UUID> message.
My code:
getLuckPerms()
.map(lp -> lp.getPlayerAdapter(ServerPlayer.class).getUser(player))
.map(user -> user.getCachedData().getPermissionData().checkPermission(permission))
.orElse(Tristate.UNDEFINED);
I noticed this issue (missing capability) on the Github, but it's been marked as closed.
What's the crash log?
Working on a Forge port of StyledChat, and I included a partial Forge-rewritten copy of the Fabric Permissions API for ease of porting (under the original "me/lucko/fabric/etc" package name which you'll see in the log).
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it isn't. The wildcard perm is taken away when leaving and given back upon typing a valid Google Auth code as an added layer of security
When setting a permission via chat or console command, it's immediately synced to other servers, say BungeeCord, but setting it via API (get the user, add node, save user) takes a while to sync (as in, (Proxied)Player#hasPermission still returns the old value), except when using lp networksync (or lp user .. permission check on the target server).
Can you immediately push the change like the command does?
yes, see the 2nd pinned message
oh, the messaging service.. it was right in front of my eyes the whole time 
thanks
Hi, i want to send players displayname including prefix of the gorup, when i use group.getDisplayName(), it returns only name of the rank
@dapper thunder You can get the prefix from the player's metadata.
LuckPerms#getPlayerAdapter(Player.class).getMetaData(player).getPrefix()
Okay thx, ill try later
is there a way to set permissions temporarily via api?
Yeah, the NodeBuilder has some methods to set the expiry date/time
hi ( ͡° ͜ʖ ͡°)
hello does anyone have an idea what i'm doing wrong there always comes Cannot resolve symbol 'luckPerms'
Player player = e.getPlayer();
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
It seems like maybe you're not familiar with how to use Java
You'd need to get an instance of the API first. If you don't know how to do that, maybe spend some more time learning Java first as the LuckPerms API will be hard to use without that base knowledge 🙂
hmm okay thanks
How can I check if the User has a specific permission node, even when they have *?
If the user has *, they have all perms, but I want to check if they have the actual permission like test.test
if (user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet)).checkPermission(permission).asBoolean()) {
^ This doesn't ignore * perms
XY problem, why do you want to do so?
Want to check for a plugin I'm writing up, and I want to ignore * perms
It's for a discord syncing kind off plugin
Where OPs are included, and need the actual perm
again though, why do you to check the actual perm? It sounds like you're using LP in a way it's not intended for
I have a plugin that gives out a specific plugin to the user, like quest.one, now I want to check with LuckPerms if they actually have that permission
For players without * or OP, it'll work, but if you do, it doesn't
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.
I'll give that a try, thanks
Hey, didnt message back, I got something working with the help of metadata, thanks!
hey, when using the api can i check the weight of any player's rank? If so, how?
Hey quadratickid! Please don't tag helpful/staff members directly.
!paste
Please use pastebin!
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
For console errors:
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Other errors:
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
someone knows?
var groupName = luckPerms.getPlayerAdapter(Player.class).getMetaData(p).getPrimaryGroup();
var weight = luckPerms.getGroupManager().getGroup(groupName).getWeight(); // <- this?
don't quote me on this but IIRC, the null warning for groupName can be ignored because it's non-null for players and null if it's the metadata of a group
Is there a way of changing the group of a player who is offline? Im currently converting the User's UUID to an OfflinePlayer and using that for the User object. I think my code explains it better than my goofy english...
OfflinePlayer ofPlayerName = Bukkit.getPlayer(chosenUUID);
LuckPerms luckPerms = LuckPermsProvider.get();
User user = luckPerms.getUserManager().getUser(chosenUUID);
String rankGroup = user.getPrimaryGroup();
String name = ofPlayerName.getName();
if(rankGroup.equals("assistent")){
GroupManager groupManager = luckPerms.getGroupManager();
Group group = groupManager.getGroup("Moderator");
user.data().clear(NodeType.INHERITANCE::matches);
Node assistNode = Node.builder("group.moderator").build();
user.data().add(assistNode);
luckPerms.getUserManager().saveUser(user);```
Works for players that are online, but not for the offline ones
load the player, modify, then save
Player gets loaded at the start of server
it doesnt load offline player data
Sorry, i meant that i load some Data of offline players that are currently offline from their UUID's i saved.
how long after that are you trying to modify the player data?
About 10sec?
luckperms probably unloads the user at some point but im not exactly sure how long it is
so i would try loading the user anyways
Still doesnt work
I've tried loading the user directly before trying to change their group and also loading before starting to change their group
Fixxed it. Somehow my OfflinePlayer Object was null
Hi how should I activate the luckperms when a member of a group chated it will be like this
(Group)(gamertag)(chat)
Bro dont need to crosspost in 3 channels
Sorry
Its ok just dont do it again
Hey i need some help i added the dependency of LuckPerms but still got this 😦
This has nothing to do with the LuckPerms API. Stick to #support-1 and do not cross post.
Nobody to help? 
Im getting this error in my code even though im never requiring the Node class (only InheritanceNode). The error line is just loading one of my classes and not even using the api.
(I do not have luckperms installed on my server because its only a softdepend and im only using the api after a check)
I can't see in the wiki api usage how I would fetch user track rank specifically regardless if they have higher weight groups etc. I want to fetch the users track and verify it up against something aka sync it
do I just list the groups in the track and do a for loop to see if the player has one? and if so go from there? seem like the obvious but not correct way
Well, seeing the class would certainly help, the only thing anyone can really say just from that is "you're trying to use LP without it being installed" 
You want to get the tracks a player "is in"? Then yes you'd have to loop through the loaded tracks and keep the tracks that have any of the user's parent groups, that's basically what luckperms does with the lp user .. showtracks command
how are you trying to build your plugin exactly? running mvn package should work fine
https://pastebin.com/ya6jUC0g
Heres the class the line 73 is loading by calling the init() method
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Do I have to isolate the parts where im using the api and only call them after checking the plugin is installed?
what about the DiscordLinker class? that's where the error is stemming from, it doesn't seem to be from the Router class
ideally yes, there are some special woes the jvm does when reading a classfile, sometimes things work out when a class doesn't exist, sometimes it blows up before you get to know what happened
it's all very well specified but it isn't easy to determine
found an easier way :p thanks 🙂
Its literally just doing Router.init() on the line that errors like i said. If you look into the error its the ClassLoader thats failing not the DiscordLinker class
the router class is nowhere to be seen in that stack trace, neither clinit nor that init method so it isn't exactly involved
but the "more proper" way is to gate the classes referring to LP under a check to see if the plugin is enabled before calling them
can't really say anything else without the other class so, uh, ¯_(ツ)_/¯
I did gate them under a check but apparently when the init method is called its trying to import the class and cant find it
Thats my theory
Well its gotta be something to do with the Router class because again, on line DiscordLinker.java:73 it literally just says Router.init() and that by itself cannot cause the Node class to not be found
how can i create a group using the api?
i didn't found anything in the api wiki and the cookbook
Why isn't this working?
public void setGroup(User user, String group) {
if (user != null) {
user.setPrimaryGroup(group);
}
}
CoreAPI.getInstance().getPermissionManager().setGroup(user, "vip");
Ig this should work but i'm not sure
public void createGroup(String name) {
luckPerms.getGroupManager().createAndLoadGroup(name);
}
Are you saving your changes each time? I'm sure I read something in the API where you need to save after each modification
luckperms.getUserManager().saveUser(user);
Primary group =/= inheriting a group. With the default config, that method (and /lp user <who> setprimarygroup <group>) do nothing. Add an inheritance node to the user with the appropiate group. See the cookbook (below) for an example
!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.
Hi! Im using LuckPerms API to set players rank.
Im using a bungee network with backend servers
Shoul'd I use some LP APIs to sync all server data using plugin message.. or is synced at all?
Im using MariaDB on all servers
public static boolean isPlayerInGroup(Player player, String group) {
return player.hasPermission("group." + group);
}
Wouldn't this return true for OPs and * permission users?
Yes, it would return true for OPs and * users
Ok
Ig if your luckperms storage is on mysql or mariadb then is it synced
see the (2nd last) pinned message to propagate storage changes to the rest of the network 
I need a method to get the group name of a player who is offline
you need to load the user
Hey, is there a way to return time left on the temp permission?
like return the value itself
I just want a command where I get can get time left of teh temp node. so I would need to check if they ahve temp node somehow and then get the timeleft, can't find any docs specifiaclly for that
Cannot resolve method 'isTemporary' in 'Node'
node.isTemporary()
boolean isTemporary()
Gets if this node is assigned temporarily.
Returns:
true if this node will expire in the future``` ? 😮
you can get the expiry as a timestamp. i think youll have to turn that into a duration yourself
ok, having trouble getting the timestamp :p thanks! 🙂
How do i check the group of player? not the groups like group. i want to know the group the player is in because i am working on StaffSpy and when the player is op or has the permission * it will put him in all the groups cause like group.* and i need to know the group the player is in as like: /lp user StaffSpy group info
i also followed the docs to get the player group by possible groups
is it really not possible to just retreive the group?
I used: [pics]
but it requires the player to have group. which dosent help me because op and * perms have all of these
Let me clarify
You are currently NOT using the luckperms api itself and you run a permission check in your plugin that queries "group.groupname" but if a user has *, thats whats first being returned, correct?
yea, because obv * will also go to group.*
how can i use luckperms api for that
for checking the group
i want to use the luckperms api
sorry i didnt clarify it earlier
!cookbook has a load of examples of different things. It helped me to get started as well
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, i already checked it out and i might missed something
If you have trouble using the api, consider pasting any relevant code and errors and describe what is happening when doing x
yea makes sense
Thanks
oh i have a great idea
il just get the possible groups
and check the members of the group
il check if its even possible
The image you attached is literally the answer. Either query a specific group or iterate over possible groups and make a collection, which you can then either further filter or do other things with
the problem is if the person has the permission * or he is op it will ALWAYS return true no matter the group list
even if the group dosent even exist
will this work?
User user = luckPerms.getUserManager().loadUser(who);
Collection<Group> inheritedGroups = user.getInheritedGroups(user.getQueryOptions());
return inheritedGroups.stream().anyMatch(g -> g.getName().equals(groupName));
}```
or it will still not work cause of * or op
LETS GOO
found out how to do it!!!!
i just need to test it.
it works!
let me send the code that works
This code uses the luckperms api to retreive the group.
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
UserManager userManager = api.getUserManager();
CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);
return userFuture.thenApply(User::getPrimaryGroup);
}
return CompletableFuture.completedFuture(null); // Return null if provider is null
}``` but the problem is it returns a completableFuture
```public String GetGroup(Player player) {
UUID playerUniqueId = player.getUniqueId();
return getParent(playerUniqueId).join();
}``` use this code to get the group after adding the getParent
Ofc it works, because a group check checks groups, not all permissions
Big difference
yea thats why i am happy that i actually found the getPrimaryGroup
how?
How do I listen for a group deletion?
Most likely need to listen for the NodeRemoveEvent
Okay but for what conditions do i check then?
Am I able to get a list of users with a specific meta value?
Check if the node is group.<anything> as group membership are nothing but node assignments such as group.owner, group.member etc
how can I actually make this work?
String next = rank.getNext().getRank().getRank();
LuckPerms api = LuckPermsProvider.get();
User user = api.getPlayerAdapter(Player.class).getUser(player);
String permission = "group.battlepass_" + next;
String oldPermission = "group.battlepass_" + rank.getRank().getRank();
Node old = Node.builder(oldPermission).build();
List<Node> nodes = (List<Node>) user.getNodes();
Instant instant = null;
if (!nodes.isEmpty()) {
for (Node node : nodes) {
if (node.hasExpiry() && node.equals(old)) {
instant = node.getExpiry();
break;
}
}
}
if (!player.hasPermission(permission)) {
if (instant == null) {
user.data().add(Node.builder(permission).build());
} else {
user.data().add(Node.builder(permission).expiry(instant).build());
}
api.getUserManager().saveUser(user);
user.data().remove(old);
api.getUserManager().saveUser(user);
custom_rewards(player.getName(), next);
}
```I want to check the old node's expiry and then put it into the new one to maintain the expiry time
But it could just be a member being removed from the group right?
When logging any NodeMutateEvent and deleting/creating a group i dont get any event call
There's CachedPermissionData#queryPermission(String), that sounds like something appropriate for your use case
Also after that, InheritanceNode#toBuilder -> change group -> build, add new node, remove old node, saveUser
you mean this ? when a group itself is deleted (not when someone gets their group.blah node removed)
it works in tandem to a secondary group so it needs to relate to the other ranking system which is a third partyp lugin so not sure that works in this case? or am I confused?
query for oldPermission
if (result.node != null && result.result == TRUE && result.node.hasExpiry)
user.data.remove(result.node)
user.data.add(result.node.buildwr.blah blah set new rank.build)
usermanager.saveUser(user)
Ah okay, i didnt know there was a seperate event for that, shouldve taken a look at the doc earlier
Thanks :D
Hello,
I use the code below to remove a list permissions from a user when they leave the server but the problem is it sometimes removes the player temp rank. for e.g players temporary vip rank
plugin.getluckPerms().getUserManager().modifyUser(uuid, user -> {
user.data().remove(Node.builder(permission).build());
});
I execute the code above when the player leaves
can anyone help me with this?
Could you elaborate, not sure how to get there. I've read the docs but I'm pretty new working with any API's other than spigot and paper :p aka how do I query the permission to get the inherit expiry instant
how do register the api? i tried
private static LuckPerms luckPerms;
public static LuckPerms getLuckPerms() {
return luckPerms;
}
``` but i get this error when i use it
it doesnt include any color information
wdym
the prefix is stored as raw text. "color codes" dont have any meaning unless you give them meaning
how can I remove a permission from certain user?
I want to remove a permission when the user leaves
hello?
!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.
When i receive NodeMutate events and then fetch the group members, theyre not updated yet. Is there a way to wait for the update to happen?
Like when i receive a NodeRemoveEvent, the player is still in the group and only on the next update that i receive, the player is removed
I also dont think that waiting for a tick or so is sufficient because the db calls might take longer and are handled async
Hello, a question, how do I detect if the rank that a user has is temporary or permanent?
Hey Developers,
How can i get this value (marked in pic) trougth the api?
I got the player's highst group.
what are you trying to do
Did you set that as a meta value?
Hi ! i have an error with luckperms api, i want use luckperms api in my mod forge :
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
at fr.civaliamod.mod.proxy.ServerProxy.getLuckPermsPrefix(ServerProxy.java:49)
at fr.civaliamod.mod.proxy.ServerProxy.onPlayerJoin(ServerProxy.java:36)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_34_ServerProxy_onPlayerJoin_PlayerLoggedInEvent.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:190)
at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerLoggedIn(FMLCommonHandler.java:583)
at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:333)
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:260)
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:72)
at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.func_73660_a(NetworkDispatcher.java:205)
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:296)
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:193)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:948)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:461)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:800)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:672)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.ClassNotFoundException: net.luckperms.api.LuckPermsProvider
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java
i use magma 1.12.2
Hybrids aren't really supported, but if LP is running as a plugin, then the hybrid software would need to support exposing plugins to mods, and allowing mods to depend on plugins. Most likely either magma doesn't expose plugins to mods, or LP is loading after the mod, and you're trying to access the API during your mod init
This is my code:
public class TabListListener implements Listener {
private final LuckPerms lp;
private String prefix;
private String suffix;
@Getter
private Scoreboard colorBoard;
public TabListListener(LuckPerms luckPermsApi) {
this.lp = luckPermsApi;
}
public void LPRegister() {
EventBus eventBus = lp.getEventBus();
eventBus.subscribe(SG_Tab_List.getPlugin(), UserDataRecalculateEvent.class, this::onLPChange);
}
public final class SG_Tab_List extends JavaPlugin {
@Getter
private static SG_Tab_List plugin;
private LuckPerms luckPerms;
private TabListListener tab;
@Override
public void onEnable() {
// Plugin startup logic
plugin = this;
RegisteredServiceProvider<LuckPerms> provider = getServer().getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
System.out.println("###LP Register");
this.luckPerms = provider.getProvider();
}
System.out.println(provider);
System.out.println(this.luckPerms);
this.tab = new TabListListener(this.luckPerms);
tab.LPRegister();
}
But i get this Error:
[20:31:55 INFO]: [LuckPerms] Successfully enabled. (took 940ms)
[20:31:56 INFO]: [SG_Tab_List] Enabling SG_Tab_List v1.0-SNAPSHOT
[20:31:56 ERROR]: Error occurred while enabling SG_Tab_List v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "net.luckperms.api.LuckPerms.getEventBus()" because "this.lp" is null
at de.simugreen.sg_tab_list.listener.TabListListener.LPRegister(TabListListener.java:36) ~[SG_Tab_List.jar:?]
at de.simugreen.sg_tab_list.SG_Tab_List.onEnable(SG_Tab_List.java:32) ~[SG_Tab_List.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-171]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-171]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:640) ~[paper-1.20.1.jar:git-Paper-171]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:551) ~[paper-1.20.1.jar:git-Paper-171]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.20.1.jar:git-Paper-171]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.20.1.jar:git-Paper-171]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-171]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-171]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-171]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
obligitory naming standards note, method names should be lowerCamelCase i.e. LPRegister -> lpRegister() (but honestly just move that code to the constructer, no reason to have it be a seperate method)
When you Serial.println the recieved LP instance, is it null?
That''s why then
as for why it's null, you most likely aren't depending on LP in your plugin.yml, so it's loading after you
In the Console its bevor me and i have it in the plugin yml
name: SG_Tab_List
version: '${project.version}'
main: de.simugreen.sg_tab_list.SG_Tab_List
api-version: 1.20
author: SimuGreen
depend: [LuckPerms]
oh hold on I'm blind. With the current code, if the provider is null, it'll still attempt to load TabListListener even though LP will be null. If the provider is null, you need to do some sort of error handling (i.e. I'd throw an IllegalStateException personally)
But why is it null, when Luckperms get loaded?
that's a good question...is there any errors from LP on startup?
also what MC version & server software?
[20:31:54 INFO]: [LuckPerms] Loading server plugin LuckPerms v5.4.102
[20:31:54 INFO]: [SG_Tab_List] Loading server plugin SG_Tab_List v1.0-SNAPSHOT
[20:31:54 INFO]: Server permissions file permissions.yml is empty, ignoring it
[20:31:54 INFO]: [LuckPerms] Enabling LuckPerms v5.4.102
[20:31:55 INFO]: __
[20:31:55 INFO]: | |__) LuckPerms v5.4.102
[20:31:55 INFO]: |___ | Running on Bukkit - Paper
[20:31:55 INFO]:
[20:31:55 INFO]: [LuckPerms] Loading configuration...
[20:31:55 INFO]: [LuckPerms] Loading storage provider... [H2]
[20:31:55 INFO]: [LuckPerms] Loading internal permission managers...
[20:31:55 INFO]: [LuckPerms] Performing initial data load...
[20:31:55 INFO]: [LuckPerms] Successfully enabled. (took 940ms)
Mc 1.20.1, paper-mc 1.20.1, Build #172
No, but like seen in the Console output they get loaded simultan, can i stop this so my plugins gets loaded after lp
I entered it on the editor, so i think
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.
I have this error with the rest api help me please 😢
Please use https://pastes.dev to send files in the future. I have automatically uploaded message.txt for you: https://pastes.dev/LZLav3GdR9
seems like magma is trying to do some unholy things with the extension classloader
not exactly a supported environment
its recommended to run the rest api extension on the standalone build of luckperms
Hi 👋 It it possible to prevent logging new user into database and instead of this log them manually using API?
uh...why?
this sounds like a serious XY problem, what are you actually trying to accomplish
How do I get these 7 entries?
how can i get an offline player group?
Has anyone a idea to fix it?
How do create a group and add a node to a group using the api
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
!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.
^^
load the user then get their groups
any example code?
!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.
thx
hey any1 can help me of luckperms api usage?
I got this error when i want to import luckperms library to my pom.xml
<dependency>
<groupId>me.lucko.luckperms</groupId>
<artifactId>luckperms-api</artifactId>
<version>5.4.102</version>
<scope>provided</scope>
</dependency>
that group ID is outdated. where did you find it at?
where did you find any of this at
on spigot
link?
sorry, where i can found how can i check user informations example of /lp user (username) info
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
!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.
Hey
(moved from #support-1 #support-1 message )
first if you haven't checked them out already
!api
Learn how to use the LuckPerms API in your project.
Read more
Example usages
Read the Javadoc
!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.
but it's worth noting that LP kind of has 2 UUID lists. There's our UUID <-> Username cache, which contains every UUID that's ever connected while LP is installed, however this isn't exposed to admins and I don't think it's exposed to the API. Then there's the list of all users who have data saved (i.e. everyone with data other than just group.default), which iirc you should be able to access via the PlayerService or w/ever
For some reason UserManager#getUniqueUsers
is empty any clue why?
its possible to give to a player the gmc permission only for 10 minutes?
yep
how?? Can you let me know the command please?
dont crosspost
okey
this is the luckperms api channel not support
[16:25:34 INFO] [luckperms]: [Messaging] Received user update ping for 'andrei9876' with id: b18bede3-8ce2-4348-982e-f42fe5baf3c1
what is the event for this?
Hello guys
using
user.data().remove(Node.builder(permission).build());
method to remove a permission form a user removes players rank
for e.g if a player has a rank of VIP for 31 days this code causes it to be removed also
why does this happen and to fix it
Does anyone know of a way to give a player a suffix with the API? I'm reading the https://luckperms.net/wiki/Developer-API-Usage, but nothing is standing out to me.
Hmm, I guess it's as easy as granting and removing a permission.
Yes. Suffixes are permissions as well.
anyone know how to make it so a command block adds the nearest player to a group?