#luckperms-api
1 messages · Page 49 of 1
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 the wiki pages are definitely worth checking
Ok ^^
Hello, i have a question, what is the syntax for skript to find a rank of a player with luckperm ? (Or with java ?)
!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 have that :
set {_api} to LuckPermsProvider.get()
set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getPrefix()
return coloured {_val} ? ""```
For get a prefix. But i need name(s) of all group(s) of player. How can i do that ?
т
you'll be looking for something like, which is directly from the wiki, which you should read before asking here
I dont know how to use enums or even if completablefutures work in skript reflect, so I'm not going to even bother converting that to skript
😂 Verry « Helpful » also i didn't think there was a wrong coding… but thanks
Well.. skript...
/lp search
how can i change the prefix of someone with the api?
Give them a prefix with a higher weight than the existing one
!API You can get that info from the CachedMetaData, explained in the second page linked here
Learn how to use the LuckPerms API in your project.
oh if it works like that i think i found it
Hello, i have a quaestion.. So yesterday i installed LuckPerms to my server, it worked fine. But i don't know how to make ranks show on tab list. And today ranks not showing in chat. have essentials to and did this: #change-playerlist: true / #add-prefix-suffix: true / #add-prefix-in-playerlist: true. But nothing changed.. Is there a way to make ranks show on chat, tab list and above player?
!tab
LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!
Thanks
Hi, I'm using the LuckPerms API to develop my plugin. Small problem: when I start my server and my plugin is activated, I get this warning:
"[Server thread/WARN]: [Ragnarok-Core] Loaded class net.luckperms.api.LuckPermsProvider from LuckPerms v5.3.53 which is not a depend, softdepend or loadbefore of this plugin."
In addition, my server can no longer continue to boot.
Can anyone tell me how to fix this error? Thank you very much for reading this request for help and feel free to mention me if you have the solution ^^
Make you sure (soft)depend on LP
How to check that ?
plugin.yml
What do I have to put in for me to (soft)depend on the API?
!paste you startup log
Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
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.
Does anyone know why this may be?
name: Ragnarok-Core
author: __Wii__
version: 0.0.1
api-version: 1.17
main: net.ragnarokmc.core.Main
depends: [LuckPerms]
commands:
setspawn:
permission: rc.setspawn
description: Sets a new spawn.
spawn:
description: Teleports to spawn.
aide:
aliases: help
description: Shows all available commands.
group:
aliases: groups
description: Change someones group.
permission: rc.group
ss:
description: Punish someone.
permission: rc.ss
restart:
description: Restart server.
permission: rc.restart```
"does not work"?
the very single snippet of log you shared indicates that it does work, only with that warning because it wasn't depend, it was depends
I don't see anything "not working"
"depends" doesn't exist in spigot doc
yes? that's what ben mentioned
how is it still not working? like that same warning appears?
Yes, I corrected that
But it doesn't work
how is it "not working"?
the warning still the same?
luckperms isnt loaded before your plugin?
Yes, and my (Paper) server is crashing
crashing then send full error
I don't know
Yes, LuckPerms is loaded before my plugin
how are you adding luckperms api as a dependency of your own plugin?
I use IntelliJ IDEA, so I go into my modules and add the LuckPerms api
No
no clue how that works then, but it likely means you are compiling the lp api classes in your own plugin
which you shouldnt
Well, no
I haven't any error except this one
Actually, I read the logs and there are no errors
[12:12:06] [Server thread/INFO]: [Ragnarok-Core] [STDOUT] [RAGNAROK CORE] Database connection successfully enabled.
[12:12:06] [Server thread/WARN]: Nag author(s): '[__Wii__]' of 'Ragnarok-Core' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[12:12:06] [Server thread/WARN]: [Ragnarok-Core] Loaded class net.luckperms.api.LuckPermsProvider from LuckPerms v5.3.53 which is not a depend, softdepend or loadbefore of this plugin.
means seems like your depend is still wrong
My server crashes when my plugin turns on
I think there are errors in console only, but they doesn't appear in the logs
if its in console
Wait
then its in the logs lol
Wait
There must be a crash log in crash-reports or somewhere
Oh um
Sorry
My server doesn't crash because of my plugin
I'm really sorry
😅
I am very sorry to have wasted your time
And if that warning (the bottom-most) still appears that can mean one of two things
Either a) the updated plugin.yml isn't being bundled in the new jar file or b) the jar file that is in the server is the old one
Whichever it is, you can verify by unzipping your jar file on the server and manually checking the plugin.yml and confirm it says "depend" instead of "depends"; if not you should ask in the PaperMC discord, that's kinda out of LP's reach
Okay, thanks a lot !
✨ psychic ✨
how would I go about getting all members in a group via the api?
you can refer to the code for the ingame command https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupListMembers.java
I dont really understand it i was looking at it earlier and couldn't figure it out
Which part you don’t understand?
hello , am trying to get the group of a player
with this :
public static boolean isPlayerInGroup(Player player, String group) {
return player.hasPermission("group." + group);
}
but since op players have all perms it will always return true if the player is op
how Can I get the group of an op player?
let's say in a server there is admin group and owner group and both of their members are op'ed
how can I check if that player is an admin or an owner ?
Maybe I shall get the User class from the player
???
OH
ok
also
would that method work ?
Group getgroup(Player p){
User user = (User)p;
return Main.lp.getGroupManager().getGroup(user.getPrimaryGroup());
}
You cant cast User to Player
By default primary group is the group with the highest weight
that's what am looking for
!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.

