#luckperms-api
1 messages · Page 10 of 1
bump
Help?
Question, I'm trying to set TP permissions to a group so I can allow players to TP to waypoints with Xaero's Minimap. I've tried adding minecraft.command.tp which Xaero uses to TP but no success. any help?
The error message says it all.
First of all, check your server Logfile. You can fix the error with the error messages that are in the Logfile.
can somebody help for some reason when i type something i get kicked and it says this
how do i get a player's primary group
nvm
I need help
I am having issues with "Styled Chat" and Luckperms to work. I have the chat mod installed and got the PlaceholderAPI in place. This is on fabric, but the chat does not want to change. I did the works in the config file but get no dice.
Anyone got something?
talk to styledchat
also wrong channel
is there a way to check if player has permission set to true ? (ignoring the * permission) ?
i've tried that:
public boolean hasPermission(Player player , String permission) {
return player.isPermissionSet(permission)
&& player.hasPermission(permission);
}
and it does not work, also i've tried using LuckPermsAPI, but to no avail
public Tristate hasPermission(String permission) {
return toLuckPermUser().getCachedData()
.getPermissionData()
.checkPermission(permission);
}
it returns TRUE instead of UNDEFINED, Tristate has: [TRUE,FALSE,UNDEFINED] ..
ping me if you have an idea
CachedPermissionData#checkPermission(String) is the exact same kind of check performed by Player#hasPermission(String); the isPermissionSet check should work, if you do not have the permission set (neither true or false), it will return false, short-circuit the hasPermission check and return false; if you have the permission explicitly set to false, that will override the global wildcard *, otherwise if you have it set to true it will return true
could you share the output of /lp user <the user> permission check <the permission> ?
Hey! I'm trying to check if an offline bukkit player has a permission, using code below. Unfortunately it returns a different value than Player#hasPermission, because it doesn't take player's op status into account. Is there a way to get the same result as using bukkit api?
if (luckpermsUser == null) return true;
return luckpermsUser.getCachedData().getPermissionData().checkPermission("something").asBoolean();```
*using join() because it's executed asynchronously*
not really
such things only work when the live player is online
I wanna say "like contexts" but you can query permissions with your own defined context set, op works slightly different
So I'll have to see how does the underlaying mechanic work on online player and try to reproduce it somehow using offlineplayer's op status?
I guess it checks for registered plugin permissions
i mean, if the player is op it'll just return true, that's how that works lol
although the op processing can be disabled
Yeah the root problem you're hitting is the OP calculator isn't active for offline players because LP doesn't check the platform's OP status - heck, I don't even know if you can query whether an offline player is opped or not easily
Not sure if i am missing something obvious, but sometimes this does just not working.
By that, I mean, a method calling "addGroup" then "removeGroup" doesn't modify the users permissions at all.
https://gist.github.com/james090500/1dd92b4ee0545bd0b77e879d41401605
Oh dam, i bet its a race condition
because they all end up in the default group if it doesn;t work
Does it also force a message?
How can I get the nodes? https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/LuckPerms.html
declaration: package: net.luckperms.api, interface: LuckPerms
I want to retrieve the prefix of a group
Just to confirm, user.data().clear(NodeType.INHERITANCE::matches); only removed groups that are inherited from the new group to be added?
So if they have a paid rank completely seperate, that isn't inherited from the group being added, it wont be removed
Does this help? It's in the cookbook
it removes all inheritance nodes from that player
@main dagger
Hey zaidffoo! Please don't tag helpful/staff members directly.
Don't ping.
How can I retrieve the prefix of a group?
I'm using the docs and I understand that it is something to do with Nodes.
https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/node/types/PrefixNode.html
Right now I've reached this far:
import:
net.luckperms.api.LuckPerms
net.luckperms.api.node
set {_group} to (instance of the plugin "LuckPerms").getServer().getServicesManager().load(LuckPerms.class)```
declaration: package: net.luckperms.api.node.types, interface: PrefixNode
Hi, i am trying to implement luckperms api to my forge project, the main thing i want to achieve is to check if player has certain time of playtime and if so then i want to add him to luckperms group. the playtime thing is basic i can do that but for that group i need to use api (well no shit, what else could i use?
). So... i read documentation, did what i was told to do but i can't get it to work in my forgemdk project. Am i missing something or it's just no possible? If so what should i use to achieve my goal?
I have it in external libraries but i am not sure if it's working. shouldn't it be loaded as mod when i start task runServer, as any other dependencies and APIs would?
Yeah i did that, but i don't know if i'm just plain stupid or it's not supposed to show up as mod when i start server in forgemdk, if so... how do i test it?
you need to have the LP forge jar in your mods folder
but only on the server
it will not work on a client
oh, so that's what i'm missing... 😅 anyway sorry for being stupid and thanks for help
How to check if an offline user has permission?
if (!annotation.permission().isEmpty()) {
PlayerDTO player = PlayersData.get(event.getUser().getId());
if (player.getUUID() == null) {
Language language = LanguageAPI.get(event.getUser());
event.reply(MessageAPI.embed(language, Color.RED, GlobalMessages.ERROR__NO_PERMISSION).build()).setEphemeral(true).queue();
return;
}
UserManager userManager = luckPerms.getUserManager();
CompletableFuture<User> userFuture = userManager.loadUser(player.getUUID());
User user = userFuture.join();
user.
if (!user.hasPermission(annotation.permission())) {
Language language = LanguageAPI.get(event.getUser());
event.reply(MessageAPI.embed(language, Color.RED, GlobalMessages.ERROR__NO_PERMISSION).build()).setEphemeral(true).queue();
return;
}
}```
Hm, I obviously misunderstand that method then
Is there any decent way of remove any groups that are children of the group to be added.
Eg; If a user has group.test1 but I want to add group.test2 and have it automatically remove the child group.
Without removing ALL groups incase they have a paid role
I think fixed it like this:
// Get all groups inherited by the new group
Set<String> inheritedGroups = group.resolveInheritedNodes(QueryOptions.nonContextual()).stream()
.filter(NodeType.INHERITANCE::matches) //Get inhertiance nodees
.map(NodeType.INHERITANCE::cast) // Filter out null
.map(InheritanceNode::getGroupName) // Extract group names
.collect(Collectors.toSet());
// Remove the groups
user.data().clear(NodeType.INHERITANCE.predicate(
inheritanceNode -> inheritedGroups.contains(inheritanceNode.getGroupName())
));
i'm trying to use the getNode() method on the NodeMutateEvent, but it only seems to work on the NodeAddEvent and NodeRemoveEvent. is there a way to pull it from the mutate, or would i have to split it up into the two separate events?
you can do a Sets.difference with getDataBefore and getDataAfter
great, thanks!
LuckPermsProvider.get(); is instantly crashing my plugin, even after ensuring LuckPerms is properly loaded.
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>
is in my pom
and i also have LuckPerms as a dependency in my paper-plugin.yml file
I don't know what to do from here, I can't use luckperms ;-;
Where are you making the LuckPermsProvider.get() call? i.e. onEnable, onLoad, constructor, etc?
It was in onEnable, I actually found the issue I didn't setup paper-plugin.yml properly so it wasn't correctly using the LuckPerms classes
how do I add custom context flags?
Having some issued with the REST API. I am seemingly able to use it to do everyting i want, and i can confirm the changes done from the API are stored on the database, however the actual permissions doesn't seem to take effect unless i reboot the minecraft server i am testing on. /lp sync doesn't work either. Using in-game commands for promotion and demotion works instantly. Am i missing some command or setting?
My plugin can't get the provider, does anyone know why?
is luckperms installed on the server?
yes
The server is hosted locally, does it affect anything?
no
I just launched the Skyblock server with a friend of mine and I would like to have authorization to trade with a merchant. How do I do this?
How to load user sync?
CompletableFuture<User>.join() will return the user directly blocking the thread?
yes
it will block for as long as it has to until the user is loaded, if the user storage or communication with it is slow
Great
Hello, is there a way to find out when a rank expires, i.e., in days, hours, and minutes? If not, is there a solution?
get the expiry of the node
Thank you
anyone?
anyone?
check the class javadoc for https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/context/ContextCalculator.html
Is it possible to check through the API if a player is in a running temporary parent group?
How can I make it stop appearing like that?
are you making a plugin using the LP api?
yes there is no plugin
what?
for LP api in not plugin
so you arent making a plugin?
I don't really know how to do this, do you have another solution?
Blast are you using the web editor?
If you are just replace it with the same code and instead of 0 try adding a 1. 
well then it no longer shows 0 and shows 1
Is the prefix for a rank permission?
Cause no offense without much context just that screenshot alone it's hard to tell what your trying to do 
Ahh color coding
hmm I'm trying
Unless this is API related, use a support channel please
Will do but I think we figured it out ☺️
but I think it will show suffix.0.rank
Blast let's go to support
okey
hi, i'm trying to use an external bot to modify luckperms database
currently, the system in question is using mariadb+rabbitmq, and i'm trying to make a discord bot to change some things (like user groups and permissions for example (yes i know, there is existing solutions, however the planned use case demands a custom made one))
i figure i have to send an update message through rabbitmq after modifying database, but its not immediately apparent to me what kind of data i should send
could someone give me a quick rundown of the classes inside api.messenger.message.type package (https://github.com/LuckPerms/LuckPerms/tree/master/api/src/main/java/net/luckperms/api/messenger/message/type) so i can save myself from a couple of hours of reverse engineering?
use the REST API
the messaging service just tells other instances that something changed, and to pull from the database again
it doesnt actually apply any changes or include what was changed
i didnt know that was a thing! that sounds wonderful
i initially intended to do exactly that; chaning DB and then "manually" informing clients of the change
could you please elaborate a bit about the REST api?
whatever code runs under lucko's name is always so well crafted
thank you very much for the heads up, i will check that out
Hi
I am developing minecraft website im thinking of using next js for frontend and i haven’t really thought about the backend yet. I was wondering how to automate rank purchase.
For example when user buys a rank which gives certain commands this process is automatically done and given to that user. Instead me manually checking who bought what and manually giving them the rank they bought.
I know a website called tebex does it where you easily set it up but I really dont want to use tebex. Plus I want to use this opportunity to learn about plugins, api etc
Is this process done through lucky perms api? If yes how?
you can either have a plugin that interacts with the luckperms api and communicates with your web backend, or you can use the luckperms REST api expansion to interact with luckperms like a usual web api
ok big question. Rest API, if I include it as an extension to the velocity server, I get an error saying NoSuchMethod (ConfigurationAdapter.getKeys)
[14:24:50 ERROR]: Couldn't pass ProxyInitializeEvent to luckperms 5.4.157
java.lang.NoSuchMethodError: 'java.util.List me.lucko.luckperms.common.config.generic.adapter.ConfigurationAdapter.getKeys(java.lang.String, java.util.List)'
Do I use an incorect luckperms version?
hm, what's the rest of the stack trace like? 🤔
Is it possible to check through the API if a player is in a running temporary parent group?
Yup, just check for an inheritance node on the player with an expiry
I'm not 100% sure but I believe I got this error because I put the rest API into the extensions folder of the velocity server. I believe the rest api is only for standalone app? Thus I got the error?
like emily said, share the whole stacktrace
I fixed it dw, still thanks for trying <3
Can someone pls help me in support 1
When someone decides to, yes.
asking in unrelated channels is not going to speed that up.
Sorry
hiii
can you help me out please 
!ask in the appropriate channel and dont ping
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
i thought this was the channel
bbut i didnt ping either ;c
replying pings unless you turn it off
how do i check if an user has a specific permission? do i need to stream the permission nodes of the user and all of its groups and subground or is there a more straightforward way? or does the user already have in its node data the permission of its groups etc
just the platforms standard permission check function
eg bukkits CommandSender#hasPermission()
doesn't work for offline players
through the CachedPermissionData checkPermission
user.getCachedData.getPermissionData...
cool ty
Hello, I don't have much knowledge of APIs and imports, how do I solve the problem?
did you reload maven?
I tried it but it didn't work
Do I have to do anything else specific?
I had also tried to change the version I had read online
the artifact name isn't luckperms-api, just api
Is there a way to fully squelch these, also in console?
Secondly, it seems due to using mongodb+rabbit for x-server perms messaging/updates, my LP velocity updates are also propagating out to all the LP paper servers, how might I prevent that?
you can't stop those messages from being logged to the console of where it originates from, but you can stop it from being broadcasted to players and sent to other servers, https://github.com/LuckPerms/LuckPerms/blob/7744913df2e8e2ad1670fd3374c47c80143fcb64/bukkit/src/main/resources/config.yml#L253-L261
i'm not sure what you mean with the velocity updates; updates caused in any LP instance will be propagated to all other LP instances in case any of the changes affect the resolved permissions loaded in any other LP instance, that's what the messaging system is for
well i have 2 proxies, both on LPV, then N SMP paper servers, with regular LP, the LP servers are hearing about the LPV updates which I wouldn't want crosspollinating
I suppose it makes sense as to why but is the only solution to, dunno, have a different rabbit vhost or something?
The messages are showing up in the console of every SMP LP server as a result of the change happening at the LPV proxy level
yes, set those two settings to false in every LP config, proxy included
with push-log-entries: false, will they still update each other appropriately though?
or is this some separate messaging service (not rabbit, etc)
oh push logging entries
yeah
i suppose you could disable the setting immediately above (auto-push-updates) on the velocity LPs, so it still remains hooked to the messaging system and it can listen to updates, and you can manually run /lpv networksync
in this specific context i'd rather not even use frequent tempperms, but that's out of scope
is there an API they can be easily used for tablist/scoreboard, or any guide, the like the ranks are sorted etc or is it way better to use TAB
Use TAB is easy to use
wait a min, luckperms actually is out of date? no update since last yeah june
what?
how can i set limit per groups like only 5 players can get the vip or something like that
i made a plugin with chat gpt but dont work
please HELP
Isn't this how you check if a User has a permission?
user.getCachedData()
.getPermissionData()
.checkPermission(teamPerm)
.asBoolean()
user being a net.luckperms.api.model.user.User
This seems to only resolve inheritance up to 2 layer, which is super weird
Oh. Interesting. It only doesn't work for a specific rank...
I'll do some debugging
Ok yeah it's me being a dummy and mistyping a permission...
I do have one question however, which event is the best to use to listen to permission changes?
I found the LogBroadcastEvent, however that fires for each log message, which is a bit much. I only need it to fire once per edit (like if in the editor there are multiple changes=
there are node add/remove/modify events, but that wont include permissions changing from contexts changing
I should clarify, I only care about permissions being changed via the editor, commands, tracks, the API, etc.
Context changes are irrelevant.
The important thing is that bulk changes (especially through the editor) only trigger once, as the code I intend to run is fairly expensive
Hello, I need to dynamically change the server name in the config, I need this so as not to change this value manually on each server. How to do this? (I have a plugin that takes responsibility for determining what the server identifier should be)
just use a custom context instead
can i find an example somewhere?
is there a way to check for x permission whilst completely ignoring the user is opped (aka has every perm by default)??
if you are on bukkit, just dont give the perm to ops
how can i get this groups?
api is returning me 3
vip4 has vip as child
but i dont want it to return child's
this is all the code
filter the users nodes for inheritance nodes
I'm using the API for one thing, I want to make it so that when I do "/maintenance on" the temporary ranks don't continue applying the time, is it possible to do this?
When I try to register a new ContextCalculator in my onEnable method, I get a NoClassDefFoundError: net/luckperms/api/context/ContextCalculator. What am I doing wrong?
no. expiry is stored as a timestamp
that sounds like LuckPerms is not installed on the server, or that you don't have it added as a plugin dependency
I have installed the plugin on the server and added Luckperms in the paper-plugin.yml
share the server's complete startup logs & your paper-plugin.yml
name: PermissionApiSpigot
version: '1.0'
main: de.meloneoderso.permissionApiSpigot.PermissionApiSpigot
api-version: '1.21'
authors: [MELONEODERSO]
dependencies:
server:
LuckPerms:
required: true
ServerManager:
required: true
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.
hm that looks like it should work
what's the paper-plugin.yml inside the jar file on the server look like?
as in, directly extracted from the jar
it looks exactly like this one
are you shading the LP API? 🤔
nope
hm yeah then if you aren't and the yml in the jar is the correct one, it all looks fine from this end; you can probably ask in the pufferfish discord given you're using pf
what's in the net folder?
The Adventure api
Hi do Star permissions return true at the permission check endpoint?
For example plugin.* for plugin.test
Fixed
In my implementation, the NodeMutateEvent is triggered only when a node is removed, although it is documented that it should also be triggered when a node is added. what is the problem? In the same way, the event is not triggered for the NodeAddEvent
helloo everyone! can someone explain me how to integrate luckperms on server, to rest api, should i use more .jar plugins, THANKS!
what part are you having issues with?
i dont know how to start to use it, and i think my minecraft hosting server is doesnt support to run docker
you dont need to use the standalone lp to use the rest api
hey check #support-1
do not crosspost and do not reply just to ping
can you tell me how to get this temporary permission via API, I am specifically interested in the time (i.e. I want to display the information in my plugin for mute)
Can I get a level of the group with the API?
You'd have to iterate through the User's Nodes, find the permission node with that permission & get the expiry off of it
i would just modify the display name of the player with player#displayName() rather than adding and removing prefixes
Thank you for the tip, but it wont let me use the API.
The method Leah referenced is Paper API, not LP. LP isn't necessary for doing what you're trying to.
Nevermind, I fixxed it thank you though for helping me!
Hi, I'm trying to use lp api, but it isn't working
With what do you have issues? Is there an error or what?
I tried add and refresh dependencies, but not worked
Do you get an error?
We need a bit more informations and some code to help you
Sorry, I didn’t explain myself very well. The plugin I’m making is for Velocity, and I wanted to add the API to check some info. But when I added it to the build.gradle, it didn’t recognize the API, and I can’t import anything from lp
Have you reloaded gradle since adding LP? After changing your buildscript, you need to tell Intellij you're done your change - there should be a little reload icon in the top right of the text area when you have your buildscript open
@jaunty torrent #luckperms-api message
Yes, I tried reloading IntelliJ, tried building it, and even restarted, but it still didn’t work.
Can I get the weight of a Group with the api? And is there an event for if a user gets added to a group?
You dont have to restart IntelIJ
let me show you, give me a second
I figured, but since nothing else worked, it was one of the things I tried.
If you change your gradle file, there should be a little button in the right corner:
that reloads gradle which should fix it
Otherwise you can click this little thing on the right side and then click the little reload Icon
- Yes, you can get it off the
Group. - Not for group changes specifically, but
NodeAddEvent(andNodeMutateEvent) will fire when any permission changes are made. Check if the node mutated is an inheritance node.
-# Note that in a multi-server network setup, LP api events only fire for the instance where the event originated! If you're only a single server, you're unaffected by this.
What do you mean with the first one, like is there a function?
Now it worked, thanks
perfect, happy to help! 🎊
Hi, I was wondering if there's an event like UserDataRecalculateEvent but that lets me know the cause of the recalculation? Because I want to filter out recalculations on login
Hi, I had this error on my 2 servers, I don't know where it comes from, it seems that the data of a player is not updated and that when I do /lp editor it completely stops the error and it displays my scoreboard, the tab etc.
[04:22:36] [Server thread/WARN]: [OMC] Task #61 for OpenMC v2.0.0 generated an exception java.lang.IllegalStateException: Unable to get a user for CraftPlayer{name=tuixy} at me.lucko.luckperms.common.api.implementation.ApiPlayerAdapter.getUser(ApiPlayerAdapter.java:59) ~[?:?] at OpenMC.jar/fr.openmc.core.features.scoreboards.GlobalTeamManager.getPlayerHighestWeightGroup(GlobalTeamManager.java:83) ~[OpenMC.jar:?] at OpenMC.jar/fr.openmc.core.features.scoreboards.GlobalTeamManager.updatePlayerTeam(GlobalTeamManager.java:66) ~[OpenMC.jar:?] at OpenMC.jar/fr.openmc.core.features.scoreboards.ScoreboardManager.updateScoreboard(ScoreboardManager.java:174) ~[OpenMC.jar:?]
Just to confirm, are you asking as the author of the plugin throwing the error, or as an admin just running the plugin throwing the error?
I am one of the developers of the plugin, it is an opensource plugin
👍 Ok just checking, we have some people use this channel for general support sometimes, and your message was a bit ambiguous
Could I see the code for the class that's throwing the error please?
Is it possible that I give it to you this afternoon?
https://github.com/ServerOpenMC/PluginV2
Here is the source code of the plugin, if you want I will give you the corresponding parts
(in core/utils/LuckPermApi.java and in core/features/scoreboard/GlobalTeamManager.java)
Is that enough or do you just want the classes?

does that happen consistently or at random?
your code usage looks fine so i'm not sure what the issue could be
For example, I just restarted my server. And I just got the error (no more errors appeared after the /lp editor)
(don't hesitate to ping me so I can be more responsive)
Ive made an private server system for players to host their private rounds. Is there any way to give players permissions (for example for the gamemode command) only on this server? I dont want to permanently add it to them. I have an api to check if the player is the host
I've done context-based inheritance for things like that before
For instance I have a competition plugin where people only inherit permissions to be able to do stuff in the world if they're in the competition. Managed with the context is_competing:true.
https://github.com/OpenRedstoneEngineers/CompetitORE/blob/master/src/main/kotlin/manager/CompetitoreCalculator.kt this is the relevant portion of the plugin
Do you think this is an API bug?
i don't really see how that could happen in the first place tbh since it's w/ online players
very confusing
I'm like you, I did some research to see if this error has already appeared in someone else but nothing
and believe me my plugin will host a lot of people and if this error appears once in 20, and there are 200, the console will quickly explode.
@slender talon could you try adding a listener to the UserUnloadEvent and printing a stack trace? I am failing to reproduce this issue myself, with a little bit of hope the event is called and that'd be of help
Also just to make sure, you are running with an up-to-date version of LuckPerms, and not on, like, v5.2 or something, right?
No worries I will do it, of course I have the most recent versions of the API and the plugin
i need help on how to do anything with ts
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
wait if you give them a perm to do something like /tpa does it also let them do /tpaccept or /tpa player name
public class UserUnloadListener {
public static void register(JavaPlugin plugin, LuckPerms luckPerms) {
EventBus eventBus = luckPerms.getEventBus();
eventBus.subscribe(plugin, UserUnloadEvent.class, event -> {
System.out.println("[DEBUG] LuckPerms UserUnloadEvent : " + event.getUser().getUsername());
System.out.println("*ceci est normal, j'en ai besoin pour capter le bug avec luck perm*");
new Exception("debug UserUnloadEvent").printStackTrace();
});
}
}
public class LuckPermsAPI {
@Getter private static LuckPerms api;
private static boolean hasLuckPerms;
public LuckPermsAPI() {
if (Bukkit.getPluginManager().getPlugin("LuckPerms") == null) {
hasLuckPerms = false;
return;
} else {
hasLuckPerms = true;
}
api = OMCPlugin.getInstance().getServer().getServicesManager().load(LuckPerms.class);
if (api != null) {
UserUnloadListener.register(OMCPlugin.getInstance(), api);
}
}
... methods
}
like this?
Mh? I don't know
that looks fine yeah
and that will help you know what?
like I said, hopefully the event is called when you run into this issue
I had this, but when the player logged in he was registered in luck perm
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
what would the command look like for luckperms for everyone to have access to their own beds in the bedhome plugin
so they can teleport to their own beds
@fast delta Sorry for the ping, but I just got the bug! I don't know if the stack trace will be useful to you.
Hey iambibi_! Please don't tag helpful/staff members directly.
oops
the housekeeper unload is after you logged out and before you logged in, right? cuz the join is happening afterwards
https://mclo.gs/dQAUhMs
keep the full log
I left, after the data was unloaded and then when I logged in it unloaded my data then I had the bug
hold up, how long does it take you to log into the server 
it's a big big server
It's an open source server created by a French YouTuber, and he has a Minecraft company and they are the ones who provided us with this server.
that's why the mistake bothers me, your question?
.
7 seconds and 1 minute
...I'm going to guess that's significantly longer than the housekeeper's threshold, since logging in should take a matter of seconds
What is a housekeeper? Sorry, I'm French, my translator is telling me nonsense.
The task responsible for unloading offline Users. Users remain in memory for at least 5 minutes after they were last interacted with via the API, or a time period I'm forgetting after they disconnect
oh ok
Ok dug it up, looks like the standard unload time is 1 minute, which is shorter than 1:07, so that's why the user isn't present
Really? This is why the error is not often present.
...and reading is hard apparently, I read your message as 7 minutes not 1:07. Looks like the effect is still the same though
ah
yeah there's something in there holding you up for over a minute, and that's enough time for LP to automatically unload the User because it did not quite finish logging in
at that point you gotta find out what that thing is as it's outside LP's control :/
Hello, to use LuckPerms api for my velocity plugin, I need to import to my project LuckPerms-API or the luckperms-velocity jar?
the API, it's platform agnostic
One thing outside of LuckPerms? But the problem is LuckPerms API, right?
No the problem is whatever is causing you to have a minute plus login time.
Well, it's a bug, so lol, imagine that on a server of 200 players there will be one person who has this bug.
the issue is that some plugin is causing logins to take over a minute
thats not really a good experience for the players
Yes, I agree, but it happens once in 200.
might be a ping thing, i'm surprised that the client is able to take that long to log in
but it's left in this limbo state during login where they don't really finish logging in, so luckperms cannot register them as online
hmm
i forgot this setting existed; could you enable the debug-logins setting and share the log section when this issue happens during login
I am also kinda curious how you are consistently reproducing this issue, lol
mhh ok I would activate this system. But then this bug doesn't happen often
I am wondering anyone can help me I have a paper server and the lp editor doesn't work I try to click the link and nothing .I can on other links just not Lp editor.
https://mclo.gs/To1JxhA
Again !
I think login debugs don't matter much.
is there an event for when a player's temporary parent group expires?
or even better, when a player loses a permission, as a result of said temporary parent group expiration?
Was this helpful to you?
myeah,, there is something outside oḟ luckperms that is holding onto the login process, preventing it from finishing? the UserHousekeeper will not clean up the Users as long as the player is online but, at that point the player is not really online, so a minute goes by and it gets cleaned up
Oh okay ! When you talk about something outside of LuckPerm, could it be a plugin? Or a program in my plugin?
a plugin or a client mod, or if you are using bungeecord/velocity it could be a proxy plugin
does login take a minute with luckperms as the only plugin on the server?
I have in common FAWE, ItemsAdder, PAPI, ProtocolLib and worldguard
I share FAWE, ItemsAdder, PAPI, ProtocolLib, and WorldGuard with my server.
So, you're telling me I should only have LuckPerm on my server? I can do that, but it's going to take a long time for me to try to reproduce this bug.
Oh I have to know! ItemAdder applies a resource pack, and sometimes it takes a long time, the bug may be caused because of that.
interesting
I think the solution is to make a connection with ItemAdder which checks if there is ItemAdder and when the resource pack is loaded then you launch the last phase of the housekeeper
have you confirmed that its caused by applying the itemsadder resource pack?
because if that is the issue in your case, it wouldnt surprise me if the same thing happened with applying any resource pack it took long enough
Would there be a setting in the configs somewhere to make UserHousekeeper wait longer than one minute to clean up players? That might fix iambibi_'s issue.
Honestly, I'm almost sure it comes from there.
otherwise try joining a server with a very very heavy resource pack in order to try to exceed 1 minute
I'm pretty sure this is the case. I cannot remember if it was this Discord or another, but I remember someone having the same issue. Occasionally their time to actually get into the server would pass 1 minute (like 1min 7sec). He had to find a way to reliably get his load in time under 1 minute.
"pretty sure" based on speculation is not confirming a bug. id think that if loading a big resource pack alone with no other plugins causes LP to unload the user, thats an LP bug
Do you really want me to test this?
i mean, it sounds probable that it can be caused by bombing the client with resource packs during the configuration stage, not specific to IA
adding a setting for the housekeeper timeout would "solve" the problem, but it's grunt patchwork than a proper fix
yes it is related to the resource pack application, it is not specific to ItemAdder
It's just a default of the program to unload after one minute if they haven't successfully made it into the server. No speculation. Less than one minute, in ok. More than one minute, unloaded.
So the bug fix can be launched? Is it possible to have an issue/pr to have concrete progress on the bug fix?
If you want to test to see if that is what your issue is to make sure firet, then take out a few plugins (just temporary) that are safe to remove to get load times under a minute and see if it works. I'm unsure if they found a fix because he was only over by 3-7 seconds about every 5th login. I think he managed to tweak a few setting to bring it under a minute reliably. I can try to research it and see if I come up with anything. No idea because I haven't experienced that myself yet.
what
About a UserHousekeeper function somewhere that unloads players taking longer than one minute load into a server.
sure, but your message doesn't make much sense to me xD
Oh lol I was responding to iambibi who I think(?) was asking me about testing or a patch. He was running into that issue and I just meant a quick test would be to remove some plugins to see if he can get user load time under a minute and see if that fixes it. Then he'd have a better idea if that is definitely his issue.
anyone here to help ??
is there a setting in the config to op me back i was setting up luckperms and the rank i was testing didnt have op soo what can i do any help will be nice
Give yourself OP over the console. No there isnt a setting
It wouldn’t let me add myself back what I needed to do was delete both light, perms and EssentialsX than I needed to go into server settings and change the file back to operator rates on so I can give myself operator through the consul. Then I had to reinstall both essentials and lock perms. It was a interesting, but I got it done thank you for the information.
so?
Hey there. I'm still unsure if you're replying to me or not lol If you are referring to me, I don't have a guranteed fix for you, but I can explain it a little better and try to help.
You're players are being timed out by the UserHousekeeper function is in the .class files of LuckPerms because it takes longer than 1 minute for them to fully load in. I think that could be altered to extend the time that LP waits for a user to login before unloading them if they take too long. That would have to be done by getting hold of the original .java files to make an edit before changing it into a .class file and recompiling the plugin.
The best thing would be for LP devs to implement some type of solution (maybe a config option for server owners to increase the time?)
For now, I think your only workaround is going to be trying to get player load time under 1 minute. The easiest way will be to simply remove a few plugins you are ok going without (at least temporarily) and see if you get the time for the player to fully load in down under a minute. That would fix your issue until the devs could respond about whether they would consider extending the time on the UserHousekeeper function or adding the ability for server owners to set the duration.
Kind of a long shot alternative here, but some plugins that add new items compatible with bedrock clients have optional .mcpacks that can be placed in the geyser folders to ease the burden on the client side. That might decrease the time for the player to fully load in (slightly). Might try that if you're only a few seconds over.
There is also a product called Resource Pack Manager that will let you combine resource packs. It's meant to try to avoid conflicts, but can have the side effect of helping to streamline your stuff a little bit as well.
But I've said everything, I think they have an idea of how to reproduce the bug and therefore fix it.
After that, I'm asking for a follow-up on this bug.
I'm not asking you to explain to me what the bug is.
I'm asking the Luck Perm developer if there's any way to give me an issue so I can follow the resolution of the problem live.
Well, nobody knows who you are asking questions to without some context. You're mostly replying at yourself and haven't had any one specific person dedicated to helping you. Are you sure the devs know you're waiting for them specifically to respond to you?
I was just trying to help, but again, the lack of context around who you're talking to in your responses makes it difficult to know who you're talking to about which subject.
Well, I'm going to give you the speech again as if I were new...
I don't even know what you are? A luck perm developer?
So I found a bug with UserHousekeeper.
If you have a very slow connection (more than 1 minute), often caused by loading a resource pack, then the username isn't loaded and this error occurs: java.lang.IllegalStateException: Unable to get a user for CraftPlayer{name=iambibi_}
So I'm asking you (the luck perm developers) this question.
Can the bug be fixed? If so, should I file an issue on GitHub?
I'm not a dev, just one of the many people using the product that doesnt mind trying to jump in and help others out, as is pretty common in any game modding community.
Always feel free to search guthub issues and post there id it isn't already an open issue. They definitely want to make it as issue-free as they can for as many people as they can. They won't mind.
I'm certain this is an issue the devs can fix, just likely is something that has not occurred enough to be brought to their attention as an issue needing addressed.
yeah but hey if they want me to pay them to fix this very annoying bug on a 100 player server well...
I definitely get the frustration when it is dealing with a server handling that many players. I can make a post in the support channel and tag you for devs to try to follow up on? I think they keep up with people needing troubleshooting there a bit better.
I could definitely be wrong, but I don't think there's ever been anything paid related to LP?
I don't think there were any payments around Luck Perm.
Oh ok. I was just confused on the comment about paying them to fix it lol
I went ahead and tagged you in a post in the support channel so that hopefully you'll get a better dev response. Hope they get you fixed up.
I mean a server can choose to keep a client on configuration stage for as long as it wants
Hi, quick one, how would one use the api to delete a player from the luckperms database?
I'm unsure, but you could try doing LuckPermsInstance.getUserManager().modifyUser(UUID, user ->{ user.data().clear() });
hello, i have the placeholder api from luckperms and use the luckperms_expirytime .... is there any way to change this time to only show hours or day and hours? rn i use in my skript the temp permission for 3 months and i want that in my score board that it doesnt show like 2mo xxxdays xxhours... i onyl want to have the days and the hours.. pls help
wrong channel
Which event can I use to intercept player permission updates? Is there one?
what kind of update are you looking for?
when a player gets or loses permissions, or when something changes in the group the player is in.
So basically, I want to have 4 custom Minecraft events that are triggered through LuckPerms. (Platform independent)
First, there’s PlayerPermUpdateEvent – this one should fire whenever a player’s permissions change.
Then PlayerGroupAddEvent and PlayerGroupRemoveEvent – pretty simple, they trigger when a player gets added to or removed from a group.
And last, PlayerTeamUpdateEvent – this should only fire when stuff like the player’s prefix or suffix changes.
NodeMutateEvent, then just check if its a player
NodeAddEvent/NodeRemoveEvent, then just see if the permission being added to a user is a group
UserDataRecalculateEvent (might be wrong on this one, but it fires when their cache data is updated, so you can check if prefix/suffix changes)
Thanks! I tried it and it’s almost working now.
The only problem is that sometimes the LuckPerms events don’t get triggered on every server.
Do you know why that happens? And is there a way to fix it?
they are only fired on the server that the change actually occured on
How can I make sure the changes are noticed on all the other servers too?
Is that even possible?
Make your code, notify the rest of the servers when it happens
This is my code, am I not doing it?
public void setDisplayname(String displayname) {
CompletableFuture.runAsync(() -> {
DisplayNameNode displayBuilder = DisplayNameNode.builder(displayname).build();
group.data().add(displayBuilder);
PermissionApi.getLuckPerms().getGroupManager().saveGroup(group);
}).thenRunAsync(() -> PermissionApi.getLuckPerms().getMessagingService().ifPresent(MessagingService::pushUpdate));
}
that still wont cause LP events to fire on other servers. there is an event for a network sync happening but youd have to figure out the changes yourself unless you use your own messaging service to send the info between servers
how do I check if a group/player is inheriting a certain permission from another group (rather than that specific group/player being allowed that permission)... while still taking wildcards and stuff into account (so I can't just check the raw permissions list)?
My approach was to query the permission, then check if the group had the returned node
however, while testing my plugin, this seemed to falsely think that the permission was inherited... once (so I can't reproduce it)
but it shows that this method doesn't appear to be reliable?
So is there a better way to handle this?
ok and?
@main dagger
Hey hinkxrao! Please don't tag helpful/staff members directly.
I need help
Oh I'm sorry
Guys I why does group doesn't appear in the chat only in tab
!chat and please use the correct channel in the future
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!
oh they already left the server 💀
Is there any way to make context calculation work for offline players? I'm on Paper
Also, why does it rely on platform player instances instead of LP's User instances?
you can't "make context calculation work for offline players", but you can make a QueryOptions with a certain ContextSet to it (see the static factory methods in QueryOptions), then pass that QOpts to CachedDataManager#getMetaData/getPermissionData
and the reason you need an active player instance for the context manager and calculators is because, a User is basically just a simple NodeMap holder with a UUID attached to it, there is no context (ha) you can really get from it to make a useful context calculator work with
(probably, i wasn't there when this was designed)
not what I'm looking for, unfortunately
I was trying to apply an inheritance node conditionally based on custom dynamic context, turns out my context calculator isn't even called for offline players because the subject type is Player and doesn't exist
a User is basically just a simple NodeMap holder with a UUID attached to it, there is no context (ha) you can really get from it to make a useful context calculator work with
Well, context calculators can grab a UUID, then grab a player instance with it using whatever API the platform provides for that
well, does your context calculator make use of the Player instance? or is it a StaticContextCalculator?
it's dynamic, it only needs a player UUID for the context calculation
can't you just calculate that context result directly given you have the id, and build a QueryOptions with it before passing that to getMetaData/getPermissionData?
Also, using User as a subject type instead of a platform player type would make contexts functional with standalone LP
do context calculators not work on standalone LP?
I'm adding an inheritance node conditionally based on a custom dynamic context, so I need the server to be able to do player.hasPermission("whatever permission that group has") without knowing what permission manager is in use
no, the subject is always the same iirc
but there is no player
fair enough, but then /lp user SomeOfflinePlayer permission check spaghetti.monster returns undefined or false even if the context would evaluate to the expected value
yeah, you're given a StandaloneUser which is a singleton
mkay yeah
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!
should I create an issue for that on github?
That doesn’t have anything to do with LuckPerms API and refrain from cross posting please.
Refer to Clippy’s response above - yes, you do need a chat formatter. LuckPerms doesn’t touch the chat.
uh, sure, although i don't really see an easy way to "solve" this situation, would be nice to see luck's thoughts on this
it might just be "this is what 10 year old code looks like" that's fair enough but it might also not be
(done, if someone wants to take a look at this https://github.com/LuckPerms/LuckPerms/issues/4093)
Does own messaging mean that I catch the changes myself, like with Redis?
you would need to send your own event over your own redis
But how do I notice changes, like when a permission expires automatically?
So somehow the server has to know when something gets updated, right? And then, on Velocity and Paper, a LuckPerms event should happen – or am I wrong?
the event is fired on the server the change is made on
But when I test it, it doesn’t always work like that. I give a group a permission using Velocity, but only the Paper server fires an event.
How are you making the permission change?
I make the permission changes using the LuckPerms API. Here is my code
CompletableFuture.runAsync(() -> {
group.data().add(nodeBuilder.build());
luckperms.getGroupManager().saveGroup(group);
}).thenRunAsync(() -> luckperms.getMessagingService().ifPresent(MessagingService::pushUpdate));
Am I using the messaging wrong, or did I forget something?
Can someone help me?
How am i supposed to edit a users meta value? i'm doing
val node = MetaNode.builder("neodaycare.boxcount", data.maxFreeBoxCount.toString()).build()
user.data().clear(NodeType.META.predicate { it.key == "neodaycare.boxcount" })
user.data().add(node)
LuckPermsProvider.get().userManager.saveUser(user)
but checking it ingame it's doubled
https://pics.briar.rocks/zKqd0hBkLOpR/direct
you probably want to use NetaNode#getMetaKey() instead of Node#getKey()
that doesn't look quite right, specifically the usage of runAsync, I'd replace the whole thing with
group.data().add(...)
luckperms.getGroupManager().saveGroup(group).thenCompose(_ -> luckperms.getMessagingService().ifPresent(MessagingService::pushUpdate))
i see
does getUserManager().getUser(uuid) not used cached/offline users?
when I do something like this:
MetaNode node = MetaNode
.builder(key, data)
.context(MutableContextSet.of("server", LuckPermsProvider.get().getServerName()))
.build();
I assume I get a meta node exclusive to that server, but how can I respect that when retrieving data like this:
user.getCachedData().getMetaData().getMetaValue(key, valueTransformer).orElse(ifEmpty);
Or does it respect it already? Because I don't see any way of specifying the server name
If I'm not mistaken that should already respect the user's active context. If need be, you can explicitly specify the QueryOptions on the getMetaData call
Okay, I'll try it. And to save the user, should I use pushUpdateUser?
Is there some further info about next commands, to do same things using API
/lp user <user> parent settrack <track> <group_from_track>
/lp user <user> parent cleartrack <track>
i am trying to embed these command functionalities into my plugin, but i would like to use API rather than executing commands of course
Although, i only see this (https://luckperms.net/wiki/Developer-API-Usage#obtaining-a-grouptrack-instance), not stated anywhere that i can use player here(maybe it is not possible)
Any ideas how i could do this? i need user and not group to be targeted
any ideas anyone?
i think you can just implement the logic manually by adding and removing groups.
"This behaves in the same way as the set command, except it only clears existing groups which are on the specified track."
so just loop through the groups the user is in and remove all groups in the track, then set the group you need
How to get when an group of an player gets expired?
just bumping this
hello i am building a team plugin and i want to use placeholders as prefixes on placeholderapi parse command i can see them but when i try to use it as a prefix in luckperms it won't work someone any idea to fix this?
If you mean you're putting a placeholder in the prefix you set in LP, that won't work under normal scenarios. LP will not apply PAPI placeholders anywhere, and display plugins have no reason to recursively apply placeholders when displaying prefixes/suffixes.
why
how am i supposed to display a team name for someones name
You should provide your own placeholder if you want to manage your own display thing in addition to normal prefixes
so i have to make like placeholders without placeholder api
but does the luckperms api be integrated?
just the good ol' NodeRemoveEvent, check that the Node hasExpiry and hasExpired (and that it's an InheritanceNode etc whatever other conditions you need)
note that (i assume) it wont fire for players that are unloaded (eg. offline) at least until they reconnect
Thank you!
Hello, I am a fabric modder and want to use permissions for my commands. How can I check if a player has some permission?
I can't find such method
use the fabric permission api
Does fabric api have permission api?
I searched "permission" but found nothing...
well, it's a independent lib and isn't contained in the fabric api...
correct
that luckperms (and in theory any permissions providing mod) bundles and responds to requests
Hello, I'm writing a fabric mod and I'm using the fabric-permissions-api on 1.21.5.
How can I register permissions so that they appear in the autocompletion of the luckperms commands/editor?
for bukkit based server you could add permissions to the plugin.yml, but how would I do that on fabric and are there ways to register permissions directly from code?
Hello, can someone help me? I don't understand why it doesn't work.
you dont. LP learns about new permissions when a permission check is ran for a permission that hasnt been checked before
is there a planned feature for this?
why would there need to be? just run a permission check if you really want to add it to the suggestions
I guess I could check against a random UUID, it just doesn't seem like the proper way to do this to me.
It would be nice to have some sort of register method that you can pass an array of permission strings into instead.
How to set default rank prefix to members
why i cant acess repo.luckperms.net
erm i got that from gemini from fixing my code
yeah no
LLMs will make shit up
chat gpt too
is that intended to be an argument against LLM's, or are you disagreeing with Leah?
yea, he's probably wrong
I’m agreeing
Hello, how can I get a list of permission a player has in api?
A couple options depending on what you want, all on PermissionHolder (which both User & Group inherit): getNodes will give you all Nodes set directly on the holder, while resolveInheritedNodes will give you both the holder's nodes, and any inherited nodes
Im trying to use the following method in a PlayerJoinEvent:
public static void setPlayerRankFormatted(Player player) {
UUID UUID = player.getUniqueId();
System.out.println("this is being run fcking hell");;
luckPerms.getUserManager().loadUser(UUID).thenAcceptAsync(user -> {
CachedMetaData metaData = user.getCachedData().getMetaData();
if(metaData == null) System.out.println("meta data is null");;
String prefix = metaData.getPrefix();
if(prefix == null) System.out.println("prefix is null");
if(prefix == null) return;
PlayerSettingsData playerSettingsData = settingsManager.playersSettingsData.get(player);
playerSettingsData.rankFormatted = prefix;
System.out.println("lp rank for player " + player.getName() + " is " + prefix);
});
}```
But the function inside thenAcceptAsync() is never being run. The setPlayerRankFormatted does run.
I just found out it worked after a 20ticks delay but is there a way to make it actually run the method when the user is loaded in luckperms or so?
idk whats causing the issue of notbeing able to load the user on player join
what import do i gotta use to get the player prefix? i cant seem to find one
package com.wilzeus.wzutils.misc;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import io.papermc.paper.chat.ChatRenderer;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.luckperms.api.*;
import net.luckperms.api.model.user.User;
public class CustomChatFormat implements Listener, ChatRenderer {
private LuckPerms luckPerms;
public CustomChatFormat(LuckPerms luckPerms) {
this.luckPerms = luckPerms;
}
@EventHandler
public void onChat(AsyncChatEvent event) {
event.renderer(this);
}
@Override
public Component render(Player source, Component sourceDisplayName, Component message, Audience viewer) {
User user = luckPerms.getPlayerAdapter(Player.class).getUser(source);
String prefix = user.getCachedData().getMetaData().getPrefix();
Component formattedPrefix = prefix != null ? Component.text(prefix) : Component.empty();
return formattedPrefix
.append(sourceDisplayName)
.append(Component.text(" §7»§r "))
.append(message);
}
}
ion really understand why line 29 errors
!paste the error
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
Cannot invoke "...LuckPerms.getPlayerAdapter(...)" because "this.luckPerms" is null
you are passing null to your listener ctor
Hey, thanks for quick reply, this is what I ended up using, however it returns [] every time, do you know what might be the issue?
private List<String> getPlayerGroups(Player player){
if (luckPerms == null) return EMPTY_LIST;
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
if (user == null) return EMPTY_LIST;
var options = QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build();
var r = user.resolveInheritedNodes(options).stream()
.filter(node -> node.getType() == NodeType.INHERITANCE)
.map(Node::getKey)
.filter(t->t.startsWith("groups."))
.toList();
getLogger().info("[LINKDEBUG] Found " + r + " groups.");
return r;
}
what's the point of the .filter(t->t.startsWith("groups."))?
all nodes are InheritanceNodes at that point so the filtering doesn't really make sense to be there at all
but, that's what is wrong, because inheritance nodes are group.foo instead of groups.foo, but you don't even need this filter so you can just get rid of it
Thanks, seems to be fixed now
guys, i need your help, please!
Please check, if my build.gradle is correct for luckperms api?
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
group = 'org.mjadapter'
version = '1.0.1'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
maven { url 'https://repo.papermc.io/repository/maven-public/' }
maven { url 'http://oss.sonatype.org/content/repositories/snapshots'
allowInsecureProtocol = true}
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT'
implementation 'com.zaxxer:HikariCP:5.0.1'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'net.dv8tion:JDA:5.0.0-beta.20'
implementation 'org.springframework.boot:spring-boot-starter-web:3.1.5'
compileOnly 'net.luckperms:api:5.4' // LuckPerms API
// OAuth2
implementation 'com.github.scribejava:scribejava-core:8.3.3'
implementation 'com.github.scribejava:scribejava-apis:8.3.3'
// JSON обработка
implementation 'com.google.code.gson:gson:2.10.1'
// Веб-запросы
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
}
processResources {
from('src/main/resources') {
include '**/*.yml'
duplicatesStrategy = 'include'
}
}
shadowJar {
archiveFileName = "RefSystem-${version}.jar"
mergeServiceFiles()
// Явно включаем все ресурсы
from(sourceSets.main.resources) {
include '**/*.yml'
duplicatesStrategy = 'include'
}
}
Cause i have error in console
If you're getting an error, please share it.
00:02:08 ERROR]: Error occurred while enabling refSystem v1.0 (Is it up to date?)
java.lang.NoClassDefFoundError: net/luckperms/api/node/Node
at org.mjadapter.refSystem.ReferralSystem.onEnable(ReferralSystem.java:45) ~[RefSystem-1.0.1.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[purpur-1.20.1.jar:git-Purpur-2062]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[purpur-1.20.1.jar:git-Purpur-2062]
ReferralSystem 45: this.luckPermsManager = new LuckPermsManager(this);
Have you declared a [soft] dependency on LP in your [paper-]plugin.yml
name: RefSystem
main: org.mjadapter.refSystem.ReferralSystem
version: 1.0.1
api-version: "1.20"
authors: [mjadapter]
depend: [LuckPerms]
softdepend: []
This?
Hello, I am trying to build a Velocity chat plugin with leverages Luckperms prefixes/suffixes and am struggling to fetch them from the api. When I attempt too I get an error telling me the Luckperms API hasn't loaded yet. I have only been able to find very limited information on implementation so any pointers are welcome as well.
As a bit of context this is being called on a PlayerChatEvent, if more information would make it easier don't hesitate to ask! 🙂
private String getLuckPermsPrefix(UUID uuid) {
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(uuid);
if (user == null) return "";
CachedMetaData metaData = user.getCachedData().getMetaData();
String prefix = metaData.getPrefix();
return prefix != null ? prefix : "";
}
make sure you arent including LP in your plugin jar
I don't think I am, this is my pom.xml https://pastes.dev/sehR0cryNq
you need to set the scope to provided
Amazing that fixed it, tysm 🙂
!help
!advanced
!api
!argumentbased
!ask
!bedrock
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!forgepermissions
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir
!locale
!lpc
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!permplugin
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!velocitycheck
!verbose
!version
!weight
!whyluckperms
!wiki
!api
Learn how to use the LuckPerms API in your project.
How i can get meta data with key but only that one with server=[servername]?
!ask Where can I learn more about the LP api
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
How does LuckPerms get the exact server name? I want to compare server=[servername] with the current server so I can use the plugin on multiple servers.
or use luckperms the named server in the config
its the first option in the config
!api
Learn how to use the LuckPerms API in your project.
Hello!
For a Discord/MC role sync plugin, I want to perform an action for each group added/removed to the player. To do this, I thought the NodeAddEvent and NodeRemoveEvent events would be appropriate, as groups are symbolized by permissions that start with group.. But the add/remove parent command doesn't trigger these events. I still can use the UserDataRecalculateEvent instead, but I'm afraid it might be triggered too frequently in my case. Just to be sure, am I missing something else that would fit better?
Thanks a lot!
Use NodeMutateEvent, and Event#isGroup
no im lying
isGroup would only work if you were modifying a group
those commands should certainly fire the events
if the plugin listening to it is on the same server it was fired on, yeah
The 3 events I mentioned are triggered if I add/remove a permission to the player with permission set/unset command, but if I add/remove a group to him with parent add/remove command, I only have the UserDataRecalculateEvent triggered. My plugin is of course on the server where the command is executed. Anyway, it seems to work as intended with the NodeMutateEvent, so I'll probably use that one. Thanks a lot! 😄
!config
Learn what each of the config options are for.
!placeholders
Display data such as user prefixes and groups from LuckPerms in other plugins.
!formatting
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!
Not a bot commands channel, @storm harness. If you need support, please use one of the support channels instead.
What is the easiest and best way to sort LuckPerms users based on weight from meta data?
I just wanted to check to see, but does this only return TRUE if the player has that permission node or does it also look for wildcards?
Like, if I check for test.example.permission.node and they dont have it, but they do have text.example.permission.* would it return UNDEFINED or TRUE
CachedPermissionData.checkPermission()
Ok so ive gone through this for like hours since last night
TSSM Access Guard is a mod I made for Fabric 1.21.1 that blocks players from using Tom’s Simple Storage terminals unless they have a specific permission.
I built it for my server to make sure only trusted players can access shared storage. If they don’t have the right permission through LuckPerms (or any mod using fabric-permissions-api), the terminals just won’t work for them.
I'm trying to build a Fabric mod that uses Lucko's fabric-permissions-api version 0.3.1, but I'm getting a Could not find error during the Gradle build. The artifact is available on Maven Central — I can access it in the browser at the correct path — but Gradle still can’t resolve it. So the issue persists even though the dependency exists online.
this is my first experience doing any mod and my first experience using java
all of this code is ai built so keep that in mind
literally any help at all would be very appreciated
PS F:\TSSM-Access> .\gradlew.bat clean build --refresh-dependencies
Configure project :
Fabric Loom: 1.8.13
Refresh dependencies is in use, loom will be significantly slower.
:remapping 50 mods from modImplementation (java-api)
:remapping 50 mods from modImplementation (java-runtime)
:remapping 1 mods from modCompileOnly (java-api)
Task :compileJava
F:\TSSM-Access\src\main\java\com\midweekmouse505\tssmaccessguard\TSSMAccessGuard.java:3: error: package me.lucko.fabric.permissions.api does not exist
import me.lucko.fabric.permissions.api.Permissions;
^
1 error
Task :compileJava FAILED
FAILURE: Build failed with an exception.
Ping me if responding to me please otherwise i probably wont see it 🙏
also i noticed this in the USAGE.md but on the old Support for 1.21.1 github issue it its noted that the correct version for 1.21.1 us 0.3.1
lmao i probably shouldve made a thread but again any help so i could just get the file to compile would be great
well now ive made it past that and am getting a different error
cannot access class_1297
PS F:\TSSM-Access> .\gradlew.bat clean build --refresh-dependencies
Configure project :
Fabric Loom: 1.8.13
Refresh dependencies is in use, loom will be significantly slower.
:remapping 50 mods from modImplementation (java-api)
:remapping 50 mods from modImplementation (java-runtime)
Task :compileJava
F:\TSSM-Access\src\main\java\com\midweekmouse505\tssmaccessguard\TSSMAccessGuard.java:33: error: cannot access class_1297
if (!Permissions.check(source, PERMISSION_NODE)) {
^
class file for net.minecraft.class_1297 not found
1 error
Task :compileJava FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':compileJava'.
Compilation failed; see the compiler error output for details.
- Try:
Run with --info option to get more log output.
Run with --scan to get full insights.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.10/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 1m 2s
2 actionable tasks: 2 executed
PS F:\TSSM-Access>
Hello, which events correspond to parent set/add/remove ? And if i work with multi server, if server 1 do parent add it will propagate the event to other server too ? Thanks you
Hi, will the String returned by getPrefix include the prefixes formatting?
It will get it as String.
If you want to convert it to Chat Component, you need to use the right serializer for example: MiniMessage.miniMessage().serialize(YOUR_STRING)
Hello, does getPrefix method respects the server context? As for me it seems to ignore it (if there's server=...) it ignores it & uses the global one
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms
anyone know how to fix this?
im on paper 1.21.7
using the wiki code
getPrefix on what class? Is this from Vault, or a LP class?
Make sure you've properly defined a dependency on LP in your plugin.yml / paper-plugin.yml
Seems I managed to fx it, but thanks!
public Group getGroupFromTrack(User user, Track track) {
List<String> groups = track.getGroups();
Collection<Group> userGroups = user.getInheritedGroups(user.getQueryOptions());
for (String groupName : groups.reversed()) {
Group group = getPlugin().getLuckPerms().getGroupManager().getGroup(groupName);
if (userGroups.contains(group)) return group;
}
return null;
}
Is this the way to go, or am I missing something
any reason why:
track.promote(user, MutableContextSet.create()) puts the user on the same track multiple times
Hey! This possible collect NodeAddEvent and NodeRemoveEvent in Velocity? If yes, how?
I tried this but not work
In a network setup when modifying LP data, all the normal events for that modification only fire on the LP instance that the changes were made on. Every other instance will only get the network sync events. For instance, if you have servers A & B behind a proxy and a LP command is ran on server A, server A will fire the normal NodeAdd or NodeRemove or whatever events, while server B and the proxy will only get the network update related events.
Oh, i understand
exists a event trigger when the modification occur?
Is it possible to alter the way LuckPerms gets the players UUID to intercept it and replace it with a different value?
I'm aware how crazy this sounds haha
altering uuids is not supported
Is there any way to alias UUID's?
No, that would fall under "altering UUIDs". The whole contract of a player's UUID is exactly one UUID maps to exactly one player, and that said UUID will never change. Attempting to modify it will break all sorts of things beyond just LP.
What are you actually trying to accomplish? There's probably a sane way to accomplish your goal without messing with UUIDs
We're trying to make our character switcher less janky w/ a Velocity plugin that creates entirely separate "users" for each. Our previous implementation felt pretty fragile since it was copying around items, potion effects, etc.
Yeah so modifying UUIDs is definitely not the way to go for that, that moves you into even more janky territory. At least for LP, providing a custom context calculator might be a more reasonable alternative? You could provide a context that's i.e. character=<who>, then set any permissions that depend on which character is selected with the appropriate context. This also means you can set any permissions that don't depend on which character is selected (i.e. staff groups, any purchased perks, etc) without a context, so they always are active regardless of selected character.
!context
Below is the documentation of context intended for admins configuring LP, and here's the documentation section for registering your own context calculator via the API
You can set a permission or group on a per-world/per-server basis, through what we call "contexts".
Yikes, alright.
!forge
Forge added the Permissions API only recently in 1.18. That API is what allowed a native Forge version of LuckPerms to be made, however that API does not currently exist on older versions of Forge, and is unlikely to be backported. Without the Permissions API existing on older versions of Forge, it is impossible to make LuckPerms work on those versions of Forge natively.
There is a Sponge version of LuckPerms! You can add SpongeForge and the Sponge version of LuckPerms to use LuckPerms on older Forge versions.
!offline
Running a Minecraft server in offline mode can cause a lot of issues, particularly with UUIDs and security vulnerabilities. Some people also view it as unethical (piracy). We understand that some people need to run their servers in offline mode. However, due to the reasons mentioned, some users will choose to not support those running a server in offline mode (this does not apply to those running in a Bungeecord network). Please respect their decision, you may continue to seek help for your issue but in most cases, it can be resolved by setting online-mode=true in server.properties.
Hello,
I've been trying for several days to add LuckPerms as a Gradle dependency in my IDE for a Forge 1.20.1 mod, but I keep encountering compilation errors during development.
However, when I run the mod on an external server (outside the IDE) with LuckPerms installed in the mods folder, everything works fine and the mod starts without any issues.
Is there something specific I need to do to include LuckPerms properly as a dependency during development?
Thank you in advance for your help.
Error :
[16:16:29] [main/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: 'com.mojang.brigadier.builder.LiteralArgumentBuilder net.minecraft.commands.Commands.m_82127_(java.lang.String)'
Index: 3
Listeners:
0: NORMAL
1: ASM: net.minecraftforge.common.ForgeInternalHandler@71c16f03 onCommandsRegister(Lnet/minecraftforge/event/RegisterCommandsEvent;)V
2: ASM: class fr.woe.serverrpmod.event.ModEvents onRegisterCommands(Lnet/minecraftforge/event/RegisterCommandsEvent;)V
3: net.minecraftforge.eventbus.EventBus$$Lambda$4013/0x00000218c3a29338@5ecb30f1
Best regards.
I'm getting the "net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!" exception as my plugin starts, although I have the "LuckPerms-Bukkit-5.5.10.jar" in my server file, and it enables correctly "[LuckPerms] Successfully enabled. (took 1449ms)". I have depend: [ LuckPerms ] in my plugin.yml and also obviously in my pom.xml and I'm enabling the Plugin in the onEnable method and not in the Main constructor or so: https://pastebin.com/wbH9EWsB
My server is on 1.21.5 Paper with Velocity as Proxy
make sure you arent shading LP into your own plugin jar
oh do i have to modify my pom? I build with mvn clean package do I have to modify my <build>?
no, just make sure your scope isnt set to compile. It should be “provided”
Ah thanks bro and @main dagger thanks too now it works 
help 😭
api.eventBus.subscribe(nexus, NodeAddEvent::class.java) { event ->
NexusLogger.debug("⚙️ LP NodeAddEvent for user=${(event.target as User).uniqueId}, node=${event.node.key}")
onNodeChange(event.target, event.node, added = true)
}
api.eventBus.subscribe(nexus, NodeRemoveEvent::class.java) { event ->
NexusLogger.debug("⚙️ LP NodeRemoveEvent for user=${(event.target as User).uniqueId}, node=${event.node.key}")
onNodeChange(event.target, event.node, added = false)
}
I'm using these on a Velocity plugin. Whenever I run /lpv user <username> parent add <group>, I get the debug log and onNodeChange fires successfully. However, whenever I use /lp user ... on the backend instance, nothing fires, even though I get [luckperms]: [Messaging] Received user update ping for... in console on proxy.
I'm using MariaDB, have tried auto, sql, pluginmsg, and redis for messaging-service, have attempted modifying sync-minutes, and just about everything else. Does anyone have any idea why this wouldn't be working? as I've been on this for over 4 hours and I'm about to lose it
events only fire on the server the change occurs on
there is a sync event though, you can use that but you have to figure out what changed on your own
I'm having some issues using the LuckPerms API:
whenever I want to promote a player (adding a new group but also deleting the old one) I use this code:
u.data().add(Node.builder("group.friend").build());
Main.lp.getUserManager().saveUser(u);
u.data().remove(Node.builder("group.default").build());
Main.lp.getUserManager().saveUser(u);```
but sometimes the player has two groups afterwards...my best guess is that its caused by the LuckPerms methods being called asynchronous but does someone know how to work around this problem?
*my only idea is to run the lp user name promote command via console but doing that in a plugin is kind of weird...i think🤷♂️
well, first you don't need to save the user data after every individual change lol, you should do all the changes and then save the user
but for this you can get the Track from the TrackManager and then call Track#promote
Thanks a lot
can I put in null into the context field when I don't want any specific context or is there an identifier for "no-context"?
*and do I also need to call saveUser() afterwards?
If you mean on Track#promote, definitely not null, that paramater is annotated as @NonNull. If you don't want any context, you can just use ImmutableContextSet.empty
Yeah thats exactly what I needed thx
As for saving...I'm honestly not sure. My gut says probably, but I'd need to check the source
is ImmutableContextSet.empty considered gloabl in the end?
I'll just do it...it cant hurt
"global" just means no context, there's no actual "global" context
Ok yeah quick 2 minute look at the implementation, there's no obvious saving happening. As long as you're not calling this several times a second, it shouldn't really matter anyways
ok so theoretically I need to save it but it only matters if I make many different changes fast?
and also why does the following code end up in the user having two groups? (the old one and the new)
Main.lp.getUserManager().saveUser(u);```
I figured it out using UserDataRecalculateEvent, since that occurs on all servers it seems.
subscribe(UserDataRecalculateEvent::class) { onUserDataRecalculate(it.user) }
// ...
private fun onUserDataRecalculate(user: User) {
val now = user.getInheritedGroups(QueryOptions.nonContextual())
.map(Group::getName)
.toSet()
val before = groupCache.get(user.uniqueId) { emptySet() }
if (now == before) return
groupCache.put(user.uniqueId, now)
(now - before).forEach { modifyNode(user, it, added = true) }
(before - now).forEach { modifyNode(user, it, added = false) }
}
Hello, is it possible to run a command when a player's primary group is changed?
Having the same issue. It keeps them in both groups, then any demotion/promotion fails afterwards because the user is seen as being on 2 tracks.
Using LuckPerms v5.5.10 on 1.20.4 & 1.21.8
public boolean promote(Player player, ModModeGroup group) {
Track track = getAppropriateTrack(group);
User luckpermsPlayer = _luckpermsAPI.getUserManager().getUser(player.getUniqueId());
if(track != null && luckpermsPlayer != null) {
Result result = track.promote(luckpermsPlayer, ImmutableContextSet.empty());
if(result.wasSuccessful()) {
_luckpermsAPI.getUserManager().saveUser(luckpermsPlayer);
return true;
}
}
return false;
}
If anything else is needed to help, please let me know. This could be PEBCAK but I saw the other person mention this and wanted to make sure.
I'm listening to the UserPromoteEvent and if I wanted to remove another node when that event is called would this be the right code?
e.user.data().remove(Node.builder("group.default").build())
Nevermind I figured it out, this works:
e.target.data().remove(InheritanceNode.builder("default").build())
e.luckPerms.userManager.saveUser(target)
Is PermissionNode.builder("test").expiry(Duration.ZERO).build(); going to create a permission node which doesn't expire?
Is it possible to create a transient group or add transient permission nodes to the player?
can help me ?
Is PermissionNode.builder("test").expiry(Duration.ZERO).build(); going to create a permission node which doesn't expire?
no, it's going to create a permission that's going to expire in 0 seconds (so, already expired basically)
you don't need to define an expiry at all if you don't want one
you can add an InheritanceNode to the user's transient node map https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/PermissionHolder.html#transientData()
I am making a plugin that can create different "profiles". Basically, when a player is logged into a profile, their UUID changes (modifying the GameProfile using NMS).
However, LuckPerms seems to break when that happens. It's not working when a player doesn't have the UUID it is supposed to have.
I tried to invalidate cache when switching profile, to no success.
Would it be possible to have different permissions based on what profile is currently selected? Knowing that the username doesn't change, but the UUID does.
Yeah, modifying a player's UUID is completely unsupported by LP (and by much of the MC ecosystem too for that matter). See here ( #luckperms-api message ) for why, and a possible alternate method to handle that.
Yeah I did try contextcalculators first. It worked, but it really only works for luckperms. My goal is to make all the other plugins automatically support each character, by assigning new data to each new profile based on the UUID. Right now, my server is mostly plugins that I made myself, so I could technically store all the data in a way to would work with this system. However, we are probably going to have at least one plugin that doesn't support it, that is made externally and that we just don't really have any control over. So that's why modifying the UUID seems like the most logical option. Right now I am almost there, just need to refresh luckperm's cache and Permissible injector. Thanks though.
👋
If a player has multiple ranks that has permissions like plugin.perm.1, plugin.perm.2, plugin.perm.3 etc. does Player#getEffectivePermission(); return all of them?
it will be the weight have the most number will do applied or the best he have...
in next update, can you add a column in luckperm interface to put some note
wdym?
i don't understand, "WDYM"
wdym = "What do you mean"
something like that
Understood. But you might want to create an GitHub Issue regarding to this since it might not get noticed here
ok thanks
This has been suggested in the past, but the (surprisingly considerable) effort required to implement it currently makes it unlikely to happen in the near future. I've also closed your issue as a duplicate.
-# (also technically this whole convo should have been in a support channel or #luckperms-web, this channel is supposed to be for developers discussing interacting with LP programmatically)
does someone have expereince with luckperms-rest-api?
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
Hello - is there an API method to add permission nodes to the suggestions LuckPerms provides to users in its permission commands, to make it easier for users to use these nodes?
Usually if your plugin register the permission through the bukkit api it should show in luckperms tab complete. But it also depends on caching.
Ah, I should have clarified this is a Fabric mod
Oh
Is it possible to add an entire list directly to the transientData for a player?
Because otherwise the event will be triggered so often, and I don't want that
Not that I'm aware of, but I might be mistaken on that.
That being said this is a rather unusual problem description; I'm getting XY problem vibes. Why is the event being triggered frequently a problem, or more broadly, what is your actual end goal you are trying to accomplish?
I want to add a list of permissions, but I want the event to be triggered only once so that my plugins don't have to process the event 20 times
Yes I figured that from your original message, I'm asking why the event being processed 20 times is a problem - this is implying there's a larger problem at play
Like there's plenty of reasonable situations where 20+ permission mutations can occur at once outside of whatever you're doing, so if your system can't handle that then you're probably going to encounter problems regardless
Hm thats bad
Hi, is there any method to get formatted duration of node? (like from a placeholder - "10d 5h ..")
No, but you can get the Duration of a Node (Node#getExpiry()) and replicate the formatting, such as in https://github.com/LuckPerms/placeholders/blob/master/common/src/main/java/me/lucko/luckperms/placeholders/DurationFormatter.java
uh, okay
how i can reload the sorting manager to get the new player list sorted?
why with lp user work but with setTemporaryGroup nop?
!tab you should probably reach out to the support of your Tab plugin
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!
I added the sort, with luckperms it works after it does the sorts and puts them in order. With the API using setTemporaryGroup, it doesn't sort the players into tabs.
but with the debug i see that it work
Hi, I did something like this (it's in Skript but you will probably understand).
- I got the duration of node:
set {_expiration} to {_node}.getExpiry() - Then I'm getting remaining time:
set {_remaining} to Duration.between(Instant.now(), {_expiration}).getSeconds() + 1 - At the end I'm formatting remaining time to timer format:
secondsToTimer({_remaining})
if {_num} >= 10:
return "%{_num}%"
return "0%{_num}%"
function secondsToTimer(seconds: number) :: text:
set {_totalSeconds} to {_seconds}
set {_days} to floor({_totalSeconds} / 86400) # 24*60*60
set {_hours} to floor(mod({_totalSeconds}, 86400) / 3600)
set {_minutes} to floor(mod({_totalSeconds}, 3600) / 60)
set {_seconds} to mod({_totalSeconds}, 60)
set {_d} to timerFormat({_days})
set {_h} to timerFormat({_hours})
set {_m} to timerFormat({_minutes})
set {_s} to timerFormat({_seconds})
return "%{_d}%:%{_h}%:%{_m}%:%{_s}%"```
But when I add myself node for more than 1mo, the time I get from lp placeholder and from this function is different. Do you know why?
(my goal is to format this in DD:HH:MM)
days are correct but the reset is not
I tried to format this from millis but the result was the same

hm, that looks correct
this too?
like why there's 52 sec in my version and 34 sec in a placeholder
did I break something in my code?
I can't figure this out
yeah i mean the code looks correct, idk what could be wrong lol
huh
Are you able to read the contents of config.yml OR get the "server" in config in the java api?
is there an event to listen whenever a player group get changed?
just use the normal bukkit version
I'm a bit confused on the Value part of a Node.
Like for a PermissionNode, is the value as simple as "true = has permission and is true; false = does not have permission OR has permission, but is set to false", or is there more to it?
My goal is to return whether the player has the permission, and said permission is actually true/granted.
I can't use stuff like the hasPermission method on Servers/Proxies because A) I'm designing this in a way that works platform independant and B) the Player is not available when I want to check this (It happens while they ping the server/proxy from their multiplayer screen)
the value of a Node is the explicit value granted to it, true or false
a Node having a value implies the existence, the presence of the node, so if you have a Node that you got from a User, then the node is present to begin with
Actually, I made an obviousl logic error.
If the user does not have the permission assigned, then they obviously don't have the node.
yep!
you got that right
you can use the user's permission data to get a Tristate for a permission check https://javadoc.io/static/net.luckperms/api/5.5/net/luckperms/api/cacheddata/CachedPermissionData.html#checkPermission(java.lang.String)
true/false/not set
I assume I would obtain the CachedPermissionData via getCachedData().getPermissionData() of the User object?
yep
Would this be recommended for group checks too, or would streaming over getInheritedGroups be a better aproach?
that check includes inherited nodes by default
as if performed by a regular hasPermission check on the platform's permission api (bukkit's Player#hasPermission etc)
Something I wonder.
When calling loadUser, will the return CF always be a new one, or does LP cache it for a while?
that method will load directly from storage
please help with the luckeperms mod with the NotLoadedException error? How do I load luckperms first and then my mod to initialize luckperms?
Fabric 1.21.8
how do we use the panel on this image?
hi. I have created a lil helper methods for adding permissions:
Main.lp.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
PermissionNode permissionNode = PermissionNode.builder(permission).value(value).build();
user.data().add(permissionNode);
});
}
public static void setPermissionForUser(OfflinePlayer player, String permission, boolean value, int durationSeconds) {
Main.lp.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
PermissionNode permissionNode = PermissionNode.builder(permission)
.value(value)
.expiry(Duration.ofSeconds(durationSeconds)) // Temporary permission
.build();
user.data().add(permissionNode);
});
}```
First one works great, but second one adds "default" parent group when executed, and I don't get why
Did the player have any other permission data before you added the temporary node?
(Side note, static abuse. Neither of these methods nor Main.lp should be static )
Yes, it has. Actually, it happens only if I call that method twice, i.e. for different permissions:
Util.setPermissionForUser(victim, "cmi.command.warp.koth", false, times * 60); Util.setPermissionForUser(victim, "cmi.command.warp.spectate", false, times * 60);
(I'm a recovering staticholic)
Interesting. Does that existing data include a group inheritance node with no context set, or was it only permissions?
Account already has group.laisvas w/o context
5.5.16 on newest 1.21.8 Paper build. This issue is present for a long time, not something new, it was just deep down in my to-do list. 😄
if i had to guess it's because of the two modifyUser calls happening concurrently, since the whole process is async and it loads the User data from storage directly
My rough recollection was adding the default group was performed sync during the load? Maybe I'm mistaken though
since I'm only dealing with online players here, maybe it is possible to use cache data instead of loading from storage?
If the player is online, yeah you can just get their loaded user instead of using modifyUser (which will load from storage regardless of their online state)
Ok no race condition, at least within modifyUser. Maybe there's some race condition if they're also online though ```java
// ApiUserManager
@Override
public @NonNull CompletableFuture<Void> modifyUser(@NonNull UUID uniqueId, @NonNull Consumer<? super net.luckperms.api.model.user.User> action) {
Objects.requireNonNull(uniqueId, "uniqueId");
Objects.requireNonNull(action, "action");
return this.plugin.getStorage().loadUser(uniqueId, null)
.thenApplyAsync(user -> {
action.accept(user.getApiProxy());
return user;
}, this.plugin.getBootstrap().getScheduler().async())
.thenCompose(user -> {
this.plugin.getUserManager().giveDefaultIfNeeded(user);
return this.plugin.getStorage().saveUser(user);
});
}
i mean, the process is not atomic
That seems to help, can't reproduce this anymore. Thank you 🙂
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
if(jailedPlayers != null) {
for(String str : jailedPlayers) {
UUID uuid = UUID.fromString(str);
Player player = Bukkit.getPlayer(uuid);
if(player != null) {
if(!player.hasPermission("group.jailed")) {
api.getUserManager().modifyUser(uuid, user -> {
// Add the permission
user.data().add(Node.builder("group.jailed").build());
});
}
}
}
}
}
is this an appropriate way of adding someone to a group?
there should be a group manager api
thanks!
Is it possible to get the actor in events (example: CONSOLE, API, PlayerName123)?
I managed to get the type (ENTITY) by doing String actor = e.getSource().getType().name();, but I can't find a way to get the actor or the actor's name if it's a player.
hey, i keep getting this error whenever I try to call LuckPerms api = LuckPermsProvider.get();
i have shadowJar'ed the dependency into my plugin and i have the luckperms plugin installed on my server. This method is also being called in a command, which means the plugin would have been enabled by now.
do i need to include a dependency in my plugin.yml maybe?
would this work?
If the Source#getType is a Source.Type.ENTITY, then the Source should be an EntitySource - you can type-check & cast it, then grab the PlatformEntity off it with EntitySource#getEntity.
Once there, you can again check the type of that PlatformEntity to see if it's a player or console, if it's a player you can grab their UUID off the PlatformEntity.
Yeah, you can't shade the LP API - you're calling the shaded version of the API, which of course will never load.
Declare your dependency in your build tool as a "compile only" dependency; in gradle that's as easy as changing the implementation to compileOnly for the LP dependency
(This doesn't just apply to LP fyi - if you're depending on any API provided by another plugin, you can't shade it)
Oh, but also yes, you do need to declare an [optionally soft] dependency on LP in your plugin.yml
Ah ok, that’s my bad I thought APIs were the same as any other dependency
How do you use softdepend? Do i need to check if the luckperms api class exists or not in my code?
Because if I don’t shadow jar it it gives class not found errors
Use a normal dependency in your plugin.yml if you require LP to be present. softdepend is an optional dependency (i.e. your plugin can work without the other plugin, but if it's installed then you do use it), while depend is a required dependency (if it's not present, the server will throw an error and your plugin won't be enabled).
If you require LP for your plugin to work, you can just make it a hard depend & you know for sure LP will be loaded when your plugin is enabled. If it's optional, then yes, you'll need to do some extra steps to handle that.
As for the ClassNotFounds, check your server's logs; make sure a) LP is actually getting enabled, and b) it should be getting enabled before your plugin
I did that and it works perfectly, thank you so much
thanks for your help, it works now 🙂
What do i need to do to get an instance of the api on the bungecord?
I allready tried to get it later but this also dont work. What am I doing wrong?
try {
api = LuckPermsProvider.get();
getLogger().info("LuckPerms API hooked.");
} catch (Throwable t) {
getLogger().warning("LuckPerms API not available yet, retrying in 1s...");
getProxy().getScheduler().schedule(this, () -> {
try {
api = LuckPermsProvider.get();
getLogger().info("LuckPerms API hooked (delayed).");
} catch (Throwable t2) {
getLogger().severe("LuckPerms API still not available.");
}
}, 1, java.util.concurrent.TimeUnit.SECONDS);
}```
You definitely shouldn't be doing that sleeping thing, that's super unreliable. Common problems:
- Make sure you are not shading LP (declare the LP API dependency as
compileOnlyin gradle / with theprovidedscope in maven) - Make sure you've declared a dependency on LP in your plugin manifest file (whatever bungee calls it)
- Make sure LP is actually running on the test instance
Oh thanks a lot. I forgot to set it as provided. yea i will remove the sheduler crap from the onenable
Not about API, but: if I decide between online/cracked authentication on velocity in preloginevent, does luckperms save user uuid after this event, during or before? (So premium users won't have offline uuids in db etc.)
It's kinda hard for me to test it, but my point is to allow premium players and cracked players with password onto my server using PreLoginEvent and I wonder if luckperms will work fine or will it check/save etc. Uuids at this event (and do it potentially before I change user from Mojang authentication with premium UUID into cracked account with offline uuid). I'm talking about velocity
Modifying UUIDs is not supported, doing so is almost always a 1-way trip to data loading errors.
? Im not doing it directly but using velocity API, but is it not good? Assuming I have good system where players either are online or offline and can't change between these
I'm really not modifying it at all. Rather I'm changing between authenticating them (premium) and not authenticating them (cracked), which to my understanding changes their uuids
Okay, maybe different question: is luckperms doing something during preloginevent or before it? And if it is, then what?
I'd suggest taking a look through the code yourself, it sounds like you have at least a rough idea what it is you're looking for. All the platform modules are relatively small and simple, so it shouldn't be too hard to find the relevant stuff in the velocity module
!github
Sorry! I do not understand the command github
Type !help for a list of commands
...do we seriously not have a command for that
Aight, thanks for response though
I have good enough knowledge to know it could be a problem and to know how to ask a question and to know that i don't know what the f I'm doing with velocity
But from what I see luckperms does it's stuff after preloginevent
So it should be working alright
Hi, i'm making a rankup plugin using Luckperms api, I create a track named "ranks" and put all groups of ranks there, and in my plugin i just make the api promote player in ranks track, and this works, but only if I "refresh" with /lp user <nick> parent info, when I don't do that, luckperms accumulates 2 ranks, and for the following ranks, an error occurs (only if I "refresh", if i don't refresh it works normaly). I can't explain it very well because it's a strange bug, but I made this video that shows what's happening.
Explain video: https://youtu.be/Xfbw_TM-S1A
val result = user.data().add(builder.build())
luckPermsApi.userManager.saveUser(user)
luckPermsApi.messagingService.ifPresent {
it.pushUserUpdate(user)
}
player need to relog in server to update the group, why?
the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?
I am trying to listen for events when a user gets a permission added or removed.
Setup:
- Minecraft server with the LuckPerms plugin installed (this is where I’m editing the user’s permissions)
- Redis is set up
- PostgreSQL database where the LuckPerms data is stored
- LuckPerms REST API connected to the database
- LuckPerms REST API Java client connected to the REST API
I have verified that the Java client is working (LuckPermsRestClient.groups().list().execute() returns all my groups).
I thought I needed to subscribe to the LogBroadcastEvent to detect when permissions are changed on the Minecraft server. Is this assumption correct, or are the events only triggered when changes are made via the REST API, and not on the server, because there is no Redis connection between the REST API and the Minecraft plugin?
import net.luckperms.rest.LuckPermsRestClient;
import net.luckperms.rest.event.EventProducer;
import net.luckperms.rest.model.LogBroadcastEvent;
public class LogBroadcast {
public static void main(String[] args) throws Exception {
try (var client = LuckPermsRestClient.builder()
.baseUrl("http://127.0.0.1:6457/")
.apiKey("LH5dRq2koqE792RSWGAb4MKmPGe5d99X")
.build()) {
EventProducer<LogBroadcastEvent> sub = client.events().logBroadcast().subscribe();
sub.subscribe(e -> System.out.println("[LogBroadcast] " + e.origin() + " " + e.entry()));
System.out.println("Listening for LogBroadcast events...");
Thread.sleep(300_000); // keep alive 5 min
}
}
}
Or is what I’m trying to do not even possible? Do I need to listen to Redis Pub/Sub with my Java application to detect changes made on the Minecraft server?
val result = user.data().add(builder.build())
luckPermsApi.userManager.saveUser(user)
luckPermsApi.messagingService.ifPresent {
it.pushUserUpdate(user)
}
player need to relog in server to update the group, why?
the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?
Display multiple prefixes/suffixes alongside a player's name.
If i delete a group with getGroupManager().deleteGroup(group); it deletes the group but the mebers will still have the InheritanceNode. Is there a way to auto delete it from every group member or do i need to loop through every player of this group to delete the InheritanceNode?
What is the latest luckperms api version
I use LuckPerms v5.5.17 on the server and as API Version 5.4 but i get this error:
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
Latest API version is 5.5. If you're getting a NoClassDef, that's unrelated to a version mismatch though; make sure you've declared a dependency on LP in your plugin/mod manifest (i.e. on Paper that'd be your plugin.yml or paper-plugin.yml) & that LP is actually starting up before your plugin/mod
does LuckPerms API have any way to retrieve a group's prefix as an Adventure Component? or am I stuck guessing whether the user used legacy or MiniMessage in the field?
you can get it as a string, which will be whatever format they used. LuckPerms doesn't convert it to anything, just provide raw data for other plugins to parse.
would there be any interest in introducing a configuration option to limit it to one format or the other?
highly unlikely.
what's the use case of this, just so i understand better what you're attempting to do?
it is for a placeholders thing, I was aiming to not have to parse legacy format if I could help it but I guess there's no escaping it if there are plugins which will inevitably support it still
this also isn't really a "one or the other" situation.
plugins can support literally any format they choose, even if they use ! in place of the & or section symbol.
it's easier to allow them the option, than to try and limit what they can do.
the issue with that is that it ends up being really ugly codewise but it is whatever
val result = user.data().add(builder.build())
luckPermsApi.userManager.saveUser(user)
luckPermsApi.messagingService.ifPresent {
it.pushUserUpdate(user)
}
player need to relog in server to update the group, why?
the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?
up...
I feel like I've overengineered but this is my way of getting the highest weight-node a user has:
try{
return Integer.parseInt(x.split("\\.")[1]);
}catch(Exception ex){
return 0;}
}).max(Integer::compareTo).orElse(0);```
...is there any shorter/cleaner way?
*or precisely getting the actual weight of the highest weight node
and as an explanation:
first I take a collection of every node and map it to the key
then I filter for the weight nodes
then I map them to the actual weight while all weight nodes that doesnt look like this weight.xyz (where xyz is an int) are castet to 0 through the exception parseInt throws when encountering unvalid ints in the string
I now take the Collection of Ints (the weights) and put them (as a list) in the Collections.max function to get the highest weight of the user
...nvm
for anyone wandering the same (especially for future reference cause I don't know if this is wide knowledge)
Although there isn't a method for getting a users weight, there is one for getting a groups (since weights are nodes specifically for groups)
That means it suffices to get a players primary group and get its weight like this for example:
Main.lp.getGroupManager().getGroup(Main.lp.getUserManager().getUser(p.getUniqueId()).getPrimaryGroup()).getWeight().orElse(0);
*and if someone has an even cleaner solution please let me know👍
what is the proper way of using the LP dev api on Velocity? I cant get it working, no matter what I do it errors with "The LuckPerms API isn't loaded yet"
make sure you're not shading LP into your velocity plugin.
otherwise, make sure LuckPerms is loading before your plugin
im not shading it, and i declared LP as a depedency so it should be enabled before my plugin @Dependency(id = "luckperms"),
Isn't it case-sensitive? Try LuckPerms instead
Fixed it
anyone can help me?
user.save()
or wtv
there's a save method
user.data().add(PermissionNode.builder(luckpermsId).build());
LuckPermsProvider.get().getUserManager().saveUser(user);```
val result = user.data().add(builder.build())
luckPermsApi.userManager.saveUser(user)
Sure
Doubt its userManager thi
player need to relog in 1.21.8
Tho
yeah its kotlin
getUserManager
getUserManager = java
userManager = kotlin
Oh thats crazy idk then I dont use kotlin, it works for me on 1.21.10
u use mongodb?
Sure
I think its mongodb
MySQL
in mysql works fine
idk why doesnt working 🙁
can someone help:
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms
i allreay have depend: [LuckyPerms] in paper-plugin (with LuckPerms also not work)
2 problems. 1, it's LuckPerms, no y. 2, paper-plugin.yml uses a different syntax than normal plugin.yml, consult paper's documentation. That being said, if you don't know the difference between the 2, you should stick with a normal plugin.yml
how to check player permission in forge 1.20.1?
there is no method hasPermission in Player
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Forge, Nukkit and Velocity.
I updated from PaperMC 1.21.8 to PaperMC 1.21.10 and got this at first login:
[20:41:59 INFO]: [HorriblePlayerLoginEventHack] You have plugins listening to the PlayerLoginEvent, this will cause re-configuration APIs to be unavailable: [LuckPerms]
do I need to do anything?
No, you can just ignore it till PaperMC has created a better event for LuckPerms to listen to.
will loadLuckPermsUser(UUID) get from session if in session?
So
how would I get a player's permission during the configuration phase? i'm making a neoforge mod and get the permission using PermissionAPI, but the player isnt loaded by luckperms yet so lp falls back to the default handler.
i'd prefer not to add luckperms as a dependency but will if needed.
not sure if this is the right channel for this
I think val mutableContext = MutableContextSet.create() be the first line, outside of both for loops, and then it.context(mutableContext) be the last line after the loops
bump
I have a question. Im coding a plugin for colored prefixes. my standard prefix for owner is "&4&lOwner", and if i make the meta thing a gradient with mini message, is it possible to do it like this: "&4&l%placeholder%Owner" and the placeholder gets replaced with the gradient and then i have a gradient prefix?
!chat
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!
No need for placeholders. Just use a chat/tab plugin which supports the format
No i mean i am coding a plugin in which you can change your prefix for example from &6Player -> &4Player
Oh yea, but it basically results in the same. You technically dont have to use placeholders. You just need to support and parse the format
bump
val result = user.data().add(builder.build())
luckPermsApi.userManager.saveUser(user)
luckPermsApi.messagingService.ifPresent {
it.pushUserUpdate(user)
}
player need to relog in server to update the group, why?
the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?
java.lang.NoClassDefFoundError: net/luckperms/api/node/Node I have the latest release and maven dependency version 5.4
help?
This is not latest
Latest is 5.5
[21:32:53 INFO]: [LP] Running LuckPerms v5.5.20 by Luck.
and the dependency version is 5.5
Send full logs
Because the class clearly exists:
https://github.com/LuckPerms/LuckPerms/blob/master/api%2Fsrc%2Fmain%2Fjava%2Fnet%2Fluckperms%2Fapi%2Fnode%2FNode.java
I'm making a plugin with a GUI and some of the items need to be permission locked (as in, the player requires the certain permission to get/click that item) is it just as simple as checking if they have the permission?
Yeah, just fire a permission check with the normal permission check API for your platform for that (i.e. Player#hasPermission on Spigot / Paper), just like if it were a command or whatnot
yea, I realised that and ended up doing that and just forgot to delete my msg
👍
Hey guys, is this safe?
public static void init(){
for(Rank rank : Rank.cachedValues){
rank.setCachedGroup(LuckPermsUtils.getGroupFromName(rank.name()));
if(rank.getCachedGroup()==null){
Log.warn("Rank "+rank+" doesn't have a group! Creating one now...");
LuckPermsUtils.API.getGroupManager().createAndLoadGroup(rank.name()).thenAccept(rank::setCachedGroup);
}
}
}
public static void clearPermissions(Rank rank) {
Group group = rank.getCachedGroup();
if (group == null) return;
group.data().clear();
Track track = Track.ofRank(rank);
if(track!=null) {
track.getRanksLowerOrEqualThan(rank).forEach(x -> {
Node node = PermissionNode.builder(x.getPrefixPermissionRequired()).value(true).build();
group.data().add(node);
});
Node node = WeightNode.builder().weight((int) track.getTotalWeight(rank)).build();
group.data().add(node);
}
LuckPermsUtils.API.getGroupManager().saveGroup(group);
}
public static void addPermission(Rank rank, String perm) {
Group group = rank.getCachedGroup();
if (group == null) return;
Node node = PermissionNode.builder(perm).value(true).build();
group.data().add(node);
LuckPermsUtils.API.getGroupManager().saveGroup(group);
}```
and this will be configured in skript, first it clears perms, then adds a list perms.
Just making sure im not doing anything wrong here.
.
Because I'm having a SUPER WEIRD issue where permissions are shuffling and buggy randomly, so maybe a few hours after startup it will happen, or not at all, it's all random. for example staff perms may hop onto default group for no reason. I'm not so sure what's going on
If anyone can help me that would be great
Im probably the first person to ever have this issue
Can your probably show us your util class?
Wouldn't it be much simpler if you were using API#getGroupManager#modifyGroup(name, consumer)?`
https://luckperms.net/wiki/Developer-API-Usage (here are quite a few examples you can find)
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java#L56 (yet another example of how to modify the users group)
I feel like you're holding and modifying the cached group which is shared across the whole server, or not really waiting for a user to be loaded
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/group/GroupManager.html#modifyGroup(java.lang.String,java.util.function.Consumer)
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html#modifyUser(java.util.UUID,java.util.function.Consumer)
yea but like is my code the reason it's shuffling permissions
anyone able to figure it out?
Damn, my problem must be the hardest one on this discord server
Oh yea sorry forgot to answer - it indeed is.
You are holding onto the user/group even if stuff has changed. Try replacing it with #modifyGroup and #modifyUser - as already said above.
And don't cache/load the user/group - just use the functions below
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/group/GroupManager.html#modifyGroup(java.lang.String,java.util.function.Consumer)
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html#modifyUser(java.util.UUID,java.util.function.Consumer)
And you might as well want to drop the Rank caching, LuckPerms already has a cache built-in. Double-caching is kind of too much imo and will most likely lead to new/other issues
Hey, i was wondering if there was a way to set a transient permission for a user?
Didnt look into the unloading, but i basically want the permission to be transient on the users session (connected to proxy).
Do you mean something like /lp user <who> permission settemp <permission> true/false <duration>?
https://luckperms.net/wiki/Permission-Commands#lp-usergroup-usergroup-permission-settemp-node-truefalse-duration-temporary-modifier-context
This would be temporary based on a timeframe. I was more thinking about a permission that invalidates when the player disconnects from the server.
I would just listen for the disconnect events, but this poses the risk of fragmented permissions in case of an unplanned shutdown or crash.
Yeah, transient permissions are definitely something we natively support, pretty sure it's exposed to the API too, let me check
Ok, yup it indeed is. Normally when you want to modify a PermissionHolder's nodes, you'd get the NodeMap from PermissionHolder#data and then modify that. For transient data, you simply use the NodeMap returned by PermissionHolder#transientData instead. You can also use PermissionHolder#getData(DataType) to dynamically grab either their normal or transient data if you want
Worth noting though, you said this was a network environment - as far as I know, transient data will only apply to the current LP instance (i.e. if you set a transient node for a player on the proxy, the backend server won't see it)
Ah i see. Important to know that its not synced, but i can handle that. Thank you 😄
Hello, I have a question: shouldn't UserManager#modifyUser also push update if messaging service is present?
it's kind of confusing
you have to do it manually
yes i know but i think it should be included in the API
what should be included where?
you can queue an update yourself via the API already
there's a pinned message here as example
it doesnt because you may want to update many users
it would be inefficient to ping for each user
well there is no option for a batch database save in luckperms either
batch loading and saving of users/groups would definitely be nice to have
but i do not think the api should be doing things without you telling it to when it is not specified
we could add modifyUser(UUID, Consumer, boolean)
and what is the advantage of that over.. just.. pushing an update through the messaging service?
like you would be adding api to that adds nothing of value and you need to call explicitly, might as well just do the thing explicitly already
which is already the case
it would be much more clear that modifyUser default behavior does not include pushing the update
then maybe it's the api contract that needs clarifying in the javadoc to mention that it does not do that, as it isn't part of the contract that it does
for me it doesn't make sense why this wouldn't push a update, like in what case you don't want your data to stay in sync other than batch updates, which are not the issue here because any implementation of messenger will handle 50k< publishes or subscribes (other than sql messenger), the issue here would be the database because even if you send one push update the database still has to do X amount of inserts on the sender server and X amount of selects on receiver server due to luckperms not having any batch handling (that I know about)
also, it wouldn't be much more clear, the behaviour of the existing method would still need to be clarified, as the boolean overload could go either way
let's just agree to disagree
you need to do this manually already, adding more api that you need to call manually does not add value
further clarification on the existing methods' contracts, however, would
yes that's correct
however, as I mentioned I don't see any user case where this would be non-beneficial
For what it's worth, I'd agree that an overload or some other thing to handle flushing would be some nice sugar syntax. It's like loadUser -> modify -> saveUser vs modifyUser; we don't need modifyUser since it's essentially just sugar syntax for the first option, but it's a great safety net for API consumers to ensure they don't forget to save things.
If an API break was an option, I'd go so far as to argue the default behavior should be to push an update alongside any save operations, and make it opt-out instead for those rarer cases where such behavior isn't desired
why is it needed and how does it add value?
It reduces the probability that API user will forget to push update. From my point of view at first look modifyUser method seems like it's doing all the work needed to save the user but it doesn't. It would also reduce lines of code that needs to be done on user end, however if you don't want this behavior you can use standard future chain. Or at least it should be mentioned in javadocs
I suppose so
feel free to open an issue or a pr, though I will say a modifyAndPush is more.. mm, appetising than a boolean parameter overload
i can't use and review lp right now; i need to ask you first
does lp register players directly in the database upon their first login to the server? or does it register them at all?
@fast delta OOHOHOHOHOHO OEMİLLYYYY XD
Hey dragonblade07! Please don't tag helpful/staff members directly.
i smile for some reason every time i see you nvm
can i prevent this with api?
or change?
ey ey ey thxxx
Does the Luckperms API have a way for you to detect when a context has changed? I can't find anything for it.
To be clear, I don't mean when the contexts assigned to a permission have changed, but when the output of a context has changed, IE a player has changed world if the context is = that world.
My use case is for Grim where we allow users to specify permissions to exempt from cancelling packets, setting back, or just fully exempting them from specific checks
https://github.com/GrimAnticheat/Grim/issues/2417
For performance reasons we obviously can't poll the permissions every time a packet comes in for every check we have
Can I get baned?
Hello, I want to register a context calculator for whether a player is muted with the LiteBans plugin. Here is my code:
public class LiteBansMutedContextCalculator implements ContextCalculator<Player>
{
@Override
public void calculate(@NonNull Player target, @NonNull ContextConsumer consumer)
{
consumer.accept("litebans-muted", Boolean.toString(Database.get().isPlayerMuted(target.getUniqueId(), null)));
}
@Override
public @NonNull ContextSet estimatePotentialContexts()
{
ImmutableContextSet.Builder builder = ImmutableContextSet.builder();
builder.add("litebans-muted", "true");
builder.add("litebans-muted", "false");
return builder.build();
}
}
Unfortunately this does not work, because the LiteBans does not allow the check to be run on the main server thread. Can it be done async instead? And if so, how?
Have a cached layer for wtv liteban data you need is probably the better option, bcu context calculation should be quick and not do db queries
alrighty ty
Hey, im implementing a hook for votifier, and i dont feel like requesting and caching Name:UUID mapping.
There is probably an easy way to access and use the cache that Luckperms maintains, right? 😄
Wait is it literally just this?
private UUID getUUID(String name) {
return LuckPermsProvider.get()
.getUserManager()
.lookupUniqueId(name)
.join();
}
Wait the UUID could be null? 🙁
In what case? On a cache miss or when the username doesnt exist on mojangs end?
You can try loading the user if he's not in the cache
https://www.javadocs.dev/net.luckperms/api/5.5/net/luckperms/api/model/user/UserManager.html#loadUser(java.util.UUID)
And if the user doesn't even exist while loading, he basically never joined the server
Loads a user from the plugin's storage provider into memory.
this is just a request to luckperms' own cache, it doesn't query mojang or anything
I know it's not java, but i guess i use the same methods
import:
net.luckperms.api.LuckPermsProvider
net.luckperms.api.context.ImmutableContextSet
on load:
set {api::lp} to LuckPermsProvider.get()
set {api::trackManager} to {api::lp}.getTrackManager()
set {api::ContextSetFactory} to {api::lp}.getContextManager()
set {api::UserManager} to {api::lp}.getUserManager()
function getTrackPosition(p: player, curr:string, track: object) :: integer:
if {_track} is null:
return -1
set {_groups} to {_track}.getGroups()
return {_groups}.indexOf({_curr})
command /rankup:
trigger:
if player's groups contains "Dommer":
send "%nl%<#ff9100>&lREBIRTH <#ffb047>Du er i maks rank, du skal /Rebirth!%nl%" to player
else if player's balance >= {price::rankup::%player's uuid%}:
#Remove Money
remove {price::rankup::%player's uuid%} from player's balance
#Get track and user
set {_track} to {api::trackManager}.getTrack("rankup")
set {_user} to {api::UserManager}.getUser(player's uuid)
set {_group} to the value of the placeholder "luckperms_current_group_on_track_rankup" for player
set {_pos} to getTrackPosition(player, {_group}.toLowerCase(), {_track})
#Promote player
{_track}.promote({_user}, ImmutableContextSet.empty())
{api::UserManager}.saveUser({_user})
#Calculate new price
set {_rank} to {_pos} + 1
set {_factor} to 1.97
set {price::rankup::%player's uuid%} to 100 * ({_rank}^2) * exp(ln({_factor}) * ({_rank}-1))
send "%nl%<#00ff11>&lSUCCES &aDu er nu ranket op til!%nl%" to player
else:
send "%nl%<#ff1100>&lFEJL &cDu har ikke råd til at ranke op!%nl%" to player```
When I promote it sometimes does remove the previous group, so i get all of them.
I might have fixed it, I parented the previous groups on each other ....
didnt fix it 🙁, it nearly happens every second time
did you fix this?
I tried this too
function promote(p:player, g:string) :: boolean:
set {_track} to {api::trackManager}.getTrack({_g})
set {_user} to {api::UserManager}.getUser(uuid of {_p})
if all:
{_track} is set
{_user} is set
then:
set {_result} to {_track}.promote({_user}, ImmutableContextSet.empty())
if {_result}.wasSuccessful():
{api::UserManager}.saveUser({_user})
return true
return false```
I can promote untill i check my info /lp user Nydt info, then i cant promote anymore because i have all the roles.
i get an error when i want to use the luckperms api. I get an NoClassDefError
I'm quite sure that you won't receive a good support here, because the Skript implementation is nothing official from LuckPerms.
You might be better off contacting the developer of the LuckPerms implementation.
!api Did you already read this wiki page?
Learn how to use the LuckPerms API in your project.
This is not an luckperms implementation, i use all of luckperms api directly as you would in a plugin
If you have a fix for Java I would appreciate that too
I'm not understanding your description of the actual problem (what do you mean by "can't promote anymore"?), however it's important to note that you're not directly using the LP, you're using it through some sort of Skript adapter.
Example of how i can force the error:
promote twice or the amount of groups i want to "bug?"
then lp user me info (now i have all the groups i promoted through from the track)
Example of when it works
promote untill i finish then track
then lp user me info (now i only have the last group of the track)
Example of how it works too
promote once
lp user me info after every promote
hope you understand
is it possible to add a prefix to a user or a group via the API?
How would I convert an adventure text component into a PrefixNode?
What sort of formatting is used by PrefixNode?
You just need to convert it into a String
For like coloring and styling.. does it use the legacy format, mini message or ..?
This should work if I'm not wrong:
String prefix = MiniMessage.miniMessage().serialize(component);
luckPerms.getUserManager().modifyUser(uuid, user -> {
user.data().add(node); // the PrefixNode you created
});
I ended up just removing the group and adding the next one
Could anyone please provide a rough estimate of the time it takes for LuckPerms to retrieve player data from the database and return it to the API's CompleteatableFuture? I know the answer isn't fixed depending on the context, but I'd like to hear the experiences of people who have used the API because I am just very new
Like under what circumstances can it be completed very quickly, in just tens of milliseconds or even instantaneously, and under what circumstances might it take several seconds?
It really depends on caching and storage backend.
If the user is already cached, the CompletableFuture will usually complete instantly (0–1 ms). If LuckPerms needs to load from local storage, it’s typically just a few milliseconds.
With a remote database (MySQL/Postgres), uncached loads are usually in the 10–50 ms range on a healthy setup, but can be slower if the DB is under load or there’s high network latency.
Multi-second loads generally only happen in pathological cases (DB issues, cold connections, extreme latency, or very large/complex permission data).
The async API just ensures this work doesn’t block the main thread - it doesn’t guarantee a specific completion time.
Okay I see that, thank u so much
Ok how is searchAll method implemented internally 
Source is on GH for perusing, implementations for anything not concretely implemented in the API module is usually implemented in the common module under net.luckperms.common.api or such iirc
I am not familiar with database or storage stuff uhmm
Just curious if calling that is expensive
Oh, it'll vary by storage method but shouldn't be too bad. Definitely don't run it on the main server thread, but the database-based storage methods should all be able to do that lookup pretty quickly barring any network latency. Plaintext methods are inherintly a little slower, but still shouldn't be horrible
hello, i'm looking to add LuckPerms support to my hytale plugin. the API documentation is very helpful, but i'm unclear about something. API documentation shows interaction with a Player class. but the API documentation is general, not specific to hytale. the hytale API also exposes a Player class. is the Player class mentioned in the LuckPerms API docs a game Player class or a LuckPerm class?
this is my first time using the LuckPerms API so this might be a stupid question. 🙂
In Hytale it’s a PlayerRef :)
We will update the docs to reflect that after it’s out of beta and all merged in
the Player class has virutally all the same methods implemented on it as PlayerRef, and by my understanding, PlayerRef isn't even an entity class. the hytale api really confuses me sometimes lol, especially since PlayerReference ISN'T a ref. /sigh
but ty, you mean to say i should be calling hasPermission on the game class?
also just to be clear, is LuckPerms implemented on Player or ONLY on PlayerRef?
You can call the hasPermission methods yes and LP will handle them
Sorry for the confusion, your original question was about the LuckPerms API which is different
The methods there that expect a platform “player” object are expecting PlayerRef
ok thank you!
they have the same default rank, within4glade got it back after leaving and rejoining
he was afk for like an hour not sure if thats the reason why
hello, i'm having a hard time figuring out how to list LuckPerms for hytale as a dependency for my plugin in manifest.json. what value should if use for the key in OptionalDependencies?
from server loading logs with LuckPerms installed, i thought it would be LuckPerms:LuckPerms, but that doesn't work and causes a server error on startup...