Any idea why my LP database file cant be opened on https://inloop.github.io/sqlite-viewer/ ?
Im trying to run queries on my database, how can I do that?
sqlite file viewer
1 messages · Page 6 of 1
Any idea why my LP database file cant be opened on https://inloop.github.io/sqlite-viewer/ ?
Im trying to run queries on my database, how can I do that?
sqlite file viewer
you shouldnt interact with the database directly. if you need to interact with luckperms data from something not running directly on a minecraft server, you should use the rest api
Not to mention, it’s h2, not SQLite.
Hi there
Very quick question
To add a group to a user we use this right?
api.getUserManager().modifyUser(p.getUniqueId(), u -> {
InheritanceNode node = InheritanceNode.builder(group).value(true).build();
u.data().add(node);
});```
But how about removal?
api.getUserManager().modifyUser(p.getUniqueId(), u -> {
InheritanceNode node = InheritanceNode.builder(group).value(true).build();
u.data().remove(node);
});```
Tried this but apparently it completely removes the user
if that node is the only node the user has, then it would be a "default user", default users are removed from storage (as there is nothing special to save)
I understand, so code-wise it's correct?
Save the user
I recently learned that I can't use the character . in meta keys if I want to find them like GroupManager.searchAll(NodeMatcher.metaKey("foo.bar")). Are there any other characters I need to avoid using, or maybe the other way around where only certain characters work everywhere? Same question for group IDs, permissions, etc. I can't find anything about what characters are or aren't allowed on the API documentation, and I didn't get any errors trying to set this sort of thing.
uh you can use them, the plugin will just escape them for storage
maybe NodeMatcher doesn't account for that? if so then that's a bug
Judging by the latest documentation not matching the APIs I have access to, I suspect I'm on an older version - so with luck it's a bug that has since been fixed.
I updated to the latest version (and updated the plugin to use the 5.4 instead of 5.3, but hooray for backwards compatibility); I'm still not able to use the node matcher to find meta keys with a . in them. So it does indeed sound like a bug. Given how this part of the plugin is still in development rather than in use, I can safely choose a different character like :, though.
NodeAddEvent what happens if multiples are added at once such as from editor?
does it just fire the event multiple times or not at all?
hiya, im in Fabric and I dont have the usual player.hasPermission from bukkit. How may I do that with Luckperms? I want to detect certain permissions like example.foo permission node
hey, im trying to promote a User within a Track. I get my track object using lp.getTrackManager().getTrack("division");, where division is the name of my track. How can i promote or demote a user within this group? I see that there is Track#promote(User user, ContextSet context) but i dont really understand where i could get a corresponding ContextSet object. What do i do here?
it will call the NodeAdd/RemoveEvent for each node that was added/removed
Contexts tell the plugin when and where a stored node should be applied to the user/group, contexts are things like current world/server/game mode/etc that a user/group "is in" , and they can change over time
https://luckperms.net/wiki/Context
When promoting a user on a track, the context you provide is the context the new inheritancenode will have (and the plugin will apply it when it is satisfied), if you just want it to be applied (potentially) anytime just pass an empty context https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/context/ImmutableContextSet.html#empty()
thanks very much!
Hello, I'm trying to remove /server command for default user joining my server.
I'm using Velocity as Proxy and Spigot 1.8.8.
Velocity documentation: If the user has the velocity.command.server permission (by default, this is granted to all users), players can use this command to view and switch to another server.
So, when the player joins I try to remove the permission.
Here's my code:
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
event.setJoinMessage(null);
Player player = event.getPlayer();
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(player.getUniqueId());
user.data().remove(Node.builder("velocity.command.server").build());
api.getUserManager().saveUser(user);
But I can still run the command, while having absolutely no permission. (attached screenshot, prints all permission attached to a user when he logs on)
also, if i want to save those changes, do i save the Track im working on or the user that i am working on?
the user
omg thats so useful, i only saw the website wiki
you need luckperms on the proxy too, and you can just deny the permission on the default group without any external plugin listeners and stuff
Found out by searching in old messages. Just installed the plugin version for Velocity. Should I make a make a quick jar for removing the permission via the API or just disabling it on LuckPerms velocity side is 100% safe?
Thank you tho
What if I'm using MySQL as remote storage?
you can just have the permission set to false on the default group, keep in mind that having LP on the proxy is not a replacement for LP on the servers, LP on the proxy takes care of proxy permissions, LP on the server takes care of the server's permissions
you can have multiple LPs connected to the same database with no problems, obviously they will share the permissions, but you can filter that with the "server" context https://luckperms.net/wiki/Context
I turned on MySQL for remote storage on proxy side, should I disable it and just use file configuration?
I just want to disable /server everywhere tbh
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(player.getUniqueId());
user.data().add(Node.builder("velocity.command.server").value(false).build());
api.getUserManager().saveUser(user);
you don't need that code
Both server and proxy use MySQL for storage
...why not just add that node to a group all users inherit i.e. default?
Sorry if what I'm asking is dumb
I'm really new to Java etc
No, this isn't something java needs, this is just simple LP configuration
yea I know
Add that node to default with a value of false
I'm new to permissions
Everything
It's the first time I'm making a minecraft server
i "accidentally" promoted myself within a track using the promote command whilst my plugin does other stuff with promoting and demoting me, and now i am part of multiple types of the same tracks it appears. how can i fix this? (both global context i believe)
this is what i now get when trying to promte / demote myself
(clearning track using /lp user USERNAME parent settrack TRACK GROUP global worked
How to do that using MySQL for saving permissions..?
/lp group default permission set <permission> false
This is an admin problem, not a programming problem
Thank you!
thanks, what about NodeMutateEvent, will it be fired if just 1 permission node was changed?
and do these events fire if a temporary permission expires?
I have depend: [ LuckPerms ] but LP looks like load after plugin where depend is
Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
It works like 4 hours back... 😄 but last 4 hours I cannot find where is problem
....yeah no it's not your code, I'd forgotten about this problem. Basically it seems you've created a race condition. LP initializes async, if it connects to a DB quickly then by the time your plugin is initialized, the API is initialized. If the DB connection is a bit slower, then the API might not yet be initialized and your plugin cannot access the API if it's the first thing it does
LP's database connection, not yours
Uh in your code, the easiest way would be to delay the accessing of the LP api instance.
I'm going to verify this is indeed the problem, and open an issue for LP, so that we can fix this in some way on our end
so put get to later task right?
Looks like it didnt work with some schedule delay.. idk
Woo
Its really weird.. When I have init plugin like static in different class from Main it throw error about net/luckperms/api/node/Node but when I move public static Plugin pl to main it works but still loaded before LuckPerms
Please lemme know what you find ^^ thanks
hello guys this is my old code but i will change to luckperms but i dont understand the api i will check if player is in group
Hello @wild whale (Sorry for ping ^^)
You find something what can fix my problem?
Hey mrharebug! Please don't tag helpful/staff members directly.
I say sorry
clippy can't read
Yep :/
Node.builder(oldPermission).build() what will happen if this doesn't exists. will it make one, or what?
do I make null checks for them?
// Remove previous suffix
user.data().remove(Node.builder("suffix.0.*").build());
// Add the new badge-related permission (based on the active badge name)
user.data().add(Node.builder("suffix.0." + activeBadgeName).build());
// Set the player's display name suffix
user.data().add(Node.builder("suffix").build());
// Save changes to LuckPerms
luckPerms.getUserManager().saveUser(user);
}```
This is adding the suffix just fine, but it's not removing it.
Any idea why?
don’t think l that supports regex
So what would be the correct approach?
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
For future reference if people use search, the answer to my question was the following:
user.data().clear(NodeType.SUFFIX::matches);
how can i set someones "rank" within a track to something without using Track#promote or Track#demote
!tracks
Tracks provide a method for you to promote/demote players along a track (or ladder) of groups.
hullo - i just wanted to ask if the common module is published to a maven repo? i'm looking to make an implementation for Geyser-Standalone.
tried the following with no luck https://paste.ofcode.org/3btNQKEGgFVPzF2LqdQtYm4 (haha)
common isn't published
your best bet is probably to fork the LP repo and add a new submodule
frankly thats really unfortunate considering i would have to sync my fork to pull changes, rather than 5.4 just being updated with breakages to common but not the api
and i would just target using a timestamp and update that single version whenever necessary
ngl i might just bundle the common jar into git as unfortunate as that is
how can i get the offline representation of a luckperms User?
i just want to check if an offline player (offline user) has a permission. I know it's possible because luckperms is able to set and check permissions for players if it's directly set through lp
nevermind, got it. Incase anyone needs this in the future here it is:
val user: User = luckPerms.userManager.loadUser(offlinePlayer.uniqueId).join() // kotlin
User user = luckperms.getUserManager.loadUser(offlinePlayer.uniqueId).join() // java
Keep in mind using .join on a CompletableFuture will block the calling thread until the Future completes (the User loads), so don't do that on the main thread unless you like lag.
so should i use an asynchronous task or is there anyway to not use #join?
hello
im new in using the luckperms api
and if i try to get a prefix of an user
i get null
can you tell me why?
im in the owner group and a prefix is set
For starters, where are you getting null from? is the return value of that line null, or are you getting a NPE somewhere?
Also XY problem, why are you splitting the prefix? I'm getting the vibes you're trying to do something you probably shouldn't be
no the return of getPrefix is null
Im splitting it to get the color
the return should be „§8[§4Owner§8] §4“
thats why i split the String at the space
and get the color
Are you trying to remove the color, or use it seperately from the prefix?
to use it
like „color + player.getName()“
that the player color is from his group but without the prefix itself
This sounds like a good use for LP's meta system, a key:value store on LP PermissionHolders accessible to admins. You can set for instance meta.namecolor.&4, then get the meta value for namecolor for a user (or use our PAPI expansion, %luckperms_meta_namecolor%). That way, no parsing required, and you easily get stuff like user overrides for name colors for free
!meta
You can set prefixes, suffixes and other meta data in LuckPerms for players and groups. Note that LuckPerms does not manage chat. You need to use another plugin to show prefixes/suffixes in chat.
so generally i can not get the prefix like that
Well something to that effect should function, it's just clunky and fragile
Okay, so i need to use Vault or something
when me.lucko.luckperms.api.LuckPermsApi was changed to me.lucko.luckperms.api.LuckPerms?
i mean version
It sent from me.lucko to net.luckperms in 5, but I don’t remember it being LuckPermsAPI the entire time I’ve been here
We are currently using plugin.luckPerms.getUserManager().modifyUser(p.getUniqueId(), user -> user.data().add(Node.builder("group.temp").expiry(Duration.ofDays(months * 30L)).build())); to add X months of a group to a user. How can we use accumulate here?
look at the source code for LP addtemp command and see how it does it
It'll probably just search for an existing node and modify it's expiry if present
(The LP source won't be very helpful since it's not using the API, you'd have to figure out how to convert it to API methods and classes_
Found TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING. Trying it now with the node add
EDIT: That was it! 🙂
!javadoc
Learn how to use the LuckPerms API in your project.
:]
I'm currently creating an authentication plugin. I want to add authentication status to context. I'm a beginner when it comes to creating plugins, so I don't know. I don't really understand when I look at Developer API Usage. I can't speek english.so If you don't mind speek japanese.
What is the ID and URL of the repository of LuckPerms? I'm using maven
!api
Learn how to use the LuckPerms API in your project.
Player has text for the action bar, which stores as meta value in LuckPerms User. When this text needs to be changed, the following code is played:
userManager.modifyUser(target.uniqueId) { it ->
val node = MetaNode.builder(actionBarTextKey, str).build()
it.data().clear(NodeType.META.predicate { it.key == node.key })
val result: DataMutateResult = it.data().add(node)
}
It doesn't work. Another node with the same key appears in the meta, but the text is different.
actionbar.message.text = 'test test test test test'.
actionbar.message.text = 'Tklthmwkthlth'
actionbar.message.text = 'You are live!'
maybe Im doing something wrong
I need the value to change, not create a new meta
Is there a way to give players new context?
How should I deal with this? Cannot invoke "net.luckperms.api.LuckPerms.getContextManager()" because "this.luckPerms" is null
well you can try to see why your luckPerms is null
I dont know How to do?...
What should I put in luckperms?
show your code
luckPerms.getContextManager().registerCalculator(new CustomCalculator());
and how are you initializing luckPerms?
LuckPerms luckPerms = null;
Cannot invoke "net.luckperms.api.LuckPerms.getContextManager()" because "this.luckPerms" is null
Well that might be related
What should I do?
!api
Learn how to use the LuckPerms API in your project.
You will see something like this: NotLoadedException: The LuckPerms API isn't loaded yet!
↓I am writing code like this↓
a) why are you using 2 different methods to get an API instance at the same time? Pick one.
b) if you're getting API not loaded errors, then either LP isn't installed, or you didn't declare it as a dependency in your plugin.yml
What should I do if it becomes null?
Why is the LuckPerms dependency red?
restart your intellij
thx
is there some convenient way of modifying a suffix of a prefix of a player?
find the one you want to alter, remove it, add your new modified one. boom, done
Player has some text for action bar message, which stores as meta value in LuckPerms User. When this text needs to be changed, the following code is played:
userManager.modifyUser(target.uniqueId) { it -> /* it = user */
val node = MetaNode.builder(actionBarTextKey, str).build()
it.data().clear(NodeType.META.predicate { it.key == node.key }) /* somenode.key == node.key ig */
val result: DataMutateResult = it.data().add(node)
}
It doesn't work. Another node with the same key appears in meta, but text is different.
actionbar.message.text = 'test test test test test'.
actionbar.message.text = 'Tklthmwkthlth'
actionbar.message.text = 'You are live!'
how can i fix this?
Is there any plugin message or something I can use to check if a player has a permission on a specific server?
Each server has its own permission stuff and my goal is to check if a player has a permission on a specific server from my proxy
You need a centralized database for them all to point to
You can then issue permissions with a scope if you need to
and check scoped nodes on any server
So... no wayto use plugin messages?
how do I check if a player has a permission
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
How can I get a users nodes that start with x using User#getNodes()? Or if there is there a better way?
An example of what I am trying to do, I could have three perms x.x, x.y, x.z. How can I figure out which of the three an user has?
Sounds like LP's meta system might be what you want. It's a key:value store tied to LP PermissionHolders that admins can configure through permissions like prefixes etc using node meta.KEY.VALUE i.e. meta.x.y (or the meta set <key> <value> command etc). You can then access the current meta value for a given key for a player using PlaceholderAPI, Vault, or LP's api manually
I am currently using forge permissions API to work with permissions with my mod. This should also work with luckperms right?
yes
how can i get all groups that are on the server and add it to a List in String
LuckPerms luckPerms = Whatever.getLuckPerms();
luckPerms.getGroupManager().loadAllGroups()
luckPerms.getGroupManager().getLoadedGroups() /*<- Set<Group> */
something like this
then you can get every single group name if i understand right
(kotlin)
already got it fixed yesterday but thanks anyway
where exactly is the first screenshot from?
actually, you assign the variable as api in the second screenshot, but try accessing it as luckperms in the second
also i dont know java all that well but that looks like your assigning it to a local variable which will be lost outside the context of "the plugin is currently enabling"
you're right
Is there a way to access a players active meta data via the bukkit api, similar to sponge how you can do player.option("meta key) to get a Optional<String>?
Assuming you mean via the LP Bukkit API,
https://luckperms.net/wiki/Developer-API-Usage#store-and-query-custom-metadata
Yup. perfect. thanks!
!api
Learn how to use the LuckPerms API in your project.
I didnt expect it to be built into LP tbh with you - although i did do many searches for it. After the using sponge the past 4 years, I became accustomed to their own platform designing around LP tying into it.
Hello guys i use a app to make a discord bot BotGhost and i like to now how i contect a rank to my LP database to diacord bot
!api
Learn how to use the LuckPerms API in your project.
No idea what you mean by "connect". If you've got more specific questions, we're happy to help
I what to make it so if a player have a coal rank and in a custom ladder named discord ranks ten it will also be given to the player in discord (/link needed also)
aka syn somranks that are only in 1 track
There's off-the-shelf plugins that exist to do that fyi i.e. DiscordSRV
Ye i now but i what to make a custom pluging for it
Bot i mean
I need 2 tracks 1 for Players MC to discord
andere 1 for staff discord to mc
Why do you need tracks for this? Why don’t you just clear old groups within a list, and add the new one.
We have som rank that we dont what in discord or other way in mc
Is there a way to serialize a Node object to store in a db?
DiscordSRV already handles linking, and you can use their api to access it, then use the UUID from that to find the player in LP and apply whatever you want to them
Short question:
I saw you could import the LP API via maven.
In the docs it said that I have to obtain an Instance of the API.
Where can I get one, if not utilizing Bungee/Bukkit etc?
For context: Working on a library that will be used in various systems, including Bungee/Spigot etc., and I would like to implement Luckperms in there.
However, the library itself is not a plugin and is meant to be utilized inside of other plugins.
Can I use the LP API for "custom" purposes or do I need to obtain a Instance through Bukkit/Sponge as displayed on your website?
!api
There's also a generic way of accessing a LP instance assuming it's loaded
Learn how to use the LuckPerms API in your project.
I have seen the page, but I am unsure if the LP API will be loaded in every use-case.
As noted there, it will throw an IllegalStateException if the API is not loaded.
Can I load it myself?
Does that involve creating a own ServicesManager similar to Bungee/Sponge?
No, LP needs to be implemented for the platform, then there is the standalone version which, just like the plugin distributions, load additional extensions which you can make your own (kinda like an LP plugin)
May I ask how the LP standalone platform is implemented?
(That docker container thing?)
Where does that get its instance from?
main function?
There might be a misunderstanding...
If I need a Bungee/Sponge ServiceManager to get a LP instance, the docker container must need some kind of way of creating an instance aswell?!
So I am confused to why the container can get one (seemingly) without running bungee/spigot, but I cant
correct
you get the already created instance
in a plugin environment, your plugin is loaded alongside LP, this is not the case in a standalone program as there is a single entry point; LP lets you create extensions which are loaded by LP which are useful in situations like running something with LP in the standalone env
I think I see your point...
when used as a plugin, ofc the LP plugins has to be loaded to use the lp perms system, and the LP instance is shared between all plugins if Im not mistaken
in this case, the library is a standalone program with a single entry point, isnt it?
in my library I have my init function, and it isnt run by any plugin directly (e.g. the library is not loaded by bungee/spigot)
so doesnt make that a standalone program with single entry point?
right
ohhhhh
but it utilizes the api module right?
just looked it up, it uses common lol
it implements it
yes
because extensions need to use the api
you can make your "standalone" version of your library an extension that LP will load
ah no, that wont work.
the library is meant to be an allrounder for our network, it currently handles player uptime, stats, bans and more when utilized in plugins (e.g. spigot) and maintenances and motd through our proxies
i wanted to use luckperms since it will become standard throughout our network, and I wanted to use it in possibly even backend solutions to check permissions (via UUIDs), where no mc servers exist.
I assume i could use the REST-API by the standalone version? I am afraid that this would result in more latency than doing queries manually
eh, if it runs on the same host machine latency is likely not an issue
evne if it's within a same LAN
kk, was wondering since I already have around 50ms "login times" while using redis and sql in a bungee plugin
that's faster than a blink duration :p
sure, but bungee marks it as a slow login, while everything is on the same network :/
maybe I was just unlucky
is there some way of overwriting how names are sorted in tab? Like i want luckperms weight stuff to still group people, e.G: people with the admin role above people without it, but when multiple people have admin id like to modify in what order they appear on tab, is that possibly easily?
Doesn’t seem like this has anything to do with the API, or LuckPerms in general.
Lp doesn’t control how names are sorted in the tablist
Hey! I'm currently stuck... I wrote a method that adds a group of X days to the player. Unfortunately, this method doesn't work at all. Am I doing something wrong?
https://haste.romian-raseck.de/zedarusaje.java
The only obvious issue I'm seeing is you're using getUser only without any method that loads users, meaning your code will throw "unknown user" if a valid UUID is offline (whether this is a problem or not for your application, I don't know). Otherwise, please state what you mean by "not working"
I mean that nothing is happening when I execute this method. No rank added to the user
net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
This could be because:
a) the LuckPerms plugin is not installed or it failed to enable
b) the plugin in the stacktrace does not declare a dependency on LuckPerms
c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
(call the #get method in onEnable, not the constructor!)
at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:53) ~[?:?]
at net.lymox.coresystem.StaticCommonClass.commonLoad(StaticCommonClass.java:60) ~[?:?]
at net.lymox.coresystem.CoreSystemPlugin.onLoad(CoreSystemPlugin.java:40) ~[?:?]
at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:399) ~[server.jar:git:Waterfall-Bootstrap:1.20-R0.1-SNAPSHOT:ec41547:536]
at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:301) ~[server.jar:git:Waterfall-Bootstrap:1.20-R0.1-SNAPSHOT:ec41547:536]
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:287) ~[server.jar:git:Waterfall-Bootstrap:1.20-R0.1-SNAPSHOT:ec41547:536]
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67) ~[server.jar:git:Waterfall-Bootstrap:1.20-R0.1-SNAPSHOT:ec41547:536]
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15) ~[server.jar:git:Waterfall-Bootstrap:1.20-R0.1-SNAPSHOT:ec41547:536]
#Interface class for my Provider
package net.lymox.coresystem.permission;
import net.luckperms.api.cacheddata.CachedMetaData;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.lymox.coresystem.service.IServiceProvider;
import java.util.Map;
import java.util.UUID;
public interface ILuckPermsProvider extends IServiceProvider {
User getLuckPermsUser(UUID uniqueId);
Group getGroup(String groupName);
CachedMetaData getCachedGroupMetaData(Group group);
Group getPlayerGroup(UUID uniqueId);
Map<String, Boolean> getGroupPermissions(Group group);
Map<String, Boolean> getPlayerPermissions(UUID uniqueId);
boolean hasPermission(UUID uniqueId, String permission);
boolean hasHigherRank(UUID uniqueId, UUID targetUniqueId);
}
#Provider class for LuckPerms Inferface
package net.lymox.coresystem.permission;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.cacheddata.CachedMetaData;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.lymox.coresystem.service.ServiceCloseable;
import net.lymox.coresystem.service.enums.EnumClosePriority;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class LuckPermsProvider implements ILuckPermsProvider {
private LuckPerms luckPerms;
public LuckPermsProvider(LuckPerms luckPerms) {
this.luckPerms = luckPerms;
}
public LuckPerms getLuckPerms() {return luckPerms;}
@Override
public User getLuckPermsUser(UUID uniqueId) {
if (!this.luckPerms.getUserManager().isLoaded(uniqueId)) {
try {
return this.luckPerms.getUserManager().loadUser(uniqueId).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
return this.luckPerms.getUserManager().getUser(uniqueId);
}
@Override
public Group getGroup(String groupName) {
return this.luckPerms.getGroupManager().getGroup(groupName);
}
@Override
public CachedMetaData getCachedGroupMetaData(Group group) {
return group.getCachedData().getMetaData(this.luckPerms.getContextManager().getStaticQueryOptions());
}
@Override
public Group getPlayerGroup(UUID uniqueId) {
return this.getGroup(this.getLuckPermsUser(uniqueId).getPrimaryGroup());
}
@Override
public Map<String, Boolean> getGroupPermissions(Group group) {
return group.getCachedData().getPermissionData(this.luckPerms.getContextManager().getStaticQueryOptions()).getPermissionMap();
}
@Override
public Map<String, Boolean> getPlayerPermissions(UUID uniqueId) {
return this.getLuckPermsUser(uniqueId).getCachedData().getPermissionData(this.luckPerms.getContextManager().getStaticQueryOptions()).getPermissionMap();
}
@Override
public boolean hasPermission(UUID uniqueId, String permission) {
if (this.getGroupPermissions(this.getPlayerGroup(uniqueId)).keySet().stream().anyMatch(s -> s.equalsIgnoreCase(permission))) {
return true;
}
return this.getPlayerPermissions(uniqueId).keySet().stream().anyMatch(s -> s.equalsIgnoreCase(permission));
}
@Override
public boolean hasHigherRank(UUID uniqueId, UUID targetUniqueId) {
return this.getPlayerGroup(uniqueId).getWeight().orElse(-1) <= this.getPlayerGroup(targetUniqueId).getWeight().orElse(-1);
}
@Override
public ServiceCloseable getServiceCloseable() {
return new ServiceCloseable(EnumClosePriority.LAST);
}
}
#Register
ServiceProvider.registerProvider(ILuckPermsProvider.class, new LuckPermsProvider(net.luckperms.api.LuckPermsProvider.get()));
Sorry for lo´ng message
CoreSystemPlugin.onLoad > LuckPermsProvider.get
the API instance is prepared on enable, not load, so you need to query it in that stage
Thanks it Worms
The user is always online when this method is executed... I really can't explain how it can be that nothing appens... .-.
hello
I kept trying... When I execute this method, wasSuccessful is true... So... Probably a sync problem? We're using bungeecord. LPB on Proxy and normal LP on all game servers. All connected with the same database.
sync-minutes: -1 because auto-push-updates: true
you need to save the user via UserManager#saveUser, and also need to push update messages yourself (see the pinned message with example)
does the api have any methods to list out active permission nodes? trying to retrieve the list of nodes that are present when doing something like /lp user x permission set _ so that i can have tab completion for a permission argument in my own plugin
Yeah, there's a getKnownPermissions method somewhere
Platform#getKnownPermissions
that
Note that it's a bit hacky and will most likely not include everything. LP attempts to find permissions by scraping plugin.ymls and any defined permissions in the LP permission setup, but it's far from perfect.
A pretty common question we get in support channels is "why doesn't the editor prompt permissions for X", since it's the same data
(no it doesn't do it like that)
Well it's something along those lines. Point is if plugins don't declare the permissions, LP won't find it for suggestions
Did luck change it or something? as far as I knew it didn't cache permission checks for suggestions, and just got what it could from plugin manifests
into the code I go
idk about ≤v4 but v5 does that, it doesn't go out of its way to scrape things
Ok went down a 15 minute rabbithole, and still don't have a solid answer. LP does indeed log permission checks for the known permissions list, it also overrides Bukkit's permission map to save any permissions added there. However, after 15 minutes of file reading and ripgrepping, I cannot answer the seemingly simple quesstion of "does plugin.yml permissions get added to that list", and I don't want to wait another 15 minutes to open WSL IJ and wait for it to update paper
they do but for the wrong reasons
bukkit does some very aggressive permission checking on login for like every registered permission (plugin.yml and PluginManager.whatever) so they end up going through LP
ok so yes but no
is there a way to link 1 track for players to discord [op players do not get all rank]
please ping me
I'm not sure exactly what you're asking but there are UserPromote/DemoteEvents which give you the track they are being moved along, the group they are being removed from and the group they're being added to
this will make sure oped players also only get the rank the have?
Hey quadratickid! Please don't tag helpful/staff members directly.
Helpfuls do not any extra permissions. Await while one of the moderators handle the situation. 
Question: Can I utilize the NodeMatcher?
Is there any doc about those?
I would imagine to copy the necessary classes into my own project and use them to lookup perms.
Hi, how do I get CachedMetaData of an offline player?
for offline players you need to load the User, see
https://luckperms.net/wiki/Developer-API-Usage#distinction-between-online--offline-players
Hello, is there an efficient way to get the player's prefix with the higher weight ?
I went with that but it says that CachedMetaData#getPrefixes shouldn't really be used for querying
Can somone help me i dont know why this is not working i tried to get an instance in onEnable and in a Constructer in PlayerListener Class
are you shading LP into your plugin jar?
Maybe but I don't know why
Why are you doing LuckPermsProvider direct in event?
Call it in onEnable as it says.
And then get it from your main class instance and get the user.
Something like this (I always get all the api like this)
private LuckPerms _luckPermsApi;
public LuckPerms getLuckPerms(){
return _luckPermsApi;
}
@Override
public void onEnable() {
_luckPermsApi = LuckPermsProvider.get();
}
i tried it
ig this is the reason
i cant check it right now
works now I have accidentally built the dependency into the jar
Are u still having a problem with PlayerListener class?
It works now
Hey !
I am currently trying to remove a permission from a user in my BungeeCord plugin, but this doesnt do anything. The code i made looks like the one i use to add the permission.
My permission is "isMuted", so maybe it comes from the format ?
Here is the code i use:
public static void removeTemporaryPermission(UUID id, String permission){
LuckPerms luckPerms = LuckPermsProvider.get();
CompletableFuture<User> userFuture = luckPerms.getUserManager().loadUser(id);
userFuture.thenAcceptAsync(user -> {
NodeBuilder<?, ?> nodeBuilder = PermissionNode.builder(permission);
Node node = nodeBuilder.build();
user.data().remove(node);
luckPerms.getUserManager().saveUser(user);
}).join();
}
Whenever i call that, the permission stays in place
Its supposed to expire in some time, but i'd like to remove it manually using a command
Im doing a /lpb check on the player
Its a BungeeCord so it should be removed on the Proxy
Also, im pretty sure its a misconfiguration from my part but Spigot perms and Proxy perms arent synced
Even though all Spigot servers are synced successfully
And even without the .join() the permission stay there
what's the result of the remove call?
is this something you desire in your setup ? cuz like, that's a fine thing to do, albeit abnormal
I'd like to have the same perms between Spigot / Bungee
It doesnt send back any errors, which is weird
hm yeah, does the permission you want to remove have any context applied? server/world context etc
I dont think so
I'll check that
Well, in theory it shouldnt
Doesnt seem to have one
could it have anything to do with it not being an actual permission node? I’ve seen something act weird with permission checks when it’s not in a foo.bar format.
that shouldn't really matter
Was the solution, but in a odd way
if i try to remove isMuted, even i have isMuted and ismuted, it will FAIL_LACKS, but if i try to remove ismuted, it works

Thanks for your help !
@calm monolith No advertising
😦
How can i get a specific meta on a group?
How would I add Luckperms to Maven if it's in Maven Central? Like do I have to do something else besides add the maven dependency? 0.o
You just add the LuckPerms dependency. No repository is needed if you’re using maven
Oh so that's it, so no need to go into Project Structure and add the jar file there?
(Sorry new to plugin development)
No, god no. If you’re using a build tool, do not add a jar directly to your project with intellijs project structure.
There are ways of defining all of that in the pom.
That is awesome! I love how simple Minecraft plugin making is to all this!!
Actually amazing haha
help me please, I don’t understand how I can implement receiving a group to send a message when joining/quiting player
the server context is just based on the server configuration option in the LuckPerms config, it isn't really to do with the name in the serverinfo on bungeecord, although ideally they'd match but it isn't necessary
so if they do match you can just use the one from the ServerInfo object itself
if not you'd have to fetch that from the server somehow, either with a plugin on the server and some request/response messages or somehow else
Hello, i'm trying to remove all ranks from a player that are in a track. Is it possible ? I didn't see any example on the wiki.
Currently stuck with :
user.getNodes(NodeType.INHERITANCE).stream().filter(node -> node.???)
-> Trying to test if a node is in a track
Is there a specific way to remove a temporary permission from a user ? Because i cant seem to make it work with just building a node and user.date().remove(node)
the node you pass to remove needs to have an expiry too, it can be any, the actual expiry time is ignored, but the has-expiry 'attribute' needs to match
something like this should get the job done
user.data().clear(NodeType.INHERITANCE.predicate(node -> track.containsGroup(node.getGroupName())))
Oh, i thought it was something like that, but couldnt find a way to add the attribute only. That should work like that, thanks !
doseluckpemrs support monkodebi
what
I'd translate that to "does LuckPerms support MongoDB" in which case it does but has nothing to do with this channel.
myeskuel

eskulait
(sorry, could not resist)
Let's stay on topic folks. This channel's for LuckPerms API related questions & support only.
monkodebi, myeskuel, eskulait and that sort of stuff can go to #general.
(You can always use #support-1 / #support-2 for general LuckPerms support.)
are luckperms chat prefix and tab prefix stored seperately? I want to temporarily remove the tab prefix of a player
but keep it in chat
LP has no concept of chat vs tab, LP isn't responsible for display whatsoever. The typical setup involves just one prefix being used for both, but one could set up a second set of prefixes using meta under a tab-prefix key or something. However, not sure what this has to do with the API
LP isn't responsible for display whatsoever.
So this is something i should do with my tab / chat formatting plugin?
yes, but still has nothing to do with the api
Trying to run /lp user <UUID> parent add clog server through LP API. From my understanding, is the way to do this
user.data().add(Node.builder("parent.clog").build());?
uh no, it'd be "group.clog" but the safe way is user.data().add(InheritanceNode.builder("clog").build())
thanks
Seems like wasn't added to the group. Is this code right to do so?
LuckPerms luckPerms = LuckPermsProvider.get();
User user = luckPerms.getUserManager().getUser(target.getUuid());
assert user != null;
user.data().add(InheritanceNode.builder("clog").build());
luckPerms.getUserManager().saveUser(user);
Image is from /lp group clog listmembers
/lp user/group <user|group> parent add <group> [context...]
/lp user <UUID> parent add clog server
Being the command
fyi assert doesn't do anything without a startup flag
But that's not causing the issue right
No, that won't affect this, just a heads up so you know to change that to something i.e. if (user == null) throw new NullPointerException("Null user");
Alright. Any idea as to why my code isn't adding to the group?
I believe the issue is that the group "clog" isn't being saved even though the user is. Does this seem like the correct direction?
User user = luckPerms.getUserManager().getUser(target.getUuid());
if (user == null) throw new NullPointerException("Null user");
user.data().add(InheritanceNode.builder("clog").build());
luckPerms.getUserManager().saveUser(user);
Group group = luckPerms.getGroupManager().getGroup("clog");
if (group == null) throw new NullPointerException("Null group");
luckPerms.getGroupManager().saveGroup(group);```
Still not adding to group, unsure why. Updated code here
Inheritance is saved on the user, not on the group, so the group saving is unneccesary
How are you determining whether or not the user is being added to the group?
ingame, /lp group clog listmembers
Had an issue with my if statement 😭 thanks for the help
Is there a way to make the username different from the prefix?
Don’t cross post 
Hello, is there a way to save some Nodes to a .yml file ?
I would like to store them so that players could be able to remove them et "equip" them later
And by Node, i mean PermissionNode
there is no api for it, but you can (de)serialize to/from whatever format you want
Can I get list of permissions set on x player and remove all the player should not have any more?
Using luckperms API how can I get a group expiration date?
Currently I have:
@Override
public void create(Inventory inv, Player p, String... args) {
AtomicInteger i = new AtomicInteger();
LuckPerms api = LuckPermsProvider.get();
UserManager userManager = api.getUserManager();
CompletableFuture<User> userFuture = userManager.loadUser(p.getUniqueId());
userFuture.thenAcceptAsync(user -> {
Data.getServices("Privilegijos").forEach(service -> {
PermissionNode group = user.getNodes(NodeType.PERMISSION).stream().filter(node -> node.getKey().equalsIgnoreCase("group."+Config.getServer()+"-"+service)).findFirst().orElse(null);
if (group != null) {
Instant expiryDate = group.getExpiry();
if (expiryDate != null) {
inv.setItem(i.getAndIncrement(), CItem.b(Data.getMaterial("Privilegijos", service), 1, "&6" + service,
List.of(
expiryDate.toString()
)).create());
}
}
});
});
}```
Solved it
epic
Is there a better event to listen to than NodeMutateEvent for group updates for players?
I really don't want to do a set diff on the nodes to see what changed
could listen to NodeAddEvent / NodeRemoveEvent and use getNode() to see what's added/removed.
does that fire on promotions/demotions?
i cannot answer that honestly - i'd imagine so?
I'll try it out, thanks
What's the easiest way to check if a player has a permission in a given world?
Does this look correct? This seems... verbose
public static boolean hasPermissionInWorld(Player player, String permission, String worldName) {
PlayerAdapter<Player> playerAdapter = LuckPermsProvider.get().getPlayerAdapter(Player.class);
QueryOptions query = QueryOptions.contextual(ImmutableContextSet.of(WORLD_KEY, worldName));
User user = playerAdapter.getUser(player);
PermissionNode targetNode = PermissionNode.builder(permission).build();
return user.resolveDistinctInheritedNodes(query).stream().anyMatch(
node -> node.getType().equals(NodeType.PERMISSION)
&& ((PermissionNode) node).getPermission().equals(targetNode.getPermission()));
}
uh no, the creation of the QueryOptions looks correct tho, you'd use that something like this
Tristate result = user.getCachedData().getPermissionData(queryOptions).checkPermission(permission)
Hi
I just have a question
I noticed in the interface storage implementation that Exception thrown
Is that good or bad practice
Hello I have an issue with code I am writing:
@EventHandler
public void onPlayerWorldChange(PlayerChangedWorldEvent e) {
Player player = e.getPlayer();
if (e.getFrom().getName().startsWith("copy")) {
Bukkit.getLogger().info(player.getName() + "test");
if (player.hasPermission("zodra.war.map")) {
Bukkit.getLogger().info(player.getName() + "test2");
LuckPerms luckPerms = LuckPermsProvider.get();
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
Node permissionNode = Node.builder("zodra.war.map").build();
user.data().remove(permissionNode);
luckPerms.getUserManager().saveUser(user);
}
}
}```
The PlayerChangedWorldEvent works.
both if statements work. (I get test2 in my logs)
However removing the permission "zodra.war.map" seems to fail.
Any idea why that would be?
This is how the permission was given way before (which works):
```java
user.data().add(Node.builder("zodra.war.map")
.expiry(Duration.ofSeconds(75 * timeMultipier))
.build());```
i think you have to add an expiry to the node you are trying to remove
^
Ayayay
Good to know!
🫡
Let's try that
Lol it can not be 'any' as 0 will not work, however
Node permissionNode = Node.builder("zodra.war.map").expiry(1).build();```
Works haha
Ty you :D
i presume 0 is just no expiry
yap but it's still a number ;^)
makes sense, but I'd see people struggle over it when debugging
Ah that makes a lot more sense. Ty!
Does anyone know why the api isn't recognised?
can you show where you defined your dependency for LuckPerms in your pom please
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version> <!-- Use the version matching your server's LuckPerms version -->
<scope>provided</scope>
</dependency>
</dependencies>
been trying different versions as well and no luck
try invalidating caches and restarting
I am writing a plugin to protect a streamer from banned words, and I need to interact with user permissions. What is the best way to correctly determine which users on the entire server, as well as online, have a specific permission?
I tried the following approach, but I encountered errors. How can I fix them?
for (Player onlinePlayer : event.getRecipients()) {
if (filterEnabled && luckPerms.getUserManager().getUser(onlinePlayer.getName()) != null &&
luckPerms.getUserManager().getUser(onlinePlayer.getName())
.data()
.toBuilder()
.build()
.asSet()
.stream()
.anyMatch(node -> node.getKey().equals("nbw.filter") && node.getValue() && !node.hasExpired())) {} ...
```|
Other code:
boolean filterEnabled = event.getRecipients().stream()
.anyMatch(onlinePlayer -> luckPerms.getUserManager().getUser(onlinePlayer.getName()) != null &&
luckPerms.getUserManager().getUser(onlinePlayer.getName())
.data()
.toBuilder()
.build()
.asSet()
.stream()
.anyMatch(node -> node.getKey().equals("nbw.filter") && node.getValue() && !node.hasExpired()));
why not just do player.hasPermission("nbw.filter") instead?
As I mentioned, I need to check if anyone has a specific permission on the server and find out who exactly has it. Therefore, player.hasPermission("nbw.filter") does not suit my needs.
I mean, there is UserManager#searchAll(NodeMatcher), but maybe there is a better solution to whatever you are trying to do? Why do you exactly need that information?
When a user issues a command (in my case, /nbw or /nobanwords), they are granted the permission nbw.filter. After that, when another player writes a message in chat containing a blocked word, the plugin should find users who have enabled this mode, using the permissions for synchronization between servers.
And after that, it adds censorship to the message for those who have used the command.
If this is gonna work on some cross-server chat, I strongly recommend you keep a redis cache for users who have the permission active and query that cache instead. The searchAll method will search for the permission in the storage which already happens on another thread, and doing that in something like chat events can incur some very undesired overhead
Are you talking about conflicts with plugins like Chatty?
No, I'm talking about the time spent performing that searchAll query on every chat message
Ah, thank you for the information. Unfortunately, I'm quite new to Java; I've only managed to write a simple plugin, so I don't know much about proper plugin development. I struggled to import LuckPerms into the project due to some error.
mm yeah, the "problem" with searchAll is that it looks up in storage for all and every user that matches the matcher, so it can be somewhat slow depending on the situation, I would be worried about running that too frequently (and the nature of "someone sends a chat message" you can't exactly pinpoint how often it'll run)
redis is an in-memory cache that you can use between multiple servers, and already having the players that run the command in there can greatly reduce that overhead
i don't wanna say it's an ambitious project but it sure isn't something i would start with 😅
Thank you for the advice.
remind me i need to watch senko san lol
👍
do not spam
how do i get a player's group using api and i normal skript? not java?
like set {_group} to %luckperms_groups%
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
the skript part, wrong channel
ok
Hello, is it possible to get the weight of a prefix from a group ?
Get an instance of the group, then user .getWeight()
Hello! How can I get an offline user only with player name?
Use the players UUID, then get name from that
but I have only player name stored
All players have a UUID if you're running an online mode server. So you can still use the players UUID
LP stores player data via UUID not name
is an offline mode server
!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.
why am i getting multiple events of NodeMutateEvent when i use web editor? i am supposed to get only one..
it depends exactly on what was done
can't really say anything without seeing the changes
okay
just removed and added a bunch of permissions
well i would expect to get one event for each addition, removal, and change
no, got an event for every single permission
(this is basically event -> discord)
is that not one event for every addition, removal, or change?
That’s what it seems like to me.
no it is, it's one embed per event, that's what i expected but when i came to testing i got this sad truth
i was expecting one event, so i can send an embed listing all changes, added.. removed or modifies
but i can't do that if each addition/removal/modification fires it's own Mutate event
the docs say that the event is fired "when a node is added to/removed from a user/group"
node being singular
oh got it, i misunderstood the event, thanks for the help!
Is there a way to get the prefix of an offline player through skript-reflect?
Since using placeholders for skript, with an offline player returns null
Uh if skript can run stuff off the main thread, you can request the prefix through Vault. If not, you'd need to load the user as outlined in our API docs, and I don't know if skript is capable of handling Futures
I just want to make sure you're careful to not do anything that will result in loading user data on the main thread, since that will result in a large lag spike. LP will automatically block Vault requests that would require a data load by default, but any manual loads require you to ensure you do so safely
I tried doing this, but I have no clue if it works, idk if the return values are something skript can print
import:
net.luckperms.api.LuckPerms
command /test <offline player>:
trigger:
if arg-1 is not online:
send "Not Online"
set {_n} to name of arg-1
set {_uuid} to uuid of arg-1
set {_um} to LuckPerms.getUserManager()
set {_uf} to {_um}.loadUser({_uuid})
set {_nodes} to {_uf}.getNodes()
send {_nodes}
And here's where those futures I was mentioning come into play, loadUser returns a CompletableFuture<User>, not a User. I don't know how your skript thing handles that.
Well I could try putting it all into 1 line and not set it to anything,
Im not the most advanced when it comes to skript-reflect. As there is very low documentation on it.
But I want to say skript allows anything or type of value to be inserted into a variable, but I believe doing this should work the same
LuckPerms.getUserManager().loadUser({_uuid})
without setting it to a variable
granted if I knew the full path after loadUser to get to the part to retrieve data from an offline player, I could tell if it works or not
There's only 2 "data" I use from players, which is prefixes, and weight.
Well if you just loadUser without storing the result, then you loose easy access to the user and have no idea when the data load is complete. Data loads are async, so you can't just loadUser(uuid); <next line> getUser(uuid). I'll be honest, unless Skript has explicit support for async programming, or the reflections thing can support Futures, I suspect this method will never work.
If you only need the prefix, you can get that from Vault slightly easier, but that still requires the request be async, which again, I don't know if skript supports
Im doing some more reserach on skript-reflect right now. I had the "data" sent to console and it was saying
[Thu 19:24:07 INFO ] [Skript] No matching static method: UserManager.loadUser called without arguments
[Thu 19:24:07 INFO ] [Skript] Did you misspell the method? You may have meant to type one of the following:
[Thu 19:24:07 INFO ] [Skript] * %UserManager%.loadUser
So just teeter tottering between I can or cant use functions / methods
I have a problem, the permission of Luckperms does not work I have written a PermissionProvider allerdiongs I ask in the LoginEvent of Bungeecord if he has this permission so that he can join in maintenance but he can not because he has no rights, but I have * permission
_11, so after getting some help, I am now successfully able to get the LoadUser data, now where to go after is still a bit more to go
What would be the best course of action to get the player data, more specifically prefix and weight from the User
Nodes? Data?
@wild whale Sorry for the ping, just wanted to let you know that it is done!!!!
Finished Product:
import:
net.luckperms.api.LuckPermsProvider
command /test <offline player>:
trigger:
if arg-1 is not online:
set {_t} to arg-1
set {_luckperms} to LuckPermsProvider.get()
set {_um} to {_luckperms}.getUserManager()
set {_uuid} to {_t}.getUniqueId()
set {_load} to {_um}.loadUser({_uuid})
while {_load}.isDone() is false:
wait 1 tick
set {_now} to {_load}.get()
set {_data} to {_now}.getCachedData()
set {_md} to {_data}.getMetaData()
set {_getprefix} to {_md}.getPrefix()
set {_weight} to {_md}.getMetaValue("weight")
set {_prefix} to LPFixer({_getprefix})
send formatted {_prefix}
send {_weight}
Hey sirsmurfy2! Please don't tag helpful/staff members directly.
Yes Clippy
what in the everliving fuck
Yes?? lol
It does, its for skript so
not really the right channe@for skript though
Well I mean, Yeah I guess, but technically I was just asking for help with how to utilize the java functions and etc, because skript-reflect, allows you to use Java inside Skript.
Hello (again), I'm working with LP API, but I dont know how to get the old rank with UserDataRecalculateEvent
what are you trying to do
I want to sync discord ranks with lp ranks. But, I have to remove old rank. So I need to get the new rank and the old rank
nodemutateevent
Ok I'm going to try
probably the one you want
luckperms stores the name lowercase
So how can I get the player ?
what are you trying to do
I want to get the previous role and the next role
and why do you need the player name for that
Because with the player name I can get his Discord ID
So that's what I need
❌ Before parent
New parent
Player Name
what
Store the UUID, not the player name. Those can change.
I added if(user == null) return;
So what did I need to cast ?
Hmm. I didn't understand sorry 😅
if (!event.isUser()){ return } // not a user
User user = (User) event.getTarget()
Ok done
So now what did I need to do to get the previous rank ?
Because I am here but I don't know what I am supposed to do
I did this
how do you send a message to a specific group?
You can do Bukkit.getOnlinePlayers().foreach(player -> if(player.haspermission("group.yourgroup")) player.sendMessage("message")
How can I do it ?

I searched on google but I really don't know how to do it
pls anyone ?
Hi, is it possible to get the "possible command list" for each group via the API?
who can help me please ? #support-1 message
don’t crosspost
Yeah
not possible
permissions dont correlate to commands 1:1. some commands do not have a permission, or have many permissions, and some permissions are not for commands.
Hey how do i use the LuckPerms api to set a server specific group on a player?
Im running it on a velocity proxy
add the inheritance node with a context
Thanks
So im supposed to say something like ".getNodes()" then find the one node that is attached to my server?
Cause i dont really see the inheritance node with a server contextg
you have to add a context to the node when you add the node to the player
How get all player groups? I find only primary group
Or luck perms dont support more one group per player?
I've used this method for now, but if someone offers a better one, I'll be grateful.
return luckPerms.getGroupManager().getLoadedGroups().stream().map(Group::getName).filter(it -> hasPermission(player, "group." + it)).distinct().toArray(String[]::new);
PermissionHolder#getInheritedGroups(QueryOptions) i.e. user.getInheritedGroups(user.getQueryOptions())
Bro _11 your so smart
Hi, how I could put in my PlayerJoinEvent class to detect when a player connects what rank he has in order to perform certain actions when a player with a rank such as "VIP" connects to the server.
Anyone know can I parse a group ?
parse in what way
I had tried with this code from the documentation but it doesn't find luckperms. However, it is imported into Maven...
thats a variable name that you probably havent declared
you can use this to get what groups the player has
Whith this: #luckperms-api message
Any clue? here's my pom.xml
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>
this.luckPerms = this.instance.getServer().getServicesManager().load(LuckPerms.class);
Also tried this,
RegisteredServiceProvider<LuckPerms> provider = this.instance.getServer().getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
this.luckPerms = provider.getProvider();
}
I'm not shading it either, here's my shade plugin config,
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.3.0</version> <configuration> <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <relocations> <relocation> <pattern>dev.dejvokep.boostedyaml</pattern> <shadedPattern>in.arcadelabs.shaded.libs</shadedPattern> </relocation> <relocation> <pattern>co.aikar.commands</pattern> <shadedPattern>in.arcadelabs.shaded.libs.acf</shadedPattern> </relocation> <relocation> <pattern>co.aikar.locales</pattern> <shadedPattern>in.arcadelabs.shaded.libs.locales</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin>
!paste
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!
send the event teams class
Away from pc rn, I'll send in a few hours
EventTeams is not extending JavaPlugin btw, I'm just instantiating the LP API in its constructor and then calling that constructor in onEnable of EventTeamsPlugin class
yo wassup
im making a plugin with permissions
so in /lp editor doesnt appear
how can i add all the permissions so it appears on the editor?
permissions are known by the server when there is a permission check made for them.
I guess thats when used the Permission class, right?
You can add those to the plugin.yml or paper-plugin.yml, https://docs.papermc.io/paper/dev/plugin-yml#permissions
Also, check the tree view to see if it's showing all your plugin's permissions there
public class EventTeams {
private final EventTeamsPlugin instance;
private LuckPerms luckPerms;
public EventTeams(EventTeamsPlugin instance) {
this.instance = instance;
this.initLP();
}
private void initLP() {
// RegisteredServiceProvider<LuckPerms> provider = this.instance.getServer().getServicesManager().getRegistration(LuckPerms.class);
// if (provider != null) {
// this.luckPerms = provider.getProvider();
this.luckPerms = this.instance.getServer().getServicesManager().load(LuckPerms.class);
// }
}
public LuckPerms getLuckPerms() {
return this.luckPerms;
}
}
public final class EventTeamsPlugin extends JavaPlugin {
@Override
public void onEnable() {
new EventTeams(this);
}
}
commands are not defined in paper-plugin.yml (https://docs.papermc.io/paper/dev/getting-started/paper-plugins#commands), and defining them in plugin.yml doesnt change anything in luckperms
I tried both methods, haven't tried the singelton method yet but I guess that's irrelevant as it can't find the class
I wasn't talking about commands, permissions can be defined explicitly in plugin.yml, didn't know it doesn't affect luckperms, how does lp load perms from a plugin tho? genuinely curious
it doesnt
luckperms tells the server that it will handle permission checks, so any time a plugin does CommandSender#hasPermission(), the server asks luckperms if that sender has permission. luckperms adds the checked permission to a list of known permissions, and that list is what is used for suggestions
it never loads any permission data from plugins
Oh, but how does it suggest permissions from plugins like worldguard, essentials etc even when that command has not been ran even once
it wont
This is on a fresh installation, I've not opened a portal or even made any sign or placed em
it might suggest the base command permissions since those are checked for in-game command completion
Anyways, could you help me with this please? #luckperms-api message
Server and LP version:
ver
[05:47:11 INFO]: Checking version, please wait...
[05:47:11 INFO]: Current: git-Purpur-1985 (MC: 1.19.4)*
- You are running the latest version
lp version
[05:47:13 INFO]: [LP] Running LuckPerms v5.4.111.
You guys can probably take over the world with this knowledge, very smart people
?? if you click the message link, you'll see I've provided everything related to help them identify the issue
They asked for whole class, I provided that here aswelll, #luckperms-api message
Your issue is a NoClassDef for the main LP api class right?
Yep
If so, have you added a dependency on LP in your plugin.yml?
I have added it in my paper-plugin.yml,
dependencies:
server:
LuckPerms:
load: BEFORE
required: true
unlucky (mod) 💀
?
why are mods unlucky just because they get disturbed for, people being continuously asking questions from them?
xD
smh
Thanks
@main dagger hi can you look after this?
sorry for the ping
So uh if people could help me out
private boolean setupLuckPerms() {
RegisteredServiceProvider<LuckPerms> provider = getServer().getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
luckPerms = provider.getProvider();
return true;
}
return false;
}
doesnt seem to work
i already did mostly what had to do to hook it to the plugin to say it needs it
like the plugin.yml adding it to the depend list
still says it isnt there
just coding tablist plugin to get the prefix and suffix for on the username
Why not get the Prefix & Suffix from Vault?
I did not know that i thought vault was mostly use for like say econ stuff
as you can see i am still new at coding
Vault is a basic for Permissions, Economy but also prefixes and that stuff.
If you don't use any advanced stuff I do recommend you to use Vault. It's easier to hook into and more code examples available
ah okay but i saw i was able to get it work but it doesnt update the ranks whenever i change them
@night pier @main dagger ^
Hey quadratickid! Please don't tag helpful/staff members directly.
You can ping the moderator role instead of specific mods. Thanks tho.
Uh, my bad. Seems like the Mod role is only mentionable for Helpful+ users. No worries. Thanks for notifying us anyways. 🤝
Possible to get the uuid of a player that never played?
from their username
if not at least have the uuid from username if they have played before
yes it is
1st no clue
depends on if the api asks the bukkit server
2nd yes
lookupUsername or something
Yeah i found it.
So basically i am trying to promote a user along a track when they vote, but there is the chance that they are not online then.
public void onVote(VotifierEvent event){
String suggestedUsername = event.getVote().getUsername();
CompletableFuture<UUID> futureUUID = lpApi.getUserManager().lookupUniqueId(suggestedUsername);
futureUUID.thenAccept(uuid -> {
User lpUser = lpApi.getUserManager().getUser(uuid);
Track voterTrack = lpApi.getTrackManager().getTrack("voter");
if (voterTrack != null && lpUser != null) {
if (event.getVote().getServiceName().equals("minestatus.net test vote")) {
voterTrack.promote(lpUser, ImmutableContextSet.empty());
Bukkit.broadcast(Component.text(lpUser.getUsername()+" has voted for the server!"));
}
}
});
Bukkit.getConsoleSender().sendMessage("vote received from "+event.getVote().getUsername()+" from "+event.getVote().getServiceName());
}```
I can see the broadcast message but weirdly the user never actually get promoted, if anyone would have a look and maybe tell me if i did something wrong.
if the player is offline you need to load the user, although in either case i suggest you simply just use UserManager#modifyUser, it will load the user (even if offline), run your action, and then save the user to the db again
hello, so im making a plugin with this permission check:
String str = event.getBlock().getType().toString().toLowerCase();
if (event.getPlayer().hasPermission("unbreakable."+str)){
event.setCancelled(false);
}```
and i wanna make appear all unbreakable.{block}, being block all the materials poissible, appear in the editor. how?
nvm, solved
Does Luckperms support PlaceholderAPI for the groups? like %luckgroup% or something?
And Ive tried to import the api... it like broke my entire project in intellji and remove bukkit from it 😭
!placeholders
Display data such as user prefixes and groups from LuckPerms in other plugins.
this isnt the place to advertise random discord servers
Thank you 👐
How can I implement getting privilege prefixes for player login/logout messages?
Is there a way to get the real name of a group, not the display name, from an placeholder? all the ones I have tried have just given me the alias i set with set displayname
No - that's the entire point of the display name. It overrides the group name, for cases where renaming it is impractical. 99% of people who use it are doing so incorrectly, and should be using prefixes, suffixes, or custom meta to do whatever
I want a regular player to be able to use the /pokeheal command what is wrong with this
How's that related to the LuckPerms API?
For general LuckPerms support you can use the #support-1 / #support-2 channels.
Can I somehow ask LuckPerms to not handle my custom player on join?
User <uuid> - A doesn't have data pre-loaded, they have never been processed during pre-login in this session. - denying login.
is there a placeholder to take the highest prefix from a certain track?
!placeholders
Display data such as user prefixes and groups from LuckPerms in other plugins.
not really an api question
I did not find it there
highest_on_track_<track>?
will that return my prefix? When I used it previously I only saw it returning my actual name of the group
I'll give it another try
oh yeah you have to use %luckperms_prefix_element_<element>% using one of these https://luckperms.net/wiki/Prefix-&-Suffix-Stacking#how-do-i-add-other-elements
Ah ok
thank you
For future refernse is this just a general support question?
I was under the impression it was an API thing
are you making a plugin?
Ah good point
How can I implement LuckPerms API into my Velocity plugin? Since it doesnt use the RegisteredServiceProvider that the LP docs say to use
Oh, the reason the singleton access wasnt working is because Velocity requires me to put @NonNull since it could return null
How i can use LuckPerms here
package me.plugs.nukkit;
import cn.nukkit.Player;
import cn.nukkit.event.EventHandler;
import cn.nukkit.event.Listener;
import cn.nukkit.event.player.PlayerJoinEvent;
import cn.nukkit.event.player.PlayerQuitEvent;
import cn.nukkit.plugin.PluginBase;
import cn.nukkit.utils.Config;
import cn.nukkit.utils.TextFormat;
import java.io.File;
import ru.nukkit.multipass.Multipass;
public class JoinMessageDonaters extends PluginBase implements Listener {
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
this.getDataFolder().mkdirs();
this.saveResource("msgjoin.yml");
this.saveResource("msgquit.yml");
}
@EventHandler
public void PlayerJoinEvent(PlayerJoinEvent event) {
Config join = new Config(new File(this.getDataFolder(), "msgjoin.yml"));
Player player = event.getPlayer();
String nick = player.getName();
String donate = Multipass.getGroup(nick);
if (join.getString(donate) != null) {
this.getServer().broadcastMessage(TextFormat.colorize(join.getString(donate).replace("{nick}", nick)));
}
}
@EventHandler
public void PlayerQuitEvent(PlayerQuitEvent event) {
Config quit = new Config(new File(this.getDataFolder(), "msgquit.yml"));
Player player = event.getPlayer();
String nick = player.getName();
String donate = Multipass.getGroup(nick);
if (quit.getString(donate) != null) {
this.getServer().broadcastMessage(TextFormat.colorize(quit.getString(donate).replace("{nick}", nick)));
}
}
}
OK, let's go. I made a plugin using the skript code in which, when the "/adm" command was used, the person would join the ADM group, the code worked perfectly. However, I need to make an update for the person to stay in this group within the game, can anyone tell me if /lp applyedits can be disabled?
what?
I made a plugin that puts me in a group, but for me to stay in the group within the game I need to use the command /lp apply edits <codigo>, and basically I wanted to know if there is a way for me to disable this thing of having to send the command /lp apply edits <code>
What are you doing that requires you to even touch the applyedits command?
I made the plugin that puts me in the group, but when it puts me in the group, it doesn't update... I made a server with tags, so the idea was to change the tag, I have the tag "citizen" , the idea was that when I used /adm I would get the "ADM" tag but this did not happen and I suspect it is because of /lp applyedits
Forget it, is there any way for me to set the value of a group that is false?
I want to do that, but on the game, with some command
@night pier
Hey kolemsz! Please don't tag helpful/staff members directly.
srry
using the luckperms api, what event would i use to detect when someone is added/removed from a group? I tried using the UserDataRecalculateEvent but that didn't seem to get called when i updated someones group, I've also tried NodeMutateEvent, but that's also kind of confusing me as I'm not sure how to get a user instance from that
(Using the velocity luckperms api btw)
NodeMutateEvent has getTarget(), it returns a PermissionHolder but you can ofc do instanceof User
I'm attempting to use
private void luckpermsUpdateEvent(NodeMutateEvent e){
if(!(e.getTarget() instanceof User)) return;
User user = (User) e.getTarget();
System.out.println("Updating: " + user.getUsername());
as a test, but it's not executing.
I'm registering it like this in the ProxyInitializeEvent
luckPerms.getEventBus().subscribe(this, NodeMutateEvent.class, this::luckpermsUpdateEvent);
Hello! I'm listening to UserTrackEvent to update the player's nametag and scoreboard when their primary group (or rank) changes.
But this is not printing or working, any clue why this could be?
I assume plugin in the subscribe function can be a normal paper JavaPlugin right? (that's instance in my case)
I'm using NodeMutateEvent now and it works, is this UserTrackEvent for something else, did I misunderstood it?
Yes, the UserTrackEvent is for when a user uses the track commands (promote, demote, parent settrack etc) to modify a user's group(s). If those commands aren't used, then that event will never be called. NodeMutateEvent is what you want in most cases.
But I was using parent add and set and it was not getting called 🤔
Correct, because those aren't track commands. parent settrack is iirc the only track-related command under the parent section. Not all parent commands modify tracks
Oh sorry I read parent settrack as two different subcommands
Yeah this works then, thanks! 🙂
all good, I figured that's what happened. Glad it's working 👍
is there a way to "register" permissions (for them to show up in tab completion), outside of bukkit? (specifically on velocity, in my case)
or should I just do some pseudo check against them or similar on startup?
they show up in tab completions after luckperms handles a permission check for that permission
bukkit or otherwise
so making a pseudo check on startup would be the most proper way to have them show up, if you don't want to rely on it being checked in normal usage?
bump
how do i get the expiry date of a player's group?
I have the luckperms plugin on my proxy and im using the luckperms api on one of my servers, however, it gives me a NoClassDefFound error when trying to use the api. Can someone help me?
you cant import a class that only exists in another process
so you need to install LP on the backend too
How would I get the Bukkit Player object from the LuckPerms PermissionHolder object (from an event)?
I have tried```java
Player player = Bukkit.getPlayer(event.getTarget().getFriendlyName());
get the uuid
and i think getPlayer() only works for online players anyways
declaration: package: org.bukkit, class: Bukkit
hey @main dagger, seen you helping a lot of people, would you mind helpin me out with this?
i am trying to make my own tab system, and on tab entries I need to display the players rank which works fine, as I'm just getting the primary group of a user and then finding the prefix for that group, but I've noticed that if I update my rank in game, my primary group doesn't change? I'm assuming this is because I'm using the velocity API of luckperms, is there anything i can do to fix this?
Hey nootnoot._! Please don't tag helpful/staff members directly.
primary group is an arbitrary concept. just get the users prefix directly
how do i do that?
Hello,
I've been intrigued by how the player.hasPermission() function automatically invokes the logic of LuckPerms when used. From my research, it seems that registering a service through the ServiceManager allows for integration into Bukkit's system. The advice I received was that creating a class inheriting Bukkit's Permissible interface and registering it as a service would achieve this.
Upon inspecting the LuckPerms Bukkit plugin code here(https://github.com/LuckPerms/LuckPerms/blob/754283c053493bfa1cbc5df05987ba46f7fde388/bukkit/src/main/java/me/lucko/luckperms/bukkit/LPBukkitPlugin.java#L254), it appeared to confirm that service registration was the correct approach. However, the LuckPerms interface does not inherit from Permissible, and its internal functions also seemed unrelated to hasPermission.
I am curious about the mechanism behind how LuckPerms registers its service and replaces the existing Permission functionality. Although I anticipate that it involves inheriting Permissible and registering it, I'm puzzled about how the service registration integrates and replaces the class simultaneously.
I've tried to understand the code, but it's challenging to find the connection. Any detailed advice or clarification on this would be greatly appreciated.
Thank you.
LP injects its own Permissible implementation into the CraftPlayer's Permissible delegate as the player logs in
see
https://github.com/LuckPerms/LuckPerms/blob/master/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissible.java
https://github.com/LuckPerms/LuckPerms/blob/master/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/PermissibleInjector.java
https://github.com/LuckPerms/LuckPerms/blob/master/bukkit/src/main/java/me/lucko/luckperms/bukkit/listeners/BukkitConnectionListener.java#L155-L216
Thanks to your advice, I've gained a significant understanding of how LuckPerms interacts with the Bukkit's permission system. It was enlightening to discover how LuckPerms replaces the standard PermissibleBase with its own implementation in LuckPermsPermissible.
LuckPerms effectively substitutes the default PermissibleBase in Bukkit by utilizing its custom class, LuckPermsPermissible. This process involves accessing the internal Permissible field of the Player object using reflection and replacing it with LuckPerms' permission management logic. The injection and uninjection processes during player login and logout ensure that LuckPerms maintains compatibility with the existing system while offering its unique permission management capabilities.
Without your advice, understanding this intricate mechanism would have taken much longer. I sincerely appreciate the help you've provided in gaining this insight. This deeper understanding will undoubtedly aid in better plugin development.
Thank you very much!!!!
TLDR “thanks”
luckPerms.getPlayerAdapter(Player.class).getMetaData(target).getPrefix(); isn't updated when the players rank is updated, it only updates when the player relogs (using the velocity api), how would i fix that?
I have the same problem with the bungee API, the prefix is updated using modifyUser but it only updates for the other plugins on the server the player is on when the player relogs to the server.
The prefix is updated in bungee's luck perms but does not take effect on other servers unless a command like "/lp user info" is executed or the player relogs from the server.
Exactly yes, I'm still struggling with this!!
you probably need to notify the changes to other servers using the messaging service; see the pinned message about that
It worked, thank you.
I want to make a Forge mod that shows me the rank prefix in the tablist because that wasn't there from the start, so I downloaded the mod and threw it into the library folder as a Jar Library and added it to Grade.build program is bound and when I join a world this error occurs in the console/crashlog: [21:11:22] [Server thread/ERROR] [minecraft/ServerLoginPacketListenerImpl]: Couldn't place player in world
net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
This could be because:
a) the LuckPerms plugin is not installed or it failed to enable
b) the plugin in the stacktrace does not declare a dependency on LuckPerms
c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
(call the #get method in onEnable, not the constructor!)
I'm actually getting that same error ^ but in a velocity plugin.
@Plugin(
// ...
dependencies = [Dependency(id = "luckperms")],
)
private fun registerTasks() {
logger.info("Registering tasks...")
timer.scheduleAtFixedRate(0L, 60_000L) {
runBlocking {
luckPermsSyncTaskService.sync()
}
}
logger.info("Finished registering tasks.")
}
private suspend fun syncPlayer(player: Player) {
val luckperms = LuckPermsProvider.get()
val user = luckperms.userManager.getUser(player.id)
// ...
}
And yet, this error is thrown: Exception in thread "OnTimeSyncTimer" net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!.
I'm not sure what else to check
if I change the dependency to luckperms1, the plugin fails to load... so it's definitely finding the dependency
okay... I figured it out - I was accidentally shading the luckperms api
@mild token This might also be your problem. Change implementation -> compileOnly for the LP dependency
Does exist a Waterdog version of LuckPerms?
If the Nukkit version doesn't work your only other options will be those on the download page.
i.e. no, but try the Nukkit version and see if it works
also wrong channel
I need help with a custom plugin my server has ordered from SaberFactions, that is going to allow us to have temporary ranks with custom faction power. However the dev of SaberFactions says his commands that are supposed to work with Luckperms Api isnt working.
we have no information what so ever. Have the developer of the plugin come here and ask, since it’s a plugin he made that’s not working as expected. 🤷♂️
You should not have accepted the plugin that is not working and let the dev figure out what is wrong on the API part
I am getting net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet! while using velocity api
where should I use luckPerms = LuckPermsProvider.get();
Wait same happening on waterfall too now, I think I changed something and now this is happening
make sure you’re not shading LuckPerms.
Oh, I am probably shading luckperms
Thanks
Can I use the API in a BungeeCord plugin?
If so, how can I check if a player has a certain permission?
for simple permission checks, you dont need the api
just use the platforms method of checking permissions
You mean ProxidePlayer#hasPermission?
does Player#hasPermission("group.{name}") check if a player has a group named {name}?
why there is no something like User#hasGroup() or Group#getUsers()?
All data aside from the UUID <-> username cache is stored as permissions. hasPermission("group.<name>") is a quick and easy way to check without the LP api, with the API you check for an InheritanceNode with the desired group.
What's the most efficient way to get the prefix of a player who may be online or offline
With some caching
check if the user is online else load
whats the best way to get all users in a group
Forge 1.20.1
ok
This method doesn't work.
private void addGroup(ProxiedPlayer player, String group) {
LuckPerms luckPerms = LuckPermsProvider.get();
luckPerms.getUserManager().modifyUser(player.getUniqueId(), (user) -> user.setPrimaryGroup(group));
}```
You have to save the changes
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
How do I put permissions in the luckperms web using a other plugin of a scr
does the luckperms api support offline players?
what is a contextSet
public class VipJoin implements Listener {
private Node vipNode = Node.builder("iransky.vip").withContext(DefaultContextKeys.SERVER_KEY, "smp").build();
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e){
User player = LuckpermsAPI.api.getUserManager().getUser(e.getUniqueId());
if(!player.getNodes().contains(vipNode)){
e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_FULL);
e.setKickMessage("The Server Is Full! You Need SkyGod Or Higher To Join");
return;
}
for (Player p : Bukkit.getOnlinePlayers()) {
if(p.hasPermission("iransky.vip")) continue;
p.kickPlayer("You Were Kicked Due To A VIP Player Join!");
e.setLoginResult(AsyncPlayerPreLoginEvent.Result.ALLOWED);
break;
}
}
}```
is there anything i need to improve?
you can load the user with the api to do stuff to them
Crazy
does anyone know how to make a range with luckperms on sternalboard?
I want to get the uuid of a player by name and when i run it i get [16:01:36 INFO]: Chucky3920 null
System.out.println(mcName + " " + uuid);```
doesnt the server provide a way to look up that info?
but i want to make it able to get offline players too (im on velocity)
How do i get all perms in the right capitalization
"get" in what way?
if you want a list of all permissions from all plugins on the server, thats not really something you can do
My main issue is that I cannot remove an permission if the permission is not case sensitive.
sry for ping
has the player joined before
Yea
Will have to try tmrw
what is the easiest way to get all users that are in a certain group?
searchAll probably
Hello!
I need some help:
I've been trying to create a plugin that uses LuckPerms to get permissions and other related stuff, but I've been running into the same issue and I've tried everything I found either on the GitHub issues page or other places:
net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
This could be because:
a) the LuckPerms plugin is not installed or it failed to enable
b) the plugin in the stacktrace does not declare a dependency on LuckPerms
c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
(call the #get method in onEnable, not the constructor!)
In this gist is the source-code (That's calling the LuckPerms API), latest log from the server, build.gradle and plugin.yml file:
https://gist.github.com/tockawaffle/39a195f17e79af7dc22dd2d500d18666
I am using:
Paper 1.20.2
LuckPerms 5.4.102 (Any version would give me the same result.)
Java 17
I don't really know what else to do, lol
libraries:
- net.luckperms:api:5.4
you do not want to do that, the api is provided by the plugin already
Yep, that did it
Thanks!
Hello, I'm having issues initializing the LuckPerms API on BungeeCord. I have the same error as the person above me (NotLoadedException). This is my onEnable Method:
public static LuckPermsConnector luckPermsConnector;
@Override
public void onEnable() {
MongoManager.connect();
luckPermsConnector = new LuckPermsConnector(LuckPermsProvider.get());
ProxyServer.getInstance().getPluginManager().registerCommand(this, new BanCommand());
ProxyServer.getInstance().getPluginManager().registerCommand(this, new MuteCommand());
ProxyServer.getInstance().getPluginManager().registerCommand(this, new UnbanCommand());
ProxyServer.getInstance().getPluginManager().registerListener(this, new ChatListener());
ProxyServer.getInstance().getPluginManager().registerListener(this, new LoginListener());
ProxyServer.getInstance().getPluginManager().registerListener(this, new PostLoginListener());
}
and this is the relevant part of my LuckPermsConnector class:
private final LuckPerms api;
public LuckPermsConnector(LuckPerms api){
this.api = api;
}
For reference, here is the relavant part of the server logs: https://hastebin.com/share/ligagibeca.makefile
LuckPerms is installed and configured on my proxy and can be used normally. It's also loaded before my plugin.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Alright, that did the trick. Thank you
It doesn't work luckperms, what can I do, I can't even create a group, can you help me?
is there a api for the lpb?
yes
I want to go to the luckperms editor's page and it doesn't go to me, it says Another command is being executed, I'm waiting for it to finish and it's been 5 days, as it says the same thing, I restarted but it doesn't help
yk for maven?
there is no api specifically for any version of luckperms. the api is shared between all platforms and works the same way on all of them, the only difference being what types are used as permission holders (eg the player class)
luckPerms.userManager.uniqueUsers.thenAcceptAsync { users ->
for(user in users)
{
luckPerms.userManager.loadUser(user).thenAcceptAsync { user ->
val rank = AbstractRankService.getRank(user.primaryGroup)
if(rank == null) {
failedUsers[user.uniqueId] = user.primaryGroup
return@thenAcceptAsync
}
}
}```
I'm aware of `user.primaryGroup`, but how would I retrieve the remaining duration of their group?
well players can have many groups
nevermind I checked out the LP placeholders and fixed it using this
these 2 lines literally do nothing, doesnt set the parent group at all.
or add the user to the group
setting the primary group like that wont do anything
you need to actually add an inheritance node for the group
!cookbook probably has an example
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Hello, please tell me how can I install donation if I get user and then and then use Method setPrimary But it gives the result Fail
1 message above yours
@Override
public void onEnable() {
instance = this;
Player player = Bukkit.getPlayer("ilia10106ggg");
LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId()).setPrimaryGroup("gri");
read 1 message above your initial message
я исправил и мне пишет ето Loaded class net.luckperms.api.LuckPerms from LuckPerms v5.4.116 which is not a depend, softdepend or loadbefore of this plugin.
Add LP as a depend (or a softdepend if LP is an optional dependency) of your plugin in your plugin.yml
That's not a LP error, where does it say that and if it's in the logs then what's the full logger line?
this is after the player has executed the command but
everything is fine in the magazine
Тут код для решения моей проблемы
Hey Fellas, would anyone know if there is an efficient way to check what numerical value is set after a permission node? Like checking someones max claim size in permissions claims.size.100 all the way to claims.size.400999 without check recursively?
You can set prefixes, suffixes and other meta data in LuckPerms for players and groups. Note that LuckPerms does not manage chat. You need to use another plugin to show prefixes/suffixes in chat.
its basically just a key -> value map
ah ya mean I would need to do one myself, I'd assume just thought it would be nice to do it on the fly
I'm working on a leaderboard plugin utilizes player's prefixs, what I'm doing is loading the users one by one to get the displayname but this is not very efficient, especially if I have everything stored in a database. Is there a way to do this without loading one by one? like fetch a group of users?
java.lang.NullPointerException: Cannot invoke "net.luckperms.api.model.user.User.data()" because "user" is null
Why user is null?
public void add(UUID resident) {
User user;
if (TownyPermissions.getUserManager().isLoaded(uniqueID)) {
user = TownyPermissions.getUserManager().getUser(resident);
} else {
user = TownyPermissions.getUserManager().loadUser(uniqueID).join();
}
residents.add(resident);
for (String permission : perms) {
user.data().add(Node.builder(permission).build());
}
TownyPermissions.getUserManager().saveUser(user);
} ```
Add some loggers to verify the user isnt actually null before trying to do anything with it in LP
But why user is null? UUID is correct
you are checking if the UUID uniqueId is loaded, but getting the user for resident which is the method param
thx)
sry for ping
I'm working on a leaderboard plugin utilizes player's prefixs, what I'm doing is loading the users one by one to get the displayname but this is not very efficient, especially if I have everything stored in a database. Is there a way to do this without loading one by one? like fetch a group of users?
Hello, is there a version for WaterDogPE?
wrong channel, but https://github.com/LuckPerms/LuckPerms/issues/3056
In other words, there isn't one, right?
and I'm sorry for speaking on the wrong channel
Hello guys, is it possible to listen to luckperm events through Velocity at all?
Hmm, it doesn't seem to work.
public RankChangeListener(LuckPerms luckPerms){
EventBus eventBus = luckPerms.getEventBus();
eventBus.subscribe(DataTracker.getInstance(), UserDataRecalculateEvent.class, this::onUserDataRecalc);
}
private void onUserDataRecalc(UserDataRecalculateEvent event){
System.out.println(event.getUser().getPrimaryGroup());
}
This is my listener and then on my main
onProxyInitialize:
luckPerms = LuckPermsProvider.get();
new RankChangeListener(luckPerms);
But the command runs in the backend server so I don't see how velocity could listen to it
Not that I've looked into luckperms I suppose there will be some plugin messaging
events will only fire on the instance a change occurs on
There is an way to only node expiry when the player is online?
I'm not sure that this is an API question, but no. the expiry is a timestamp
Sadly, I believe I should save each player's time and add/remove the equivalent timestamp when they leave/join
Of course. I never expected it to just print out, I'm causing the event. It still doesn't fire. Does velocity receive events through plugin messaging or are events only backend server specific?
Hello U have a quqestion how can i can make the luckperms api in my plugin
!api
Learn how to use the LuckPerms API in your project.
i cant see anything abaut velocity
The singleton method works on every platform
oh ok thx
If a player has never joined the server, is it possible to add him (the nickname) a permission and then check for it?
use the uuid
Hey, i want to get the time how long the Rank is always response: Like this
https://i.imgur.com/Xbto9Ti.png
and who i can set them?
Do you mean something like this?
Yes, but i mean i want go get the Code, not s placeholder
If I've checked correctly, what this is about
!meta
You can set prefixes, suffixes and other meta data in LuckPerms for players and groups. Note that LuckPerms does not manage chat. You need to use another plugin to show prefixes/suffixes in chat.
💀
Possible to get how long is left on a temp group?
how i can create a custom command that allows to set temporary groups to players? like /tempgroup
epic
i just created a command with 3 arguments and make a Integer parse the 3 argument in a luckperms /lp user parent addtemp command
/tempgroup <Nick> <Rank> <Time in Days>
Try reloading maven project
Try Invalidating Cache Data and Restarting IDE
Try right clicking pom.xml Maven > Unlink Maven Projects then right click pom.xml again and Add As Maven Project
(Assuming you're using maven)
thanks
well, hiding debugging information is one way to hinder the ability of getting help, because that one line you hid is pretty important to see where the issue is caused exactly and that could give one or two hints :p
other than that, make sure that your bungee.yml/plugin.yml is formatted correctly for the plugin dependency thing with LuckPerms
yes and that line provides extra information that can help us help you
would need to see either a) that line and/or b) your plugin yml to see what could be wrong
Hey why does the LuckPermsProvider.get().getUserManager().getUniqueUsers().join() not return all the users in the db?
It'll only return the users who have data saved. If a user's only data is group.default, LP doesn't save anything about them to save space
yes theres 2k users in the lp db with ranks
and it returns 0
i understand that the method "getLoadedUsers()" only loads the online players right? is there a way to get all the offline players as well ?
sorry if im asking something blatantly obvious
what are you trying to do exactly? there might be a more efficient way of doing whatever you want to achieve
hey did you manage to find out how you do this ?
I mean, there's UserManager#searchAll, but it might not exactly fit all of your criteria
loading all users to fetch that info seems a bit.. not good designed lol
why can't you just wait until the player logs out, then save the remaining time, and then when they log in again you add the difference?
thank you very much, i pretty much have a "/lp pause", and it works perfectly 🙂
hey
how i can get my server players info (group and ....) and show them in my discord bot ?
use jda
How to listen to network sync through LuckPerms API
Is it not possible with JS?
!rest
Sorry! I do not understand the command rest Did you mean latest?
Type !help for a list of commands
there’s a rest api you could use
@jaunty pecan
Hey aceita! Please don't tag helpful/staff members directly.
Don't ping Luck.
you can help me pls??
!api
Learn how to use the LuckPerms API in your project.
as it shows, there is no method named "getApplicableContexts" in the ContextManager
but for that you can just call getMetaData(), without passing any parameters to it
that will work, yes, but it will not get the LP configured prefix, for that you'd use getMetaData().getPrefix()
bump
Bump
I need to listen when player's group gets updated, and this one doesn't seem to serve my situation lol
network syncing is just "reload the data for this user" or "reload all the loaded data", it does not communicate what exactly changed
the specific events when stuff changes are fired on the LP those changes happened in
that looks correct, what isn't working and how do you check whether it's working or not?
It doesn't add the role to the player, I check by going to /lp editor and going to the panel
So how do you add a temporary group?
with an InheritanceNode
not a MetaNode, an Inheritance represents a parent group, a MetaNode represents an arbitrary key-value pair
you can send me one example pls?
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
one question, the .expiry is in seconds? minutes? hours?
it's a timestamp
yeah, or if you want you can use the method that you can pass a java.time.Duration, or the one you can specify the time amount https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/node/NodeBuilder.html#expiry(long,java.util.concurrent.TimeUnit)
I have an issue with this where when removing multiple permission nodes sometimes it's resetting the player's ranks
the function im using ```java
public static void removePermission(Player player, String... permission) {
luckPerms.getUserManager().modifyUser(player.getUniqueId(), user -> {
for (String s : permission) {
user.data().add(Node.builder(s).value(false).build());
}
});
}
is there a reason why that might be happening? this is the implementation
i assume that it's due to me modifying the user multiple times, rather than doing it all at once.
What's the event that gets fired when user's group/parent changes whether the group is on track or not. i.e. /lp user X parent set Y. Which event would fire? Currently I have UserTrackEvent, but not what I'm looking for. Thanks in advance!
NodeAddEvent, NodeRemoveEvent and maybe NodeClearEvent (stuff like parent set will clear the InheritanceNodes and add the one you're setting)
check that the holder is a user, the node being added is an InheritanceNode
that's generally my guess as well, I have to find time to debug that properly but I haven't been able to spot anything immediately wrong with the storage logic.
Anyway, you can build a String[] or a List<String> with all the permissions you want to remove and pass that instead
Yeah i realized what i was doing midway through sending that message, haven't pushed to prod yet so i cannot tell you for sure that was the reason but it most likely was
Worked, thanks🌹
I did that as soon as i noticed
how can i fix this?
anyone can help me??
uh, I wonder where you got that code from, but:
long, it returns a java.time.Instant, you can see that if you check the method return type or if you hover your cursor over the squiggly red linenode -> node.getContexts().isSatisfiedBy(contextSet.u
help me
😄
It said there is a data error occurred while loading permissions, do someone know how to fix it?
Hybrids are not supported, #support-1 or #support-2 for support with using LP in the future. #luckperms-api is for support with using the LP API
Hello
On my server, players periodically lose permissions. I would like to make an debugger plugin that would tell me when a player has lost a permit and what caused it, so that I can track which plugin is taking a permission from a player. is it possible to do this? I found NodeRemoveEvent in the documentation, but unfortunately, it does not provide information about which plugin removed the permission.
im not super familiar with java or how the lp event system works but you might be able to look at the call stack
if you can access that, and lp doesnt delay handling the event
I tried this. Unfortunately the call stack doesn't show me the call from another plugin