#luckperms-api
1 messages · Page 35 of 1
There you have it, expireAt 0
O
But those are nodes, the user already had
I add it with user#getNodes#add
Oh ffs that's why
You don't do that
You .data, not .getNodes
getNodes is a view of all the nodes the user has, not the actual mappings
So modifying the view won't have any effect since it's just that, a view, a "copy"
Oh, okey
With PermissionHolder#data you retrieve the actual mappings that the holder has, so modifying those do take effect
okay
Como puedo hacer para poner los rangos de Luckperms como %ranks% ? :u xd
Eeh.. querés obtener todos los grupos? O el grupo primario de un jugador?
Que el administrador de el servidor ponga la variable %rank% en la Scoreboard por ejemplo y salga el rango de el jugador
Aa
a
Eeh para lo que estás necesitando User#getPrimaryGroup te es suficiente
Es que soy nuevo en esto :u xd
como hago eso xdxd
en el codigo solo es Java, no se como puedo importar en este codigo la Api
de LP para usar sus complementos
!api te aconsejo chequear ambos links, están en inglés pero cualquier navegador moderno te lo puede traducir ¯_(ツ)_/¯
Learn how to use the LuckPerms API in your project.
https://hastebin.com/owiweleceh.apache
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/node/Node.html
Am i dumb or am i dumb
90% that im looking at the class right there, and looking at my LP the class exists. so wat?
Please note i just started messing with LP API 3 hours ago
I have imported the class with
import net.luckperms.api.node.*;
Apologies I can't give full code as I'm away from home atm
I don't know how sponge does it but:
a) Is LuckPerms installed on the server?
b) What version of the API are you compiling against and what version of LP are you using?
Yes.
5.1
5.1.107
Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
Um. Might be able to access it from my phone. One sec
Can't open it on my phone unfortunately but
latest.log
Please use https://bytebin.lucko.me to send files in the future. I have automatically uploaded latest.log for you: https://bytebin.lucko.me/44TG1bJHW5
I don't see LuckPerms being loaded
Again, I don't know how sponge does it, but make sure your plugin depends on LuckPerms (meaning it loads after LP does)
It is in the list but your mod/plugin/whatever is loading before LP
I'll look into that when I'm back. I think that may be the problem is that it crashes before it loads
Yea
Well that makes sense over anything else. I'll check how sponge does it
I mean the FML is loading your mod before loading LP, because there is no trace of LP loading
There's got to be a way of telling sponge "my mod/plugin depends on this other one so I have to load after it"
There is. Just gotta find it haha
https://docs.spongepowered.org/stable/en/plugin/plugin-meta.html
For future reference
!help
!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!cauldron
!chat
!colours
!commandequivalents
!commands
!config
!context
!default
!downloads
!editor
!errors
!essentials
!extensions
!extracontexts
!faq
!helpchat
!inheritance
!install
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!tracks
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki
!install
You can install LuckPerms on Spigot/Paper, Sponge, BungeeCord/Waterfall, Velocity and others. Check the installation guide for more info on setting up LuckPerms.
Alguien que sepa como usar la Api de luckperms para poder importar los rangos de las personas, es decir, estoy trabajando en un plugin y quiero conectar los grupos de luckperms con el plugin para que los que usen el plugin puedan agregar los grupos de los usuarios a la Scoreboard, no se nada de String y no entiendo para nada las paginas de ayuda de la Api :u
no se nada de String
qué
Siquiera sabes java...?
Lo basico
Eeh la LP API es un poco avanzada... vos lo que querés hacer es obtener todos los grupos te un usuario?
Lo que intento es que por ejemplo en la scoreboard pongan %rank% y salga el rango que tiene el usuario en luckperms
En la página principal de la API explica cómo obtener una instancia de LP, de ahí obtienes el usuario
También podes chequear eso para unos ejemplos útiles
https://github.com/LuckPerms/api-cookbook
Esto estaba en el ejemplo, lo que no agarra es el luckperms.example
Necesitas obtener una instancia, un objeto
Está mostrado como hacerlo literalmente en la primer página del uso de la API
this? :u
Mhm
where can I find information for implementing tab-complete from luckperms on permissions for my plugin?
Just declare your perms in plugin.yml (or whichever platform equivalent) and LP will automatically learn them
I think he wants to use whatever LP uses for tab suggestions 🤔
is there an event called for when a node expires? i want to do a check when a node expires to see if some conditions are met, and if so then re-give the node
NodeRemoveEvent should do from what I know, since you can get the node from there and check the expiry time not being 0 and all
In other words: no, there isn't an event specifically for expiring nodes lol
how do i got abouting adding someone to a group
With the developer api?
yes
!api
Learn how to use the LuckPerms API in your project.
These two links contain the knowledge and examples needed
guess i had it partially right
i did getData(DataType.NORMAL)
wait
but seems to be the same thing as data()
ill keep looking at the api
ah
i didnt save
i believe that was my issue
i am having an issue with suffix and prefix getting to show
not sure why
ah
vault
!chat
LuckPerms is only able to send information to formatting plugins so that they display them properly. LuckPerms does not put the prefix in front of your name, you need a chat formatting plugin to do it, and you need Vault. Same goes for the tablist! If the information appears correctly when you run /lp user <user> info, LuckPerms is doing its job!
hi there, trying to update from v4 to v5 api and get rid of my legacy expansions, can anyone tell if node.getPermission() was replaced by node.getKey(), just trying to make sure im reading this javadoc right ty
Yep that's correct
thank you
v4 -> v5
Does LuckPerms implement Vault?
Luckperms sends information to vault yis
what was v4 method unsetPermission replaced with in v5?
lol all good im just as confused
Possibly https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/AddPermissionCommand.java
but with user.data().remove(node) @neon hatch
thank you very much
is there any command to set a player's rank time for example / lp user aleejoo parent set vip 10 days?
o/ hope everyone's doing well, question, i have a minigames plugin and i would like to create a context calculator to fetch the player's arena, and whether they are in a lobby, etc.
do i need to add some sort of unique namespace when passing the info to the context consumer?
like myminigame_arena instead of just arena
Imagine not enabling font ligatures smh
There is a method just for what you're looking for
wait since when does intellij even have font ligatures?
Does it matter? Lmao
Settings -> Editor -> Font I think it's in there
On it lmao I don't remember exactly where it is but I know it exists
oh well what does it do though
fetch the player's arena, and whether they are in a lobby, etc.
Basically their current context set
oh so basically collect all their data in a context set?
how would i pass that into the consumer though
Just a question tho, now that I look closely into that screenshot
Why are you implementing your own context calculator?
The API is the interface you use to work with LuckPerms and LP implements it. Unless you make an entire implementation around it too, it won't be magically invoked 🤔
@nocturne elbow sorry was away, basically one of my users suggested that they would like to give certain permissions if my context is met
Hey Revxrsal! Please don't tag helpful/staff members directly.
i read the wiki and saw that the context calculator is what is used for that (also checked some examples in the plugin itself like the server and world calculators), so if there's a better/more appropriate way to do it then i am most likely not aware of it 😅
You can just user.getQueryOptions().context() and check for your contexts
i won't be checking for the context, LP would
isn't that how contexts work 😅
what was originally requested from me (spleefx is my plugin)
Okay
Let me get rid of my headache
So you want to implement your own contexts keys and values
Right?
yeah i suppose
yeah precisely
Okay now we're talking
https://github.com/LuckPerms/ExtraContexts
Check this lmao take it as an example
oh that's actually epic
thanks
since registering context calculators doesn't require specifying a plugin instance or something, i suppose i need to do something like spleefx_arena instead of just arena?
Np 😁
How would you register a context?
ContextManager#registerCalculator(ContextCalculator)?
Fefo is everywhere
Any java docs on it?
Literally the javadocs lmao
📌
Fefo is everywhere
@lime rune yes hi
Did you know that more than 3 billion devices run Java?
@remote sky but you can check ExtraContexts for examples if that's what you want
Did you know that more than 3 billion devices run Java?
On what devices?
Oh well
Many
Including but not limited to Computers, Printers, Routers, Cell Phones, BlackBerry, Kindle, Parking Meters, Public Transportation Passes, ATMs, Credit Cards, Home Security Systems, Cable Boxes, TVs...
Not at all, since Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
That’s crazyyy
why luckperms doesen´t work in spigot 1.16.1
it does
and #support-1 would be more appropriate if this isn't related to the developer api
so i want to show duration of temp permission with placeholderapi but due to no async in papi i'll loop all online players and store duration in a map in async runnable that runs every second. Is getting all online player's perm duration every second will have any performance issue with lp?
Nope, that data is all loaded on memory already so theoretically it takes the same time to access it, and it's blazing fast (theoretically)
You should be able to run that synchronously safely
doesnt luckperms papi expansion alr have one to show duration of temp permission?
I mean it takes little to no time to access loaded data
that runs every second
now with that there will be one single inconsistency
Temp perms are "checked" every 3 seconds, so the value shown won't really update every second
wait no
I'm stupid
oh there is %luckperms_expiry_time_<permission>%
ignore that last bit
and it also uses papi time format which is i need
||make sure you're using a PAPI dev build||
i am
||latest release formats the time wrong||
yes i am np
neato
idk how papi can pass a release with that bug tbh
it's been there for ages
papi means placeholderAPI?
Yes
ow ok
does bukkit platform have TristateCheckEvent or some else way to change the permission check result?
wdym by change the result?
dynamic change the sender.hasPermission(foobar) returns
well hasPermission just returns true or false, teh result depends on whether the user is opped and the permission plugin like luckperms
yes that is
so if you want to chnage user perms, you have to interface with a permission plugin or create a permission plugin
you probably want to do the first option
I mean use LuckPerms to process hasPermission result
yea, so you want to use luckperms API to change user/group perms?
A non-persistent way
I mean you just set and unset them when you need to, or you can also have timed perms with LP
But seems if server crashed, the permission won't revoke after server restart
*if use set and unset
your plugin need to have some logic to unset/set upon restart after these situations then
🤔 But i think if i can register my listener to LuckPerms like EventBus or other something to process every permission checking request in myself plugin is will be more safe.
I found LuckPerms have TristateCheckEvent on bungee platform but i can't found it in bukkit one
so you want to listen to every hasPermssion call
@obtuse jolt yes. after LuckPerms
Hey Ghost_chu! Please don't tag helpful/staff members directly.
hmm
Because i still want use LuckPerms to managing most of requests.
luckperms does have EventBus but idk how you are suppose to hook onto hasPermission call
So it should like this : hasPermission -> LuckPerms -> Ask my plugin after LuckPerms gives the result(true or false), so i can change the boolean if need -> return
tbh, I dont think that is a good idea, bcu that will mean LP loses control of perm handling, and what you are doing is basically creating another perm plugin.
I also dont see the use case.
bcu you should just set the perm correctly using luckperms
🤔 hmm, i just want control the permission if player in a region like WorldGuard region
You can set a permission or group on a per-world/per-server basis, through what we call "contexts".
!extracontext
Add contexts not supported by stock LuckPerms.
Guys, one question. how to get player group?
oh, thanks
it literally uses the method I sent lol
Hey so I'm trying write a bungeecord plugin with permission checks using luckperms, how would I go about doing that?
!api check both links 👇
Learn how to use the LuckPerms API in your project.
ok I think I got it, but now I'm having a dependency issue I have listed Luckperms as a dependcy in bungee.yml and have it installed on the proxy but it cant find it
name: CharmojiBungeecord
version: @version@
main: bonn2.charmojibungeecord.Main
depends:
- Luckperms
any idea why this is?
np lol
🤔
@nocturne elbow let's move here
!api
Learn how to use the LuckPerms API in your project.
import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;```
LuckPerms api = LuckPermsProvider.get();```
ok?
String prefix = metaData.getPrefix();
String suffix = metaData.getSuffix();```
how to get the metaData?
Why don't you have member role lol
I wondered that too lol
Sorry! I do not understand the command !verify
Type !help for a list of commands.
!verify
Sorry! I do not understand the command !verify
Type !help for a list of commands.
You get it automatically on join to
the bot is supposed to give that role to you automatically
but anyways
@severe bone fix pls
How to get the MetaData?
https://github.com/lucko/LuckPerms/wiki/Prefixes,-Suffixes-&-Meta```
i think this
no not this
oh
:}
getPrefix command?
That's an API usage example
A real example
Not a textbook example
Thank you so much.
I hate textbook examples
They suck
import me.lucko.lpcookbook.CookbookPlugin;
Error
and
LuckPerms-Bukkit-5.1.107
im using this
Uhm.... you're not supposed to import it, but learn from it how it uses the LPAPI
Ok.
CachedMetaData metaData = this.luckPerms.getPlayerAdapter(Player.class).getMetaData(p);
String prefix = metaData.getPrefix();
String suffix = metaData.getSuffix();
LuckPerms api = LuckPermsProvider.get();
private final Main plugin;
private final LuckPerms luckPerms;
public ChatPrefix(Main plugin, LuckPerms luckPerms) {
this.plugin = plugin;
this.luckPerms = luckPerms;
}
and 💥 GG
Neato
Nope, the plugin is crashed xd
What it say
i don't want to see because im a cow 😂 so,
thank you for help me and the support.
ok lol
. _.
Hello, I'm getting User from LuckPerms with UserManager.loadUser(uuid)
But it return something if user already in LuckPerms database. What can I do for checking, is user exists?
check if the returned user is null?
how? loadUser returns CompletableFuture<User>, if user is not exist, userFuture.thenAcceptAsync is not called, how I can see 😦
does it not get called?
No, because I have this code, that is returning json and if I make request with user that doesn't exist, this code is not called 😦
Rewrited it to another thread and future.join(), and it seems to be working, now it returns null 🙂
Rewrote*
Переписал*
How can I set meta of a user or group?
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/AddPermissionCommand.java
It's the same process as shown in that AddPermissionCommand example, but instead of using Node.builder(permission) you do MetaNode.builder(key, value)
And it works on both Users and Groups (basically a PermissionHolder)
Hi, in API 5 how ican replace this : Group group = api.getGroupManager().getGroup(usergetPrimaryGroup());
@charred sentinel you'll want to call PermissionHolder#getInheritedGroups(QueryOptions), it returns a Collection<Group> of all the inherited groups (according to the provided QueryOptions) and it's already sorted according to the inheritance rules (there's a setting in config for that)
so you'll have to get the first element in that collection, it'll be the primary group (as a Group)
Hey. Do I need to update/reload something after doing this: https://luckperms.net/wiki/Developer-API-Usage#modifying-usergroup-data ?
The result indicates success, however the permission doesn't show up as set (/lp user username permission info) and Player#hasPermission(String) still returns false.
Yeah you need to save the user/group
UserManager#saveUser(User)
Or something like that
ty, I'll have a look
After adding the node
You can also check some "real world examples" on the api cookbook repo
📌
thanks :3
UserManager#saveUser(User) is what I was looking for
maybe that should be noted in the wiki entry
So I'm trying to make a "title" system, where your suffix changes when you're in specific regions, and obviously I don't want the players to have 2 suffixes at the same time, so I'm trying to clear the suffixes with the priority 50, and then setting it again. However, doing this:
plugin.getLuckPerms().getUserManager().modifyUser(eventUser.getUniqueId(), (User user) -> {
user.data().remove(SuffixNode.builder(user.getCachedData().getMetaData().getSuffixes().get(50), 50).build());
});
followed by
plugin.getLuckPerms().getUserManager().modifyUser(eventUser.getUniqueId(), (User user) -> {
user.data().add(SuffixNode.builder(ChatColor.WHITE + " (" + getColor() + title + ChatColor.WHITE + ")", (50)).build());
});
doesn't seem to always work, and sometimes the suffixes stick around despite being removed in the first bit of code. Does anyone have any ideas for a workaround?
I have also attempted putting them within the same modifyUser() {}, but when I do that, it seems to completely neglect the part where I re-add a suffix to the player
Well that's a bit of a messy code but I'm not here to bash you.
Just running the second one should do it; chat meta go by weight so adding a chat meta node with the same weight should replace it afaik
That's how it works when you run the command tho so it's a bit of a guess, but if not, putting both the node removal and addition under the same modifyUser callable should do it
See that's what I thought as well, but no, when look up the user's info it will just display 2 different suffixes, both with the priority of 50
and like I said, I've already tried putting both under the same modifyUser, which also didn't work :/
When I did that, it didn't even add a suffix
Wouldn't the user.data().clear(NodeType.PREFIX::matches); part remove all suffixes though? I only want it to clear the ones with the priority of 50
because the suffixes on the server are also used for ranks, I just want the "titles" to override them whenever the user is in specified areas
unless it only clears the suffixes that are inherited from self and not from parent groups
PermissionHolder#data()only returns the objects' own nodes.- That you pasted above would clear all prefixes, not suffixes.
- To that clear method you are passing a predicate that takes a node. You can evaluate the type of the node (suffix) and the priority of it (50) to only clear all the nodes that match that predicate (it's basically a "test", if it returns true it will be removed, if it returns false it won't).
1 okay thanks
2 yeah I know, I just copypasted it from the site, didn't bother changing it for the sake of the example
3 turns out i've never encountered predicates before, so gonna read up on that
I know how to get the permission's expiration time but I want to modify it to month: day, not mins: hours
what I should do
what?
Are you trying to do this programatically via the API?
I really don't get what you're trying to do
not only API , i just want to know how to do
How to check a permission node for a offline player
Learn how to use the LuckPerms API in your project.
What if the player is already loaded?
Like so I have to do any checks
offline players are not loaded
if they're in memory as online then you can just check them
hmm ok
who ghost messaged 
👻
erm how to check if a player/offlineplayer has or inherit a specific permission?
UserManager userManager = LuckPermsProvider.get().getUserManager();
User u1 = userManager.loadUser(p1.getUniqueId()).join();
then...?
Then you can call resolveInheritedNodes(QueryOptions)
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/PermissionHolder.html#resolveInheritedNodes-net.luckperms.api.query.QueryOptions-
and check if the returned collection has the node you want (key, value, expiry (if any), contexts (if any), etc)
You'll want to create a copy of the node you want with Node.Builder btw
And compare with that one
ok thanks 🙂
np
Honestly, for something like that, your best bet is to do it through Vault instead, and LP will take care of all the meta-formatting (stacking), settings-dependent variables, etc.
Disappointing, I know lol
But believe me, in regards to that, Vault is what you want to use
Any reason in particular?
You can do in here
Well the vaultapi readme on gh shows how to set it up
https://github.com/MilkBowl/VaultAPI#implementing-vault
And while there isn't any actual chat example, the api source itself is pretty explanatory (docs n all)
https://github.com/MilkBowl/VaultAPI/blob/master/src/main/java/net/milkbowl/vault/chat/Chat.java#L90
This is probably the one method you'll likely use
getPlayerPrefix will get it from the group if the user inherits the group
Not only the user's own prefix
@halcyon minnow
.. TextComponent component = new TextComponent(prefix + p.getName() + msg);
because nowhere in there you have a variable named prefix
You'll want to call Vault's Chat#getPlayerPrefix(Player) to get the prefix, put it in a string and add it to the component
Just like, in that event listener method, you are making a player variable p and a string variable msg, you need a string variable prefix, whose value you get by getting it from Vault
declaration: package: org.bukkit, enum: ChatColor
You are trying to use legacy color codes (the ones with the § thingy) with the new BaseComponent system
Just by themselves, they are incompatible, but thankfully there is a method that lets you translate legacy formatted text to the new system
TextComponent.fromLegacy(String) returns a BaseComponent[] which is what you want
But I suggest you give this a read in general, as you can do many things with the new system
https://www.spigotmc.org/wiki/the-chat-component-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
paste the whole method please
https://paste.helpch.at/
Okay, you are doing BaseComponent[] bc = TextComponent.fromLegacyText(msg); as you said
So you have a bc variable
What are you doing with it?
No
because you are converting and sending the msg alone
without the prefix and name
You will want to do something like String fullMessage = prefix + name + msg; and then do TextComponent.fromLegacyText(fullMessage); and send that to the player
Because as of right now, you are discarding the other component (with prefix and name)
String fullmess = prefix + p.getName() + msg;
msg = msg.replace("testcmd", "§e§lTEST");
Do you see what you're doing here?
And that's something you are doing wrong
Order of operation matters in here
You are first creating fullmess and then replacing the original msg with TEST
fullmess doesn't know about the changes you made to msg
So you have to do it before you create fullmess
yes
show a screenshot of what you see in chat and what you type
The & are not valid color chars
You need to ChatColor.translatewhatever and then feed it into the TextComponent thing
i don't recommend PlugMan it breaks some plugins
Not on prod at least
For testing is me
But what which color codes do I have to translate?
the prefix
lel
Hey Trippyn! Please don't tag helpful/staff members directly.
Hi ! how can I get the groups of a player disconnect?
@scarlet oasis you hook to LP, get the user manager, call UserManager#loadUser(UUID), that returns a CompletableFuture<User> so you may want to know how to work with that (see https://github.com/lucko/LuckPerms/wiki/Developer-API#using-completablefutures for more info), and from the retrieved user instance you call getInheritedGroups(QueryOptions) https://javadoc.io/static/net.luckperms/api/5.1/net/luckperms/api/model/PermissionHolder.html#getInheritedGroups-net.luckperms.api.query.QueryOptions-
Thx you ^^ !
What is the best way to listen to parent updates?
Subscribe to the NodeAddEvent/NodeRemoveEvent and check for the target type, node type, etc...
!api
Learn how to use the LuckPerms API in your project.
javadocs pinned 😛
And a couple examples in the api cookbook repo too (also pinned lol)

eventBus.subscribe(NodeAddEvent.class, e -> {
if (!(e.getTarget() instanceof User)) return;
User user = (User) e.getTarget();
LinkedPlayer.get(user.getUuid()).recheckRoles();
System.out.println("Added node to " + user.getName());
});```
What I'm I doing wrong, its subscribing 100% sure of that but not logging anything. (Bungeecord)
While I do receive the following message in my console:
> >.... [19:22:43 INFO] [LuckPerms]: [Messaging] Received user update ping for 'iflyinqmc' with id: e087a461-5ec2-427a-a092-0131332feed8
How do you know it's subscribed if it doesn't print the thing?
🤔
Hmm mmmmmmmmmmm?
How do you know it's subscribed if it doesn't print the thing?
I mean, its executing the code (Logged a message just above the line and underneeth) so I guess its subscribing 😮
What command did you run and where?
And no exceptions 
What command did you run and where?
In the lobby, /lp user iFlyinqMC parent add Builder
And I did it for all NodeXEvents https://i.imgur.com/Vqm40bV.png
Nothing happened 
Hint hint NodeMutateEvent never gets called so you can discard that one
Humm are you sure those subscribe calls are.. well.. being called?
Oh wait a second
I know
Most events are only called by the platform instance for the subscriptions on that platform. Meaning Bungeecord LP will not trigger events that happened on other servers (such as NodeAddEvent)
Run the command from proxy LP
It will trigger
I just saw that UserLoadEvent does trigger it so I think I'll just use that
Yeah that's not really the best way to go but I mean you do you . _.
but why is that being called 2000 times 😂
Because
It does stuff lmao idk
Some events are called each time something happens, and some of those happen a lot of times for the same action
O wow, I just remade my whole system to realize that only pings will be sent from ppl whose are online
huh?
hello
i'm really having trouble setting a player's primary group with the api, anyone knows a sollution?
ill send my code
Perms.setRank(Perms.getUser(p), Perms.api().getGroupManager().getGroup(args[1]).getName().toLowerCase());
I'm using this to set the player's group, perms class:
i'm not sure what that means
It means User#setPrimaryGroup(String) may or may not have effects
Depends on the settings
I'm trying to make a command to set a player's rank
for testing purposes only
i also tried setting a rank when a player joins, but that doesn't seem to work either
You can take a look at this example: https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java
I'll try this and i'll come back if it doesn't work
Thank you
Yep, i'm using the same method yet it still doesn't work
public static void setRank(User p, String r){
api().getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
user.data().clear(NodeType.INHERITANCE::matches);
Group group = api().getGroupManager().getGroup(r);
Bukkit.getPlayer(p.getUsername()).sendMessage(group.getName());
Node node = InheritanceNode.builder(group).build();
user.data().add(node);
if(Bukkit.getPlayer(p.getUsername()) != null) {
Bukkit.getPlayer(p.getUsername()).sendMessage(ChatColor.RED + user.getUsername() + " is now in group " + group.getName());
}
});
}``` this is the method
why dont you use the java code block
yea im trying it rn
```java
Code here
```
yeye
i tried copy pasting the whole command fefo sent
i'll see if that works
it doesn't work either
odd
nevermind
it does
thank you a lot @nocturne elbow
Hey noobdog! Please don't tag helpful/staff members directly.
:d
hi, is there any even for when a player's group is changed? i wanted to update the player's tab displayname whenever his group is changed (i.e: if player is in group member, his tabdisplay shows &7 + p.getName() and after i change his group to vip, tab shows &a(VIP) + p.getName())
NodeAddEvent is what you're looking for
so
and in there you check the target, type of node, etc
i do public void onGroupChange(NodeAddEvent e)
?
!api check both of these links, there's a special section explaining how to subscribe (listen) to events
Learn how to use the LuckPerms API in your project.
ah
but
?
can you just please tell me how to do it
ive been working on this plugin for past
10 hours
giving me a link wont help atm
:))
it will if you read it thoroughly and properly
it shows you how to listen to LP events
where exactly
i cant find it
In that case you should take a break for now
yea ik but its that last thing i have to do
ty
public NodeAddListener(RohiHubCore plugin) {
this.plugin = plugin;
EventBus eventBus = api.getEventBus();
eventBus.subscribe(LogPublishEvent.class, e -> e.setCancelled(true));
eventBus.subscribe(UserLoadEvent.class, e -> {
System.out.println("[Rohi] User " + e.getUser().getUsername() + " was loaded into the database!");
});
}
private void onUserPromote(UserPromoteEvent event) {
Bukkit.getScheduler().runTask(plugin, () -> {
Bukkit.broadcastMessage(event.getUser().getUsername() + " was promoted to" + event.getGroupTo().get() + "!");
Player player = Bukkit.getPlayer(event.getUser().getUniqueId());
if (player != null) {
Scoreboard s = Bukkit.getScoreboardManager().getMainScoreboard();
s.getTeam(api.getUserManager().getUser(player.getUniqueId()).getPrimaryGroup()).addEntry(player.getName());
player.setPlayerListName(ChatColorTranslator.color(LuckPermsUtils.getPrefix(api.getUserManager().getUser(player.getUniqueId()))));
}
});
}
i tried this but it doesnt work
it crashed the server
share the crash log then?
huh?
@nocturne elbow That LP only send update pings to the proxy if the target player is online.
Hey iFlyinq! Please don't tag helpful/staff members directly.
Sorry for tag, the quote feature did that automatically on phone ☹️
I'm trying to fix to open chests but default players can't open chests 😦
you are using luckpermsAPI?
Lmao
How can I add a user to a group (non-primary) using the LP api?
what's the api equivalent of this? /lp user/group <user|group> parent add <group> [context...]
using dispatchcommand is usually bad practice when there's an api method to do it directly
Read through the API docs and I can't find what node/values I should add
!api it does explain
Learn how to use the LuckPerms API in your project.
this is the javadocs https://javadoc.io/doc/net.luckperms/api/latest/index.html
hi
is this support channel???
For the developer API, yes
oh ok
If not, #support-1 or #support-2
so i have a problem on my server
basically, i have a scoreboard in the hub and i have placeholderAPI installed and i have ran the command to install the luck perms extension, and it is not working, i only installed the extention in the hub but i plan to install it on other servers too... the server is running bungee... i have %Luckperms_prefix% showing in my scoreboard... please help someone
do i need to get a bungee version of placeholderAPI and install it on the bungee server??
This isn't related to the dev api...
is this support channel???
@nocturne elbow
For the developer API, yes
@nocturne elbow
Hey ejclayton36! Please don't tag helpful/staff members directly.
how is this related to the dev api?
well sorry... can someone tell me the support channel then please : )
how do you checkif someone has a suffix
tried to do if(api.getUserManager().getUser(player.getName()).getCachedData().getMetaData().getSuffix() == null)
but you cant do that
xD
which part you can't do
I mean if you already have the player object, you can simply pass the UUID instead
lol
How could I get all the groups a player inherits directly?
I've tried user.getInheritedGroups but that returns the groups inherited from other groups as well
Then you didn't try hard enough :d
You pass a QueryOptions object to that method
And in those query options, you can set it to not resolve inheritance (i.e. ignore what the holder's parent groups inherit)
Thanks
how can I get a group prefix
I've tried with this peace of code
public static String getPrefix(Player player) {
try {
if (Bukkit.getServer().getPluginManager().getPlugin("LuckPerms") == null)
return "";
final LuckPermsApi lpAPI = LuckPerms.getApi();
User user = lpAPI.getUser(player.getUniqueId());
Contexts userCtx = lpAPI.getContextForUser(user).get();
return ChatColor.translateAlternateColorCodes('&', user.getCachedData().getMetaData(userCtx).getPrefix());
} catch (Throwable e) {
return "";
}
}
but it doesn't work
LuckPermsApi?
ya
What version are you working with?
5.1
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.1</version>
<scope>provided</scope>
</dependency>
I've also tried wwith version 4.4
Well try clearing your IDE cache, because it's still using the v4 API
ok
make sure you refresh maven when you make changes to pom.xml
by restart the ide right?
I mean that will do the job
done
are ya using intellij?
are you?
yea
oh lo l
go to file -> invalidate caches
done
see if it gives you the v5 api
yes sir
did it work
yea
sik
read the docs
ok
my friend did it like this
LuckPermsProvider.get().getGroupManager().getGroup(LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId()).getPrimaryGroup()).getCachedData().getMetaData().getPrefix()
but that's for bungee
you realise it uses the same methods
but when I paste that code in I get an error
whats da error
no worries
how can you delete someones suffix? or set
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetPrefixCommand.java
Pretty neat example in here, and it's all in one, clear and set (set is basically clear + add)
ty @nocturne elbow
Hey Mal! Please don't tag helpful/staff members directly.
So I'm looking to find the highest rank a player has on a certain track is this possible? I've looked through the api and it doesn't seem like a simple task unless someone has some guidance.
You'll need to get the user's parent groups (only the ones they directly inherit), filter those that the track contains and get the one with the highest weight
Take a look in the javadocs at PermissionHolder#getInheritedGroups(QueryOptions) and at the QueryOptions themselves too, in there you can specify a flag to only get the holder's own parent groups
for the queryOptions do I just do User#getqueroptions?
For the most part yes, but you'll still need to apply this flag I mentioned
I think QueryOptions#toBuilder is a thing, then you can add the flag, and re-build it
Thank you I got it working
coolio
ok I was wrong I didn't debug enough what is the flag for the parent groups because I tested all the flags and nothing will come up unless I have all the flags there
ok do i need to put other flags with that? because on its own it returns nothing
Set<Flag> flags = new HashSet<>(Arrays.asList(Flag.RESOLVE_INHERITANCE));
QueryOptions queryOptions = target.getQueryOptions().toBuilder()
.flags(flags)
.build();
Collection<Group> groups = target.getInheritedGroups(queryOptions);```
you said try false?
I wanted to test 1 by 1
if you simply put it in a set, means it's true
ok and I want only this one as false?
yeah I saw that, but I thought I only wanted that flag as true not only that flag as false and by default they're all true and I didn't want to do .flag 5 times
testing it now will let you know
wow I feel dumb now thank you that worked
lmao
I'm confused. I get this error randomly sometimes
Caused by: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: Lnet/luckperms/api/LuckPerms;
I did not touch the LP jar
I did not touch anything to do with LP in the code, and I've put LP as a dependency
What LP version do you have installed on your server and what API version are you building your plugin for?
The version on your server -> /lp info
compileOnly "net.luckperms:api:5.1"
issue is, I didn't touch anything, and it just borks sometimes on reboot
"sometimes"?
yes, I'm coding a plugin, and sometimes it just errors like that
this is the whole main class
dependencies = @Dependency(id = "luckperms")
I don't know how sponge dependencies work but wouldn't it be "LuckPerms" instead of "luckperms"? Correct me if I'm wrong
I'm so confused lol
only when I edit something even if it doesn't even touch LP
aaa I see the issue
last time I fixed it by using GamePostInitEvent instead of GameInitializationEvent
(well I think, again, idk sponge lmao)
but even then @Dependency should fix it
try doing it like this
dependencies = {
@Dependency(id = "luckperms")
}
I mean, makes sense
it's an array, not a single one
tbf I already used it in the past (if you search that error in that chat here the only msg is from me, and doing it like what I did worked); imma try and see
Asking here then
How can I listen/subscribe to a player changing from one group to antoher, it isn't promote or demote
Thought it'd be ContextChange but that didn't work out either
no, those are for the individual user .. promote/demote commands
you're looking for NodeAddEvent
check that the target is a user and the node added is of NodeType.INHERITANCE (basically, a group)
NodeAddEvent for /lp user <name> parent set <group>?
yep
ily2
ah yes now it works lovely
:^)
why did it work before then lmfao
check that the target is a user and the node added is of NodeType.INHERITANCE (basically, a group)
@nocturne elbow How exactly do I check the user, sorry for the ping
Hey infintyz! Please don't tag helpful/staff members directly.
anyways, thx fefo xD
lmao
I assume e.getTarget and then?
e.isUser will do
didn't see it lmao
I need the user though, how can I get a player instance from there?
I need the user though, how can I get a player instance from there?
well after confirming it's a user, simply cast the target into a user
User user = (User) event.getTarget();
got that far, then user.getUniqueId() I suppose
I mean if you want to get the uuid...
ofc 😎
:bruh:
and the only thing that I added is a sout in a completely different class
literally added just this
uuh how does your @Plugin thingy look like?
@Plugin(
id = "battletower",
name = "BattleTower",
description = "gew",
authors = {
"gse"
},
dependencies = {
@Dependency(id = "luckperms")
}
)```
```java
// :d
```
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.
ok you want to know what fixed it this time?
hm?
@Plugin(
id = "battletower",
name = "BattleTower",
description = "gew",
authors = {
"gse"
},
dependencies = {
@Dependency(id = "luckperms")
}
)```
that space
I've added a space and the server started
🤷♂️
lovely stuff
I have a quick question regarding the Event API. Is there an event to listen for a player parent group change that does not happen through the promotion track? The UserPromoteEvent only happens when the track is followed.
Oh sweet, thanks
Np
I only want to know if I only need to use mysql if I want to do so every server have the samething whit roles and permission
!sync @torn ember and use #support-1 or #support-2 for things not related to the developer API :d
To sync data between servers, you need to connect each LuckPerms plugin to the same database (for example MySQL) and set up a messaging service.
@next orchid you can (and should, given the design of the api 👀) user.data().clear(NodeMatcher.key("kit.Nitro"))
lmao it's been 3.5 hours
Hello i'm searching to get all users which have a group. So, i got the group but now i'm kinda stuck on how to get those players.
Is it possible ? If yes, how ?
Hmmmmm
UserManager#searchAll(NodeMatcher) might be what you're looking for @marble lichen
okay, thanks 🙂
is there any way to set uuid in bungeecord?
i'm making a plugin to check if player is premium and then autologin (on offline server)
but when i do the check in PreLoginEvent with setonlinemode(true) i have a online uuid so i set it in offline in LoginEvent
so now in hub I have offline uuid but in bungeecord now I have 2 different uuids, offline and online, and luckperms go mad
is there any way to prevent it?
I mean if you're having an online / offline UUIDs mismatch between Bungeecord and the backend servers, you should probably double check your network settings.. you know the drill, make sure bungee config.yml has ip_forward and online_mode set to true, backend servers spigot.yml have bungeecord set to true too, etc
no... can i share my desktop?
you actually can't lmao
uhm no thanks
mh.. i'll try to explain better 😂
if you're having an online / offline UUIDs mismatch between Bungeecord and the backend servers, you should probably double check your network settings
I mean.. that's as much as there is to it
but i need a offline network not online
where who wants more protection can set online his account
like premiumlock
yeah..... I don't know about you but I'm not up for piracy; besides, in my experience, offline mode always brings issues (like, uh, this one lmao)
so.. yeah, sorry, not sorry
but when i do the check in PreLoginEvent with setonlinemode(true) i have a online uuid so i set it in offline in LoginEvent
@hasty coral this is going to cause so many issues
So what happens if the user logs in on a cracked account after logging in with premium?
he can't login
Good luck with that bud
What happens if someone with their name joins before they log in with a premium account?
Also thats just the message from the hacked client. Not your plugin
I can see so many UUID issues
Already
Just have a normal server
Or get everyone to log in
there is no way to fix it?
because at the moment i have online uuid saved in bungeecord and offline uuid in other servers inside bungee
Idk it just seems like I dumb idea
because at the moment i have online uuid saved in bungeecord and offline uuid in other servers inside bungee
@hasty coral thats every normal bungeecord network
not really
not really
@nocturne elbow um.. yes it is
Hey Tim__! Please don't tag helpful/staff members directly.
How u gonna modify a UUID
because at the moment i have online uuid saved in bungeecord and offline uuid in other servers inside bungee
how is that every normal bungeecord network?
setting bungeecord to true (and offline mode to false) makes spigot fetch the UUIDs through proxy
and if proxy says "I'm online mode" it'll be a type 4 uuid
with this i modify uuids, but only on Hub ecc, not in Bungeecord
I love how people use code blocks for words 😂 like why say bungeecord
Habit?
because it's a setting..
So why not say true ¿¿
Did you add "LuckPerms" into your plugins' depends list in bungee.yml?
sorry, where is this file?
yessir
Then you're most probably shading the LP API into your plugin (i.e. including it with your jar)
And class loader go brrrrrrrrrr
How are you building your plugin?
maven clean package
damn
v4
lmao what version of LP are you running on your proxy server?
also, add this to the LP dependency entry <scope>provided</scope>
Might want to consider upgrading to v5.2 lmao
lol I didn't know that the api was the same version of the plugin
also, add this to the LP dependency entry
<scope>provided</scope>
do this pls
okay
lol I didn't know that the api was the same version of the plugin
yep, and v5 (in general) was a complete overhaul to the API so there are quite large differences between v4 and v5 APIs
Ok hahaha, then in version I put 5.2 right?
defo also update the dependency version to 5.2
Hey 𝗢𝗻𝗹𝘆𝗦𝗼𝘆𝗼☯! Please don't tag helpful/staff members directly.
kek
hey so obviously this works:
List<Integer> amounts = new ArrayList<>();
for (PermissionAttachmentInfo permissionAttachmentInfo : islandLeader.getPlayer().getEffectivePermissions())
{
String permission = permissionAttachmentInfo.getPermission().toLowerCase();
if (permission.startsWith("permission.perm."))
{
Integer parseInt = Integer.parseInt(permission
.replace("permission.perm.", ""));
amounts.add(parseInt);
}
}
But this obviously doesn't work as soon as the player is offline so how would I do that?
> so obviously this works
> But this obviously doesn't work
Learn how to use the LuckPerms API in your project.
it's on one of these links
i suppose it would still be needed lol
also why superperms api when you can just use LPaPI
LarryPerms API
I use minecraft version 1.12.2 which LP ver 5.0 doesn't support. So I use ver 4.0 and the LP doesn't support it (You have very old / outdated version of LuckPerms installed on your server. end of this month. Please update to the new version of LuckPerms as soon as possible to continue using the online applications.)
Is there any way to use it on minecraft 1.12.2?
This is not a support channel.
I mean
- This is not a support channel for general support things
i stg if I was watching this at the moment instead of having a snacc things wouldve ended differently 
was it good?
lolll
(ping me)
Don't worry bro
I got ya covered
@dusk saffron
Pinged
thx
(the last one is an example on how to add a node, so mix and match the links provided above with what the example shows)
yea
i dont see any expiry function on InheritanceNode?
InheritanceNode.Builder extends from NodeBuilder 🙂
hmm
i just see getExpiry() getExpiryDuration() hasExpired() and hasExpiry()
also hi luck lol
hey
yea, that's because you are looking at InheritanceNode and not InheritanceNode.Builder
to create a new node, you use the builder (and it's methods) before calling .build() to get the result
ahh ok thanks
you can't modify an existing node directly, you have to call node.toBuilder().changeSomething().build()
which will return a new node containing your changes
in other words, nodes are immutable :))
expiryEpochSeconds is the parameter name, so :p
It's a timestamp - https://www.epochconverter.com/
ah k
if you just want to set a duration relative to the current time, I suggest using the other methods
soo if 24 hours is 86400 seconds, i should put 86400?
i just want to create one for 24h
e.g. expiry(Duration.ofHours(24))
ah thanks
Duration is java.time.Duration iirc
np haha
you can't call yourself a real developer if you haven't had tons of tabs open lmao
(should see my brothers brower, more tabs than that
XD
@nocturne elbow it does work but i was literally asking about converting it to lp api because i need to work with offline players...
Hey Terminated! Please don't tag helpful/staff members directly.
If you need to cast an OfflinePlayer to a Player to have access to the Permissible methods while the player is offline, yeah that doesn't work lmao
This section (as a whole, up until "Obtaining a Group/Track instance") in particular will help on how to get offline users data https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#distinction-between-online--offline-players
Yesterday i asked a question about how to remove a rank for all people having a permission / rank.
So today, i tried this http://prntscr.com/v3ax1o but the map always empty. I don't really understand why, maybe i'm not NodeMatcher#key ?
I mean, I really doubt there are users with that permission, hence the resulting collection being empty
Also, for group nodes, you might want to use the (proper) InheritanceNode.Builder instead
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/node/types/InheritanceNode.Builder.html
You'll avoid mistakes like that one with it :d since all you give it is the group name
!api read wiki
Learn how to use the LuckPerms API in your project.
I think there is an example of exactly that in the API cookbook repo 📌
@marble lichen (check above if you didn't see the answer)
And also, you'll definitely not want to call methods such as CompletableFuture#get() or CompletableFuture#join() on the main thread, an operation such as a massive permission lookup will make that block the main server thread!! Check in here on how you can make that operation safely: https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#how-to-query-information-for-a-potentially-offline-player
I think there is an example of exactly that in the API cookbook repo 📌
@nocturne elbow The way its done in the wiki doesnt work or Im too stupid xD
Hey Hallo5000! Please don't tag helpful/staff members directly.
Oh okay^^
Uuh the way done in the wiki? Or the way shown in the repo?
In the wiki ...can you send a link pls
I think there is an example of exactly that in the API cookbook repo 📌
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetPrefixCommand.java
How are you retrieving it?
The way its done in the cookbook repo but now I've found a new way like this: String pr = Main.loadUser(p).getCachedData().getMetaData(QueryOptions.defaultContextualOptions()).getPrefix();
But I dont know wich QueryOption I should use....?
Isn't User#getQueryOptions() a thing?

Why I cant use the getPlayerAdapter Class?
I don't really know what you mean by that btw
The "QueryOptions.defaultContextualOptions()" in my example is more like an placeholder I dont know what I should insert there
...and sorry for my english skills xD
And what I meant by that is that you should be able to use a method named getQueryOptions() you can call on a user instance to replace your placeholder
So I tried it and it doesnt work ... my IDE doesnt know this Method...and I think it doesnt exist too
Mind pasting the exact code you're typing?
Because the method clearly does exist
Oh okay so I think it was added in one of the newer versions I used 5.0.88
But I will update it
Yeah you'll definitely want to update, LP is currently on 5.2.14 I think
And that method was introduced on v5.1
Okay fine than I know whats the problem ...thx for the help

Well the API version isn't the problem, but between v5.0 and v5.2 there have been hundreds of builds, including bugfixes
So it can be a known issue on the version that you're using that's been fixed later on
But the method were talking about isnt in my version so I cant use it
Then... update luckperms?
Yes
!update you can get the latest build in here
You can download LuckPerms for Bukkit/Spigot, BungeeCord, Sponge, Nukkit and Velocity.
I need some advice.
So I'm hoping to make a highly configurable plugin relating to upgrading towns with the Towny plugin. I have quite a bit done on it, except I have this "addPerms" option in my config in which I want to add permissions to certain town ranks for a certain town upon upgrading to a certain level (Ex: once a town reaches level 2, give the mayor of that town the permission "ah.sell.5" and give the residents of that town the permission "essentials.fly").
I was thinking I'd use LuckPerms to simply dispatch a command through console after cycling different ranks, but if there was a large town with say 100 members that was deleted and I needed to remove 5 perms from each of those 100 players, it'd definitely cause some lag. Do you guys have any ideas that would allow me to implement this addPerms option using LuckPerms API that might cause less lag? Please tag me in your response and thank you in advance for your help!
Why would removing perms cause lag
^
Everything that can be async, is.



