#luckperms-api
1 messages · Page 1 of 1 (latest)
check if they have any permission nodes ig
Sounds to my your plugin is unable to find the correct LP instance of your server.
Sounds dumb and maybe you already checked it, but did you check...
- witch version of lp is running on the server?
- Luckperms is enabled and running without errors?
- in your plugin.yml you declared Luckperms as dependency?
- In your maven you did shade the latest version as runtime provided?
- if your plugin is working on a ln empty Dev server with only Luckperms installed?
(they left)
Hello ! how do you set a prefix to a player with the luckperms api?
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetPrefixCommand.java#L48-L64
Here's an example of it in cookbook.
euh.... i love you
don't work
We really would absolutely love to help you out! However, telling us that it isn't working wastes everyone's time. Please, just describe the issue you're having clearly and with as much detail as possible, and send any relevant screenshots of whatever problems you're having.
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("gp")) {
if (sender.hasPermission("CUSTOM")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (args.length == 0) {
String prefix = args[0];
Main.getInstance().getLuckPerms().getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
user.data().clear(NodeType.PREFIX::matches);
Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i + 10).max().orElse(10);
Node node = PrefixNode.builder(prefix, priority).build();
user.data().add(node);
sender.sendMessage("Prefix changé en §r" + prefix);
});
}
}
}else {
sender.sendMessage("§6§lHub §f┃ §cVous n'avez pas la permission");
}
} return true;
}```
0 error
0 error
Okay, what actually happens when you run /gp something
yes
yes?
that's exactly what i want
What does happen. surely there's not just 0 feedback. any command output? any message in console?
Okay, and what does the player see in-game
nothing
please stop replying just to ping me, i will see the messages
Hey Ota'! Please don't tag helpful/staff members directly.
Hey Ota'! Please don't tag helpful/staff members directly.
what does that screenshot have to do with anything?
in api luckperm
yes i know
Does clippy autoyeet after so many illegal pings?
no
just starting at 5 pings in a single message
Interesting... 
either that, or flip it to check if args is not equal to 0
https://pastes.dev/VwmHHvgQMP
You'll have to re-modify it to your style/class setup, but this code works.
@slim sky ^
Hey Ota'! Please don't tag helpful/staff members directly.
Join the args together
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
!api
Learn how to use the LuckPerms API in your project.
get the group instance
where ?
Hello ! can someone help me put the grades in the tab? (with the weight of the rank)
!help
!advanced
!api
!argumentbased
!ask
!bedrock
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!forgepermissions
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki
Hello, I have a question, is it possible to get user on the survival server, if it wasn't on it before but was on the lobby server? (plugin linked to one database)
Hello ! can someone help me put the group in the tab? (with the weight of the rank)
can somebody help me add teleportation for players on my server plz
Teleport a player ?
to a location
Here Its luckperms api not spigot api
?
i have tried no use
…
fabric
It's not a salon where we help with fabric
rip
what?
if you need help with lp api on fabric then you can get help here, if you need help with fabric api in general use their discord or #general
just seen the point about api wrappers - is anyone working on a js wrapper? if not then i’d be up for doing one
that would be cool!
I was going to make a typescript module if nobody else did - I think it should be possible to auto generate some of the required types using https://github.com/OpenAPITools/openapi-generator
i’d do both in one go
awesome :D
hey luck, just an info, can the standalone version be integrated as a library in a custom backend ?
or is it just a cli app?
at the moment it is just a cli app
but using it within another java app wouldn't be a huge jump
the only thing that complicates it is the classloading
I wonder if a pure library version with a method like LuckPerms.init(config-file-path, directory-path) is in your plans ?
yeah potentially
It would make backend developing to check user permissions / give permissions with interactions on websites-app a breeze
Hello ! can someone help me put the group in the tab? (with the weight of the rank)
is it intended behaviour that the GET /user endpoint doesn't include an user in the array if they don't have any nodes whatsoever, even if the user is actually created (because POST /user returns 409)
unlikely scenario but just something i noticed while attempting to make a wrapper thingy
@nocturne elbow has informed me that users without nodes aren't stored, but i'd still like to point out the behaviour here that the two methods of the same endpoint use different storage thingies, maybe a little weird idk
Hey Emilia! Please don't tag helpful/staff members directly.
Although it is correct as per API contract, just very (understandably) confusing from the REST API perspective
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html#getUniqueUsers()
"Unique" meaning the user isn't just a member of the "default" group.
If I wanted to manually give and change user permissions through a website by directly changing the database, would I be able to?
Well you can kinda give certain permissions and stuff but how does the expiry work for settemp?
The expiry is an epoch
So generate an epoch for the time you want it to expire
Iirc you need to tell LuckPerms to sync the data to the player too
I remember something about using the messaging service
it also puts smth in luckperms_actions table when I use the command so I guess I gotta make an entry there aswell?
Hm it seems like I can't update the expiry for some reason
k I just deleted the record and inserted again and it works lol
Hi, I’m thinking of making an extension for use with Geyser/Floodgate which allows a context that is whether a player is joining by a Java or Bedrock client, would this be possible to do as an extension? Any response is appreciated 🙂
don't see why not
Ah good to know, thanks 🙂
Although If you've already got existing code running on the platform (i.e. plugin/mod), can integrate into that, no extension nessecary. LP API is accessible to platform plugins/mods
Oh ok, thanks that’s really good to know, may I ask what are the advantages/disadvantages of using a extension vs a plugin? Thanks again for your help 🙂
LP extensions are cross-platform, platform plugin/mod means you have easy access to that platform as well (especially if you've got existing codebase).
Hey, I couldn't seem to find the correct event for when the parent of a user changes. May I ask which one to use for that?
When i change the group of an user via the api, how can I apply these change (prefix in chat) instant, without that the player has to reconnect?
Is there some reload function for the player
if you did it correctly, it should just work
atm the player has to reconnect for the group change
well then your probably doing something wrong
assuming it works fine when you use the command
How would I query permissions of user based on regex? So queue.priority.([0-9]+)
iterate over nodes and check if they start with that
but that’s really something you should use the meta system for
Is there an event for when a permission expires?
NodeRemoveEvent
Check that node.hasExpiry && hasExpired
Hey i have a question vault didnt get updates for the 1.19 and now i must code my system with luckperms. How can i give persons a specific permission like i want to code a rangshop for the players. And in vault was it " Vault.getPermission().playerAddGroup(null, player, rang.getRankName());" but how can i do this (or a better way) with luckperms?
Vault works just fine on 1.19, hell it'll probably still be working a decade for now.
Since vault doesn't touch any ingame mechanics, it won't break cross-version. LP is (normally) the same
I updated my plugin from 1.16.5 to 1.19 with the vault integrations and it didnt worked so i switched to luckperms ^^' for coins it workes but not for permissions thats my problem rn
doesn't work how? If vault was broken we'd have a small apocolypse in our support channels, which we don't
Idk i didnt changed anything i just updated from 1.16.5 to 1.19 and then i had a huge problem with vault bc of permissions.
I reinstalled the vault plugin and mine and nothing changed.
No errors or something
and it didn't work in what way?
I have a npc that sells you ranks on my server. And it workes via the vault integration when you click on anyrank you want it checks the weight of your current rang and your new rang and when the current rang is higher from the weight then your new rank it dont work. But since the update from 1.16.5 to 1.19 it always said that i have reached the maximum rank i can get (and no i dont had * perms or something like that) i did fixed that problem with luckperms now but i need a way to give the specific rank to the person who clicked on the rangshop
!cookbook well check the cookbook, but LP hasn't changed and vault's the same old POS it was 5 years ago so I doubt it was something breaking in either of those
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
whats the easiest way to get a Player list of who's in a specific group? or just the names of those players in the group
oh i found this https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GroupMembersCommand.java
So, I'm using the LuckPerms API to get the primary group for a player, and I'm getting this error.
[22:48:14] [Netty Epoll Server IO #12/ERROR] [FML]: There was a critical exception handling a packet on channel pokeninjas
java.lang.NullPointerException: value
at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_312]
at me.lucko.luckperms.common.api.implementation.ApiUser.getPrimaryGroup(ApiUser.java:76) ~[ApiUser.class:?]
at com.pokeninjas.pokeninjas.api.RankTagAPI.getUserTag(RankTagAPI.java:313) ~[RankTagAPI.class:1.0.51]
at com.pokeninjas.pokeninjas.api.RankTagAPI.getPrimaryTag(RankTagAPI.java:296) ~[RankTagAPI.class:1.0.51]
I've deduced that this is happening because the "value" variable is null, meaning the primary group obtained is null somehow. What could be causing this?
How to read expiry in database as seconds etc?
using the api?
Is there a version of luckperms for sponge 7.4.7?
!api7 and wrong channel
LuckPerms no longer releases updates for API 7 of Sponge, which is what the 1.12.2 version of Sponge uses. However you can still download the last version of LuckPerms that supported API 7 from Ore.
Does LuckPerms#GetUserManager().getUser(UUID) only work if the player has been online in that session??
No, it will always provide a valid user
only if the user is online?
oh, I thought it was loadUser, derp
!advanced
!api
!argumentbased
!ask
!bedrock
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!forgepermissions
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki
!api getgroup
Learn how to use the LuckPerms API in your project.
.
mention me pls
i don't see what this has to do with luckperms, lol?
well it’s the luckperms api???
ty
It does not work
show screenshot
that’s not what i told you
mh ?
you need to get a group instance
- if(PluginManager.getGrade(player).equals("CUSTOM")) {
+ if(PluginManager.getGrade(player).equals(GroupManager#getGroup("CUSTOM"))) {
.
@hybrid pantherplease?
Hey Ota'! Please don't tag helpful/staff members directly.
oups
can you help me ?
Hey Ota'! Please don't tag helpful/staff members directly.
that link shows you how to get a group instance
its not good this ?
its good this *
That looks like it should work
Hi, I'm trying to make it so that when a player joins, I get whatever their highest group is along a certain track, save it in a variable for future use, and then reset their rank to the first rank in that track. I would also like to promote them along a track. My current idea for getting their highest group along a track is using the track manager to get a list of all groups in that track using plugin.getLuckPerms().getTrackManager().getTrack("track").getGroups(), and then looping through it backwards returning the first rank they have the permission for. If anyone would be able to help me with setting them to the first group in the track and promoting them along a track I would really appreciate it 🙂
Could someone tell me how do I set a group using api?
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
I did not find it
@drowsy crystal
If someone does reply to this please ping me btw
internally as far as the code is concerned, tracks are literally just groups of groups. there's no data stored for position on the track or whatever, so you can just manipulate parent groups like normal to promote (remove old group, add new). There might be a convenience method to do that for you, but I don't recall seeing it when I was last poking around.
Double check the javadocs etc though, I may be mistaken.
Thank You
Np
Thank you, I'm not too familiar with the node thing however so I'm a bit confused on how to remove the old group and add the new one. Is it just adding a permission node with like "group.groupname" and that would add the group? If you don't want me pinging you when replying please tell me btw
Fundamentally yes, inheritance is just determined by a group.GROUPNAME node. Again though, it's been a while since I've poked at the api so there might be a way of adding / removing a group more gracefully
It would be of great help if someone found out then
Great. I coded it out and if you wouldn't mind could you take a look and tell me if it looks right?
String oldGroupName = "";
for (String group : plugin.getSettings().getGroups()) {
if (player.hasPermission("group." + group)) {
oldGroupName = group;
break;
}
}
plugin.getLuckPerms().getUserManager().modifyUser(player.getUniqueId(), user -> {
Node oldGroupNode = InheritanceNode.builder(plugin.getLuckPerms().getGroupManager().getGroup(oldGroupName)).build();
Node newGroupNode = InheritanceNode.builder(plugin.getLuckPerms().getGroupManager().getGroup("survivor")).build();
user.data().remove(oldGroupNode);
user.data().add(newGroupNode);
});
@pale impAfter this declaration , which argument do I put here to serve as an instance to the register a registerCommands
Whatever you initialized luck perms as in your main class
I have no idea ashuashuashu
Send me your main class
my command executor class is the same as found on github and my mother this is what is imported
Okay so you'd pass in api
instance = api?
luckperms = api
send the code where you registered your command
That’s not going to be useful.
Oh ok
I managed to solve it, then another problem arose to set, the rank shown is null in the message as if it didn't identify any group
used api as instance
as he said
Please use https://pastes.dev to send files in the future. I have automatically uploaded setgroup.txt for you: https://pastes.dev/T5IVAyRMpn
setgroup class
It might be possible the group doesn’t have a display name set - it could be nullable
oh ok
I can't solve it
https://pastes.dev/OisjZ1ZdEm my main class
Anyone knows why I cannot find the class?
Would love to have this sorted but can't seem to figure this out
refresh cache
Where can I do so?
Never heard about that
For Intelj with Maven project
ctrl shift o
Still not, the IDE is also multiple times restarted
try building it
Worked with some sync thing. Thanks!
i'm using luckperms api in my velocity plugin to fetch the player's prefix, and I'm trying to subscribe to the UserDataRecalculateEvent. but it doesn't seem to be triggering my function when i make a prefix change (for example, /lpv group default meta setprefix 2 <blue>). is this the correct event to be listening to?
That would call the data recalculate event for the group you changed the prefix on, not the inheriting users
I'm not exactly sure but it might call it when it refreshes the prefix for the user the next time it is fetched
the event only has .getUser() and .getData() so probably that second option
"Gets the user whose data was recalculated"
what event should i listen to instead?
Well... it only has getUser because you are subscribing to the UserDataRecalculateEvent
Not the GroupDRE
oh nvm the event does trigger if i set the prefix on my user
so should i just listen to both the User and Group events?
Yeah for now I guess, I'll see if there's some way around that
my global chat plugin is using the api too to get the prefix but when i send a chat message (which means it gets the user and cached metadata again), it still doesnt trigger the event
so it doesnt work that way it seems
mh may i ask why are you listening to that change?
the plugin i'm doing right now is a tab list formatter, and i want to automatically update the display name whenever the player's prefix changes
otherwise i have to wait for them to either change servers, or relog
Right
Yeah then listening to both Group/UserDRE will suffice. It's.. not ideal because you'll need to loop through all players but it's not exactly an intensive process
yeah
could there be a race condition between Player#hasPermission and the actual group recalculate event, because for some reason it's working like 50% of the time for me
i gtg
Oh wait unless I'm supposed to schedule a task inside the event
Great question but, I don't think so? The event is dispatched into another thread after the whole cache invalidating has taken place. Would be nice to test/see, hm
wait it couldnt be this because my group membership wasn't changing, so maybe my permission query was wrong
replaced it with user.getNodes().contains(InheritanceNode.builder().group(event.getGroup()).build()), this works every single time, except for the first time i change the prefix after the player joins. any prefix change after that works
wtf the group recalculate event is triggering 3 times, every time i change prefix
for reference this is my entire function as of now (without the logger lines since its very wordy)
public void onLuckPermsGroupDataRecalculate(GroupDataRecalculateEvent event) {
server.getAllPlayers()
.stream()
.filter(p -> {
User user = luckPerms.getUserManager().getUser(p.getUniqueId());
if (user == null) {
return false;
}
return user.getNodes().contains(InheritanceNode.builder().group(event.getGroup()).build());
})
.forEach(this::updateTargetInAllLists);
}
yeah it might be possible, because it removes the previous existing prefix first (first trigger), adds the new one and uh something else :))
Hi, i'm trying to build a custom plugin who have the luckperms api as dependancy. But when i build i have this error:
Compilation failure
error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider me.lucko.helper.plugin.ap.PluginProcessor not found
My IDE is Intellij version 2022.2 and i use java 11, any idea to fix this ?
How to get specific node? I want to get the .getExpiryDuration
user.getNodes().stream().filter(Node::hasExpiry).partWhereIamStuck
Im kinda new to this
Is it possible to just filter with the node key like "test.test1"?
string -> string.contains(key)?
I want to get only one node not set or collection
You can get the applicable node for a permission from the cached permission data, https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/cacheddata/CachedPermissionData.html#queryPermission(java.lang.String)
Could you help me with it too? I dont know but this is not working rn
public class PlayerJoin implements Listener {
public PlayerJoin(bpWicia plugin) { Bukkit.getPluginManager().registerEvents(this, plugin); }
private bpWicia plugin;
private LuckPerms luckPerms;
String joinGroup = plugin.getConfig().getString("join-group");
int joinTime = plugin.getConfig().getInt("join-time");
public Node createNode(Boolean value, int hours, String key){
return Node.builder(key)
.value(value)
.expiry(Duration.ofHours(hours))
.build();
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
if (!(player.hasPlayedBefore())) {
user.data().add(createNode(true, joinTime, ("group." + joinGroup)));
luckPerms.getUserManager().saveUser(user);
}
}
}
you’re not setting the luck perms var to anything
this is not working for me LuckPerms luckPerms = LuckPermsProvider.get();
how isn't it working?
i meant it does not add the node
user.data().add(createNode(true, joinTime, ("group." + joinGroup)));
luckPerms.getUserManager().saveUser(user);```
return Node.builder(key)
.value(value)
.expiry(Duration.ofHours(hours))
.build();
}```
createnode function
Hi guys i need help
So i have mine custom gui
and in tht i have some roles like doctor engenieer smp cleaner and etc
Like i need to add a cmd in tht
So i added this cmd
/lp user <playername> parent set thugs
but it dint worked
Plz help
you dont need to ask your question in every channel
context
public void addPerm(OfflinePlayer player, String permission, World world, int seconds) {
Node node = api.getNodeFactory().newBuilder(permission).setWorld(world.getName()).setExpiry(seconds, TimeUnit.SECONDS).build();
User user = api.getUserManager().loadUser(player.getUniqueId()).join();
if (user != null) {
user.setPermission(node);
api.getUserManager().saveUser(user);
}
}
Thats from the old api
!api
Learn how to use the LuckPerms API in your project.
thx, that really helped
and how do i get all WORLD permissions of the player
?
yes
how can i check if a group's is temporal
grab the node for the group from the player and just check hasExpiry on it
Hi try get weight from Userjava public static int getWeight(String name) { OptionalInt weightOptional = Main.luckPerms.getGroupManager().getGroup(Main.api.getUserManager().getUser(name).getPrimaryGroup()).getWeight(); return (!weightOptional.isPresent()) ? -1 : weightOptional.getAsInt(); } what do you think about this?
might be able to do weightOptional.orElse(-1)
public static int getWeight(String name) {
return Main.luckPerms.getGroupManager().getGroup(Main.api.getUserManager().getUser(name).getPrimaryGroup()).getWeight().orElse(-1);
}``` thanks
enable java annotation processor
is here someone that can help me with the luckperms api stuf?
I want to get a players group that he/she has on my server in my custom plugin. i got the code from the site (https://luckperms.net/wiki/Developer-API-Usage#finding-a-players-group) but how do i use it ?
!cookbook here's an example plugin if you need help - there should be an example of that in it
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
okey thx
wel i got the code from this site but i don't know how to use it (i can't find it ether here)
what exactly are you trying to accomplish
wel can you come in call it is alot of typing
no
okey then i'll do my best
so i'm making a minecraft plugin that has the luckperms rank on a scoreboard but i don't know how i get the rank so i googled it and came on some code
public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
for (String group : possibleGroups) {
if (player.hasPermission("group." + group)) {
return group;
}
}
return null;
}
but how do i give it my ranks on the server
it uses the LP Api, your plugin communicates with LuckPerms Bukkit to get the information. that's why this interface exists.
this definitely is in cookbook
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/User.html#getPrimaryGroup()
This may be of more use to you
so if i use the code i gave i just neet to pass in the org.bukkit.event.player.PlayerEvent and then for my ranks i need to get it like this "owner, admin, staff, builder, vip, default" ?
if you want their primary group, just get an instance of LP in your plugin, load the user, and get their primary group as a string, and display that on your scoreboard.
Yes, cookbook has multiple examples, as well as comments telling you what the code does. i'm not going to spoonfeed you the code if that's what you're asking for.
oke np
!api
Learn how to use the LuckPerms API in your project.
!tab
LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!
line 32 is where I get the api
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
heres it syntaxed
17.08 21:30:01 [Server] ING Exception encountered when loading plugin: BungeeStaff
17.08 21:30:01 [Server] INFO net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
17.08 21:30:01 [Server] INFO This could be because:
17.08 21:30:01 [Server] INFO a) the LuckPerms plugin is not installed or it failed to enable
17.08 21:30:01 [Server] INFO b) the plugin in the stacktrace does not declare a dependency on LuckPerms
17.08 21:30:01 [Server] INFO c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
17.08 21:30:01 [Server] INFO (call the #get method in onEnable, not the constructor!)
17.08 21:30:01 [Server] INFO at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:53)
17.08 21:30:01 [Server] INFO at me.ohbuzz.BungeeStaff.onEnable(BungeeStaff.java:29)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:265)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.BungeeCord.start(BungeeCord.java:285)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
this is the error i get when I add the LuckPermsProvider.get() to the onEnable() in my main file as it insists
anyone got any tips???
read the error
yes ive read it
ive used this same code without an issue
but rn its giving an error
the luckperms plugin is activated before my plugin
it declares it as a dependency
im not trying to get the api before the plugin enables
which is why Im going to support for the issue
ive already tried fixing the issues it gave me
How are you building your plugin? Maven/gradle..?
maven
make sure you declare the dependency with <scope>provided so you are not accidentally shading it
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
thats in the pom
but if i hover it says "Non-Project Files"
is it supposed to say that
what do you run to actually build a jar file?
like ide?
how are you building the jar
Plz somoene help me i put all the things in lucky perms But dont work i aleary use the add group command in my friend but hes cant use the commands
Yeah don't actually do that, use maven for its purpose (it's a build tool for.. well.. building), either run mvn package on a command line/terminal in the project dir, or IntelliJ has a little maven tab on the right hand side (by default), somewhere in tasks/goals/lifecycle it lists "package", hit that
Artifacts is IJ's own way of managing dependencies and building, maven is that same thing, mixing and matching them is no bueno
okay gotcha. I removed those available elements and just let maven do its work and it worked. Thank you Emily so much <3
Return the user future
public static CompletableFuture<User>
then return userFuture
remove the .join()
These are all questions about java itself and not necessarily the luckperms api - you should checkout the javadocs for the api as well as some of the classes it commonly uses; such as completeablefuture
Hi, how can i get player's highest group from lp db?
without lp api, bc i'm creating web app
hm?
How can I add an permission to an User with the API inside from a Plugin?
Hey, I'm using CompletableFuture and I'm having issues regarding it.
If I run my method to give permissions to a user on the main thread it always gives 34 permissions, but while running it with CompletableFuture it only gives some, sometimes 12 and sometimes 33, so it's random, but never gave 34. Does LuckPerms have a limitation?
If not what could be the issue?
show code
addPerm method
have you tried debugging it yet
yes, but what do you suggest specifically?
logging the steps and what it does i guess
So I debugged everything and it's 100% something to do with LuckPerms, so does LuckPerms have kind of limitation or can handle 34 node permission adds?
Get the user once and then add all of your permissions in one go
same way you get the expiry time of any other node
Hi, how can i get player's permission matched with pattern?
How can I get the permission node of a command using the luckperms API?
As in find the permission for the command or?
Yes, find the permission required to execute said command
I don't think you can? That would be something that's handled by the plugin providing the command.
I do believe LuckPerms maps the permission node of every single command once there is a permission query event
It then put thats in some database to my knowledge
I need to access that database
It's not quite like that
LuckPerms knows nothing about no command, permissions are not "part of a command", and all LP gets is just any permission check regardless of source
The other plugins literally just ask Luckperms "does this user have this permission?" Then the other plugin handles the response.
So its actually not possible?
a permission is a key to be allowed to do something, whether that's a command or something else like moving around, killing entities etc LuckPerms doesn't know
it does keep track of every permission checked since the server was started however, don't know if that is of your interest
alright thanks for the help
I will output the luckyperms database data as json, but I am not getting some information from the database data.
sample
group owned by a player and their permissions
how can i output this data to json
I will only use the database data for api purposes, I will get json output with php
plss help
Why not use the REST API extension to use the API rather than scraping the database directly?
https://luckperms.net/wiki/Standalone-and-REST-API#luckperms-rest-api-for-developers
no no
i need this json output
why do you need all of the data, and not just parts of it from the api
I want to get this output what should I do in the config
Querying storage directly isn't exactly supported in general (which is why the REST API extension exists), but if you get the data directly from the database you're... getting it directly from the database and handle it yourself, you can't get it serialised in some other storage format
Hi 👋 I tried to read the LuckPerms doc but I didn't find something I need. I need to set a temp prefix (for a 30 days duration) for a player, how can I do that please ?
!help
!advanced
!api
!argumentbased
!ask
!bedrock
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!forgepermissions
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki
you specify the expiry date or duration in the NodeBuilder, see the various expiry methods
https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/node/NodeBuilder.html
I'm sorry, tbh I didn't understood how to use the api. is it possible to send me the code to update the player's prefix for 30 days ?
I don't have the time or energy or willpower right now to do and provide that as for I am going to sleep, but I can link you to the relevant bits and pieces needed to do that.
You can create a builder for a PrefixNode like shown in here https://luckperms.net/wiki/Developer-API-Usage#creating-new-node-instances and in the Builder itself specify the expiry duration with any of the expiry methods from the link above
Then you need to add it to the player's corresponding User object, you get it like explained here https://luckperms.net/wiki/Developer-API-Usage#obtaining-a-user-instance, and then add the built prefix node to the user's node map https://luckperms.net/wiki/Developer-API-Usage#modifying-usergroup-data
that error has nothing to do with LP
The error isn’t at line 41 ?
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
String join_message = main.getConfig().getString("join-message");
for (Player e : Bukkit.getOnlinePlayers()) {
String prefix = player.getCachedData().getMetaData().getPrefix();
e.sendMessage(MiniMessage.miniMessage().deserialize(join_message, Placeholder.component("player", player.displayName())));
}
}``` Am I doing something wrong?
you need to convert the bukkit player to an lp user to use lp methods
!api
Learn how to use the LuckPerms API in your project.
No it is, it just isn't caused by LP. A NullPointerException (NPE) means that you tried to run a method on a null variable, or was thrown because you passed null to a method.
Thus, either luckPerms is null, or player is null. With that one snippet, I don't have enough info to be able to know for sure which
read the dev api docs, top link of the clippy message before yours
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}``` So, this is what I need?
Something to that effect, yes, although of course you need to keep in mind variable scope
Yes you should have a public getter, although ideally without static abuse
Using the API, is there a way to determine what prefix has a higher/lower priority?
i assume there is a way to get the weight
I can't seem to find anything in the wiki about that.
Hmm, I'm not sure how to use that. Is there an example on the Usage wiki?
you dont know how to use what
getPriority in the instance of the player's group.
you have to use getPriority on the prefix node itself
May you point out how to use nodes? I've been looking at the Usage wiki and once again there's not a whole lot that really stands out to look promising.
!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.
Here's my current code if needed: java @EventHandler(priority = EventPriority.HIGHEST) public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); String join_message = main.getConfig().getString("join-message"); String resourcepack_join_message = main.getConfig().getString("resourcepack-join-message"); User user = luckPerms.getUserManager().getUser(player.getUniqueId()); String prefix = user.getCachedData().getMetaData().getPrefix();
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetPrefixCommand.java the code for getting the priority of their highest prefix is similar to this
just adapt it to not just check inherited nodes
you also have CachedMetaData#getPrefixes() which returns a map using priority/weight as key
so just find the entry with the greatest key
you need to really learn to check javadocs and search through api examples, I’ve touched the api very few times and I instantly found 2 methods (albeit with decent knowledge of how it’s structured)
If anyone needs to print out prefixes this is how I did it in my plugin, very simple and straight forward.
While this is simple. It is not really the best way to do it. Because you are cancelling the chat event, meaning if you ever mute the player or have other things that you're wanting to show in the chat, it won't work.
the best way, is to change the chat format.
This plugin is for a very specific usecase, sorry about that, just wanted to show the prefix get part.
Hey guys, I'm working with luckperm and I am wondering how to change the parent of user?
!weights is the easist way
LuckPerms allows you to set weights in order to determine the priority of certain nodes, like permissions and even prefixes. A higher weight number is a higher priority.
how do I get user uuid in NodeAddEvent?
With the API or?
yeah with the api
Users have a #setPrimaryGroup() function
/**
* Sets a users primary group.
*
* <p>This modifies the "stored value" for the users primary group, which may or may not
* actually take effect, depending on how the platform is calculating primary groups.</p>
*
* @param group the new primary group
* @return if the change was applied successfully
* @throws IllegalStateException if the user is not a member of that group
* @throws NullPointerException if the group is null
*/
@NonNull DataMutateResult setPrimaryGroup(@NonNull String group);
but I want de obtain the UUID in de NodeAddEvent
There is a an example here
User user = Main.luckPerms.getUserManager().getUser(player.getUniqueId());
user.setPrimaryGroup(permission);
Main.luckPerms.getUserManager().saveUser(user);
I'm trying with this code but still don't work, Am I something wrong?
Doesn't work as in, it errors, or just doesn't change the parent group
I think it's second
?
doesn't change the parent group
* Sets a users primary group.
*
* <p>This modifies the "stored value" for the users primary group, which may or may not
* actually take effect, depending on how the platform is calculating primary groups.</p>
*
Did you read that bit
Ah I didn't I'll read it
In the config for luckperms, what is the primary-group calculations set to?
but I can't use e.getTarget().getUniqueId()
I didn't change nothing in config for luckperms
it set to "primary-group-calculation: parents-by-weight"
Then if you're wanting to change the primary group, just make the group, you want to give them have a higher weight than the groups they currently have.
ahh the other's (what will change to) primary groups should be higher weight than original groups(player's group) am I understand right?
Because parents-by-weight is set, whichever group the player has with the highest weight, will be the players primary group
Thank you, but how can I change the weight of the primary group?
Using the api? Quickest way is to just do it in LP itself.
Ahh kinda like cmd in game?
lp group <name> setweight <weight>
ahhhh
Otherwise it's weight.<weight> in the editor
Read the example, you should be able to.
private void onNodeAdd(NodeAddEvent e) {
if (!e.isUser()) { // Checks if the event is getting triggered for a player
return; // return out of function if it wasn't a user. (i.e It was a group instead)
}
User target = (User) e.getTarget(); // The user the event is getting triggered for
Node node = e.getNode(); // The node that was added
thanks
What if the primary-group-calculation value is stored? Ignore the weight?
Yes
and is a method to get who has give the node?
# - Possible options:
# => stored use the value stored against the users record in the file/database
# => parents-by-weight just use the users most highly weighted parent
# => all-parents-by-weight same as above, but calculates based upon all parents inherited from
# both directly and indirectly
Ahh than if it's it "stored" the below code'll work right?
User user = Main.luckPerms.getUserManager().getUser(player.getUniqueId());
user.setPrimaryGroup(permission);
Main.luckPerms.getUserManager().saveUser(user);
Try, haven't done it myself personally.
Ok I'll try it
I changed the primary-group-calculation option to stored But It doesn't change the primary group
OOH I see, I think it's luckperms who's null because player is not.
mm I think so
but how can I get source on a NodeAddEvent?
e.getSource() does not exists
Learn how to use the LuckPerms API in your project.
Hi, I don't understand everything at how work the API of luckperms, I have this code here but it doesn't change my prefix, can you help me why please ? (I got no error)
you can just do data().add(node…
don’t think it’s a good idea to do a toString on a prefix mode
the problem is if I don't put toString it's an error
well what's the error
remove the node.builder
Still not working
Anyaway, instead of using the api, i’ll use console command
How can I add an Permission with the Luckperms api? Can you send me the Code for that?
!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.
Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i).max().orElse(10);``` I have this, how could I get the prefix of the `priority` variable?
My goal is to have a prefix for the highest and lowest priority.
you want to get a prefix from an integer...?
Well, not exactly, something similar though
I'll of course need to alter the int variable to a string, just not sure what else to put.
Hello, if I create a contextcalculator on velocity, can that same context also sync data to the bukkit-based servers?
If yes, how so, it doesn't seem to do it by default? If no, are there other recommended ways to sync data without leaving the luckperms environment? If all else fails, I will probs go back to redis or plugin messaging.
(context: I only want a group to apply under a certain circumstance. This circumstance is known by the proxy and therefore I was hoping to use contexts rather than adding and removing groups on players... that seems like it is prone to issues)
you could have you proxy plugin communicate with a plugin on the backend server to apply the context there
you would need to implement that yourself though
developer of 90k+ member server asking for help
is there a problem with that?
Why should I struggle when I can ask the team that provides the plugin we use x)
Just because I maintain a big server doesn’t make me all knowing 
(i wish it did tbh)
what its like running a server
Any way to make %luckperms_primary_group_name% display when player is offline?
of some way to display the prefix of a player when they're offline?
everyone will have some problems that they arent sure how to solve
any ideas?
It displays "no-match"
this is #luckperms-api
ok, so where do I ask??
I assumed it could of been to do with api
are you creating a plugin?
no
then you would not be using the api
ok, i've asked in #support-1
I am trying to set a player's group with the developer API but when I check the result it returns FAIL. What am I doing wrong? ```java
var lp = LuckPermsProvider.get();
var player = event.getPlayer();
var user = lp.getPlayerAdapter(Player.class).getUser(player);
user.setPrimaryGroup("dev");
lp.getUserManager().saveUser(user);
ALog.debug(user.getPrimaryGroup());
!api
Learn how to use the LuckPerms API in your project.
I couldn't find anything in there
!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.
in my plugin.yml I have this gmc: description: Easily toggle gamemode creative permission: hycordia.gmc usage: /<command> [player] the hycordia.gmc permission is required to change your own gamemode, and the hycordia.gmc.other permission is required to change someone else's gamemode. How can I add the permission hycordia.gmc.other to the plugin?
what do you mean by "add the permission"?
all you need to do is make a permission check like you normally would
I want it to show up within luckperms
it will
in my gmc command: ``` if (!checkPermission(player, "hycordia.gmc.other")) {
```public static Boolean checkPermission(Player player, String permissionNode) {
User lpUser = getLuckPermsAPI().getPlayerAdapter(Player.class).getUser(player);
CachedPermissionData lpPermissionData = lpUser.getCachedData().getPermissionData();
return lpPermissionData.checkPermission(permissionNode).asBoolean();
}```
is there a reason you arent just using bukkits CommandSender#hasPermission() method?
does that take into account luck perms?
luckperms is a permissions plugin
it provides permissions
using the luckperms api directly for normal permission checks is just locking yourself out of using other permission plugins if you ever want to switch, or stops other people from using whatever they prefer if you make the plugin public
as if that was a bad thing :p
it wont be a bad thing until one day some new better permissions plugin comes along and becomes the most used permissions plugin and then theres stuff that only works with LP for some reason
never!!
can we speak italian?
How can i send a Update ping for a user?
wdym by update ping
when i set a suffix like this:
User user = luckPerms.getUserManager().getUser(spieler.getUniqueId()); if (user == null) return; SuffixNode node = SuffixNode.builder(suffix, 150).build(); user.data().add(node); luckPerms.getUserManager().saveUser(user); Are the changes only there as soon as the user rejoins
does it update correctly if you change it manually with the command in-game?
are you getting its value on bungee or a backend server?
via bungee, but all backend servers and bungee a connected via sql with the same database
Do you have any idea how I can update it myself? I can't find anything about it in the docs...
i did that
DataMutateResult result = user.data().add(node); System.out.println(result);
and i get SUCCESS
is that right?
before saving i get the suffix and after saving still the suffix
but it dont updates ingame xD
only if i rejoin
if you print it before and after though does it change?
nope
bevore saving i get this ImmutableNode(key=suffix.150. test, value=true, expireAt=0, contexts=ImmutableContextSet([]) and after it the same
That are my methods to remove and add the suffix
I'm pretty new to programming so sorry if it's not quite right
You can use the messaging service to send a user update :)
The saveUser call will store the new data in the database
Then you send an update ping using the msging service to notify other servers “hey the data has changed, refresh from the db”
How can I update it with this?
LuckPerms.getMessagingService
just that?
MessagingService.pushUserUpdate
Those two, chained together
(Sorry I’m on mobile)

Do you mean so? luckPerms.getMessagingService(MessagingService.pushUserUpdate); (Sorry im inexperienced)
luckPerms.getMessagingService().pushUserUpdate() i think
it does not work
Something like that
The class/method names will not match exactly
Awesome 😎
Hey, how i can get expiry date of the parent group with the highest weight ?
Is it possible to get the list of cached permission nodes that luckperms uses for it's webGUI auto completion?
Figured out I could use LuckPermsProvider.get().getPlatform().getKnownPermissions()
Hi, how do I determine whether a user has some permission? This is the first time I'm working with LuckPerms from a mod/plugin perspective and the API is a bit overwhelming.
I just need to test whether a user has some permission like my_mod.command.reload
Can't you use the permission api of the platform you're using?
I can do that when on the plugin target, but I'm also compiling to a mod where I can only get the vanilla op-levels
Alright, thank you!
How do i get group track?
so can i have collection of group tracks using api?
go through every track and see if it has the group you want
How can I remove context from a Node I copied?
This works to add a world as context, but how do I remove?
group.data().add(node.toBuilder().withContext(DefaultContextKeys.WORLD_KEY, world).build());
nvm got it. took me a bit
Hi ! How to set player suffix please ?
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
thx
How should I add my CustomStorageProvider on Spigot?
Because the necessary classes aren't exposed as the part is isolated in the jarinjar
Hello! I'm using PlaceholderApi for my plugins, but i'm doubting if I should use luckperms papis or objectiveScore papis (these check vanilla scoreboards, for example a score 0 or 1.)
What is more efficient? LP's papis, or to check scoreboards?
what does luckperms have to do with the vanilla scoreboard?
I want to check a boolean score, but i'm wondering if LPs permissions are more efficient than searching a scoreboard score.
benchmark it and find out ¯_(ツ)_/¯
why not just use a map or something in your plugin though?
and if you want persistent storage, javas file classes arent too difficult to work with
I will take a look into it, thanks!
Does someone know how to do that?
first,
Wonder why you want to do this in the first place.
I want to use a database which isn't implemented, because it is better for my use case in most situations
what database?
OrientDB
according to wikipedia, orientdb supports sql queries
have you tried that with luckperms yet?
if it works, itll certainly save you a lot of effort
But I want to implement it another way as it is build as a document database with graph capabilities which wouldn't be best to use with relational design
i kinda oofed luckperms

Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
i kinda did a oop
i always like to break luckperms XD
but fun thing is. im not even using offline lookups
send your code
unless
i yeeted something i shouldnt have yeeted
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
https://hastebin.com/fepurivobe.kotlin second one
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
fun thing is. i never had that message popup so idk if i broke something
did that so the tablist updates
yeah, you're doing a player lookup on the main thread.
should i not do that?
sync = on main thread
Ask the author of the plugin making the request to perform Vault calls for
offline players "asynchronously"
No
Dont block-lag your server with lookups on main lol
Aren't there methods in Vault that take the Player directly? Why are you checking by player name?
WAIT FUCK
and why are you using the variable p in your for loop, but using player right below it?
exactly this
i just noticed this
im stupid

see. a weekend isnt something for me lol
now the message is gone
how to denied to join any world? in luckperms
asking the same question in 4 channels will not get you a response any faster
!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!
Hi, for some reason my plugin can't load the provider for luckperms and always returns null, Anyone got any ideas?
https://pastes.dev/g92R1lOgqN
You did add luckperms as a dependency right?
No, i meant as an actual dependency in your pom.xml or gradle build file
You missed the <scope>provided</scope>
this is more of a Java question.. but does anyone know of a way to return that value from a lambda function? I want to return if a player has a specific role while their offline
private boolean isTimedOut(UUID uuid) {
LuckPerms api = LuckPermsProvider.get();
UserManager userManager = api.getUserManager();
CompletableFuture<User> userFuture = userManager.loadUser(uuid);
userFuture.thenAcceptAsync(user -> {
Collection<Group> inheritedGroups = user.getInheritedGroups(user.getQueryOptions());
for(Group group : inheritedGroups) {
if (group.getName().equals("timeout")) {
//this returns the labda function not isTimedOut(UUID)
return true;
}
}
});
return false;
}
You can't. Treat a lambda like it's an entirely different method, because it is.
There's a couple different ways to handle this situation, easiest being just blocking the thread, but this will also cause problems if anything else is on the thread
hm.. thanks
i'll probably just put the code in my onCommand( so I don't have to return from the labda
I can't access the main thread from inside lambda
well yeah as the method says it's running it async
No because it requires a data load, which is expensive
LP won't allow you to do a data load sync since it'll cause a massive lag spike
easy way around that, schedule a task inside the lambda to run sync, then toss whatever sync code you want in there
ah.. I should probably rethink how I'm managing timed out players, maybe I shouldn't make it tied to a role
oo
Well why do you need to query it when they're offline?
when a mod toggles their timeout
(also the one problem with the schedule a task solution is you start getting into "callback hell" aka a mess of nested lambdas)
mmk fair enough
yeah it will be a lot of nested labdas
:/
ok putting it in a scheduled task worked, thank you!
Hey everyone! I had a question about the API regarding how permissions are checked. Cause I'm not totally sure how that's taken care of by minecraft in the backend.
All say I'm working in paper and velocity.
I'm wondering if I'm able to just use the player.hasPermission to check if a player has a permission that's been granted via luckperms. Does that information get saved in a way that I can access it through that method? Or do I need to actually get my hands dirty through the API?
for simple permission checking, all you need to do is use the standard method of checking permissions on whatever platform you are using. i only know that bukkit has a hasPermission method for CommandSenders (which includes entities, players, command blocks, and the console), but i assume velocity and bungee have a similar easy way to do that.
Okay! So just to be sure, I could just do something like this on a join event and it should be okay?
Player player = event.getPlayer();
String serverName = "server1";
if(player.hasPermission("pluginName."+serverName+".access")) {
// Do something
}
Then I just give the player pluginName.server1.access in the LuckPerms dashboard and it should work?
yeah
awesome, thank you.
This is my first time really working with minecraft's permissions system (usually I just use the default command perms that you can define in plugin.yml) so I'm pretty new to it haha
well its not minecrafts permission system
minecrafts "permission system" is op levels
which are not very useful
i think bukkit was what started the current standard for permissions, but it still only exists with mods
okay yeah, sorry that's sorta what I meant, cause yeah I know that vanilla doesn't really have any useful permission stuff as you mentioned
heyy i want to setup some perms to my sever
can anybody help me??
basically i want a builder role who has perms to place/break blocks but cannot drop items because he/she is in creative
Hello everyone, tell me how to delete player accounts
you would need a plugin that lets you use permissions to determine the ability to drop items, then you'd also need (or perhaps it's built-in) a context for gamemode
yeah i got to know how its done using worldguard thx
update on this issue: switching to promoting the user via UserManager#modifyData seemed to solve my issue. I’ve not a clue why, but it works for me so 🤷♀️
how do y'all do wildcard support with unregistered permission nodes
what do you mean?
- just means every permission
- is valid for
fjhaiefhisdhfjhdsaifhisadhfjiasdhfiif you checked that permission
not by default, for wildcard to work permission nodes have to be registered in the plugin.yml of a plugin, but somehow luckperms gets the unregistered ones 🤔
luckperms doesnt care about plugin.ymls
at least not as far as i know
im pretty sure only bukkit has them anyways
fabric and forge at least have no such thing
I mean it does for permission discovery for completions, but it doesn't affect calculation afaik
Actually if there's no node set for something, it might respect the default setting if it's set to all
but it won't affect wildcards
actually theres an option in lp to respect plugin.yml default permissions
defaults to true
but its only for bukkit
but that has nothing to do with wildcards
found it n got it working
(for reference for other coders) they get the crafthumanentity from the player, and get the perm declared field which is a PermissibleBase object. They then create a new permissible of their own creation which extends PermissibleBase and set all of the permissions in the old perm to the same in the new one of which they then set to the perm object in crafthumanentity using NMS. Their extension class of PermissibleBase contains methods such as hasPermission which they override to include wildcard checking
Hey, how would I go about finding the server url and Api key of my luckperms server
apiKey: '<your API key>'```
Anyone know how to find the apiKey?
@cobalt otter Hey, I assume it was you who sent me an email 🙂 Where you find the URL depends on what type of hosting you're using. Are you on shared hosting like BisectHost, Shockbyte, etc, or do you use a VPS/Dedicated Server/your own PC?
The API key can be set in your LuckPerms config after installing the LuckPerms-rest extension if I remember correctly
Hey! Thanks for getting back to me. I appreciate it.
I am using deplexhost, which is like shockbyte.
How would I go about installing the extension ? Is it a plug-in ?
Is there a quick n easy way to get an offline player's permission nodes as strings after loading the user data?? Something really simple that resembles Player#hasPermission ?
!api
Learn how to use the LuckPerms API in your project.
check the second page linked^ @willow folio
Yeah I figured something out, thanks though :)
Oh nevermind it doesn't work
User user = luckPerms.getUserManager().loadUser(player.getUniqueId()).join();
if(user.getNodes(NodeType.PERMISSION).contains(Node.builder("arthworld.rank.owner").build())) return Rank.OWNER;
Wouldn't this work??
Oh it doesn't consider inherited data
correct
you should use the cached data
which is explained in the second page linked :p
Well cached data wouldn't always be up to date right
How do i set the world group/player prefix?
Create a PrefixNode and use the .withContext(DefaultContextKeys.WORLD_KEY, "<world name>")
To add the context to it
Then just assign that prefix node to a group/user
@robust yacht ^
world prefix?
prefix of a group in a world
the thing i am setting here
String prefix = user.getCachedData().getMetaData().getPrefix();
To get the prefix users current prefix
PrefixNode does have a getContexts() method as well, since it inherits from Node
Should work. Try it and see what happens
If this doesn't work, try node.getValue() instead of getMetaValue()
Hi, I'm trying to get when a user primary group is set using the parent set <group>
What's the event that's triggered when this particular command is executed ?
I could be wrong, but I think it may be the UserDataRecalculateEvent
I tried it
never printed out anything
get the group with the name default
well im making a plugin where i don't know the default group name
should i make it configurable ?
That's my current approach
Getting the group with the least weight
in luckperms, it will always be default
oh so , any user cannot change it's name ?
!default
LuckPerms provides a group that every player is added to upon joining the server, called default. You can use multiple methods to change the default group or change the name of it.
Ty
Is there some API to use custom weighted meta nodes? I want to store the tablist color for users as weighted metadata to allow important groups to overwrite other colors.
I like the idea of prefixes with the weights but I don't see a way to implement own weighted metadata.
By default the value for a certain meta key is the "first one found" when traversing the inheritance tree, that is to say it is driven by the group weight + group inheritance setup
https://github.com/LuckPerms/LuckPerms/blob/1790c0ad4744d31ea3e30eb87822b4f506de449b/bukkit/src/main/resources/config.yml#L473-L488
oh, that should be good enough, i can use the group's weight too. thx
i have a small issue
whenever i update a user permission (in my case : "bungeecord.command.server")
it update successfully in the web editor but i have to quit the server and rejoin for the permission to be applied how could i fix it?
my code :
User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(p);
user.data().add(Node.builder("bungeecord.command.server").value(true).build());
LuckPermsProvider.get().getUserManager().saveUser(user);
Mention me when replying 🙂
and how to add and remove players from groups will help me too .
Do you add the permission on a backend server and want to check the permission on the bungeecord server?
yes, this code is in a backend server (spigot server) but i am checking it in the same project
i am doing a login plugin so when you successfully logged in you should get that role to go to "Lobby" server
Then you should use the messaging service to push the user update to the proxy.
Should be ..saveUser(user).thenAccept(n -> LuckPermsProvider.get().getMessagingService().ifPresent(s -> s.updatePing(user));
but my plugin is in backend server will this work ?
Yes, the backend LuckPerms instance will push a update message to the proxy and LuckPerms on the proxy will reload the permission data from the user
that sounds good i'm gonna try it now
your code should be under my code right?
wait a sec i figured it alone 😂
Yes, but updatePing is probably the wrong method name
i got those
brooooooo it works!! Thanks a lot i just trying to fix this since 2 days 😂
for anyone who has the same problem use this code:
User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(e.getPlayer());
user.data().add(Node.builder("permission").value(false).build());
// Now save changes.
LuckPermsProvider.get().getUserManager().saveUser(user).thenAccept(n ->
LuckPermsProvider.get().getMessagingService().ifPresent(s -> s.pushUserUpdate(user)));
thx to @brazen spire
Hello, how can I get the group prefix? I already have the group instance
!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.
Thank you!
how do you get a groups members?
You'll need to iterate through all the players, and check for the group and then if the group is found, add the player to a list.
Just search for the "group.<group name>" permission
Hello is there an event when a player changes of group? I want to update their ranks in the tab when it changes
public static Group getPrimaryGroup(UUID uuid) {
LuckPerms luckPerms = LuckPermsProvider.get();
User user = luckPerms.getUserManager().getUser(uuid);
if (user == null) return null;
return user.getInheritedGroups(QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build()).stream().max(Comparator.comparingInt(a -> a.getWeight().orElse(0))).orElse(null);
}```
that doesn't seem to get the group when they are offline
however does (using a Player object rather than a UUID) when they are online
Yup, offline players aren't loaded. You have to load them
ah
so userManager.loadUser()?
why is this so painful
so many completable futures
fuck it, i don't even want to use it anymore
i'll just rely on cached data
unless there's another way
is there any way to know if the offline user's cached data is up to date?
or if I want always up to date data, do I have to use UserManager#loadUser(UUID) method? does this method always fetch the database?
Correct, load is it loading from the storage method
how do i make it so my rank transfers through other servers?
Hello, I want to add players who join for the very first time to a group, I've tried
User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(player);
user.setPrimaryGroup("group.admin");
and I have also tried
User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(player);
DataMutateResult result = user.data().add(Node.builder("group.admin").build());
But none of these work it does not add the player to that group for some reason? If anyone could help I would really appreciate it
save the user
are there any cases when LP doesn't have all groups loaded?
I tried that as well, but I’m getting luckPerms is null when I create
private LuckPerms luckPerms; and make a constructor for it, how do I make it not null?
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
and it says luckPerms is null
nvm figured it out, thanks!
Is it possible to get a meta data tag of an offline player?
I am trying to parse the rank name, specially formatted (aka the metadata tag). On a leaderboard where all players should be able to be offline, and their rank still display on the leaderboard. However with my current code it only is able to fetch the rank name when the player is online.
Basically I want to take out the placeholder middle man and make my own query of an offline player for a meta data tag
Here is my current code
LinkedHashMap<TopVoterPlayer, Integer> topVoters = votingInstance.getMainClass().getTopVoter(topType)
int i = 1;
for(Map.Entry<TopVoterPlayer, Integer> entry : topVoters.entrySet()) {
if(i == position) {
OfflinePlayer potentialPlayer = Bukkit.getOfflinePlayer(entry.getKey().getUuid());
String rankPrefixRaw = PlaceholderAPI.setPlaceholders(potentialPlayer, "%luckperms_meta_prefix_board%")
String rankPrefix = PlaceholderAPI.setPlaceholders(potentialPlayer, rankPrefixRaw)
return rankPrefix + " " + entry.getKey().getPlayerName()
}
i++;
}```
That will tell you the process to getting data from offline players
is there a way to load an offline player without completable futures?
no
I'm trying to fetch the data of an offline player, but this is just returning empty, and I'm very sure that it is a player that has logged in and a proper UUID. As well as the api is loaded, otherwise I'd have an NPE. It just returns an empty string
for(Map.Entry<TopVoterPlayer, Integer> entry : topVoters.entrySet()) {
if(i == position) {
UserManager userManager = luckPermsApi.getUserManager()
CompletableFuture<User> userFuture = userManager.loadUser(entry.getKey().getUuid())
userFuture.thenAcceptAsync {user ->
CachedMetaData metaData = luckPermsApi.getPlayerAdapter(User.class).getMetaData(user)
return user.toString()
}
}
i++
}```
I just checked and I believe the line CachedMetaData metaData = luckPermsApi.getPlayerAdapter(User.class).getMetaData(user) is actually just stopping the thread
Apparently the player adapter is only for the online player object?
the player adapter is for the platform's player type
Player.class, ProxiedPlayer, ServerPlayer, ...
you already have the user object, you can simply getCachedData getMetaData
I did that, but now I am ending up with only one node when I query it
for(Map.Entry<TopVoterPlayer, Integer> entry : topVoters.entrySet()) {
if(i == position) {
UserManager userManager = luckPermsApi.getUserManager()
CompletableFuture<User> userFuture = userManager.loadUser(entry.getKey().getUuid())
userFuture.thenAcceptAsync {user ->
Bukkit.getLogger().info(user.getNodes(NodeType.META).size())
Bukkit.getLogger().info(user.getNodes(NodeType.META).getAt(0).metaKey)
return user.getNodes(NodeType.META).getAt(0).metaKey
// return user.getNodes(NodeType.META).stream()
// .filter { node ->
// node.metaKey.equalsIgnoreCase("prefix_board")
// }.collect(Collectors.toList()).get(0).metaKey
}
}
i++
}```
This produces the output
1
lp-editor-key
If I am trying to get a meta node that the user inherits from a group should I get their highest weight group and read the meta from the group instead?
I want to get meta data from the users highest weight group
Should I just get their inherited groups and sort the stream by weight or
and why not the resolved value from the cached metadata?
because it only has the user's meta data
it doesn't have its inherited meta data
from what i can tell
if it did my user would have way more meta nodes than just one
the user itself will only have whatever the user has, the user's own nodes do not include inherited ones
Exactly
Hello When my friends are nicked in my server with luckperms chat and essentials the nick only showes up in tab and not in chat does anybody know the reason for this?
!chat
LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!
Hey, is there any distribution of LP implementations? I wanted to run the game on the IDE with LP loaded
!download ?
You can download LuckPerms for Bukkit/Spigot/Paper, BungeeCord, Sponge, Fabric, Forge, Nukkit and Velocity.
Sorry should have clarified I mean of artifacts on maven like just the API has
eh no there's no platform implementations on maven since that doesn't make sense. Maven is only used for APIs.
What are you actually trying to do?
I'm developing a fabric/forge mod and recently added LP compatibility for permission checks, I wanted to be able to run the game in debug mode with a LP distro w.o having to rely on flatfile deps
can't you just load the LP mod like normal?
we can but it's nowhere near as convenient when you're not the only developer
but ig the answer is no, it's usually a common thing for more prominent mods to provide but ig LP is new to the space, thanks for your time :D
I guess that must be a wierd workaround for the modded community because from what I've seen in the plugin community, people just manage other plugin deps for dev servers manually
!api
Learn how to use the LuckPerms API in your project.
hi, how to remove parent group from a player with api?
i tried Objects.requireNonNull(user).getInheritedGroups(user.getQueryOptions()).remove(group) but it doesn't work, and don't see other ways
Use an InheritanceNode and remove the group that way
ooh, yeah, thanks!
Hi i want set to a player a parent, do you think its better use Server Command or use API?
probably api
I got a question is here anyone who can help me i'm making a plugin and wants to put a players luckperms prefix (his rank) in my score board. But my problem is that it won't work (i got the prefix but i cant get it in my scoreboard)
If your scoreboard supports placeholderapi, just use the placeholder for the prefix
And how can i see that ?
if my scoreboard supports placeholderapi
by looking at its documentation
wel can you come in a voice chat ?
no i was thinkin private chat
oke i'll see if it supports the placeholderapi
i don't think it supports placeholderapi (i'm using the org.bukkit.scoreboard )
oh you are making a plugin
yes
then just add placeholderapi support to your plugin
and can you give me an exemple how i can do that (i'm new at making plugins)
ow oke
how i can get queryOptions of a group?
Is it possible or not to take the queryoptions from a group?
I don't really understand the developer api
What are you trying to do with the Api?
I want to get a specific permission from a specific group
I already know how to take prefix, suffix, etc from a group, but I'm getting confused with the permissions
https://luckperms.net/wiki/Developer-API-Usage#the-basics-of-cacheddata Start from there - It explains it all
In this way it took the cachedmetadata of a group
I am trying to do another way to get the CachedPermissionData
You should be using something like:
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
``` To get an instance of Luckperms then using something like:
```java
User user = luckPerms.getUserManager().getUser(uuid);
``` To get an instance of the user.
Group group = luckPerms.getGroupManager().getGroup(groupName);
if (group == null) {
// group doesn't exist.
return;
}
``` Or that if you're wanting a group
QueryOptions queryOptions = group.getQueryOptions();
CachedPermissionData permissionData = group.getCachedData().getPermissionData(queryOptions);
That's the easiest way to get the cachedPermissionData of a group.
@tidal ermine
fixed
Hi all! I ran into such a problem, I wanted to make the / info command in one of the social networks. I get the player's nickname as a string. Therefore, in api I get the player as a string. So, if the player does not enter the server at least once, and on the server he has both donations and that's it, the user will be null
what
?
If a player leaves and some time passes, then there will be no data about him, why?
Users are unloaded when they are no longer needed (i.e. after they log out)
If you are unsure whether they are online or not you need to load the user
Not sure if this is the right place it ask or #support-1 was better but...
What is the easiest way to get an expiry time for a temporary permission but in seconds?
I was happing to use this info inside a JavaScript Placeholder to compare permission nodes expiry time and than have the output depend on which permission node has the longest expiry time. Just haven't been able to figure how to get the time in seconds.
Hello, does anyone know if all luckperms groups (not users) are loaded on startup or if they are loaded as players join?
If they are not loaded immediately, is there a known cache timeout before it will unload unused group data?
Hello, how to get a list with all groups in luckperms?
@lean mirage мб так
Server crashed and this came up. Luckperms was mentioned in the server dump
What can I do to fix
@zenith mantle go to one of the support channels, and also include the server dump
this channel isn't meant for that, and no one can help with Spigot's default err message
Hey a small question where can I find the maven dependency for the BungeeCord API ?
Learn how to use the LuckPerms API in your project.


