#luckperms-api
1 messages · Page 4 of 1
Is there a way i can attach non-persistent permission to an user - meaning permission node that is thrown away the moment player logs off
yes, you need to add the nodes to the transient NodeMap, I think the method is called transientData()? as opposed to data()?
How does its implementation look like?
Is it synchronized under the hood?
like synced cross-server?
no, like thread safety
I'd assume so since LP is built with async in mind, but I don't know for sure, would need to look at the code
(iirc in the impl it's some impl of NodeMap stored on a PermissionHolder, but it's been a minute)
Im researching whenever it would be viable use lp to check for permission node every time PlayerInteractEvent (clicking on blocks, clicking on entities) is called.
or would this use result in too much of overhead.
should be fine, LP withstands the paper anti-xray permission checks, and PlayerInteract should be less frequent than that check
But the entire antixray is async, its made on a protocol level, isnt it?
yes but iirc it's incredibly frequent even on a single thread
(to amend to this) the point isn't that "it happens 'async'", it happens on the same thread as the antixray, and if it was slow it would absolutely devastate connections and ping, which it doesn't đ
protocol threads are an absolute no no when it comes to blocking them
do i just take the top one? or should i use a differnt version
Could i use the transient data to add a permission group to an user?
yes
which Node type should i use?
inheritance node
.. and its possible to create a transient group that will be exists only at runtime? Group interface seems to have no builder method.
So, is there a way for me to tell LP that a specific command can only be run on console?
LP doesn't deal with commands, it deals with permissions, unknowing where they are coming from
So, not really, just, don't grant the permission to players and add a check in the command to prevent players from using it
Hmm so then I suppose I need to check for console in the command itself?
ok
thanks
Quick question, does luckperms store colors for groups? Like, maybe for the prefix or for the group display name or something?
or is it just part of the string content?
if it's part of the string content, is it using section symbols, or ampersands?
damn
so the prefix content is just a string and then it gets formatted by the chat plugin?
yes
ok thanks
can someone send me a yt video on how to import lp api because i am to stuipid
!api
Learn how to use the LuckPerms API in your project.
1st link
Thats what i tried to use but i dont quite understand it. Im new to Java, Bukkit and everything in this envrioment kinda
I figured i need to use manual becuase i dont use maven as far as i know
but not more
nvm got it now
!help
!advanced
!api
!argumentbased
!ask
!bedrock
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!forgepermissions
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!velocitycheck
!verbose
!version
!weight
!whyluckperms
!wiki
!hack
Most certainly: no. In most cases a 'LuckPerms exploit' is a simple case of human error, which can be avoided easily. Look below for some tips to be on the safe side.
While this should be obvious, a lot of times a exploit can be traced back to faulty permission settings. You should always take your time with permissions and read the plugin documentations. In 99% of all cases the plugins have documentations explaining each permission, in the rare case that the plugin you are using does not have a documentation, you could still:
A: Ask the plugin developer for help
B: Use LuckPerms verbose functionality ( !verbose )
C: Select a different plugin with proper documentation.
If you are running your server or network in offline mode, hackers have it really easy to steal your, or any other admins identity. While the server is in offline mode, certain checks ( which exist to prevent exactly this ), are being skipped, and the server does not verify if the person joining actually is the person they claim to be. While there may be plugins which increase the security of offline mode servers by adding things such as admin codes, you should just switch it to online to prevent the issue in the first place.
You should never put anything on your server which has not been downloaded by yourself from official sources. Plugins can be infected with malware which injects itself into all other plugins, and thus is hard to remove. While it may look like a plugin has been hacked, you most certainly downloaded a modified version of it and it is not the plugin authors fault. In case your server has been infected by such malware:
- Stop the server
- Delete all plugins in your plugins folder, and just to be safe also the server jar file
- Re-Download all plugins and server jar files from official websites such as SpigotMC or official plugin websites ( luckperms.net for example ).
- Check if there have been any modifications to the permission system and remove unknown users and wrong permissions.
if you follow these steps you should have a clean server by the end, without exploits.
!downloads
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Forge, Nukkit and Velocity.
!config
Learn what each of the config options are for.
can you trigger an lp sync for a single player?
yes, see the second latest pinned message
I don't know if this is the right place to ask cause the permissions are working, its just the brigadier command suggestions that isn't working. If i type the command out it works just fine. I'm using lucko's fabric-permission-api for managing permissions. I don't know if thats the way to solve this issue tho
yeah that should definitely have the command updating thing
does it update correctly if you give yourself the permission via console?
when i gave myself the permission that i already had it updated the command tree, the same thing happens with /lp sync
its working fine now but i can just relog and it'll stop working
i'm checking for that permission with just this simple kotlin extension function
which calls Permissions.check from lucko's fabric permission api
fun ServerCommandSource.permission(s: String) : Boolean =
Permissions.check(this, s)
and thats just passed to brigadiers' requires
command("mudarSenha") {
requires { it.permission("soberana.account.changepassword") }
it in that case is ServerCommandSource so that's pretty much code thats directly taken from the lib's examples
for granting the permission it is done manually now for testing, but they'll be inside of a group which will be granted later once i can fix this bug that happens with just myself testing
ah i thought you were giving the permission in code
nope, thats just checking for it
wait, how are you even getting that? if you add the permission via cmd it'll work fine, same if you relog
once the player joins, they aren't authenticated and as such the first check fails, but after the log in with their password the command tree isn't refreshed and they land at that state where they can execute the command but it isn't suggested
doing /lp sync fixed that, but i don't think its a good idea to resync the entire server every time someone logs in
idk how brig works but might need to put it in the same requires block?
isAuth && hasPerm
hm, i could try doing that, shouldn't take long
if you're the one doing the authentication, it sounds like you should be the one triggering the update? There's PlayerManager::sendCommandTree (yarn mappings) which is what LP uses when you add/remove perms etc
yes i'm the one doing the authentication, thats what i needed, thanks
cheers
Hello! I'm having a problem checking player perms on a specific server from the Bungee network. What's my mistake?
what is "s"
CommandSender
can you send your pom.xml
I use Eclipse to develop plugins
I changed luckperms-bungee to api-5.0 from https://mvnrepository.com/artifact/net.luckperms/api/5.0
I compiled, but absolutely no change.
QueryOptions.contextual(contextSet)
you don't need to use the context manager
you already have the context set you want
the context manager is to retrieve the active contexts from a User/(platform player object)
Hurrah, it works! Thanks a lot powercas_gamer (Cas) and Emily
how to set user to group for a period?
How am i supposed to put user into a group.
Group group1 = SpigotRpgPlugin.getLuckPerms().getGroupManager().getGroup(group);
user.transientData().add(InheritanceNode.builder(group1).build());
the group exists and is not null,
after this assignment i check user groups via lp editor and only group that the user has is the default one
you need to save the user
and pretty sure transient data doesn't show anywhere
since it'll be deleted awhen the user leaves
use data() if you want it to persist
transient data are intended here
they wont. even with saving.
yes, they won't show up
aaaa i missed the not lol
you can properly check with /lp user .. permission check foo.bar
it won't say it's transient (it probably should), but it will say where it's coming from etc
that'd be a nice addition if it showed it was transient
im checking stuff via /lp group xxx listmembers, and getting 0 despite im sure the user should have it
i think listmembers retrieves the data from storage, since it also checks for offline users
you were right, i have to check for desired permission. that info view seems to be only thing that is able to display transient group
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
PermissionNode node = PermissionNode.builder("somepermission").build();
user.data().add(node);
luckPerms.getUserManager().saveUser(user);
is there anything obviously wrong with this?
for some reason it sometimes does not give the permission to the player? couldn't reproduce but it 100% does happen
MC 1.12.2 Paper
Bukkit.getServicesManager().getRegistration(LuckPerms.class).getProvider();
is this always return null after reloaded?
!reload
Using Bukkit's /reload command causes issues with many plugins, including LuckPerms. If you are adding or removing plugins, you should always fully restart your server.
Plugman causes all of the same issues as /reload as it is fundamentally doing the same thing as /reload
how can i store some kind of data on a player
a name
in my case
or to be more precise a player
meta
Is there any way to check, how long a players temporary group was set for?
Like if they are in a temp group, check if it was set for 30 days, or for 60 days, etc. No matter what time is remaining
no
its possible to not specify a duration when adding the group
Ah true
also if you use the accumulate modifier, what would it do in that case?
What is that?
Ah I see
That is very true didnt even know about that
Thank you
That also leads me to another quick clarification. If I only need to check if players are in a certain group or not, I dont even necessarily need the lukcperms API even. I can just use Bukkit's hasPermission right?
yes
groups are just a group.<group name> permission
Yep đ
Also temp groups and regular groups have the same permission node right? group.<group name>
yes
Hey, is there any way to check the OfflinePlayer group by the UUID?
Hello, how do I cast my player to user please ?
at fr.idaamo.essentials.Listners.PlayerListener.getPrefix(PlayerListener.java:701) ~[?:?]
at fr.idaamo.essentials.Listners.PlayerListener.enableScoreboard(PlayerListener.java:664) ~[?:?]
at fr.idaamo.essentials.Listners.PlayerListener.onJoin(PlayerListener.java:55) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_312]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_312]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_312]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_312]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[server.jar:git-Spigot-21fe707-741a1bd]
... 14 more```
You don't cast it. Read: https://luckperms.net/wiki/Developer-API-Usage#obtaining-a-user-instance
okay thanks
oups sorry
uh
help pleae
please
even luckPerms doesn't work
oh bruh
*
thanks again
I already did it but I didn't use it bruhhh
uhm
I don't understand how to use it in playerlistener
oh good
solved
can someone tell me what im doing wrong
restart ur ide
!extracontexts
Add contexts not supported by stock LuckPerms.
!bungeecheck
Please double check that:
1. BungeeCord config.yml has ip_forward and online_mode set to true
2. All backend servers' spigot.yml has bungeecord set to true
3. All backend servers' server.properties have online-mode set to false
!meta
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.
!api
Learn how to use the LuckPerms API in your project.
!advanced
Discover some of the more advanced concepts of LuckPerms, such as permission calculation, shorthand permissions and more.
I'm looking to use LuckPerms with Forge but was wondering if anyone had any examples of using it with the Forge PermissionAPI on 1.18.2. I am not quite sure what channel is best for this question so apologies if this is the wrong place.
are you asking as a server admin or a mod developer? if a mod dev then this is probably the most appropiate channel, if server admin then #support-1 / -2 is usually better
I'm asking as a Mod Developer :)
How can i add a temp rank via the api?
lp user Pepito09DD parent addtemp capitan 7d
Via the API
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Hello, I tested everything, I don't understand, I tried to get the group of a player, this player has this group, but the command doesn't work like it has to work. Here is the code:
if(!user.getPrimaryGroup().equals("group"))
Instead of asking for the group try asking for the group permission
I tried to, same problem
Hm
I solved my system this way, but you should be able to query it unless you didn't include the Luckperms getter correctly.
public void addPermission(User user, String permission, long duration) {
user.data().add(Node.builder(permission).expiry(duration, TimeUnit.DAYS).build(), TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING);
luckPermsApi.getUserManager().saveUser(user);
}```
so I have to add a premission ?
Has anyone get any information regarding this? :)
Hey, does someone know if there's an event triggering when a player's rank expires?
Can someone tell me if using track#promote will add the user to the first group in the track if they're not in any of the groups?
with node ? If yes, I already tested too
WĂ€re nutzlich
Nah
Ah can someone help me
I wanted to enable the essentials command /ec and just /ec not /enderchest or /endersee
When i add /ec then those two are also automatically added too
Please i need help
How can i get the expiry time from groups
and check them if it is a permanently group or not
You can get the node object of the corresponding group and use Node#getExpiry
and to check if it's permanent you can use Node#hasExpiry
why don't you just try it?
Hey so I'm having some issues with the api;
I've made a few wrapper classes for tracks users and groups, and also for user data that I can freely store in local storage; we are using luckperms integration to manage our ranks and permissions, but we are doing it so that we don't break the original functionality of the plugin (this plugin I'm working on has been around for 12 years), used to be true op and legacy hardcode ranks, but this update is trying to fix that with LuckPerms integration. My issue is that we are trying to add a user to the first group on a track, but the way we are doing it is not working.
I thought that simply adding the group Inheritance nodes to the user would be enough, but that doesn't seem to be the case. We are also trying to avoid using User#getPrimaryGroup and #setPrimaryGroup because the user may be on multiple tracks, and inheriting from multiple groups, and we need to get that data as well.
However we also need the users primary group to be of the rank that is the highest from each track they inherit. For example, we have three tracks, op, builder, and admin; op is the default track , with the default group and another group called "op". The admin track has admin and senior admin. If a user is in group op on the op track but also in group admin on the admin track, the admin rank should be their primary group. How could I do this?
@sour rose /ec is an alias. You can't enable the alias without also enabling the full command. If you want users to only use the /ec command, you can block usage of the other ones with some sort of command blocker.
Oh ok but is there a command blocker feature on luckperms
sry for late reply. it works
learn Java it solve many problems
Good evening, I've been trying to use the API for a chat plugin; when I try to use the code written on the API Guide to get a user prefix and suffix the method getCachedData() is not recognized, same thing happens when I try to get the user variable with
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
luckPerms is not recognized either.
hi, how can i get offline player's primary group?
return LuckPermsProvider.get().getUserManager().getUser(uuid).getPrimaryGroup() throws me Caused by: java.lang.NullPointerException: Cannot invoke "net.luckperms.api.model.user.User.getPrimaryGroup()" because the return value of "net.luckperms.api.model.user.UserManager.getUser(java.util.UUID)" is null
uuid is an UUID provided by getPlayer(args[0]).getUniqueId and this player has player before
!api
Learn how to use the LuckPerms API in your project.
getUser only works if the User is loaded i.e. online. If the player is offline, you'll need to load the user instead
Note that loading a User is IO and as such should not be done on the main thread
got u sir
He's right
Hi everyone!
I have the server on Bukkit 1.7.10, and want to use Luckperms api in my server side of modification
How can I use it?
When i try to get User primaryGroup in UserManager userManager = LuckPermsProvider.get().getUserManager().getUser(name).getPrimaryGroup(); i have a Java error:
java.lang.NoSuchMethodError: net.luckperms.api.query.meta.MetaValueSelector.selectValue(Ljava/lang/String;Ljava/util/List;)Ljava/lang/String;
at me.lucko.luckperms.common.cacheddata.type.SimpleMetaCache.<init>(SimpleMetaCache.java:88) ~[?:?]
at me.lucko.luckperms.common.cacheddata.type.MetaCache.<init>(MetaCache.java:60) ~[?:?]
at me.lucko.luckperms.common.cacheddata.AbstractCachedDataManager.calculateMeta(AbstractCachedDataManager.java:166) ~[?:?]
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[?:1.8.0_292]
at me.lucko.luckperms.common.cache.LoadingMap.get(LoadingMap.java:67) ~[?:?]
at me.lucko.luckperms.common.cacheddata.AbstractCachedDataManager$AbstractContainer.get(AbstractCachedDataManager.java:202) ~[?:?]
at me.lucko.luckperms.common.cacheddata.AbstractCachedDataManager.getMetaData(AbstractCachedDataManager.java:90) ~[?:?]
at me.lucko.luckperms.common.api.implementation.ApiUser.getPrimaryGroup(ApiUser.java:74) ~[?:?]```
I am using LuckPerms api 5.4, could you help me?
I tried to use it in server side of my forge modification
screenshot /lp info
!update
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Forge, Nukkit and Velocity.
!latest
5.4.71
Open your jar and see if itâs bundling LuckPerms with it
when/where are you calling the CMD constructor? in onEnable? or where
donât shade LP into your jar.
Are you using maven
Iâve been there unfortunately ;-; ||big thanks to @fast delta for that one||
language !
Anyone please ?
assuming your on bukkit, just do Player.hasPermission('group.<group name>')
Already did it
Doesn't work too
That's also what I don't understand
what about it doesnt work
It says I don't have the requiered anyway
what is your code
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
this.api = api;
}
Player player = (Player) sender;
User user = api.getUserManager().getUser(player.getName());
if(!user.getPrimaryGroup().equals("group"))
{
player.sendMessage("§cErreur: Vous devez ĂȘtre au minimum §aPremium §cpour exĂ©cuter cette commande !");
}else{
if(player.getGameMode().name().equalsIgnoreCase("creative"))
{
player.sendMessage("§cErreur: Vous ĂȘtes en mode crĂ©atif !");
}else {
if (isFlyingSet) {
player.setAllowFlight(false);
isFlyingSet = false;
player.sendMessage("§aVous avez désactivé le fly au lobby.");
} else {
player.setAllowFlight(true);
isFlyingSet = true;
player.sendMessage("§aVous avez activé le fly au lobby.");
}```
is their primary group "group"?
I just typed group not to show the actual group but yes, I did lpb user <user> parent set <group>
screensbhot /lp user <user> info
do /lp not /lpb
im on bungee
that code is on bukkit
so I have to type lp ?
bruh
why are you hiding your minecraft account details 
same
not mine that's why
its still not sensitive info lol
ik
Hello, I can't put luckPerms on bungeecord, I searched on several forums, but nothing, can someone please help me i can't do it...
!download ?
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Forge, Nukkit and Velocity.
Is it possible to make a permission node expiry time go down only if a condition is met and otherwise stay the same?
It's the bukkit condition that isn't working, maybe it has something to do with lp concerning permissions ?
...
Hey ya'll I am trying to use the api I have added it to my pom depenedices then did the following and can't get the api to load. (Using Intellij)
If someone could @ me that be great if they got an answer
Does it give you option to import LuckPerms class when you hover it
with the api?
Is there any possible way to get an offline player to use within a bungeecord plugin? I want to use it with the LuckPerms API in case a target player is offline, but the OfflinePlayer class is only available within Bukkit.
you can get a User from their UUID via the UserManager
if the player is offline, you'll have to load it
Is there a way to get the User from a username? I'm running an offline server
you can lookup the uuid for a username in the UserManager too, then get the user from the uuid
lookupUniqueId I think?
I'll have look, thank you.
is there a listener when the group of a user changes?
There is, but I can't remember what It is, check the java docs
I have found nothing
Hello, anyone know how I get the Address from a Player that is offline?
or the last address with the user has connected?
I have these 2 methods but I need a method to get the Address
public final UUID getUserUUID(String userName) {
UserManager userManager = api.getUserManager();
return userManager.lookupUniqueId(userName).join();
}
public final String getUserName(UUID uuid) {
UserManager userManager = api.getUserManager();
return userManager.lookupUsername(uuid).join();
}
What address?
You cannot get the users ip address with the LuckpermsAPI
no?
No.. Luckperms does not care about IP addresses
oh
i need it for my ban system.. :c
i find another way to get the address
thank you
YOu can use the normal SpigotAPI for it I am pretty sure.
no i use a database to save the address and get it back
No, you can get the Players IP Address from the SpigotAPI
I need it in Bungeecord
Then use the bungeecord api for it
And i have a /ip command for online player ip's. If i create a new database I can update the command
the bansystem is finished but it does not have any auto ban
Well this is not a Luckperms API issue
Hello, my group wont set:
api.getUserManager().getUser(user.getUsername()).setPrimaryGroup(rank);
no error
and rank is good
Are you saving the user?
luckPerms.getUserManager().saveUser(user);
still no
That should be after you make any changes
!paste the full code
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
api.getUserManager().getUser(user.getUsername()).setPrimaryGroup(rank);
api.getUserManager().saveUser(user);```
do you have an idea why this doesn't work ?
Use some debug messages to see where the code stops executing or if the If statement is even executing at all
?
hello, I have the same problem, but what do I put in the parentheses of equals ?
it is a string.
but what did you put ? a rank or smth ?
I still can't read minds

will this work for getting a offline user?
public final User getUser(UUID uuid) {
UserManager manager = api.getUserManager();
return manager.getUser(uuid);
}
how works CachedMetadata#getPrefixes()??
returns every prefix from every rank? or just specific ones based on a other specific configuration?
doc no mention about that method
@NonNull @Unmodifiable SortedMap<Integer,String> getPrefixes()
Gets a sorted map of all accumulated prefixes.
By that it means, all prefixes that the group or user has access to
I want to get all the prefixes of specific ranks.
something similar to prefix stacking but limited to certain ranks
Group group = luckperms.getGroupManager.getGroup("owner");
StoredMap<Integer, String> groupPrefixes = group.getCachedData().getPrefixes();
That will make groupPrefixes be filled with all the prefixes that group has, along with their prefix weights
thanks.
what
This is not #luckperms-api related.
Use one of the support channels instead and explain what you want to do.
sorry
Hey, is there any way to get the Update Event from a Offline Player that have a temp group?
no
at least i doubt it
expiry time is stored as "this permission expires on this day at this time" and not "this permission expires in this many seconds"
so it wont remove the node at least until the user is loaded
you have a example code?
for what...?
Can I change this block of code from group. to permission. to check for a specific permission? (IE: myplugin.mypermission)? I just need to check if a user has a specific permission before running a block of code in the PlayerJoinEvent.
public static boolean isPlayerInGroup(Player player, String group) { return player.hasPermission("group." + group); }
If you want to do a simple permission check, just use player#hasPermission(<permission>)
Yep, I see. And to do a simple permission check, I technically don't need the LuckPerms API in my project, do I? Or do I need to include LuckPerms in my project in order for it to over-ride permission checks?
You don't need the LP api if you just want basic permission checks as the Player class has the hasPermission()
halp
package club.crestmc.neptunecarbonbukkit.commands.ranks
import club.crestmc.neptunecarbonbukkit.NeptuneCarbonBukkit
import net.luckperms.api.context.DefaultContextKeys
import net.luckperms.api.model.group.Group
import net.luckperms.api.model.user.User
import net.luckperms.api.node.Node
import net.luckperms.api.node.NodeBuilder
import net.luckperms.api.node.NodeType
import net.luckperms.api.node.types.InheritanceNode
import org.bukkit.OfflinePlayer
class RankManager(val plugin: NeptuneCarbonBukkit) {
fun setRank(name: String, player: OfflinePlayer, user: User): String {
System.out.println("debug 1")
val group: Group? = plugin.luckPermsAPI.groupManager.getGroup(name)
if(group == null) {
return "INVALID_RANK"
}
for (g: Group in user.getInheritedGroups(user.queryOptions)) {
user.data().remove(Node.builder(g.name).build())
}
user.setPrimaryGroup(group.name)
plugin.luckPermsAPI.userManager.saveUser(user)
return "SUCCESS"
}
}
``` why is this just adding the rank and not setting the parent to it
if i set parent to default with this
it just doesnt do anyhting
setting the primary group doesnt add the group to the user
I am doing something wrong?
I am trying to get the contexts using the cached data. The permission does give it to me but the contexts don't, even obtaining the list of all gives me the empty list
perm is readed. i can check if have the permission, access to the node, but all contexts are always empty
I'm looking through the API and trying to determine whether it works exclusively with "minecraft" users, or if something like LP standalone could be used for non-mc uuids. At first glance I don't see why I wouldn't be able to create users from my own uuids, but i'd just like to make sure.
Usecase is checking permission for users outside of the game, for example interacting through discord or on a website
okay... im realizing now that this would probably cause permission checks on the server to not work because the uuid doesnt match the minecraft account
A User is just identified by a UUID, it isn't specifically restricted to Minecraft IDs only
thats also what i initially thought
LP keeps a cache for Username â UUID, there are lookup methods in the UserManager to find username/id by a id/username
LP doesn't care about a UUIDs integrity
it's just an object it uses to identify permission holders
okay, so lets say I have a "User" table, which isnt related to MC at first
i give the user a permission based on the pk of that table in LP
how would LP in game find out about the permission nodes set to the original user
"LP in game" doesn't really mean anything, if you mean a Bukkit Player it will use their UUID as source, if you check a permission via the API you need to pass a UUID to get/load a LuckPerms User, etc
right but against what is a permission being checked? LuckPerms can't guess an ID it can't source
Somewhere in the creation of a User, regardless of platform, regardless of source, a UUID is passed to LuckPerms
right
There is no concept of "Mojang ID" either, see for example the UUIDs Geyser/Floodgate gives to bedrock players, those aren't "valid", but they'll work fine
Let me try to give some more context here
Trying to set up a unified user account/permission system across e.g. website, discord and mc
so lets say I have a Users table, and LP stores permissions for me
against the primary key (uuid) of that table
which is not related at all to a mojang uuid
now I give the user some permissions, and LP stores those permissions
after being registered already on the website, the user joins the mc server
and the accounts are linked
so now you have a global Users table and a GameUser table
GameUser keeps a reference to globalUserUUID
now, how does LP check in-game permissions against the original table?
an action is performed in-game which is attached to a mojang uuid. I now need to provide LP the UUID it knows (from my Users table) based on the in-game uuid
so that it can check the permission for the in-game action
Inside the game, at login, LP will get the UUID from the game Player/ServerPlayer/ProxiedPlayer obect and load a User from the database from the table luckperms_user_permissions with that ID, that is the UUID that will be used if you have LuckPerms installed in a Minecraft server, and if you use the platform's own permission API, that's what will be used
LuckPerms won't reach out to some random table it doesn't know about to get some ID based on another ID, like I said before
Somewhere in the creation of a User, regardless of platform, regardless of source, a UUID is passed to LuckPerms
and, inside the game server, the player login process is the source of the UUID, if you use the API directly you are the source of the UUID, but different UUIDs are different Users
LP doesn't exclusively use "Mojang UUIDs", but if you want to perform some kind of cross-platform permission bridging and you want to also preserve the in-game "nature" of permission checks with that same bridging, you will need to keep your own table mapping from the other platform's ID to the UUID of their Minecraft player (which may or may not be provided by Mojang, see offline mode or Geyser/Floodgate UUIDs), and whenever you perform a check in the other platform, lookup the Minecraft UUID from the other platform's ID, get the User and check that
before i get into the details - thanks for spending that time helping :)
the typing... message went on and off for like 20 minutes on my other monitor
(it's been that long?)
almost đ
you will need to keep your own table mapping from the other platform's ID to the UUID of their Minecraft player (which may or may not be provided by Mojang, see offline mode or Geyser/Floodgate UUIDs), and whenever you perform a check in the other platform, lookup the Minecraft UUID from the other platform's ID, get the User and check that
yes, this would also work but will require the user to log in with mc first basically
the whole thing would be based off the minecraft account essentially
which... I guess is possible
I wanted to keep it quite game agnostic actually which is why I was trying to avoid doing it that way
considering this
LuckPerms won't reach out to some random table it doesn't know about to get some ID based on another ID
the only way to really achieve this is to hijack the impl/platform and pass the login event to LP myself with the transformed UUID
which is very questionable at best
at that point I'd recommend just forking luckperms lmao
I did think about that đ - had to end up doing that for brigadier
but thats much smaller
as a silly graph calculator and storage system, LP is pretty platform agnostic but trying to cross-reference IDs from other platforms was certainly not in the design plans
i'll have a play around with the code to see if anything remotely PRable comes out of it
i want to avoid forcing people to use my custom fork
Is there a way I can set a rank to be applied when another one expires? Some players end up having no rank:
Join -> Rank expired -> no rank -> rejoin -> default
return this.plugin.getLuckPerms().getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
user.data().clear(NodeType.INHERITANCE::matches);
user.data().add(InheritanceNode.builder("titan")
.expiry(millis, TimeUnit.SECONDS)
.build());
}).thenApply(unused -> new TitanRankResult(TitanRankResult.ResultType.RANK_ADDED))
.exceptionally(t -> new TitanRankResult(TitanRankResult.ResultType.ERROR, t.getMessage()));
getPermissionData() will only contain permissions that "pass" the user's current active contexts, not all permissions (if the context doesn't match, it won't be included)
There is getPermissionData(QueryOptions), you can pass QueryOptions.nonContextual() to not apply said that kind of filtering, ...getPermissionData(QueryOptions.nonContextual()).query...; but keep in mind that queryPermission will only give you the "most matching" permission as per https://luckperms.net/wiki/Advanced-Setup#permission-calculation
But also, are you using contexts as data storage? Because that will affect when the permission is applied and such; context is used for filtering, not for storage; there are MetaNodes for arbitrary storage but they are their own permissions altogether
i guess you could subscribe to the NodeRemoveEvent, check if the node hasExpiry && hasExpired + whatever other conditions you may want, and re-add the other node
I see, thank you! :)
btw does luckperms check for expiries every second or just when they join or are online during expiry?
if the user is loaded (player is online or was loaded via api), it checks every 3 seconds i think
if it isn't it will be checked when it's loaded (login or api loadUser)
i guess some commands might trigger that too?
np
thanks, it worked.
And yes, I am using the context as a data store. More than anything because the nodes only return true or false and I really don't want to do weird things with RegExp :/
Yeah you should be using MetaNodes instead, see the API Usage page on the wiki, the section about storing/retrieving custom metadata
Sounds like it's exactly what you need
metanodes values can be editable in the editor?
i'm still no get how to modify metanodes
meta.<key>.<value>
A meta pair, favourite-color = red would translate into the permission: meta.favourite-color.red
oh, i see... thanks
do the metanodes have to be added to a registry or something? more than anything because they do not appear when i want to edit them
You have to add them manually I am pretty sure. Then it's upto the other plugin to use the meta
It makes it a bit annoying for the user, but it works. thanks!!
Hi, how can I get an offline user by his name?
How can I get all groups that exist?
And how can I get the weight of the group?
Wdym exactly?
over the API I mean
Oh, sorry. I thought it was the other channel
You can use the GroupManager class and call the #searchAll method. It requires a NodeMatcher. You can filter all the groups with a weight set.
I'm on my phone rn so it's a little difficult for me to write the code
okay ty I will try that
Why do you need to get an offline player for that?
there's no situation where a player will be offline, if they're running the command themselves.
How can I sort the Players in my Tablist with the weight of there group?
Using a plugin for it. LuckPerms does not format the tablist.
thats the reason why i am in the API chat. So the easiest way is to loop through all roles and create Teams with the weight of that group and than put the players in the right group?
Where is the salon with all the command ?
tablist is sorted by the client, first, players in spectator mode always go last, then they are sorted by team name (lexicographically) and then by player name (also lexicographically)
so you'd assign teams to players after the group they're in, and the team would be named in such a way that the ordering would follow the group weight
Do you thnik this will work for making a list of all groups?
List<Group> groups = Timetab.getApi().getGroupManager().getLoadedGroups().stream().toList();
yes
Do you know how I can get this to work?
get User from player name instead of uuid
Hi !
I need help with the LuckPerms API, in fact, I made a shopping plugin and I want to assign the player his rank when he has made his purchase but I don't know how...
Do you know why I get this error and how can I fix that?
Hello there. I'm trying to search an user based on his username using the Luckperms REST API, but the result is always empty.
I'm using this params {"key": username, "type": "display_name"} while calling the /user/search route, using GET.
Does anyone have an working example?
please tag when replying, I have too many servers :p
/user/search is for searching users that have a specified node, display_name is a node type that's only relevant to groups really, and the key is the node key (like minecraft.command.kick)
but also, you don't give it a json, you pass query params (and only one of them)
getPrimaryGroup returns a string
but also, you don't give it a json, you pass query params (and only one of them)
I took only a snippet from my actual code so that's why it seems to be a JSON, I'm passing this as an object torequests.getin py
so there's no way to search an user based on his username? :(
i don't think there is, no
Forge have a permission api and includes nodes with integer and string as values
that node values can be editable with luckperms (using web editor or comamnd editor)?
i see someone ask the same but get ignored...
#support-1 message
Hi !
I need help with the LuckPerms API, in fact, I made a shopping plugin and I want to assign the player his rank when he has made his purchase but I don't know how...
Get instance of LP, get instance of user, modify user, add the group to the user, save the user.
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java This gives a small example of how to make a command that adds a group to a user, so you could get an idea how to do it from this.
p.sendMessage(Lavori.format("&cNon lavori in questa azienda."));
return;
}
if(Groups.isPlayerInGroup(target, work)){
p.sendMessage(Lavori.format("&cIl cittadino indicato fa giĂ parte della tua azienda."));
return;
}
UUID uuid = target.getUniqueId();
Groups.addPermission(uuid, work + ".dipendente");
p.sendMessage(Lavori.format("&aHai assunto il cittadino &a" + target.getName() + " &anella tua azienda."));
p.sendMessage(Lavori.format("&aSei stato assunto nell'azienda &e" + work + " &acome dipendente.\n" +
"&eSe pensi che si tratti di un errore, usa il comando" +
"&f&l/lavoro &7licenzia " + work));```
hi, i'm developing a work system, in the "assume" command i created the Groups class in the "utils" package, where i inserted the "isPlayerInGroup" method, but it returns the error message where it says "Groups.isPlayerInGroup(target, work)"
that is, that the indicated user is already part of the company indicated in the command
Wait so what is it issue? It's not detecting the user in the group or?
i think it detected it, so the first condition checks it "!Groups.isPlayerInGroup(p, work)", after that it doesn't check it anymore "Groups.isPlayerInGroup(target, work)"
that is, even if he doesn't have the group, he still claims to be part of that company
!paste the full class where the code is
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
public static boolean isPlayerInGroup(Player player, String group) {
return player.hasPermission(group + ".direttore");
}
if it could help you
I think that has permission is wrong. It should be hasPermission("group." + group)
As you pass the group name in as a group variable.
but on the LuckPerms wiki it tells me to do this
Group permissions are always group.<group name>
hasPermission("group." + group) is the best way to check.
if(!Groups.isPlayerInGroup(p, work)){
p.sendMessage(Lavori.format("&cNon lavori in questa azienda."));
return;
}
This will then check if the user has group.work which basically checks if they have the group work
i solved
they were 2 different groups, one had to check if it had the "manager" group, the other if it had the "employee" group, i was checking them in the same group
thanks
is there any existing way to run a standalone LuckPerms inside another java application?
so it would basically be a standalone luckperms api implementation, the startup process of which is initiated by other code, plus disabled console input
i reask this...
Hello, I was wondering if anyone can see any reason why players might be keeping their previous group when ranking up in my plugin? I have yet to be able to reproduce the issue. I just know that sometimes when a player tries to rankup their money is taken but they are not given the next group in the track, and when I go to check their groups they have 2 or 3 groups in the same track
Here is my code that handles all of this: https://paste.insprill.net/MBXLm
hello, i created a track of groups, I'm creating the command "/job promote <job> <user>", but in the wiki i can't find anything that explains how to use the Tracks
can you help me?
:/
when someone who knows how to help is available, they will answer
until then, you will just have to wait patiently
I think I found it on the JavaDocs (https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/track/Track.html#promote(net.luckperms.api.model.user.User,net.luckperms.api.context.ContextSet))
However, like my issue above states, I've been having trouble with players groups not getting removed when being promoted along a track resulting in them having 2 groups and I'm not sure if its an issue with my code or an issue with luckperms, but just be weary
ok ok i solved
so, i have a question
how do i check if the user has reached the maximum roles? the code used does not work
i'm talking about tracks
or this code
List<String> trackGroups = track.getGroups();
if(primaryGroup.equals(trackGroups.get(trackGroups.size() -1))){
p.sendMessage(Lavori.format("&cIl lavoratore indicato ha giĂ raggiunto il massimo dei ruoli registrati nell'azienda."));
return;
}```
oof đŠ
Pretty sure Track#promote returns some useful value you can use
yes i used the promote() method, but i can promote up to a certain point because there is a limit, the promotion works, i just have to make sure that if it has the maximum role but continues to "promote" then the must return an error
Yes, and the return value of the promote method is useful for you to identify and send the error
Call promote, check the result status
https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/track/PromotionResult.Status.html#END_OF_TRACK
heyo, im trying to get the prefix of a user through the proxy on one of the connected servers, how could i go about doing this?
Edit: I got it getting the userâs prefix, now I need to get the userâs group prefix (the one that displays on the user when chatting) + parsing color codes
Might be more like change &6 to <GOLD>
How do i save the data here ? I do not receive any User or Player or UUID object..
okay, what if i want to verify that the user has the minimum role? i can't find this either
Change the colors on the group prefix or�
Also, is there a way to get the highest weighted group of a user?
@slender pagodaMy server has been setup for years and weights group prefix are good, just want to update the color codes in many of my meta tags and group prefix's
???
Ola, is there a way to get players group without inherited ones? hasPermission obviously returns all groups below, i want to check only if player has that one specific group
This is what I have for getting the new group when I add it to a player, is there a way to get the primary group of that player before the new group applies? (the event needs to fire with /lp user userName parent add groupName )
I think it would be smart if I remove the new group, get the primary group, then add it back.
Heya, using 'net.luckperms:api:5.4' on Fabric (1.19.2), and came to an issue I'm not used to on other platforms. Using LuckPermsProvider.get().getPlayerAdapter().getPermissionData(serverPlayerEntity).checkPermission(permission).asBoolean() (simplified) on a player for some.permission.child is true when some.permission is, even though some.permission.child is undefined, forcing users to negate the permission. Is there a way around this? (Other than changing some.permission to some.permission.base)
Does anyone know how to setWeight using the luckperms api?
help ‎ïž
I call it on SERVER_STARTED to be sure, mod init may load before LP
toInheritanceNode is not a method that exists, but you have a stream of InheritanceNodes already so that'd achieve nothing really
get the Group from the group manager and add a WeightNode, then save the group with the manager as well
ah lmfao ty