😌
how can i get luckperms groups names using spigot api? api.getGroupManager().getLoadedGroups() doesn't give me the names :/
Group#getName?
oh, yes! thanks
like the code used in the lp command /lp group <group> listmembers is confusing. I just need some simple code to get all unique users in a group
make an InheritanceNode for that group and call UserManager#searchAll
Passing a NodeMatcher.key(Node) or smth
How do I get the "prefix" of the group the player is in?
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 If you are unfamiliar with the LP API as a whole, you should definitely read over these wiki pages: the first one contains overall info about adding and using the API in your project + important info about the API's design you will most definitely want to have in mind when using it
The second page is just a whole bunch of things you will use in your journey throughout the LP API
Learn how to use the LuckPerms API in your project.
how ro xhange a users group
!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.
!nw
We really would absolutely love to help you out! However, telling us that it isn't working wastes everyone's time. Please, just describe the issue you're having clearly and with as much detail as possible, and send any relevant screenshots of whatever problems you're having.
how to set duration when u give a rank?
r u dumb
tghis is api channel
xD
?
me trying to pull a joke
result: someone asking me if im dumb
lol
:P
Hi there, I've written a piece of code to add suffix to a player
The code does run but the suffix is not changed at all ...
(I've debugged the code and each line of code inside the modifyUser() does actually run)
Can someone help pls ? 😳
Also I think the console would show the LuckPerms Logging Info as I've used the ActionLogger to submit a log. However the log info doesn't appear on the console ..
OMG I figured it out! I just removed the code of the whole logging part from the callback
And it worked!
I'm not sure if it's a bug as it's not said in the javadoc or wiki (or did I miss something?) but it worked ...
hi
Hello
I have a small question regarding the usermanager API.
Is there an easy way to retrieve all users having a specific permission?
I tried using the searchAll method but am not sure how I should use the nodes to achieve this.
Well that's what I assumed
I just don't know how to use that method.
Is there anywhere like a code example I could look at?
searchAll takes a NodeMatcher, check out the static factory methods in the NodeMatcher interface, there are a few ones that take a Node or a String as node key
!cookbook I'm fairly certain there is also an example in the cookbook plugin
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Thanks, didn't know that existed
The cookbook
One more question about that API.
So I create a matcher using a PermissionNode and that will result in a Map<UUID, PermissionNode>. Is there a way to retrieve the playername as well directly from the searchAll method?
I assume the UUID is the player uuid right?
Yes
If so, you can use your platform or the api to get the username
Yeah but I am looking to retrieve every user in the network even if the player has never joined the specific server I am running the search on
d;lp UserManager#lookup
@NonNull
CompletableFuture<String> lookupUsername(@NonNull UUID uniqueId)
throws IllegalArgumentException, NullPointerException```
Uses the LuckPerms cache to find a username for the given uuid.
a username, could be null
IllegalArgumentException - if the username is invalid
NullPointerException - if either parameters are null
uniqueId - the uuid
Ah nice, I'll try that
Why does it say the LuckPermsApi is not enabled but the plugin depends on LuckPerms?
is there like a posted format for action log descriptions xd
Can you share the server log and your maven/gradle dependencies?
Not really, they're just supposed to be "friendly", readable descriptions of what happened
Though short
If I directly update the MariaDB, would changes be reflected immediately or would the player have to rejoin the server?
Trying to figure out how to do 3rd party integration (not a plugin)
Neither (unless you wait like 5+ minutes before logging in again)
Why would you update the db yourself?
@nocturne elbow, we're currently creating a shop, and I'm in charge of the backend. Since ranks can be bought, I need to figure out how to give it to the user. I was hoping updating the Database would reflect the changes, since I'm not seeing any other way to integrate with Luckperms
Hey Lunar! Please don't tag helpful/staff members directly.
Erm, sorry for pinging. When I was mentioning you. it showed your username (@ emily) instead of your nickname (@ Emily (do not ping))
No Discord! I didn't want to ping again in the edit!
Well you have two options
Well, 3 but I would reduce it to two
- After updating the db, dispatch a
/lp networksynccommand.. but if you're gonna run commands anyway I would suggest instead you do: - Dispatch a command directly instead of updating the db, that will do a number of things too
- Would be to make your own bridge plugin that bridges your system with LP API to apply the changes
Easiest by far is #2 lol
#3 would be a bit more practical for me, but yea, #2 is easiest
Alright, I think I have a vague idea of where to start
Thank you Emily! I appreciate your patience and your support
#3 is by far the most flexible option
You have your own plugin in between, you can process your own instructions and do w/e you want, not constrained to specific command syntaxes
Indeed
We'll have to have a plugin anyways which loads in cosmetics and perks, so it'll just be another thing that's integrated
If I want to do something if a player loses/gains a permission using bungeecord api how which event should I use?
(Also, what if i wanna do it in spigot?)
NodeMutateEvent
Or if you want to do things for them separately, NodeAddEvent and NodeRemoveEvent
Thanks, the event bus thing is required for this right?
"thing"?
Yeah, LP uses its own event bus for all this
I have the luckperms plugin in my serv but am always having :
The RegistredServiceProvider.getProvder() null
How can I solve this
Did you add LuckPerms as a depend?
Hm shouldn't be needed
Well, either depend or soft-depend
Can you send the whole server log?
sure
[15:55:04] [Server thread/INFO]: [TabList] Enabling TabList v1.0
[15:55:04] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[15:55:04] [Server thread/INFO]: Done (63.817s)! For help, type "help"
[15:55:23] [User Authenticator #1/INFO]: UUID of player validdanixo is c1ee717c-f000-3c9f-9658-bc1030af442e
[15:55:26] [Server thread/INFO]: validdanixo[/127.0.0.1:64629] logged in with entity id 210 at ([world]-150.19303922415043, 84.0, -231.6021123194474)
[15:55:28] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5035ms or 100 ticks behind
[15:55:39] [Server thread/INFO]: Sending the packets !
[15:55:39] [Server thread/WARN]: java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because the return value of "org.bukkit.plugin.ServicesManager.getRegistration(java.lang.Class)" is null
[15:55:39] [Server thread/WARN]: at tablist.valid.me.Main.ordor(Main.java:55)
[15:55:39] [Server thread/WARN]: at tablist.valid.me.UpdateList.update(UpdateList.java:21)
[15:55:39] [Server thread/WARN]: at tablist.valid.me.UpdateEvents$1.run(UpdateEvents.java:21)
[15:55:39] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:82)
[15:55:39] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415)
[15:55:39] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1254)
[15:55:39] [Server thread/WARN]: at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:438)
[15:55:39] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1202)
[15:55:39] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1035)
[15:55:39] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303)
[15:55:39] [Server thread/WARN]: at java.base/java.lang.Thread.run(Thread.java:831)
[15:55:39] [Server thread/INFO]: packet sent !
[15:56:13] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 15241ms or 304 ticks behind
>java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because the return value of "org.bukkit.plugin.ServicesManager.getRegistration(java.lang.Class)" is null
[16:00:42] [Server thread/INFO]: Unknown command. Type "/help" for help.
we'll get the error at player join and quit events
cuz I used the Luckperm class there
Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
hm how are you building your plugin? maven, gradle, ...?
I just use the luckperms jar as an external archive
Make sure you aren't bundling the API inside your jar, that can cause this issue to happen
You can just unzip your jar file to double check if the net.luckperms packages are in there or not
yw
how do i check the permission of an offline player with the API?
pls help, ty
okay nvm if the api is bullshit i cant do anything
Lmao
Doesn't LP set the prefix and suffix in display name of players? Player#getDisplayname()
I've read https://luckperms.net/wiki/FAQ#why-are-prefixessuffixes-not-working
I did set a prefix, but it's just showing the player's name with nothing else.
LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!
Essentials provides the {DISPLAYNAME} placeholder to its chat formats which will combine the prefix, nickname and suffix into one
{DISPLAYNAME}=%1$s=Player#getDisplayName()
Then I'm confused, what does it mean by it will combine the prefix, suffix etc?
Oh so I can use getDisplayName only if I have Essentials installed?
I'll try that. thanks
I still get the Bukkit.getServicesManager().getRegistration(LuckPerms.class)
null
I even changed to maven and it still happens
I use this to check :
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
if(label.equalsIgnoreCase("test")){
if(Bukkit.getServicesManager().getRegistration(LuckPerms.class)==null){sender.sendMessage("lp null");}else{sender.sendMessage("lp not null");}
}
return true;}
check that luckperms start before your plugin
How are you adding luckperms as a dependency to your project?
I just added the lp api dependency to my project's pom.xml
<project xmlns = "http://maven.apache.org/POM/4.0.0"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.companyname.project-group</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
help 
[18:37:41 INFO]: [LP] > Group Info: s-admin
[18:37:41 INFO]: [LP] - Display Name: s-admin
[18:37:41 INFO]: [LP] - Weight: 70
[18:37:41 INFO]: [LP] - Parent Groups:
[18:37:41 INFO]: [LP] > manager
[18:37:41 INFO]: [LP] - Contextual Data: (mode: server)
[18:37:41 INFO]: [LP] Prefix: "[S-ADMIN] "
[18:37:41 INFO]: [LP] Suffix: None
[18:37:41 INFO]: [LP] Meta: (weight=70) (auctions=10)
As you can see the group only has a single prefix
The getPrefixes/Suffixes method returns all of the inherited and owned prefixes/suffixes as shown in lp (user|group) <user|group> meta info
And yes, you can make the "final" evaluated prefix/suffix to be composed of many owned/inherited ones, see https://luckperms.net/wiki/Prefix-&-Suffix-Stacking
Have you checked if the jar file contains LP packages and classes or only your own ones?
It contains only mines
hu
Idk if tjere is somethin am doing wrong
Is there a other way to get luckperms class ? Or any alternative solutions
Yeah you can use LuckPermsProvider.get()
I don't see why that would happen though besides you bundling the API in your plugin which, apparently you aren't
Plus this is weeeeeeell beyond enabling
np
Hey guys just wondering... how do I add a ImmutableContextSet to a SuffixNode? Can't seem to manage to do it. Here's what I got with the Context so far. ```java
ImmutableContextSet set = ImmutableContextSet.builder()
.add("server", servername)
.build();
there are a few methods in NodeBuilder, contexts or withContexts
So would this work? ```java
ImmutableContextSet context = ImmutableContextSet.builder()
.add("server", servername)
.build();
SuffixNode node = SuffixNode.builder(format, 1).withContext(context).build();
Nope from my Plugin config.yml. Here... ```java
server-name: ""
Like that as an example
ah okay sweet lol
LOL
yeah that should work fine then
Collection<Group> inherits = user.getInheritedGroups(QueryOptions.contextual());
If I want to retrieve all inherited groups that have a context of server=survival
how would that be possible ?
the plugin's jar ?
ya
here or privet ?
here is fine but if you don't want to my dms are open
uploading
uhm
is it supposed to be that large?
like, you're almost definitely doing something wrong lmao let me see
you're shading the entirety of Minecraft lmao
I'mma go ahead and delete that 'cause it's against MC EULA and Discord ToS lmao
But yeah, you are bundling every single thing you depend on, you most definitely do not want to do that lol
nope it's just my internet
and it got cancelled for no reason
sorry for keeping u waiting
imma reupload
Oh
And you are bundling in your plugin the entirety of a modified MC server (spigot) + the LP API + whatever else you are depending on
I don't know what you're doing to build your plugin jar but you should probably do some research into how to not do that
weird
I never created a plugin that was over 10mb
and this one have like 2 classes
lemme fix everything and i'll tell u when it's done
sure
is there a way to get every UUID of every user who has data through the api
if not I need to use bukkit's offline player's thing but I'd rather do something with less overhead
nvm that also wouldnt work aha
hm I was just doing an autocomplete search, getUniqueUsers() possibly?
Is there anyway to retrieve the config's
server: survival
context set in the plugin itself from the api ?
For example i want to retrieve all the inherited groups of a user depending on the server LuckPerms is in which is specified in the context server: anyserver
luckPerms.getServerName()
thank you
alternatively, you may find luckPerms.getContextManager().getStaticQueryOptions() more useful
String serverName = api.getServerName();
ImmutableContextSet contextSet = ImmutableContextSet.builder()
.add("server", serverName)
.build();
Collection<Group> inherits = user.getInheritedGroups(QueryOptions.contextual(contextSet));
for (Group g : inherits) {
Bukkit.broadcastMessage(g.getName());
}
[01:07:44 INFO]: [LP] - Parent Groups:
[01:07:44 INFO]: [LP] > master (server=survival)
[01:07:44 INFO]: [LP] > owner
I think this is supposed to print all the groups that I inherit having context server=survival
It's printing all my inherited groups.
It's printing all the inherited groups that satisfy the context
global context satisfies all contexts (unless turned off in settings, effectively disabling global nodes (I've never seen anyone want this lol))
oh
I think there's a flag for the query options
yea i aint gonna do that lmao
You should make a QueryOptions.Builder with that context set and I would say set this flag to false https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/query/Flag.html#APPLY_INHERITANCE_NODES_WITHOUT_SERVER_CONTEXT
That's probably what you want
yup that worked
ImmutableContextSet contextSet = ImmutableContextSet.builder()
.add("server", serverName)
.build();
QueryOptions options = QueryOptions.builder(QueryMode.CONTEXTUAL).flag(Flag.APPLY_INHERITANCE_NODES_WITHOUT_SERVER_CONTEXT, false)
.context(contextSet)
.build();
Collection<Group> inherits = user.getInheritedGroups(options);
for (Group g : inherits) {
Bukkit.broadcastMessage(g.getName());
}
But we’ll but for understanding what it does
and surprisingly idk why it only printed the highest rank which was my end goal.
Apart from displaying the primary group prefix in chat, the goal is to display the highest group you inherit from on that specific server beside the primary group prefix.
It’s make it clear
yes, Java in a nutshell
BufferedReader bufferedReader = new BufferedReader
Haha
idk why it only printed the highest rank
probably because the groups that master inherits have no/global context?
so they aren't taken into consideration
like, technically you only inherit master in server=survival
that "enables" the transitively inherited ones to exist in global context as well
I think
lol
it was because i only inherited master in context server=survival
once i added another group with the same context, it displayed both
just need to sort them by highest weight and display the one with the highest weight
Emily it's done , I just had to remove the spigot decompiled from the output file
😄
and Now I don't get null errors
How do you connect certain assets from this plugin to other plugins?
If anyone can teach me about it please Dm me
I mean In general*
Connecting plugins to other plugins
How do I add a temp rank?
what? what do you mean exactly?
that's an extremely vague question
Say, displaying a rank from another plugin
Check out the different expiry methods in the NodeBuilder interface, see https://luckperms.net/wiki/Developer-API-Usage for a general overview on using the API
Like luckperms say I want to display a Rank with a description of the rank that is a Lore
Thank you very much!
?
it's okay
Still not sure what you mean; keep in mind LP itself does not put the prefix/suffix in chat/tab/etc
You store them in LP, but it's other plugins' responsibility to actually take them and display them
Hey, how do I reference the LuckPerms API as a library in a Velocity-Plugin project?
hi i never done bungee stuf b4
how to
register luckperms instance\in bungee
this.luckPerms = getServer().getServicesManager().load(LuckPerms.class);
spigot
but
hjow
bubnegee
You can just retrieve an instance using the LuckPermsProvider
On that note, is there a way to get just the prefix for a user using the LuckPermsProvider in velocity?
Yea yea
getLuckPermsAPI().getUserManager().getUser(player.getUniqueId()).getCachedData().getMetaData().getPrefix()```
the getLuckPermsAPI() method returns a instance of LuckPerms which you get using
{
luckPermsApi = LuckPermsProvider.get();
}```
In your plugin's constructor
that is so wrong on so many levels
lol you dont put that in the constructor of your plugin
Constructive advice is better than laughing and pointing
plugin load at onenable
for velocity?
I was just told earlier today that onEnable is depricated
I mean you are right, I meant to say its suppose to go into the method thats listening for ProxyInitializeEvent.
ah yea, I always just called that method name onEnable to be consistent with bukkit api lol
Does anyone know how I can check the permissions of an offline player?
with the api
What would be the alternative to cached data to retrieve a meta value for someone who isn't online/in the cache?
The code I have now checks the cached data and if that is null retrieves it using user.getNodes(NodeType.META).find { node -> node.metaKey == "color"} which seems to be returning null as well
i think i've got it, i need to load the user
how does luckperms handle unloading users?
like, if i load users will they stick about for ever or is it cached? if so, what sort of cache?
I think it unloads the user after 2 minutes?
with no reset on touch?
you can cancel the UserUnloadEvent
Blimey okay - looks like it's wrapper api time then 😬
Does this include online players as well then?
Online should remain loaded
Honestly I’d rather you just let lp handle when to load or unload
Would cancelling the unload event reset the timer or would I then be in charge of unloading users myself?
Then if you specific need a user that is not loaded, call the load user method as required
Yeah I'd rather that to! But a timer that doesn't reset on touch is pretty useless if I'm touching specific users very frequently
Yea if you can code a decent logic in which determines frequent users yourself, then sure lol
Else you may run into your server using too much memory.
Nope, touching data does reset the timer as you can see https://github.com/lucko/LuckPerms/blob/f0e1a8f0923b6784457253740bd81122d2f4f8d9/common/src/main/java/me/lucko/luckperms/common/cacheddata/AbstractCachedDataManager.java#L196
And the resetting is done on L204 it seems
Generally yea caching does that, but lp internal caching isn’t documented
So test and see lol
I think "CachedData" doesn't exactly reflect the general idea of what people think of a "cache"
It's more of "precalculated"
Considering contexts, settings, etc
Like, as soon as the user is loaded, it gets calculated for applicable contexts, and cached
Well yea cache is to save calculated info in memory so we don’t have to keep calculating again
Yeah but it's directly attached/binded/coupled to the User, it is saved when the user is loaded, it vanishes when it's unloaded, it's invalidated when the user is, when they change contexts etc
After all the PermissionHolder is the data entity
Right, so the user still gets unloaded after two minutes regardless?
Tbh Luck would probably be best suited for these questions lol
"Probably" tsk
I know there's the UserHousekeeper which is what drives the unloading, uh I'm not exactly sure what happens when that happens
I also don't store Users long term, but fetch them on demand and use as a local variable, but that's me tho
Yeah, it seems that when it does the unloading it checks against two caches, one for if it's been recently used by the API. This cache expires after 5 minutes.
Like yeah there is eventually a point in time (e.g. after unloading and relogging, re-loading etc) in which the instance you're holding is no longer valid, and LP is handling a completely different instance
In short: mutability bad
Yes definitely, although I'd assume the cache would be invalidated at that point?
Like, there are methods to invalidate the cached data and permission calculations so I'd assume that these were used somewhere
I need to just boot this up in an IDE and have a poke about, github search only gets you so far :')
Yeah those are called on things like the ContextManager, when players change worlds, or just entirely too when a permission is changed it's also recalculated
I wish people did this more often haha
It seems like the registerApiUsage method is only called when you load a user, not when you get it or do anything with it
The other method is only called on attempted log ins, so it's a straight timeout cache with no reset on touches
haha tell me about it :')
whats the api to get the groups prefix?
how to give player offline permission?
Someone can help me using the LP API? I really need to get a player group name and im not fidding out how to do that
!api
Learn how to use the LuckPerms API in your project.
!cookbook has examples
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
tks
What?
Well you need to fetch the new user name from Mojang yourself, LP does none of that stuff
But you can save it in LP with UserManager#savePlayerData or something
d;LP usermanager#saveplayerdata
@NonNull
CompletableFuture<PlayerSaveResult> savePlayerData(@NonNull UUID uniqueId, @NonNull String username)
throws IllegalArgumentException, NullPointerException```
Saves data about a player to the uuid caching system.
the result of the operation.
IllegalArgumentException - if the username is invalid
NullPointerException - if either parameters are null
uniqueId - the users mojang unique id
username - the users username
Be confident 
Nah
Oh
Is there a way to get the case sensitive IGN of a member?
lp does't store case sensitve IGN iirc
Is there a way to enable that/is it allowed to make a PR for it?
Or is it done w/ a specific reason?
Is there a way to enable that
No
is it allowed to make a PR for it?
Sure, but it will likely be closed. See https://github.com/lucko/LuckPerms/issues/2595 (please read the entire thing)
Sure, understandable though. Saved it to my own playerdata instead then 😂 It was for the same reason as that guy, just nice to have it since it already stores it
So if a plugin hooks into LP via the context calculator, does it just automatically get ran when a permission check is ran for a plugin / player on the hasPermission() check or whatever?
I don't think so, from what I know, it happens whenever permissions are pre (re?) calculated and cached, for example during login, changing worlds, changing gamemodes ...., essentially whenever any of the bizillion invalidate/invalidateCache/signalContextUpdate etc are called
Interesting. I have someone who has a project that they check players permissions via the hasPermission() check and in the Spark it's taking up 0.13% and after taking a closer look, they also have Towny on their server which has a context calculator hook for LP, it's actually calling Towny's calculator hook each time and running a ton of extra logic that shouldn't be necessary for this other plugin.
You can get into a really deep rabbit hole regarding how all of this is cached and stored in the backend 😛
Can you send the spark report btw?
look under the JobPerks plugin
the blacksmith class does not do anything regardig towny. however, the plugin does use towny api in some other classes
we're not really worried about performance, its just something odd we noticed lol
dude idk this plugin is beyond me lmao
apparently the context the player is in expires roughly every tick?
but the permission queries themselves are backed by a map
idk this plugin is insane
привет
Time to ping Luck to have him check it out at some point?
I guess lol
I pinged him last time so it's your turn.
hello
the amount of misinformation I myself have created for my own understanding is outstanding 🙃
@jaunty pecan 👀
i need help
with?
what to do I write / pl editor, but the link does not come to me
Wrong channel bud. Use #support-1 or #support-2 .
How is that?
This is the channel for the LuckPerms API. (development)
if you need plugin support, use the channels listed above.
Using the Bukkit service manager, it's returning a null service provider. what would cause this?
im seeing LuckPerms loaded before my plugin too, as should be as I depend on it in the plugin.yml
obviously a me issue but im not sure what would cause it
my simple test plugin worked without issue
ah, forgot to set the maven dependency as provided so it included and relocated the class, so the classpath changed :^)
thanks for the help me
NodeRemoveEvent isn't called for lmao when i do the following:
/lp user TheUsername parent set lmao -- Properly calls NodeAddEvent
/lp user TheUsername parent set default -- Does NOT call NodeRemoveEvent, even though it was
is this an oversight?
No, NodeRemoveEvent is for individual things like parent remove, node unset, meta unset etc, since parent set removes all your current parent groups NodeClearEvent is called
huh weird, not sure how I managed to miss that
very nice specialization for a common action
Myes, it's essentially for NodeMap#clear and overloaded variants
Hello. I need to add multiple groups to the user (as you can do with "/lp user blablubb parent add anothergroup") through the API. How do I do that? The User interface only has .setPrimaryGroup() and it takes only one group. 😦
Setting the primary group is not necessarily related to adding parent groups
They are two different concepts
You need to build an InheritanceNode and add it to the user's NodeMap data
!api the second link has some examples for that and many other things as well
Learn how to use the LuckPerms API in your project.
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
ok thank you. I will try.
Thank you. It works 🙂
public static void addPermission(ProxiedPlayer p, String name) {
LuckPerms lp = LuckPermsProvider.get();
PermissionNode n = PermissionNode.builder(name).build();
User user = lp.getUserManager().getUser(p.getUniqueId());
Objects.requireNonNull(user).getNodes().add(n);
lp.getUserManager().saveUser(user);
}```
why doesn't that add a permission
if i run that method
adding permission
tab.group.default
when i do /lp user Quared permission info
it isnt there
that looks like bungee, and you're using /lp, are you sure the proxy and the server are synced?
so it doesn't show in /lpb user <user> permission info either?
nope
well that just sounds none of this is running tbh, put various print statements in there, e.g. at the beginning of the method, then print the node, and put a print in saveUser(user).thenRun(<print here>)
Also any errors in the proxy console?
also screenshot /lpb info
public static void addPermission(ProxiedPlayer p, String name) {
System.out.println("Hello from adding");
LuckPerms lp = LuckPermsProvider.get();
PermissionNode n = PermissionNode.builder(name).build();
User user = lp.getUserManager().getUser(p.getUniqueId());
Objects.requireNonNull(user).getNodes().add(n);
lp.getUserManager().saveUser(user).thenRun(() -> System.out.println("Hello from saving"));
}```
just to be entirely sure, in game run /lp user <user> info and same for /lpb
because that just looks like it's working
there is no reason for it to not lol
wait no that's wrong tho
getNodes returns an unmodifiable view of the holder's own nodes
to modify this you use the data() which returns the NodeMap
Objects.requireNonNull(user).data().add(n);?
yeah that should do it
tysm
sweet
Eclipse is giving me this when I try to register events. Is this common?
EventBus#subscribe returns an EventSubscription which extends AutoCloseable if you wish to "close" the subscription anytime and not use it
AutoCloseables are usually but not exclusively used for resources, e.g. file IO, database connections, network streams, which require to be closed to safely handle them
In this particular case you can ignore that warning
Okay thank you ❤️ (Learning new things about Java every day thanks to you guys ^^)
Hey @jaunty pecan quick bump on this. I know Emily pinged you a couple days ago. Just wanted to make sure it was noticed.
But the question is, why is Towny even invoked here at all? Is it simply because it registers a calculator hook?
Yes
Hmm, okay. I guess it's something they'll just have to live with then. Thanks for getting back to me on that.
Track.promote() is asking for a user, how do I get a user, when I try to import user eclipse can only find the essx User because I'm using essx for something else
also how to I promote/demote a user until they get a specified group?
!api The second page linked goes over retrieving Users
Learn how to use the LuckPerms API in your project.
ah yes giveMeADamnUser()
eh that's a rather inefficient approach, I suggest you remove all inheritance nodes from the user for groups that are on the desired track instead, and then add the inheritance node of the group you want
ok, I will try to find out how to do that, thanks
That's what the .. parent settrack .. command does essentially
/blob/ LOL
Keep in mind the way the command does it is not a one-to-one copy to how you'd do it with the API, it uses internal classes and stuff, rather than the API itself
where is getPlayerGroup()
the 2nd function is a public static String getPlayerGroup()
ugh I really dislike that example
but I can't find which class it's in
it isn't in any class, that's something you would make to get the player's "primary" group (assuming the collection is ordered)
Eh you should definitely become familiar with Java itself and the Java API before diving into something like the LP API
That's my suggestion, it takes a lot of things you should know beforehand for granted
collections are just abstractions of arrays
But never heard someone say they like arrays lol
it's giving me a java.lang.ExceptionInInitializerError for public static LuckPerms lp = (LuckPerms) Bukkit.getServicesManager().getRegistration(LuckPerms.class).getProvider();, why?
static 💀
well I want to call it from my other classes
That is the worse way of doing that btw
But anyways you need to get the lp instance at the onEnable method
Also ensure you set lp to load before your plugin, by configurating depend in plugins.yml
Just ask here
ping I guess
I'm routinely checking whether a certain condition is being met and assigning a permission group that lasts grreater than the interval of the check time. I need to be able to overwrite the remaining time on the temppermission. How would I be able to do that?
Node node = Node.builder("group.test")
.value(true)
.expiry(Duration.ofSeconds(50))
.build();
DiscordPlugin.LUCKPERMS.getUserManager().modifyUser(playerUUID, user -> user.data().add(node));
}
}
}.runTaskTimer(DiscordPlugin.INSTANCE, 0L, 200L);```
i set the durations to be low for testing
and it appears that the new node doesn't overwrite the old one
and thus every 50ish seconds there will be up to a 10 second gap where the player would not have the permission
(the real time interval would only be once an hour or so)
i put in a fix by checking to see if the user has the node and just removing it and re-adding it, let me know if there is a better way
There's an add(Node, TemporaryMergeStrategy) method, that's probably what you want
d;LP TemporaryMergeStrategy
public enum TemporaryNodeMergeStrategy
extends Enum<TemporaryNodeMergeStrategy>```
TemporaryNodeMergeStrategy has 1 extensions, 2 methods, 3 all implementations, and 3 fields.
Controls how the implementation should behave when new temporary nodes are set that would otherwise conflict with existing entries.
The default behaviour of NodeMap.add(Node) is to return a result of DataMutateResult.FAIL_ALREADY_HAS when an equivalent node is found. This can be replicated using NONE.
However, the NodeMap.add(Node, TemporaryNodeMergeStrategy) method allows this behaviour to be customized for temporary permissions.
Well, almost lol
i added luckperms to my pom.xml but the project is marked red
!paste pom.xml
Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
!api
Learn how to use the LuckPerms API in your project.
thanks; ill check it out that sounds like a way more efficient solution
In my plugin I need to make it display A certain rank from luckperms can anyone help me out in dms or we can call or I can send snips so I can show you where I want it so we can do it
Dm me In the next 24 hours please
display how?
what about the group you need to display?
the name? the display name? the prefix?
how you get the group?
Yea I need to display the group
Like for say:
Name : Bob
Last on: 6 days
Rank: Member
Like I need it to display like that
Or for owner
Name : Iamtheowner
Last on: Now
Rank: Owner
so you need to get the player's primary group and show the group name?
Exactly
Finally someone understands me
you got anything until now?
Just the menu and it to display the name, all I need rn, is Display time Last on, and Display Group name
Just 2 things left and I'll be done with my GUI
I meant if you got anything about getting the User and/or the player's group
Oh no not at all I am So confused
with?
Eberything
I don't know how to display it
If you could send me a code to copy paste so I can read it or teach me that would be great
I suggest you start off by reading this page (more particularly this section linked), it goes about getting an LP user from a player; if the player is offline, you'll need to load it, read the section carefully: https://luckperms.net/wiki/Developer-API-Usage#loading-data-for-players, once you get the User, there's a method for it uh, getPrimaryGroup or something which is more than likely what you want.
You might also want to check out the API "cookbook" example plugin, it's a good "real world" example of how to use several elements of the API that are commonly used https://github.com/LuckPerms/api-cookbook
If you have a specific question about something in particular ask about it, but I can't really help "about everything", I don't really feel like repeating everything that's been written in the wiki already, so if you don't get something about it in particular, do ask about it and we can start with that instead
Thank you very much
hey, I have an issue. My server was backdoored so we needed to delete and reinstall all plugins. And we didnt have time to save the luckperms roles. Is there any way to take the roles from the old luckperms files. Because we have the old files.
!api
Learn how to use the LuckPerms API in your project.
basically only different is like the player class, the rest shouldnt have a difference between platforms
how can use this??
User user = Main.api.getPlayerAdapter(Player.class).getUser(p);
the Player.class throws an error
sry for mentioning
oh
Player.class is for bukkit, use the correct one for the platform you dev
!tab
LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!
How can I rename a group over the API?
manually
Create a new group with the new name, copy all of the nodes from the old one to the new one and then delete the old group
okay!
Then you'll want to use UserManager# and GroupManager#searchAll to find all instances of the InheritanceNode representing the old group, and replace them with one pointing to the new one
If you want to also update the name in the inheritances that is
Not the best yet, I'm planning-ish to expand the API a bit to ease those two processes, as it is far from ideal at first (copying node collections and running bulk operations)
how do you get all of the users belonging to a certain group? LP does it like this internally https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/commands/group/GroupListMembers.java#L73 but it doesn't seem like those classes are exposed anymore
!cookbook The API cookbook plugin has a command example for that
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
GetMembersCommand or something like that
thanks!
Can the API be used standalone?
Dont think so
How to load LuckPermsAPI in Velocity?
The same way you can use in any other platform
!api Check these two wiki pages, they go over that
Learn how to use the LuckPerms API in your project.
oi
I couldn't seem to find anything to get a players group highest in a track
anybody know?
a what?
ideally the player will be in either none or 1 group on a track, not more
ideally
what are you trying to do?
Retrieve a group's prefix, for the highest group a player is in, on a track.
Essentially what the placeholder does
wait i could prob just look its open source
lmao
yep, it is
oml i cant even find the class that has them lmao
I believe all placeholders are in a single class, it would be a matter of Ctrl + F'ing the placeholder name
with "highest_on_track" as element
tyvm
One thing I can't understand, is where these variables are initialized .. (player, user, userData, queryOptions, element)
those come from the placeholder expansion/plugin itself, it is adapted beforehand for the placeholder function
how inefficient is this? lmao ```java
public String getDonorTag(Player p) {
Track donorTrack = Achievements.luckperms.getTrackManager().getTrack("donorranks");
PlayerAdapter<Player> playerAdapter = Achievements.luckperms.getPlayerAdapter(Player.class);
User user = playerAdapter.getUser(p);
QueryOptions queryOptions = playerAdapter.getQueryOptions(p).toBuilder().flag(Flag.RESOLVE_INHERITANCE, false).build();
Collection<Group> groups = user.getInheritedGroups(queryOptions);
List<Group> inTrack = getUserGroupsInTrack(donorTrack, groups);
if (!inTrack.isEmpty()) {
Group highestweightedGroup = null;
for (Group group : inTrack) {
if (highestweightedGroup == null) {
highestweightedGroup = group;
} else if (group.getWeight().getAsInt() > highestweightedGroup.getWeight().getAsInt()) {
highestweightedGroup = group;
}
}
return highestweightedGroup.getCachedData().getMetaData().getPrefix();
}
return "null";
}
public List<Group> getUserGroupsInTrack(Track track, Collection<Group> groups) {
List<Group> inTrack = new ArrayList<>();
for (Group group : groups) {
if (track.containsGroup(group)) {
inTrack.add(group);
}
}
return inTrack;
}
Hi ! I search to get the number of player in specific group with the API. It's possible ?
this return just the nomber of people in a group ?
thx
I just want a method to return a int ^^
I have made this
then adapt it for your own use
Yeah i try but i don't understand something here
because it's for the same usage but i just need to return to use on other place in my code
ah yea you need to learn async coding
meaning learning java's completable future api
There is a short section here https://luckperms.net/wiki/Developer-API, but you probably want to do your own research on it first.
Hello, it's possible to get all of parent (group) of a player ?
No no with the api 😂
yep, i realized that. mb
🙂
Maybe this helps? #luckperms-api message
#luckperms-api message He found it but it's the Emily's solution ?
I would assume so. I used the search function in the top right btw
It's my first time to use java objects.
I try this but i have an error do you know the good syntaxe ?
set {_api} to LuckPermsProvider.get()
set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
#set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getSuffix()
set {_val} to {_user}.resolveInheritedGroups({_user}.queryOptions().toBuilder().flag(Flag.INHERITANCE, false))
return coloured {_val} ? ""```
I need to have a list of all prefix of all parent of a player
Do you have a list of all class ?
set {_val} to {_user}.resolveInheritedGroups({_user}.queryOptions().toBuilder().flag(Flag.INHERITANCE, false))
This return what ? String ?
A list of strings ?
resolveInheritedGroups? I think it returns a Set of Groups
Builder seem doesn't work on skript i suppose
You aren't rebuilding the QueryOptions Builder
Ho
So i have to do that ?
set {_val} to {_user}.resolveInheritedGroups({_user}.queryOptions().toBuilder().flag(Flag.INHERITANCE, false).build() one ) missing
Where i have to write it 😮
At the end ?
That
That's not really a helpful error message
I only have that :'s
When i remove that : .toBuilder().flag(Flag.INHERITANCE).build()
Skript work how can i get all of the prefix of all groups for a user ?
Ah, apparently it's getQueryOptions, not queryOptions
I don't need builder ?
Yes you do, but the function isn't called queryOptions, it's getQueryOptions
i can't do something like that ? {_user}.resolveInheritedGroups().getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getPrefix()
In there you should be able to just call getMetaData(), no arguments passed to it
{_user}.resolveInheritedGroups().getCachedData().getMetaData().getSuffix() like that ?
Ho 😮
set {_api} to LuckPermsProvider.get()
set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
#set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getSuffix()
set {_val} to {_user}.resolveInheritedGroups().getCachedData().getMetaData().getSuffix()
send "%{_val}%" to {_p}```
It's send me `<none>`
How can i fix that ?
Is the inheritedGroups suffix null?
But you are trying to get the suffix....
Not the prefix
The prefix is before the name
The suffix is after the name
You tried asking in the skript discord?
set {_val} to {_user}.resolveInheritedGroups().getCachedData().getMetaData().getSuffix()
what are you trying to do in here? because this:
resolveInheritedGroups().getCachedData()
is not correct,resolveInheritedGroups()returns aSet(effectively a collection without duplicates), a Java object,getCachedDatadoes not exist inSet, but in theUseritself
Uh is this skript?
I can only have 1 prefix on the chat. I want to have all of other prefix (from other groups of a player)
Look, not to hate on skript, I barely know it, but if you're at the point of using the LP API, I strongly suggest you use Java (you definitely are capable if you're using the LP API already!); the tools at your disposal will be vastly superior and possibilities will expand to a whole different perspective
You.. can do that already with LP, there's a setting for that
Well it's not "a setting", flip a switch, it's done, but there is a section in the config for that, yes
But i want to have it when someone hover the first prefix of the player 🙂
I see
Beacause if i don't do that it's to many text in my chat area
I learning but for now i'm too beegeener : s So i still use skript
I just want to get all of others prefix in string for a player, it's possible with java ?
Absolutely
I don't know the capabilities of Skript, but the LP API is designed in Java, I would be surprised if you couldn't do it lol
You can probably do it with Skript too, but I can only help so much
I can write java inside skript
Just idk what i need to write beacause i'm too beegeener in java : s
I enderstand it's a class language with objects
Can you help me to write the line please ? : s
Well, I don't know how you would do it in skript (or again, what its capabilities are), but if I were to do that in Java I would do something like this
user.getCachedData().getMetaData(
user.getQueryOptions().toBuilder().flag(Flag.INHERITANCE, false).build()
).getPrefixes()
.values().stream()
.collect(Collectors.joining(" "));
that would join all prefixes into a string, separated by a single whitespace each
that's kinda better
Ok and the prefix of the higer group too ? Because i don't need it it's by default in the chat
I used to use skript and now I see it as useless knowledge
Would HIGHLY recommend learning java instead
CachedMetaData.getPrefixes() returns them sorted by their weight
Is there not a skript addon for luckperms?
I trying your idea
which is why you should expand your knowledge and learn more 😄
This server in particular isn't "Java help", but there are tons of others that are dedicated to that
I need to set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId()) for replace user ?
User is an object ?
correct
Well in Java there are some general conventions (how to name things, capitalization, etc): User is a class, user would be an object of type User
These conventions really help identify what each thing is
I've never been there but I can imagine
Ho ok
Your code return a list or a string ?
this?
ah
I'm stupid lol
It returns a string
that would join all prefixes into a string, separated by a single whitespace each
Ok hum :/ I try to match it with my skript : s
if you want them as a list it can be done as well, just collect(Collectors.toList()) instead
but yeah again idk what the capabilities are lol
It's verry stange it's return me <none>
set {_api} to LuckPermsProvider.get()
set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
#set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getSuffix()
set {_val} to {_user}.getCachedData().getMetaData({_user}.getQueryOptions().toBuilder().flag(Flag.INHERITANCE, false).build()).getPrefixes().values().stream().collect(Collectors.joining(" "));
send "%{_val}%" to {_p}```
And `getAllParrent(Gleush)` (Gleush as player)
Do you see something strange (In Java code ?)
I have to import something ?
import like, import a class or something?
Wait wait wait i miss something
idk how skript works lmao
ah okay?
Yes import class ?
I already import : net.luckperms.api.LuckPermsProvider
I have to import something new ?
Well, Flag in net.luckperms.api.query.Flag and Collectors in java.util.stream.Collectors
huh?
No no sorry
ah, it's Flag.RESOLVE_INHERITANCE, not Flag.INHERITANCE
This is something proper tooling would help at 😂 instead of pulling everything off the top of my head
It's verry helpfull for me 😮 thanks again !
Nothing to import for the build ?
or toBuilder ?
Bruh 😂
well, I wouldn't need to import anything else if I were to be doing this in Java
At this point you should really be asking skript support
Found a skript addon for luckperms btw
I don't know if I am allowed to post links so if you want it, its called skUniversal
I already have it
Well.. it will take care of all the dirty work for you...
But i don't found doc online : s
Go to skripthub, and search for SkUniversal in the documenation
I can have an actual prefix of the player but not all of the prefix of all group of a player : s this addon can't help me : s
?Get ranks api
You can have multiple prefixes of multiple group on 1 player using the lp config..
How to load LuckPermsAPI in Velocity?
this.luckPerms = LuckPermsProvider.get();
It throws LuckPermsNotLoadedException. Btw, I had set dependencies in plugin.yml.
Yes, but it didn't show me smth
Its just doc
Can u show me, how to load LuckPermsAPI using Velocity? Singleton doesn't work
how does it "not work"?
Caused by: net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
But I set in plugin.yml:
depends: ["LuckPerms"]
Uhm... Velocity doesn't have a plugin.yml? It's annotations based
Ohhhh, its correct. Sorry, i forgot about that.
there is no thing for that (e.g. temp group removal on expiry isn't logged);
I suggest you do that on your own by listening to NodeRemoveEvent, and check that the target is a User and the event's Node is an InheritanceNode, and keep track of that yourself
Hey guys, just a quick question about luckperms' user meta
how heavy is updating a meta value for an online player? I'd like to update a user's meta every second but I'm wondering if using the LP meta is the best solution or not for that scenario
if hitting the meta a lot is an issue, caching would solve that (for my use-case, it would be fine to load/save a player's LP information on join/leave, and just manipulate values in memory for the period that they are online)
yeah - don't update it every second
the side-effect of that is that a lot of downstream caches get invalidated, which would make permission checks considerably slower
a separate system for online players, then just persist the update on quit sounds like a a good solution
(Google translation)
Hello.
I have a question while developing a plugin using 'LuckPerms'.
How can I get all players in a group?
This is exactly what you want #luckperms-api message
Thank you so much! 😃
Hello.
I have a question while developing a plugin using 'LuckPerms'.
i already give perm to default group
but its still not working
how i fix it
u reload your server right now
kkk
Hello guys 
I'm currently looking into adding custom contexts from my quest plugin. These would base on conditions which are user-defined checks that can be evaluated at any given time.
However, after reading the API docs it seems like LP wants me to evaluate the state of my context in general without giving me information about what value was specified in the context that is currently checked.
From my POV it looks like LP is building a list of all contexts that are currently deemed active instead of checking just the ones that are relevant when a permission is checked. Is that correct?
If it is, it means that I would have to evaluate ALL conditions whenever my calculater is invoked because I don't know which condition i'm supposed to check for. As this happens quite frequently and condition checks are expensive, server performance would be killed.
Can someone confirm this?
I think you are misunderstanding what a context is: a context is a state, a status the player exists in at any given point in time, not "event based". For example the world context represents the state in which world the player is in at any given point in time, or from ExtraContexts the whitelisted context, if the given player is currently whitelisted or not. None of these are event driven, it is data that just "exists in the player", you can think of it as a custom field in the User object
That's why a context calculator, the only thing it takes for you to do the job is the player object itself (if you need to fetch state from elsewhere you will need to DI it when creating the calculator)
Ok, that is what i was suspecting 
Thank you for the reply! 👍
Hi!
It's my understanding that checking user.getCachedData().getPermissionData().checkPermission(String permission) will always return true when the player is opped.
Is it possible to check if they also have a specific permission?
like
idk
See if it's present in the permission map, in the cached perm data
Although checkPermission will return UNSET if it isn't set ¯_(ツ)_/¯
That's false btw, the tristate returned will be of the same value as the permission is set to, or unset, regardless of op value; not all platforms LP runs on has an "op status"
It's just that on bukkit, if it is unset then it will (likely) fallback to op status, but that is using Permissible::hasPermission(String), not the LP API
hi, is there an event to know when a player loses a temporary group?
NodeRemoveEvent
Thanks you
Check that the target is a User, the node is an InheritanceNode and that it had an expiry
woa its THE bluely
that's right
Hi, how can i get a list of permissions on a user with luckperms api?
There are many ways, but depending on what you want to do, you might be better using one way or another
@limber reef do you mean the user's own permissions or inherited ones as well?
The user's permissions but i already solved.. if i need support i will make other questions. Thanks
coolio
like in my server
GroupManager::getLoadedGroups()
It returns a collection of groups so you can get the names from that
where should i put that?
because im currently trying to make a gui that is dynamic, first it would get all the groups, and then add them to the gui
Wherever you need to get the groups?
You get the GroupManager instance with LuckPerms::getGroupManager()
If you aren't familiar with using the API in general or need to revise classes and packages in general I suggest you check out the javadoc and the general API usage pages
!api
Learn how to use the LuckPerms API in your project.
Hey, is it a desired behavior that the NodeMutateEvent is not called on bungeecord when mutating a user on a sub server?
Or is this a bug?
the node mutation happens on one server, the other servers simply reload from storage
oh i see, thank you
hey, how can I check how many players are in a luckperms group. I'd like to be able to get the number of players whos highest priority/inheritence group (im not sure what the correct word is there) is equal the group I'm checking to
I can track rank changes myself, but checking to see if there's an easy way to use LP's API for this before I go off and do my own thing
Take a look into UserManager#searchAll, and the static factory methods in NodeMatcher
I see, yea this looks like the right track
So say I have group A and group B. B inherits from A. If I search for A, will players in B also show up?
No
This looks for players that own a particular node
It just looks for it in storage, it doesn't do any tree traversal or anything and it does not discriminate between different node types
Good stuff, thanks emily
is there a way, using the API, to reset a player inside a track? (i.e. moving them to the first group in the track)
- a way without demoting them till they're out of the track and then re-adding them
Remove all of the user's InheritanceNodes of groups that are on said track, and then put them in the first group (either promote them on the track or simply add the InheritanceNode of the first group)
how would I do that? I know how to get the current inherited groups:
user.resolveInheritedNodes(user.getQueryOptions().toBuilder().flag(Flag.RESOLVE_INHERITANCE,false).build())but it's unmodifiable, so how do I remove them?
None of that
user.data().clear(NodeType.INHERITANCE.predicate(node -> track.containsGroup(node.getGroupName())))
Something like this should do it
Idk if that's exactly right but similar method names surely
I'll try that, thx!
Hello, is there a way to get the rank of an offline player?
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetOfflinePrefixCommand.java
QueryOptions.builder(QueryMode) then QueryOption.Builder#build()
or just PermissionHolder#getQueryOptions() if you don't want anything fancy (contexts etc)
<copied from a moderators response to another person, found when using the discord search function>
Ok
Hi,
is it normal that :
User user = Main.getLuckPermsApi().getUserManager().getUser(player.getUniqueId());
Track track = Main.getLuckPermsApi().getTrackManager().getTrack("default");
if(track != null && user != null) {
track.promote(user, ImmutableContextSet.empty());
}
Even when /lp user mypseudo promote default works
I foud the answer thanks to this message : #luckperms-api message
I needed to save the user : api.getUserManager().saveUser(user);
How i Loop all RankNames
Thank you so much! emilyy#3958
you're welcome
if(net.luckperms.api.LuckPermsProvider.get().getGroupManager().getGroup(role) != null) {
Bukkit.broadcastMessage("Yes " + role);
}
i check for a existing group
Hi
How i can delete a users node with a string match?
Im using this: but idk how to make a node with a string match
user.data().remove();
to put inside remove() method
nvm
i use a collection of nodes but is there a best way?
User user = api.getPlayerAdapter(Player.class).getUser(target);
Collection<Node> nodes = user.getNodes();
for (Node node: nodes){
if (node.getKey().equals("group.admin")) user.data().remove(node);
}
user.data().clear(NodeMatcher.key("node.key"))
Thank u :3
hi is there any way to hide player command who don't have permission in LuckPerms
LP is not directly responsible for that
Consider it a "side effect" of denying the command permission, which is done by the server itself
So register your commands properly and/or deny the correct permissions; everything else is up to the server platform really
i need this because player can see other command who don't have permissions , any plugin hider don't have the feature
Again, LP is not responsible for that.
If the command is registered properly, denying the permission will suffice, but it is not something LP controls, it's up to the server platform to check at login if the player has the permission for the command, and based on the result, send the command to the client or not
If you're on Bukkit I guess you can listen to the PlayerCommandSendEvent, check for the commands you're wanting to check and remove them from the set
thank you so much
i have idea but coding 0 knowledge
but thank you so much now i get some clue how can i do this
yw
public void preCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
if (event.getMessage() != null) {
event.setCancelled(true);
player.sendMessage("Unknown Command. Type \"/helps\" for helps");
}```
help me i want to use LuckPerms api player permissions check but line number 4 luckPerms is red after importing LuckPerms it not solve and says package net.luckperms.api not available
Did you add the API as a Maven / gradle dependency?