Hey ya'll I am trying to have luckperms load before my plugin and put it in the depend section of the spigot.yml do I just put [LuckPerms] or is it [luckperms] [lp] or what. Feel free to @ me
depend: [Luckperms]
Thank you!
hi how do i use the editor
- Don't cross post
- Answered in #general
- Not related to the API, stick to #support-1 , #support-2 or #general please.
Is there ever a time where this would return blank? ```java
Group group = this.main.luckPerms.getGroupManager().getGroup("groupname");
return Utils.chat(group.getCachedData().getMetaData().getPrefix());
assuming the group does exist and has a prefix?
basically I am using this as a placeholder, and sometimes for some players, it is literally just returning blank lol
For the people that it returns blank, does it return blank from other sources such as lp user <name> info?
No, they have the group, and the prefix shows up in lp user <name> info aswell
actually
i know the problem sorry
stupid programming error
Ah okay
if (identifier.startsWith("donorprefix")) {
} else if (identifier.startsWith("donorprefix_forced")) {
see the problem here 
pretty sure ive done that before
Pretty sure we all have.
you're using outdated api
i am using 5.4
Learn how to use the LuckPerms API in your project.
Since which API version has this been the case?
5.0
Use LuckPermsProvider instead
How can I get the Priority of a group for my tablist plugin?
d;lp Group#getWeight
@NonNull
OptionalInt getWeight()```
Gets the weight of this group, if present.
the group weight
does the .setPrimaryGroup() function work?
if not is setting a group node the best way to go around this.
it works but it doesn't do what you're wanting to do most likely, the primary group (by default) is calculated automatically by group weight (so configuring weights is how you determine the primary group), adding an InheritanceNode is adding a parent group
something like this?
InheritanceNode node = InheritanceNode.builder(groupname).build();
user.data().add(node);```
need to save the user but yes
can someone help me and tell me how can i get color of prefix that user has
luckpermsApi.getUserManager().getUser(player.getUniqueId()).getPrimaryGroup();
i got his primary group
but i need color of that group
yk
?
groups and prefixes dont have colors
it may include special formats that are parsed by a chat plugin or tablist plugin, but neither the group or prefix has a color as far as luckperms is concerned
so im trying to promote a user along a track. firstly am i going about this right?
track.promote(user, ...);```
secondly, what is the ContextSet param?
im not sure i understand it
bump
okay? What does this have to do with the API
Is there a way to check if a player is in a group but not an inherited group?
like
player could be in Rank6, but rank 6 inherits rank1 to rank5 right
what if I want to check if they are in rank3? I couldn't just check their groups right because wouldnt that be true even if they were in rank6 aswell?
Like if somebody was in Rank6. and Rank6 inherits Rank 1 to Rank5. user.getInheritedGroups() would return ranks 1 to 5 too right
d;lp PermissionHolder#getInheritedGroups
@Unmodifiable @NonNull
Collection<Group> getInheritedGroups(@NonNull QueryOptions queryOptions)```
Gets a collection of the Groups this holder inherits nodes from.
If Flag.RESOLVE_INHERITANCE is set, this will include holders inherited from both directly and indirectly (through directly inherited groups). It will effectively resolve the whole "inheritance tree".
If Flag.RESOLVE_INHERITANCE is not set, then the traversal will only go one level up the inheritance tree, and return only directly inherited groups.
The collection will be ordered according to the platforms inheritance rules. The groups which are inherited from first will appear earlier in the list.
The list will not contain the holder.
5.1
a collection of the groups the holder inherits from
queryOptions - the query options
Hello, I am trying to get the prefix of a group without a player. Is this possible?
nvm, found a method
public String getGroupPrefix(String group) {
Group groupT = api.getGroupManager().getGroup(group);
return groupT.getCachedData().getMetaData().getPrefix();
}
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/User.html#getPrimaryGroup() returns group which has the biggest weight, right? (on default)
yep
Hi! How can I create a group(!!) through code if luckPerms.getGroupManager().getGroup("Whatever") == null ?
Should I use GroupManager#createAndLoadGroup ?
or smth
yes
thx
How can I remove an entire group from player?
remove the group node from the player
hello how can i get a user in a join event
Do you know how to get the player from the join event?
yes but i need the luckperms user
Yeah Iâm fully aware.
have you added LuckPerms to your project, and got an instance of the API?
yes
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
i have it fixt
I got an issue with my server
When I gave my friend a role
It didnt let him perms to open chests and doors
anyone can help me out?
but I could do it since I got op
What's the difference between using CachedData to perform a permission check vs what bukkit calls (which I'm assuming doesn't call CachedData?)
LP docs say that it's very fast, but what makes it so fast?
And are there any downsides to using it?
hello dkim one nine three seven five
hello Emily!
What's the difference between using CachedData to perform a permission check vs what bukkit calls?
LP's bukkit Permissible uses the cached data behind the scenes
https://github.com/LuckPerms/LuckPerms/blob/84bd2ee52abbed9624e72435c37fe6fcc3439a8d/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissible.java#L166C1-L174
but the whole bukkit permission system is non-ideal and in some situations has some unavoidable overheads (namely, adding/removing/registering permissions via bukkit api)
but what makes it so fast?
not an easy question to answer :') but at the very most basic level, heavy caching and precalculation
And are there any downsides to using it?
not really
Although it says
If you're doing frequent data lookups, it is highly recommended that you use CachedData over the methods in User and Group.
so does User/Group fetch directly from the database?
I'm trying to make a prestiging system which is based off of permissions, but I'm not sure if having like 1000 permission checks for example is ideal, especially if there are PAPI placeholders being used
Should I just store the data myself instead of using permissions? And then the server owner can also add their own permission group if they want to do like a prestige-only thing
what methods in User/Group? 
but to answer that question, no, the data is in-memory, it's just that the whole inheritance tree etc etc is pre-calculated in the CachedData
I guess that means "put the CachedData in a variable instead of recreating it every time"? idk lol
add the maven publish to common module
thereâs probably a better way to do all this though
Why is the user still null after 5 minutes on the network?
User user = api.getUserManager().getUser(playerName);
Also, new players are not displayed at /lp editor
where are you executing that code and where is the player
I'm being a bit overwhelmed with the amount of features in the api.
I decided to depend on it because I needed a way to get permissions of offline players (which seems to be not viable via spigot api, but if you do know how, I would appreciate that too.)
So, I just have a player uuid and a string permission node such as "foo.bar".
What would be the appropriate way of checking if a player (who could be offline) has the permission.
I read the wiki on api usage and and ended up with code like this
CompletableFuture<User> userFuture = userManager.loadUser(UUID.fromString(playerUuid));
userFuture.thenAcceptAsync(user -> {
Optional<Node> node = user.resolveInheritedNodes(QueryOptions.nonContextual()).stream().filter(n -> n.getKey().equals(permissionNode)).findFirst();
if (node.isPresent() && node.get().getValue()) {
Which does seem to work fine.... most of the time....
Sometimes after the filter there are no nodes left and the check is falsy even though it should be truthy
For a simple permission check you should use the CachedPermissionData, see
https://luckperms.net/wiki/Developer-API-Usage#the-basics-of-cacheddata
and following sections
welp, should have read further into the api usage i guess
that does indeed look simple and effective.
even then the api seems to sometimes return the wrong value
I'm checking the permissions really often- like tens of times a second- could that affect anything
Hello, I have a problem on my bungeecord plugin, I can't check the prefix of the player with the luckperms api, if someone could help me.
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
read the wiki
think of your grammar.you german^
is there any way to see when plugins call the api? I am having an issue where some users are getting groups given to them, but its not showing in server logs nor the luckperms_action table. I was told that the only thing that wouldlt be logging anywhere is changed made via the api
LP doesn't push API calls to audit log, but there is audit log API for plugins themselves to push entries to
however
There is the NodeAddEvent, events are called by API actions as well, but there is no "cause" system
darn
well there is a cause system, just not exposed in the API lol, I think it's used in /lp verbose
verbose shows players getting groups added? I thought it only showed checks
oh yeah I was more generally talking about the cause system
oh :/
Is it possible to "sort" through permissions? I have three permissions hollowrealms.race.elves hollowrealms.race.lizards and hollowrealms.race.demons. I need to find out if two players have different races, if they have a different word after race.. How would I do that?
best to use the meta system for that
Is there a link for this on the docs?
How do I check if a player has the meta "test"
Hi people 
I would like to detect when the player's role is changed by parent set, parent add and remove. But there is no event for this, any ideas?
all those commands do is add, mutate, or remove inheritance nodes (group.GROUPNAME) on the user. Use the appropiate node add/mutate/remove events, and filter for inheritance nodes
Oh yeah, really works! Thank you
ĐŃĐžĐČĐ”Ń ĐșŃĐŸ ŃŃŃĐșĐžĐč
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
How can i check for a meta value like meta.clansize.20 without iterating over all inherited groups of a player
just get the meta normally. unless you intentionally make it so it only looks for values on the player, it will include inherited meta values
it didnt include inherited values
i did
user.getNodes(NodeType.META).filter { it.metaKey == "clansize" }
that only gets the user's own nodes
see ^
and the other stuff around CachedMetaData
how i can check the duration of the rank of a player ?
@Nullable
Instant getExpiry()```
Gets the time when this node will expire.
the Instant when this node will expire, or null if it doesn't have an expiry time
Hey there, i'm new to using the api and when trying to add the dependencies etc it does not work. It says that Luckperms is a unresolved reference. But when i refresh my dependencies or use ./gradlew it comes out as build succesful
maven {
url = uri("https://cursemaven.com")
content {
includeGroup("curse.maven")
}
mavenCentral()
}
}
dependencies {
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
mappings("net.fabricmc:yarn:${property("yarn_mappings")}")
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}")
modImplementation("curse.maven:cobblemon-687131:${property("cobblemon_curse_file_id")}")
compileOnly("net.luckperms:api:5.4")
include("net.luckperms:luckperms-api:5.4")?.let { implementation(it) }
}```
but shows in other chats
What do you mean?
i want it to be so that all the staff roles to not be seen in the default chat, and so that its only seen in a diffrent chat i select
Does someone know by any chance if i imported the api wrong?
that include for luckperms-api doesn't look like it should be there at all, other than that it looks alright
I added that because i thought it would help but with or without it does not work :/
HEy i keep getting this error - https://sourceb.in/2h1sAXDfPK
whenever i run the plugin in the server, no build errors or such
the dependency on pom.xml is
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>```
and
im using the latest Bukkit version of luckperms in the server, v5.4.79
You've got to declare in your plugin.yml that your plugin depends (or soft depends, if the LP dependency is optional), to make sure LP loads before your plugin.
Otherwise, the load order is for all intents and purposes random, and that means sometimes your plugin will load before LP, and when it tries to use LP APIs, the server doesn't know they exist yet
like this?
I believe so, yes
What imports do i need when having the dependency installed in my kotlin fabric mod?
For some reason Luckperms stays on unresolved
I already added everything in my repositories and dependencies and the gradle builds successfully
Hey i got an error while trying to build a bungee plugin,
these are the strings that gives the error
String prefix = user.getCachedData().getMetaData().getPrefix();
String suffix = user.getCachedData().getMetaData().getSuffix();
method getMetaData in interface net.luckperms.api.cacheddata.CachedDataManager cannot be applied to given types;
and this is the error
can anyone help?
what version of the api are you building against?
sorry?
oh
i just pasted in this from here: https://central.sonatype.com/artifact/net.luckperms/api/5.0/overview?smo=true
and i added these 2 jars to the library
uh you shouldn't really add those jars directly there, using maven should be all of it
but, yeah, that method was introduced a bit later than 5.0, if you target 5.4 (which is the latest today) it should be fine đ
yeah
yep, if you're using intellij there should be a "reload maven" button floating somewhere
that would probably work too
np
Hey there
can I use this code to get the this meta attribute from a certain group? Because if I use it, I dont get a a color code back
private String getUserRankColor(Player player) {
User user = plugin.getLuckPerms().getUserManager().getUser(player.getUniqueId());
if(user != null)
for(Node node : user.getNodes())
switch(node.getKey()) {
case "meta.rank-color.§4":
return "§4";
case "meta.rank-color.§b":
return "§b";
case "meta.rank-color.§c":
return "§c";
case "meta.rank-color.§1":
return "§1";
case "meta.rank-color.§6":
return "§6";
case "meta.rank-color.§d":
return "§d";
case "meta.rank-color.§a":
return "§a";
}
return "";
}```
hi, so im working on a plugin that will have a permissions gui, a ingame menu to give/remove permissions,
i want to create an item for each permission, this isnt my issue, id like to know if there is an easy way to get all user permissions in an string array or list. any help is appreciated feel free to @ me if you can help
Over complicating this a little bit. Just get the meta value for ârank-colorâ
How would I do that?
I used it like this, itâs not going to be exactly the same code since youâre not just getting an integer.
Hey I'm currently getting this error
https://hastebin.com/share/mofatayuja.ruby
Code:
private String getPrefix(Player p){
CachedMetaData metaData = CraftValleyCore.luckPerms.getPlayerAdapter(Player.class).getMetaData(p);
return metaData.getPrefix();
}
@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
Player p = e.getPlayer();
String prefix = getPrefix(p);
if (prefix == null) {
prefix = "";
}
e.setFormat(MessageUtil.Colorize(prefix + ChatColor.GRAY + "%s" + ": " + "%s"));
}
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I don't really know why
The screenshot is from the on enable method
make sure that you have a dependency on luckperms in your plugin.yml so that your plugin loads after it, and if you use maven make sure you're not accidentally shading it in
soft or normal depend
depends on whether you want your plugin to work without luckperms or not
if it's a regular depend and luckperms isn't present then your plugin won't enable
Added it but I'm still getting the error
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Yo, how do you add/set up groups to a player?
Trying to give x group to a user with the api and im confused
why this code gives me errors import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPermsProvider; import net.luckperms.api.group.Group; import net.luckperms.api.group.GroupManager; error='Cannot resolve symbol 'luckperms''
do you have a variable/field called LuckPerms?
you need a variable of type LuckPerms, and assign it the instance obtained either from the services manager or from the static provider
can you show it? plz
still Cannot resolve symbol 'luckperms' the code
`@Override
public void onEnable() {
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
}`
Hey I'm really confused by some of the documentation, can anyone give an example of how I would get a player's prefix as a string?
đ Hello good people! I'm building an app that allows me to whitelist people by setting their group from an invite only Slack workspace. I'm attempting to set their primary group like this:
DataMutateResult res = user.setPrimaryGroup(group);
however the result fails every time. I'm able to see that the group I am trying to set exists with lp editor. I'm developing this as a paper plugin using gradle and the runServer plugin which starts a paper server with the plugin I'm working on.
Any idea what might be causing this to fail?
This method from the cookbook seems to work:
private CompletableFuture<Void> addUserToGroup(Player player, String group) {
return luckPermsApi.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
user.data().clear(NodeType.INHERITANCE::matches);
Node node = InheritanceNode.builder(group).build();
user.data().add(node);
});
}
setting the primary group doesnt actually do anything
you need to add the group node to the player
the primary group only matters if you have certain config settings set, but with the default, its not used
and they would need to have that group anyways
how do I set prefix for a group?
`import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node;
import net.luckperms.api.node.NodeType;
import java.util.stream.Collectors;
LuckPerms luckPerms = LuckPermsProvider.get();
if (luckPerms != null) {
player.sendMessage("---- LuckPerms Groups ----");
luckPerms.getGroupManager().getLoadedGroups().forEach(group -> {
String groupInfo = "Group: §a" + group.getName() + "§7, Prefix: §a" + group.getCachedData().getMetaData().getPrefix() + "§7, Suffix: §a" + group.getCachedData().getMetaData().getSuffix();
player.sendMessage(groupInfo);
String playersInGroup = luckPerms.getUserManager().getUsers().stream()
.filter(user -> user.getCachedData().getPermissionData().checkPermission(NodeType.INHERITANCE, group.getName()).asBoolean())
.map(User::getUsername)
.collect(Collectors.joining(", "));
player.sendMessage(" Players: §a" + playersInGroup);
});
player.sendMessage("-------------------------");
}
}
`so it dosen't work
Don't just post "it doesn't work" without any evidence of it not working... What error do you get?
Cannot resolve symbol 'luckperms'
on all only these imports import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPermsProvider; import net.luckperms.api.model.group.Group; import net.luckperms.api.model.user.User; import net.luckperms.api.node.Node; import net.luckperms.api.node.NodeType;
Share the full stack trace
idk want is that (but i am traing to make a minecraft plugin that takes all the groups and deletes (i am making a so if a player chages the luckperm permisions is will delete all groups and create all them again))
If you don't even know what a stack trace is, then you should really reconsider making plugins.
Hello? I want to use the LuckPerms API to do the following.
I noticed that the Prefix/Suffix of the Meta of LuckPerms has a priority number. And theoretically, the higher the number, the higher the priority.
So I can use this to implement fake Prefix/Suffix.
This is for example:
PrefixNode prefixNode = PrefixNode.builder(prefix, 77665).build().
user.data().add(prefixNode).
But when I want to restore the original, i.e., I just need to delete the prefix with priority 77665.
But I don't seem to find this operation directly in the API provided by LuckPerms.
But the operation of deleting Meta directly by priority exists.
I.e. /lp user <name> meta removeprefix
Also, I think there are times when reading Prefix can skip this fake Prefix/Suffix.
But I found that when fetching Prefix/Suffix it seems to only fetch the currently displayed Prefix/Suffix.(i.e. the one with the largest priority number Meta) I want to skip the largest one and choose the second largest one. And how do I achieve this?
Perhaps the maximum priority number we can use is Integer.MAX_VALUE
everyone starts somewhere
hey
val luckUser: User = LuckPermsProvider.get().getPlayerAdapter(Player::class.java).getUser(e.player)
luckUser.data().add(Node.builder("worldguard.region.flag.regions.own.${chunkName}").build())
Can somebody tell me why isn't it giving the permission? Just won't work, no errors
you have to save the user
so getting cached meta from a user doesn't hold the expiry right?, was thinking of putting some buffs into the users meta data ex "exp-buff" 0.1 with expiry of 5 minutes and then fetch that whenever the user mines a block and also to display the current buffs as placeholders ex "exp buff: 10% 5 minutes left"
but I guess I have to use nodes if I want to get the expiry then or is there a better way to do it?
Yes
Yes not nodes?
Hi I am trying to make use of the API with a plugin that allows me its name is ConditionalEvents this has a configuration that allows me to enter the package and shred it to save its variables in placeholder. But the issue is that I can't find a way to put it together. I need to listen to the event when a user loses permission to fly for whatever reason, because it has been added temporarily or not. If you allow me I pass you the link to the wiki of the plugin
Hello, is there something like a GroupChangeEvent? So I can see when a player changed their group and do something in that case.
Oh I think I see it now, thanks.
@main dagger that's a pity... I should know somehow when someone is added or removed from a group in the standalone app... đŠ
Hey Roomiiaanâą! Please don't tag helpful/staff members directly.
how can i get a permission (like permission.value and get the value as a text)
Do what
p2 has permissions like plots.plot.8. I want to do the same and get the value 8
use meta
how
!meta
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.
how do i set the data? key.1 as a permission would return 1?
Can i add it through the editor and how
meta.key.value
Thank you very very much!
!cookbook this should have an example for you to look at.
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Im probably doing something very wrong, what is it?
the rank is the same as the id of the group Im pretty sure
my best bet is that the node key is not group.<rank id>
ping on reply please <3
actually seems like its this part
im dumbass it seems
yeah fixed
this is what happens when you dont read the docs properly kids
user.data() has add and remove methods, but how can I modify the node?
if I need the behavior similar to lp user <user> meta set <key> <value>, do I have to do remove and then add?
yep
Do someone now, how i can do this:
If someone adds a rank to a member, a dc bot will get the info from the api and add the info to the member in the dc (acc's are linked)
d;lp UserManager#serachAll
@Unmodifiable @NonNull
<T extends Node> CompletableFuture< Map<UUID,âCollection<T>>> searchAll(@NonNull NodeMatcher matcher)```
Searches the normal node maps of all known Users for Node entries matching the given matcher.
5.1
the entries which matched
matcher - the matcher
nice markdown broken again
hello, how can I convert this number to days?
its not a duration
but directly accessing the db isn't really supproted
but I want to get an offline player's ranks and the expiry date, and with luckperms api I cant get informations of offline player. i thought the only way is database request.
ah thank you, you saved me
Now it also shows the rank of all players who haven't even played on the server yet. Is there any way I can check if the player is in the luckperms database?
how can i set a users' primary group for an amount of time. like modifying a users' primary group for a week and then roll it back to default
no?
declaration: package: net.luckperms.api.node, interface: NodeBuilder
I know we can get expiry date of node, but can we get date of when this node has been given or what total duration it had?
I mean you can search for that in the LP logs (afaik that's exposed to API), but nodes themselves don't contain the time they were given.
LuckPermsProvider.get().getUserManager().getUser(name).getCachedData().getMetaData().getPrefix()
whats wrong I get prefix group &4[&Member&4] &8
If that's what you get, then that's the prefix the player has.
And how to get groups prefix
How can i get all the users with a specific role, eaven offline ones. I tried getting all the offline users and loading them for after check their groups but it return player who had the group in the past to. Using luckPermsAPI.getUserManager().getUniqueUsers() return null for some reason
How do I completely delete the user from luckperms using api? There is no userManager.removeUser method.
deletePlayerData/cleanupUser don't work as expected though cleanupUser tries to do something but fails in many cases.
user.data().clear() leaves out the default group thing
I find luckperms api very limited and complicated compared to permissionsex, in pex I could just user.remove but in luckperms no such thing
a user without nodes (or just group.default) should automatically be deleted from the database; there is an open issue about that on GitHub so it isn't an unknown problem
in my case if I do user.data().clear() and then save the user stays with the default group in the editor
a user without nodes should automatically be deleted
there is an open issue about that on GitHub so it isn't an unknown problem
Most of them don't get deleted even after restarts. I'm developing a fakeplayers plugin and I want to make my plugin compatible with luckperms. Fakeplayers are "offline" and "uuids" in the luckperms, editor (because they are just uuids real players can't hack donate by logging on to the fake accounts). When I clear up the fake user and then save, he is still in the editor with the default group, though some of them get deleted. The debug logger keeps saying:
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for b53d8881-7efd-487c-bd3f-ca32c8cd2dad
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for 63dc8da6-76fc-4b2f-a10a-6113838edcfd
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for 338a31ff-b464-4949-bd9e-7591c5a3a950
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for 744e5e49-b79b-4071-977c-c8dc538d43e7
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for d8fa477c-52af-4445-8a1d-e8aa14258f96
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for 2522df05-5bb4-4e40-91d3-a6a4e406759f
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for 5bfb0350-cd78-44e2-9093-90d8f57adaee
[luckperms-command-executor/INFO]: [LuckPerms] User Housekeeper: unloading user data for 32d9385c-e49d-4819-ba7b-b4c47be2a543
But these unloads don't do anything, and they are still there:
for the third time, it is a known issue
what's the solution, where is the issue
if fake users don't get deleted, they will trash up the editor that's why it's so crucial
but unloading has nothing to do with the data saving, that's in-memory
I don't know where the issue is, the proper solution is to fix it in LuckPerms, contributions are always welcomed, without that, manually deleting it from the db I suppose
the full db access is not in the api, so I can't directly delete them from it, I'll look into contributing,
it's not exposed directly in the API because there are many storage methods that need to be abstracted away, not just a sql database (you can even provide a custom storage method via extensions)

the logic for the deletion is there, but clearly there's something else going on
I tried it but it too throws a NullPointerException
could you share the stack trace?
I found out the problem, will open pr soon

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.
how do i give someone a certian group for a certain amount of time
YOu can build an inheritance node and add an expiry to it
Can I post code here?
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
so my the luckPermsAPI variable isnt being set aka not allowing me to use any features of the API. any ideas? https://pastes.dev/6NkKSZnKSU
this is in my onEnable
Try LuckPerms api = provider.getProvider(); instead.
inplace of luckPermsAPI = provider.getProvider();?
Right.
alrighty let me see
Am I meant to use the getProvider() func in every class or the api variable set in the onEnable?
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); is just returning null even though LP is installed on the server
does luckperms provide an event that's called when player groups change? and if so whats it called?
Learn how to use the LuckPerms API in your project.
That should work, not sure exactly what youâre doing.
is it possible to get the main node of player which contains it group and expiration date and change it? i red from docs that they cannot be changed but i really need to modify the expiration date
https://luckperms.net/wiki/Developer-API-Usage
Nodes are immutable - meaning their attributes cannot be changed. However, we can easily create a new node based upon the properties of an existing one.
im not sure how can i get the node from player.data()
im sure there is only one node there
also check the reading one
ah thanks
what should i set the key name?
i cant get it by example
s that are on docs
like is this fine to use ?
"madcraft.rank.vip"
ÂŻ_(ă)_/ÂŻ
read the api guide again
you canât use the bukkit event stuff for luckperms events
oh
alright cool I have the event, is there any way to get a player name or uuid to turn into a player object from the event?
getFriendlyName will give you their username iirc.
so something like this would work?
Bukkit.getPlayer(e.getTarget().getFriendlyName());
Doesnât getPlayer look for a UUID?
well it has the option to look for a string
although that might just be a UUID in a string object
You are right, it can accept a username.
declaration: package: org.bukkit, class: Bukkit
iirc i het event also fires for groups
so youâd want to check what the e target is
DataMutateResult result = user.data().add(Node.builder("group.vip_old").expiry(7, TimeUnit.DAYS).build());
i tried this but nothing changes for the player
need to save the player
oh right lemme
aight should now work thanks
is it possible to get the current node that User has?
Hi something repair code fix rank string
if (pl.isOnline()) {
String name = pl.getName();
new BukkitRunnable() {
public void run() {
String rank = Main.api.get().getUserManager().getUser(name).getCachedData().getMetaData().getPrefix();
new BukkitRunnable() {
public void run() {
Player p = Bukkit.getPlayerExact(name);
if (p != null) {
LoginBar.sendHeaderAndFooter(p, String.format("§4â°Â§fâ°Â§0â°Â§6â°Â§bâ°Â§2â°Â§4§lPLAY§6§lZONE§2â°Â§bâ°Â§6â°Â§0â°Â§fâ°Â§4â°\n§f §eJusu rank:§r %s\n§eJusu balansas: §c%sâŹ\n§eJusu /xp: §c%s", rank, Main.es.getUser(p).getMoney().setScale(2, RoundingMode.DOWN), LoginBar.this.plugin.xpc.getXp(name)), " §3§l§k|||§f §6§lwww.mc
§2- §cTau ir tavo draugams! §3§l§k|||§f\n§6Discord: www.discord");
}
}
}.runTask(LoginBar.plugin);
}
}.runTaskAsynchronously(plugin);
}
}```
and I get §eJusu rank:§r %s &4[&8Member&4]
Hey log4shell! Please don't tag helpful/staff members directly.
why is it not working? i tried everything
i fixed it, thanks for help
anyone know how to make a custom welcome message but with your prefix?
Broadcast "&b[&c+&b] then the lp prefix of the player"
please help me
are you using the api
yup
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
i used %luckperms_prefix% still dont work
are you making a plugin
they asked me to go here bro
this is for the luckperms api
you're not using the api
We have no idea how Skript works, that is upto them
Hi đ does somebody know how can I get a list of all permissions that player have on server=survival and contains cmi.? I've been looking (on wiki and here on discord) and trying it for a while now but I can't find the solution for this. đ
It will be really helpful for me if somebody does know how to do it đ
Hi
Is it possible to get all the players in a group
If you know the answer please @ me
?
Yes, see https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/model/user/UserManager.html#searchAll(net.luckperms.api.node.matcher.NodeMatcher)
Also see the static factory methods in NodeMatcher !
so im making a code where if i right click on something i get a rank and im now stuck on how to give that player the rank please help me
!api
Learn how to use the LuckPerms API in your project.
!cookbook
