#luckperms-api
1 messages Β· Page 11 of 1
the lp api itself doesn't really change all that much so you could just do "LuckPerms:LuckPerms": "*"
yes that's what i thought, and that's what i tried. but it causes the server to crash on startup.
"OptionalDependencies": {
"LuckPerms:LuckPerms": "*"
},
i don't know if this has anything at all to do with LuckPerms lol, just asking here in case someone has done this already and seen it work.
i mean, that looks fine.. that is not directly related to luckperms however
what error/stack trace does the server crash with?
[2026/01/19 05
57 SEVERE] [PendingLoadJavaPlugin] Failed to load plugin G:\git\com.github\my\hytale\plugins\WorkbenchRepair\official\build\resources\main
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
at com.hypixel.hytale.server.core.plugin.pending.PendingLoadJavaPlugin.load(PendingLoadJavaPlugin.java:48)
at com.hypixel.hytale.server.core.plugin.pending.PendingLoadJavaPlugin.load(PendingLoadJavaPlugin.java:15)
at com.hypixel.hytale.server.core.plugin.PluginManager.setup(PluginManager.java:215)
at com.hypixel.hytale.server.core.HytaleServer.boot(HytaleServer.java:345)
at com.hypixel.hytale.server.core.HytaleServer.<init>(HytaleServer.java:303)
at com.hypixel.hytale.LateMain.lateMain(LateMain.java:54)
at com.hypixel.hytale.Main.main(Main.java:43)
Caused by: java.lang.IllegalArgumentException: String does not match <group>:<name>
at com.hypixel.hytale.common.plugin.PluginIdentifier.fromString(PluginIdentifier.java:97)
at com.the7legions.hytale.plugins.WorkbenchRepairPlugin.<init>(WorkbenchRepairPlugin.java:23)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
... 9 more
Boggles the mind because my entry is definitely in the format Group:Name lol
interestingly this only seems to be happen when debugging. i put my mod on a normally installed server and it loads with LuckPerms as an optional dependency just fine. must be an issue with my project debug configuration, thanks, checking that now.
For Hytale how do i use the luckperms api to work with a /rankup function to take my luckperms ranks a-z
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.5</version>
<scope>provided</scope>
</dependency>
theres no docs so idk how to use this
!api
Learn how to use the LuckPerms API in your project.
User user = luckperms.getUserManager().getUser(uuid);
commandContext.sendMessage(Message.raw(user.getUsername() + " is rank " + user.getPrimaryGroup()));
user.setPrimaryGroup("b");
luckperms.getUserManager().saveUser(user);
commandContext.sendMessage(Message.raw(user.getUsername() + " is now rank " + user.getPrimaryGroup()));```
its not saving for some reason
Add another test message before you save the user to see if it updates it.
still not working sadly
Try just setting the group, instead of changing primary group and see if that works.
I dont see anything on the wiki page to do that
nvm i figured out how to do it
Hi, is there any way I can find out when a player's permissions or groups expire? Are there any database changes that I can monitor, for example, or is this only checked again when the data is retrieved?
Could possibly use the NodeRemoveEvent to listen for when a node is removed from a user or group, just add some checks to make sure its a user and that its a group node.
And does that also work for offline players?
From what I know:
The event does fire for online and offline accounts as long as the user data is loaded into memory at the moment of expiry.
If the user is never loaded, LuckPerms may expire their nodes internally during a background task and then save - in which case the event may still be sent, but only if the backend scheduler loads that user into memory.
Otherwise you could technically create a VIEW or TRIGGER in your database and check the expiration date/timestamp.
There is also the node getExpiry and has hasExpired methods you could possibly use.
I just need something I can listen to and don't have to check
My goal is this: I have a list of many players and information about them in MySQL. I can retrieve and display this list. But I want players who no longer have a certain permission to no longer be displayed there. Ideally, I would like to insert them into another table. When selecting players, I don't want to first have to query the API for all players to see if they still have that permission. Do you understand what I'm trying to do?
Something like this doesn't "just" exist. If you would load every single user just to check the expiry, that could cause an overhead (depending on the amount of users are registered).
What you are searching for is a custom-solution which doesn't come from LuckPerms by default.
So you would have to create a plugin (or a scheduled task querying the LuckPerms database) which as access to the LuckPerms database and create a query to return the users and its expiry timestamp - if available.
For the users that are loaded into the memory, you could still use the mentioned NodeRemoveEvent.
I still could be wrong and if so, please correct me!
Hmm, okay, so the most sensible thing to do would probably be to just query the database
Hello ! I want to use luckperms in my hytale mod. What I need to write in the manifest.json please ?
I tryied "luckperms:luckperms": "*" in the dependencies section, but it doesn't work
Thanks !
it should be "LuckPerms:LuckPerms": "*"
inside the dependencies/optional dependencies block of course
Humm it's this yes, thanks !
But... I put it in dependencies
And when my mod start, LuckPerms is not ready, so I have my debug message saying that LuckPerms is not ready
Is this something else to do in the manifest.json ?
"Dependencies": {
"LuckPerms:LuckPerms": "*"
}
Okep, I found something.
Using BootEvent before calling LuckPermsProvider
When calling LuckPermsProvider.get().getUserManager() in hytale I get a java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider the mod is loaded and working, has anyone encountered this?
the message above yours :)
you need to add LuckPerms as a dependency in manifest.json
and the API is only ready during the start() lifecycle, not setup()
damm, I was trying to add the dependency but I was getting a cycling dependency error, aparently if you add a mod in the mod folder it automatically adds your dev mod as a dep
I meant that if you add mods into your run/mods folder the game automatically adds the plugin/mod you are developing as dependency in their manifest, making a depedency loop when hytale loads the game
add mods into your run/mods folder
on the server?
or somewhere else
I haven't come across that
how does the game know which mod "you are developing"?
what does your build.gradle file look like? that's probably because you're passing the --mods argument to the server when you run it. the sever will automatically load mods copied to your mods folder that is in the working directory used in the command to run the server even without the --mods flag, so if you add the --mods flag, even if it points to the same folder, you're going to get the server trying to load the plugin twice.
They've left the server, thanks for trying to help though
heh shrug, np π
updated the wiki with Hytale specific API instructions, and pushed a simple sample plugin:
:)
Hi, I'm adding a temp group in this way
.builder("group.bedwars_champion_division")
.expiry(60, TimeUnit.DAYS)
.withContext(ImmutableContextSet.of("server", "bedwars"))
.build(), TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING);
if (add.getResult().wasSuccessful())
LuckPermsProvider.get().getUserManager().saveUser(user);```
And removing it (even when days passed) like this
```DataMutateResult remove = user.data().remove(Node
.builder("group.bedwars_champion_division")
.withContext(ImmutableContextSet.of("server", "bedwars"))
.expiry(60, TimeUnit.DAYS)
.build());
if (remove.wasSuccessful())
LuckPermsProvider.get().getUserManager().saveUser(user);```
but the removal doesn't work
Do you need to add expiry on removal? π€
you do - the expiry time doesn't need to match exactly, but it needs to be a temporary node
oh I see
well it seems asking here fixed the issue after 4 months of doubts
thanks for the fix
@jaunty pecan There is a serious bug in Hytale on servers, and you can easily remove it with your plugin, thus improving several servers and helping them protect themselves. If you want to submit a support ticket, that would be better.
I'm looking for someone to create a mod so I can protect myself. You would create it and I would pay!!
Hey zebasenpai! Please don't tag helpful/staff members directly.
Is it memory safe to load an user from db just to check if it has a permission?
I'd say it heavily depends on your use-case. But once you load a user, the user will be caches
Hello, trying to configure the API in another plugin of mine I create the dependences and also add the compileOnly("net.luckperms:api:5.4") in gradle. However an error apears when I'm trying to import the net.luckperms.api.LuckPerms, it says that cannot resolve symbol "luckperms". Anyone could help me?
C:\ME\ServidorHytale\OlympusPlugin\src\main\java\com\apicolin\Olympus\OlympusPlugin.java:6: error: package net.luckperms.api does not exist
import net.luckperms.api.LuckPerms;
- The latest version is
5.5(the wiki is not up-to-date) - Did you add add
LuckPermsasdependin yourplugin.yml? - How are you calling the API in your code?
- Sometimes the Gradle cache is kind of scuffed. You can try hitting "Sync all Gradle Projects" and/or "Download Sources" within the Gradle window in IntelliJ
You can also share your build.gradle, plugin.yml and your main class for further help π
@Override
protected void start() {
LuckPerms api = LuckPermsProvider.get();
}
Where is the plugin.yml?
you mean the manifest.json? I'm creating it for hytale
oh men, i didn't press the sync all gradle projects
thank you a lot
!hytale
An experimental/beta version of LuckPerms is available for Hytale.
As this is still an early preview, several features aren't properly implemented just yet or need further refinement, and there may be bugs. Known issues are listed on the PR.
I didn't know you were on hytale π
No worries, you help me
hi, i have the luckperms rest api docker container set up
https://luckperms.net/wiki/Standalone-and-REST-API
now, i cannot seem to find documentation on how to configure messaging for this
i haven't looked at the container files, but i would prefer not to fiddle with that and configure it using environment variables instead
where can i find info about this?
if this container doesnt support messaging services, then i am a bit confused because i am missing some meta keys that i recently set on request results.
i was assuming they didnt sync to the rest api yet, because i can see them in lp editor and also in other commands, but they are simply not existent in responses from the api container
yes it seems it was a caching issue, after restarting the container the meta values now show up
If i use /lp user <player> permission settemp <permission> true 10s it will just remove the permission after 10sec instead of it going to false how can i fix this?
This is the intended behavior; a permission not being set vs a permission explicitly being set to false are 2 different things. Temporary nodes simply remove the nodes at the end of the expiry, they will not be set to false.
Are you asking as a server admin/owner, or a developer trying to do something involving this?
Owner/developer
Im trying to use skript to detect when player gets a permission
From false to true
If you were using Java to interact with our API, you could listen to the various node related events to detect such a change. However on Skript, I don't know if any of those are an option for you, at least not without some sort of third party adapter or such
Sorry, is this not the right channel or am I simply out of luck with Noone able to help so far?
π
wondering if the cache control header has any effect on this... But taking a glimpse at the rest api code, I kinda doubt it
hello!
just to make sure I understand your question, you want to configure your standalone/rest instance to connect to a messaging service like Redis, so you can use the /messaging/ routes?
if so, you can indeed use environment variables, as documented here: https://luckperms.net/wiki/Configuration#environment-variables (sorry I admit not the easiest to find!)
might look something like
LUCKPERMS_MESSAGING_SERVICE: redis
LUCKPERMS_REDIS_ENABLED: true
LUCKPERMS_REDIS_ADDRESS: host:port
or similar, depending on which type you are using
omg yes exactly that
do you happen to have an example at hand for rabbitmq?
although i suppose .. it would be just LUCKPERMS_RABBITMQ_URI
replace REDIS with RABBITMQ in examples above
not sure we support setting as a URI, think it just expects host/port, one moment
address makes more sense, i would have actually checked plugin configs for the config key
was just a hot guess
but yep, those should work: https://github.com/LuckPerms/LuckPerms/blob/master/standalone/src/test/java/me/lucko/luckperms/standalone/MessagingIntegrationTest.java#L263-L265
alright, thank you very much! highly appreciated
np!
hm, it seems its having a bit of trouble with rabbitmq uris
i have my docker-compose.yml like this, but on startup i get an error message saying something about the uri. i suppose YML is having a hard time parsing the :// part of the uri
putting it in double quotes doesnt seem to help
this is weird. why would it expect a number π€
unfortunately i also cannot find an example here that provides username and password π seems a bit strange tbh
usually, i'd assume rabbitmq expects a uri scheme like amqp://user:pass@host:port
oh i see in the MessagingFactory it does it with separate keys for username+password in
been a while since i configured the plugins haha
LUCKPERMS_RABBITMQ_ENABLED: true
LUCKPERMS_RABBITMQ_ADDRESS: host:port
LUCKPERMS_RABBITMQ_VHOST: /
LUCKPERMS_RABBITMQ_USERNAME: guest
LUCKPERMS_RABBITMQ_PASSWORD: guest
think you got there by the time I typed it out :D
but yeah
yup, i found it ^^ its easy once you know where to search π
thanks for pointing this out, i would have been looking for a while anyway
\o/ victory
on a side note, it seems to me that either the image's healthcheck configuration may be a bit screwed up or i misconfigured something about that
either way - it seems to be working now - thank you very much
Hello, I was wondering if luckperms standalone can be launched in Spring app so I can check user permissions without additional rest api? I know that there is a option to add an extension but idk if this would work with Spring eco system
Hello, i am adding Luckperms context for my claim plugin. However when i want to know what chunk a player is currently in, (Location#getChunk) Luckperms seems to get stuck trying to reach something in Cache.
If i do not use Location#getChunk(), there are no errors
Am i missing something ? Thanks !
[00:59:26] [Paper Watchdog Thread/ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - 1.21.4-194-ce30016 (MC: 1.21.4) ---
[00:59:26] [Paper Watchdog Thread/ERROR]: The server has not responded for 10 seconds! Creating thread dump
[00:59:26] [Paper Watchdog Thread/ERROR]: ------------------------------
[00:59:26] [Paper Watchdog Thread/ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[00:59:26] [Paper Watchdog Thread/ERROR]: ------------------------------
[00:59:26] [Paper Watchdog Thread/ERROR]: Current Thread: Server thread
[00:59:26] [Paper Watchdog Thread/ERROR]: PID: 48 | Suspended: false | Native: false | State: BLOCKED
[00:59:26] [Paper Watchdog Thread/ERROR]: Stack:
[00:59:26] [Paper Watchdog Thread/ERROR]: me.lucko.luckperms.common.cache.ExpiringCache.get(ExpiringCache.java:62)
[00:59:26] [Paper Watchdog Thread/ERROR]: me.lucko.luckperms.common.context.manager.QueryOptionsCache.getQueryOptions(QueryOptionsCache.java:57)
[00:59:26] [Paper Watchdog Thread/ERROR]: me.lucko.luckperms.bukkit.inject.permissible.LuckPermsPermissible.hasPermission(LuckPermsPermissible.java:172)
[00:59:26] [Paper Watchdog Thread/ERROR]: org.bukkit.craftbukkit.entity.CraftHumanEntity.hasPermission(CraftHumanEntity.java:248)
[00:59:26] [Paper Watchdog Thread/ERROR]: TownsAndNations-0.17.0.jar//org.leralix.tan.listeners.PlayerJoinListener.onPlayerJoin(PlayerJoinListener.java:45)
location.getChunk() is called when Overriding calculate from ContextCalculator<Player>
Given this is being triggered from the PlayerJoinEvent, I'm going to guess the chunk isn't loaded yet. Try adding a check to ensure the chunk is loaded and if not, don't continue trying to do stuff that relies on it
(That cache is the context cache for the player, which is why it's blocking on it)
Ok thanks, i can always achieve what i want only with x/z coordinates so no problem.
Thanks !
Hey, i would like to transfer all player groups i currently have on server X to server Y.
My plan was to simply export the data into a file, move it over, and import it using some rules.
This is my plan to export the primary groups:
TaskManager.runOnIOPool(() -> {
Map<UUID, String> extractedGroups = new ConcurrentHashMap<>();
LuckPerms luckPerms = LuckPermsProvider.get();
UserManager userManager = luckPerms.getUserManager();
Set<UUID> uniqueUsers = userManager.getUniqueUsers().join();
CompletableFuture<?>[] futures = new CompletableFuture[uniqueUsers.size()];
int index = 0;
for (UUID userId : uniqueUsers) {
CompletableFuture<?> future = userManager
.loadUser(userId)
.thenAccept(user -> extractedGroups.put(user.getUniqueId(), user.getPrimaryGroup()));
futures[index++] = future;
}
CompletableFuture.allOf(futures).join();
saveToFile(extractedGroups);
});
And applying them would be done this way:
public void applyGroups(Map<UUID, String> extractedGroups) {
TaskManager.runOnIOPool(() -> {
LuckPerms luckPerms = LuckPermsProvider.get();
UserManager userManager = luckPerms.getUserManager();
extractedGroups.forEach((userId, group) -> {
String mappedGroup = getMappedGroup(group);
userManager.modifyUser(userId, user -> {
String permission = "group." + mappedGroup;
user.data().add(Node.builder(permission).build());
});
});
});
}
what's wrong with LuckPerms built in method of exporting/importing?
There are a ton of permissions that i dont want to transfer. Im really only interested in the primary group.
And there is a mapping from old group names to new ones. "xyz" could be "abc" in the new system.
Hmm... im just seeing the [--without-users] flag in the command.
Maybe i could just export it right now and only worry about the importing.
nvm, that doesnt contain any user data at all π
@left geyser ^
Hey utfunderscore! Please don't tag helpful/staff members directly.
Thank you 
Hey is there a way to use the LuckPerms API in Minestom?
μλ
Is there a way to get the common module on the local maven repo?
Anyone online
Nope
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.
userFuture.thenAcceptAsync(user -> {
for (String service : Config.getServices()) {
String group = Config.getServiceGroup(service);
InheritanceNode lpGroup = user.getNodes(NodeType.INHERITANCE).stream().filter(node -> node.getKey().equalsIgnoreCase(group)).findFirst().orElse(null);
if (lpGroup != null) {
Instant expiryDate = lpGroup.getExpiry();
if (expiryDate != null) {
String title = Config.getServiceTitle(service);
inv.setItem(i.getAndIncrement(), BItem.b(Config.getServiceMaterial(service), title,
List.of(
"<white>" + TOOLS.formatDate(expiryDate.toEpochMilli())
)));
}
}
}
});```
I'm trying to get the expiry date of a group a person has.
Should I enter the group with "group" prefix or not?
For example group callled - "example"
Should I check with "group.example" or "example" in user.getNodes(NodeType.INHERITANCE).stream().filter(node -> node.getKey().equalsIgnoreCase(group)).findFirst().orElse(null);
Hey, is it possible to synchronize LuckPerms standalone using NATS, similiar to the plugin?
We tried setting up our servers, as well as a standalone instance with the rest api. The synchronization between servers works. The standalone service does not synchronize, the data is right however when we restart the service in Docker, so it's not a database issue.
We have set the database as well the rest configuration using environment variables, however we couldn't find one for synchronization, so we set it in the config. Is there anything we did wrong?

Standalone should behave the same, is it definitely connected to your NATS instance?
Should say so in the startup log
getKey is the full key, so yes including group.
It probably isn't. However, I'm not sure how to connect it right then. You can set the database using environment variables, but not the synchronization method and credentials, atleast the wiki said so. We set it using the config and the values are the same as on the minecraft servers
If you need anything, such as the config, the docker compose or anything that might help, let me know.
Wherever you saw that needs to be updated, or you encountered a bug. All options should be able to be sourced from environment variables https://luckperms.net/wiki/Configuration#environment-variables
is there a full list of environment variable names?
Not a nice one on the wiki or anything, but they're generated automatically from the keys used in the config & there's a few examples given to convert from yaml to env variables.
If you're fine looking through code, the master list of config keys is in the ConfigKeys class, for environment variables keys in that file are uppercased and -s & .s are replaced with _s
Ah, that's pretty helpful, thanks!
I'll look through the code and find the ones I need
Maybe it would make sense to add a list of them in the wiki or atleast mention how they are generated, since it was a bit confusing
I got it to work, thanks for your help
Hey, I am using the Restapi and was wondering, how do i generate an api key for my application to use?
nvm found it
How to get user groups that apply in that specific server (in network setup, users gets groups with context server=<server>, I don't want to build a query each time explicitly setting the server context).
Current setup that doesn't work (always return 0):
public static int getRankWeight(UUID uuid) {
if (!available) return 0;
User user = userManager.getUser(uuid);
if (user == null) return 0;
Optional<Group> rankGroup = user.getInheritedGroups(QueryOptions.defaultContextualOptions()).stream()
.filter(group -> group.getWeight().isPresent() && group.getWeight().getAsInt() < 50)
.max(Comparator.comparingInt(g -> g.getWeight().orElse(0)));
return rankGroup.map(g -> g.getWeight().orElse(0)).orElse(0);
}```
If I'm not mistaken, you can just grab the appropriate query options off that User (PermissionHolder#getQueryOptions), which should have all their current contexts set already, including any other non-server contexts like world or whatnot.
-# (Side note, this kind of thing shouldn't be static, looks like there's some static abuse happening in this class)
Oh and as for why it's currently returning 0, QueryOptions.defaultContextualOptions just kicks back a QueryOptions without any contexts set, so if all your groups are set with contexts then that'll return nothing
Why it cant be static?
There's nothing explicitly "wrong" about it such that it won't function, but it's an anti-pattern since it negates OOP principles. Generally static should only be used for "pure" utility functions, factory functions, constants, occasional use for things like a singleton pattern (a single static method to retrieve a shared instance of an object), things like that. If a significant percentage of things in a class are static, that's usually a sign you're not following proper object-oriented programming.
-# (One minor actual problem static abuse can cause is introducing weird bugs or resource leaks when /reload or similar is used, but that's usually not as big a concern for many developers)
Hi, I am trying to replicate lp user <user> permission settemp <node> <duration> <mode> programmatically using the API. So far this worked great:
api.getUserManager().getUser(player.getUniqueId()).data().add(Node.builder("my.node.here").value(true).expiry(5, TimeUnit.MINUTES).build());
Except that I don't see any builder methods to set it to "accumulate" mode. I see 2 overloads that takes TemporalAccessor, TemporalAmount but i'm not sure if it is relevant or how to construct these.
I am currently searching the wiki with key word accumulate and expire but no luck so far π
The API doesn't necessarily have an analogue for every command implemented by default, I'm not aware of any method that replicates the accumulate modifier. You'd need to implement it yourself by searching that user for a node with the appropriate permission & contexts and an expiry set, and if present add the new expiry to it.
TemporalAccessor & TemporalAmount are both interfaces from Java's time API; classes that hold a specific time (i.e. Instant, OffsetDateTime, etc) generally implements TemporalAccessor, while things like Duration implement TemporalAmount. Notably you can grab the Instant a node expires at with Node#getExpiry, so once you've found the Node, you can simply add your desired additional duration to it & set that as the new expiry.
Ok got it. Ty.
Turns out there is one. It's in the NodeMap class not in the builder one. It was not mentioned at all in any wiki example. Putting it here so it might help someone:
final UserManager lpUserManager = api.getUserManager();
final User lpUser = lpUserManager.getUser(player.getUniqueId());
final NodeMap lpUserData = lpUser.data();
lpUserData.add(
Node.builder(node).value(value).expiry(duration, timeUnit).build(),
acculumate == true ? TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING
: TemporaryNodeMergeStrategy.REPLACE_EXISTING_IF_DURATION_LONGER);
lpUserManager.saveUser(lpUser);
I even specifically looked in the NodeMap class for a method like that and somehow missed it. Sorry about that, glad you found it!
An experimental/beta version of LuckPerms is available for Folia.
is this returns all the users?
It returns all users who aren't just a member of the default group.
how can i get all the users?
Well luckperms only stores players that have not only just the default group. So if you want to get all players. Online and offline youd be better to use the main servers api instead of LP api.
For example like Bukkit.getOnlinePlayers()
i think luckperms users is more trustable
i just have 2740 users on playerdata folder
and on luckperms i have 2989
and i need convert all my old bedrock uuids to new floodgate bedrock uuids
I had a configuration in Geyser where the Bedrock UUIDs in Geyser had the offline Java UUID instead of the Floodgate UUID, and I need to convert all the plugin data to the new UUIDs
Well you'll only be able to get all users that have more than just the default group using LP. I dont believe there is a method to get all the users including those in the default group.
Unless...
You use the getuniqueplayers method, then save them to a list, then get a list of the members in the default group and add them to the list. It may work. Im not sure.
I need to see if a online or offline player have a permission
am I doing correctly?
Why this code sometimes cause user data reset? It removes all his permissions, groups, etc. We use that code when player is online on server
we are running on latest github commit
If I'm not wrong: modifyUser bypasses the in-memory user and works on storage, so under async timing it can overwrite newer data with older data
So what you could do is:
User user = LuckPermsProvider.get().getUserManager().getUser(uuid);
if (user != null) {
user.data().add(node, TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING);
userManager.saveUser(user);
}
It make sense with older data, but it completely wiped player data, all his permissions and groups what were given weeks ago.
No clue tbh. It might collide with two datasets, can't decide which one to use and just clears it.
Didn't look in the implementation tho.
did this only start happening recently?
we started using it recently (using some item, gives you temp permission), and some players complains that after using items their group resets
How to use
!api
Learn how to use the LuckPerms API in your project.
Where and how can If ix this:
private void setupLuckPerms() {
try {
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
luckPerms = provider.getProvider();
plugin.getLogger().info("LuckPerms provider hooked.");
subscribeLuckPermsEvents();
} else {
plugin.getLogger().warning("LuckPerms provider not found. Role sync disabled.");
}
} catch (Throwable t) {
plugin.getLogger().log(Level.WARNING, "Error hooking LuckPerms. Role sync disabled.", t);
}
But it keep sayting the provider is not found?
Show us your plugin.yml please
Name: BloneBurgCore
version: '${version}'
main: nl.bloneburg.bloneBurgCore.BloneBurgCore
api-version: '1.21'
depend:
- LuckPerms
commands:
mhh where do you call "setupLuckPerms"?
!paste And can you also show us your pom or gradle file?
And you have LuckPerms intalled on your server?
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!
Already fixed it
Good evening, I'm making my first server and I have some questions.
I'm making a modpack using NeoForge, and I want to create a rank and kit system. I was previously using FTB Ranks, but it wasn't working the way I wanted.
Now I'm using the NeoForge version of LuckyPerms, and I would like to know a few things:
1 - Can ranks created in LuckyPerms increase or limit the chunk claims in FTB Chunks and the sethome limit in FTB Essentials?
2 - How can I create item kits that only a specific rank can claim, such as:
- once only
- once per day
- with cooldowns
3 - I've seen some servers where players can open an in-game GUI/interface and redeem kits through it if they have the required rank.
How is that usually done on NeoForge servers?
4 - Which TAB or nametag mod works well with LuckyPerms on NeoForge?
I already have custom rank textures/icons ready.
- it would be up to those mods to support that
- those are features your kit mod needs to support
- again, something your kit mod would need to support, or use a command gui mod
- anything that supports lp will work
i dont have any specific recommendations for mods as i dont use neoforge myself
How do I limit the maximum number of normal and forced chunks that each group can have using lucksperm and ftbchunks?
π
Good evening, I'm having a problem.
My modpack is:
Minecraft 1.21.1
Neoforge.21.1.228
Arclight-neoforge-1.21.1-1.0.2-SNAPSHOT-0769551
LuckPerms-Bukkit-5.5.42
ftb-chunks-neoforge-2101.1.14
ftb-xmod-compat-neoforge-21.1.8
I want that when assigning the luckperm group, for example group-default, if anyone enters the server they receive the default group, but I want to limit the maximum number of chunks that people in that group can use, for example 10 normal chunks maximum and 2 forced chunks maximum, and if I put that person in another group, for example group-old, in that group-old the person has 30 normal chunks maximum and 10 forced chunks maximum.
CachedData is designed to be thread-safe if I'm not wrong
#support-1
And hybrid servers such as Arclight are not supported by LuckPerms
You just have to assign the given permissions from ftb-chunks to the user group ad it should work, no?
All other commands that I configured via plugin using lucksperm are working, only ftbchunks is not working.
I even wanted to use the Neoforge modded version of Lucksperms, but it keeps giving me an "invalid player data" error, and I couldn't find anywhere to fix it.
This error always happens when I try to log into the server.
That's why I opted to use the hybrid version, which so far is working okay with the other plugins.
I am providing the lp api like this:
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.5</version>
<scope>provided</scope>
</dependency>
But it downloads a release from 23. may 2025.
Any idea how to get the latest 5.5 changes from git as well? Including hytale etc
I dont see any patch versions on the maven repo, but you could clone the github and build it locally to get an up-to-date api jar. Then, you can add it as a local dependency to your project.
Wait sorry i didnt realize you sent that 6 days ago sorry for the ping
All good, I ended up building it locally. This was enough to get the new version in my local maven repo. That was good enough for me
Is there a way to tell LuckPerms about custom permissions on Velocity?
Platform.getKnownPermissions() can't be modified, and i couldn't find a way to tell velocity about my custom permission.
just run a permission check. thats how luckperms learns about new permissions
once per restart or does luckperms keep them in the database?
The permission vault is every permission that's been checked during that LP instances' runtime, plus every permission already set on a group/player. So technically if you wanted to seed a permission on velocity, you'd need to fire a permission check for every restart, but honestly I wouldn't really bother - the majority of plugins don't do any special action & the auto-discovery just finds things as they're naturally checked, generally admins won't try to give a permission until someone encounters the "no permission" state anyways
any method to check if a string is a valid track name or will I have to check if said string contains spaces manually
@nocturne elbow π
ty
:p
@jaunty pecan how to get users objects list, which have specific permissions like /lp search permission ? With API?
Hey iBo3oF! Please don't tag staff members.
Any1 help mewith something?
Just say what you need help with @ornate cove
Hey, im helping my friend get a server going we wanted some prefix names etc but cant seem to figure it out
Hello, I need some help. Please @mention me if you respond since I turn of notifications.
Issue: I am trying to make it so I can set somone to a group, not promote them using /lp group default permission set essentials.kit
Because: I need to do this to simplify setting up buycraft and auto rank plugins.
Why not use original method: If there is only one group in stack, or there are multiple, it either doesn't allow it or requires me to run the command multiple times.
Screenshots:
@wintry comet
1st: That's more a #support-1 question and less a API-related one.
2nd: You can use /lp user <user> parent set <group> to set them in one group only (replace set with add to add the group to the others the player already has)
Hello, i try to use the api but get some errors
http://prntscr.com/io4io6
I'm using this example:
if (!LuckPerms.getApi().getStorage().loadUser(uuid).join()) {
// got an error whilst loading the user
return;
}
User user = LuckPerms.getApi().getUser(uuid);
if (user == null) {
// user not loaded, even after requesting data from storage
return;
}
// the contexts for the lookup. if the prefix/suffix is set in a specific server, you'll need to add that here.
Contexts contexts = Contexts.allowAll();
MetaData metaData = user.getCachedData().getMetaData(contexts);
event.setFormat(metaData.getPrefix() + player.getName() + ChatColor.DARK_GRAY + " Β» " + metaData.getSuffix() + event.getMessage());
// cleanup the user now we're finished to prevent memory leaks.
LuckPerms.getApi().cleanupUser(user);```
you don't need to call loadUser each time a player chats
in fact you shouldn't call it
and yeah, if it's returning null, it just means they don't have a prefix/suffix set
So i don't need the loadUser method? And yeah, the admin did something wrong^^
Thanks Andre_601
So, on github would files in common not rely on spigot or sponge?
And be usable by both
yes
Nice!
@jaunty pecan I have permission "rank.vip" I want to replace all users having this permission with "group.vip", what's easiest way with LP ?
Hey iBo3oF! Please don't tag staff members.
you can't perform bulkupdates with the api
Will you add support for it in the future?
Rule says don't tag luck or the admins @nocturne elbow
@frank drift has already stated that.......
AHHHHH!!!!
Im trying to retrieve the prefix the user should have on for the server they are connected to via the LuckAPI. I'm having a little trouble as it only ever says guest. When I set the context to allowAll, it begins to work but then never changes when they move server. Here is the code im trying to use, in various stages of completeness (as per the wiki):```
ContextManager cm = Main.luckApi.getContextManager();
//ImmutableContextSet contextSet = cm.lookupApplicableContext(user).orElse(cm.getStaticContext());
Contexts contexts = cm.lookupApplicableContexts(user).orElse(Contexts.allowAll());
MetaData metaData = user.getCachedData().getMetaData(contexts);
//String prefix = user.getCachedData().getMetaData(Contexts.allowAll()).getPrefix();
String prefix = metaData.getPrefix();
//String suffix = user.getCachedData().getMetaData(Contexts.allowAll()).getSuffix();
String suffix = metaData.getSuffix();
use
Contexts contexts = cm.lookupApplicableContexts(user).orElse(cm.getStaticContexts());
Hey there, I was just wondering if its possible to access the Lucky Perms API through bungeecord?
If you have LuckPerms installed on your bungee server, yes.
I do, was just wondering how to do it since I couldnt find it for Bungee on the github pages?
the API is platform agnostic
in other words, it's the same for all platforms LP runs on
Ah I got it, thanks.
@jaunty pecan As per git hub issue, sadly that doesn't work. Although Im sure it will do once LP outputs the correct info π
Hey xtechgamer735! Please don't tag staff members.
Sorry π¬
and how do you connect luckperms's permission to all servers
Not sure. The global wasn't working for me too
on a bungee network?
u put lp in every spigot instance
and configure it
to connect it to the same MYSQL
connect all of them
but it's not that usefull, I mean, if u want to give someone operator on a server (up from admin to operator on survival, (example) ), it will give him operator on all the servers that are connected.
I have a bot on discord which is a "rank moderator" and with only ?remove (name) u remove him the rank, and so on, u can select the subserver, what so ever
But u can specify servers
when u add a rank to a player with lp?
I didn't know, if it's possible it could be good
@obtuse lynx https://github.com/lucko/LuckPerms/wiki/Network-Installation Have a read of that
THANKS!
@obtuse lynx #offtopic
This is API talk. And I got told off for talking about connecting lp to MySQL in general. So yeah, apparently it's offtopic
Just letting you know
ok
can a luckypems to discord plugin be made ?
its jsut an idea for a discord bot to help with rank match up with the server
You could most certainly make one yourself, but if you use DiscordSRV for bukkit and MagiBridge with the necessary addon, you can sync ranks
Whats the current recommended way to pull permissions for sponge?
pull permissions?
I'm guessing he means to list all permissions a user has? But I'm not sure π€
To list perms you could always do /lp (user/group) (example) editor
@neat mauve This is for plugins using the luckperms API. That means getting it through the API. Not with a command
Correct
I am building a Server agnostic plugin, but for sponge it looks like I will have to use the LuckPerms API
The context calculators get called every time permissions are checked, right?
the result is cached for approx 1 tick
Ok. Thanks
Am I implementing the ContextCalculator correctly like this?
https://github.com/BrainStone/DragonProxy/blob/b1c2693843bee4a53049763e0268d589d0b923a3/plugin/bungee/src/main/java/org/dragonet/plugin/bungeecord/compat/luckperms/BedrockClientContextCalculator.java
π
Great. π
@crystal sonnet are working on Dragonproxy??
Hey Nostyll! Please don't tag staff members.
I just made a PR to allow LP to distinguish between bedrock and normal clients
Nice I'm trying to get it working but I'm having issues with the hybrid system
Hello!
When i set a permission to an offline user
do i have to save the user?
In the 3.0 api i had to save it
Yes you still need to save
;_;
ok
I should also invoke the cleanup right?
Or LP handles it with an expiring cache?
Yes, but that is no longer an essential step
In my code i don't know if i'll reuse or not a User object, can i just let LP hadle it with the cache expiration?
@jaunty pecan
Hey sgdc3! Please don't tag staff members.
Do i have to refresh the cached data after i saved the user?
i'm porting my hook from api 3.0 to 4.0 and i'm not sure which steps are now useless
Any help? I really don't know what to do in this case
Iβd recommend waiting for Luck
ok
When it comes to the API Iβm also just guessing XD
lol
this is my code so far
lambda over 9000
do you know how to call saveUser async but ignoring the result?
just call the method?
Nope. I know nothing by heart of the API tbh
no it's a question about lambdas
if i have a method that returns a CompletableFuture
Ok
in this case saveUser
Use runAsync
Or thenRunAsync
One of the two
Runs Async and discards the the return value
Idk
Need to check the LP source, one moment
it always calls supplyasync
otherwise there would be no point in returning a future
I've tried to explain a lot of this in detail on the wiki pages
Yeah, that was what i initially thought...
What about the refreshCache? do i need to call it after saving?
in 3.0 i had, is it still required?
Luck, does LuckPerms convert from PEX 1.19.5 version?
[LP] > no available plugins to migrate from
plugman info PermissionsEx
[12:28:57 INFO]: [PlugMan] Plugin Information: PermissionsEx
[12:28:57 INFO]: - Version: 1.19.5
can you guys add support to migrate from this version to LP?
Whatβs the current version of PEX?
@nocturne elbow can't you just update to the latest?
Or download an earlier version?
Ofc backup your permissions
Surely the permissions file hasn't changed that much with pex
I need help, I donno how to just add myself to the group I named 'Admin'
/lp user <user> parent add Admin
Thank you β€
Hello there π I have one question about API. Why when I getting api User from userManager() by getUser(String username) method, this User copy stores in api only about 5 minutes..? I know what LuckPerms using Caffeine for caching but maybe I do something wrong?
I'm not sure what you mean exactly
can you maybe share the code you're using?
just so I can get a better idea of what you're trying to do :p
Hi, Lucko.
I have a large system depends on your permission plugin.
My big core api plugin, messenger bot (to provide two factor auth and another cool stuff), and some small plugins depends on core api and your plugin.
Before LuckPerms, I used custom permission plugin with custom uuids system and now I have very big donation data. It's reasonable for me to use a single uuid system for all my plugins.. I was decided to move to the LuckPerms and import all of my data from old plugin. I write importer in LuckPerms and convert all uuids to my own uuids system with all donation data.
I rewrite some code in your plugin to handle my new uuids and now something went wrong, when I trying get User copy.
I rewrite all connection listeners. Just change player.getUniqueId() to my uuids system.
Sorry for my bad english... And thank you.
Without
if(user == null) user = luckPermsApi.getUserManager().loadUser(toDardUUID(player.getName())).join();
It works only ~5 minutes
After 5 minutes I always get null
Can I send you a link of my modification of LuckPerms?
Oh right okay
yes, offline users are unloaded automatically after 5 minutes
you need to keep calling loadUser when you want to view/modify data
the auto unload behaviour is handled here
hm?
With my changes or you're not interested?
Well you didn't say what the "link" was
Archive with source code
I don't really understand what you're trying to suggest
Advice, maybe I'm doing something wrong.. Your code is amazing and difficult at same time
oh right, i'm happy to answer questions
but would prefer just snippets of code instead of having to look for changes in your version π
It should be okay
if you want to do that sort of thing, you basically want to check for all usages of player.getUniqueId() in the codebase and run them through your conversion method
intellij will let you search pretty easily
That's exactly what I did π
And this
Because lp user info Status with UUID not working after my changes
And I added one more Dao, called Aerospike
What you think about this database?
Something like this
cool!
nice to see other databases being used
there's an implementation using cassandra here
My skills in programming much lower than yours, but maybe I refactor some code and make pull request with this?
I probably won't accept PRs which add new storage implementations, they become a bit of a maintenance burden for me
but I've added an API (as you can see from above) which lets other addon plugins provide storage implementations at runtime
Okay :)
Thank you so much for your feedback!
I was very pleased to talk with you :)
Thank you for your amazing plugin and really cool architecture of code, a lot of interesting features I found for myself in your plugin!
thank you for the kind words, and I'm glad you've found some use for it π
But I really do not fully understand how she works... :'DDD
haha
But with this it works great
Thank you once again and goodbye π
Oh! One last question!
Why this is happening?
Storage is empty
try {
this.phaser.awaitAdvanceInterruptibly(this.phaser.getPhase(), 10, TimeUnit.SECONDS);
} catch (InterruptedException | TimeoutException e) {
e.printStackTrace();
}
In storage memory nothing contains while plugin disabling
Hello, Luck, does your maven dependency manager handle transitive dependencies?
Uhh no it doesn't
π
How would I go about getting a player's group across all contexts?
Contexts.allowAll()
How can I get a user's prefix using the luckpermsapi?
it's covered on the wiki page
Hello, Luck, how can I add temporary group to user? Which will disappear in a month
Use the setExpiry method on Node.Builder
Thanks!
And.. If this group has a weight higher than the existing , I need to set it to primary?
After it expires, previous group sets automatically?
uhh you shouldn't need to do that
Ok.
luckPermsUserToGrant.setPermission(
luckPermsApi.getNodeFactory().makeGroupNode(groupToGrant)
.setExpiry(month.getTime()).build()
);
It's okay?
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, 1);
Date month = calendar.getTime();
Oh.. Node has setExpiry(long, TimeUnit); I din't notice
Does luckperms support webhooks? I think I saw it somewhere....
Or would we have to code our own plugin to work as a webhook
in what sense would it work with a web hook
How long did it take u guys to make luckperms
coming up to 2 years of work
Dang
I'll take that as a "not included in luckperms"
I was able to get the player's primary group, but I didn't see a method to get the prefix of the group. Could you tell me the name?
you'll need to read from above to understand how you get to that point
but those are the methods you need
oh thanks, I got it to work.
itsTyrion - Today at 20:54
User user = LuckPermsApi.getUserManager().getUser(p.getUniqueId());
non-static getUserManager() can't be referenced from a static context. normally when I get this while coding when forgetting a "static", but in this case, I don't know how to do ._.
@limber token LuckPermsApi is an interface
you need to obtain an "instance" of it
I'll go look for my brain... in the microwave or so... π€¦
π
sooo I didnt even know about LuckPerms 'til a few days ago...
I need an equivalent of cloudplayer.getPermissionEntity().getPermissions().put("silenthub.fallback", true); (what I do for the cloudnet perms system)
Please write like you're talking to an idiot, bc you are. I'm very new to (bukkit)development^^
it's (unfortunately??) not as straight forward to do in luckperms
but on the plus side, it's quite well documented
you need to:
- obtain a
Userinstance - create a
Node - add the node
- save the user
all of that is explained here
try to read through as much of it as you can, if you have any questions feel free to ask and I'll try to explain in more detail π
Hmm. 1 snack and minute, creating a node seems simple. let's have a look...
Wow. It is actually as eZ as fighting an afk steve with no armor xD
That deserves a pin
How to get group display name with API?
Btw can I add for default group permission group.test won't this cause any issues @jaunty pecan
Hey Milburn! Please don't tag staff members.
if being more accurate: adding "group.c" permission for group called "c2", which inherits default group with displayname C
Luck :/ ?
yep sounds fine
(sorry for not replying π )
np
getFriendlyName()
Can I iterate over all know players and filter if they have a certain permission? (Will be executed async, so can take a while)
do you need to check for inheritance too
Yes.
Like I want to check if a player is in the group team directly or indirectly
I mean it can take a while, doesn't matter
yeah i guess that's the only way then
Ok. So the API provides a method to iterate over all players LP knows?
yes
Great. Do you know which call it is? If not I'll find it. But if you know it at the top of your head it would be nice telling me xD
Hey can anybody help set up my server perms and what not I'm new to this plugin?
You should read github first: https://github.com/lucko/LuckPerms/wiki/Setup
An exception was thrown by me.lucko.luckperms.common.contexts.LuckPermsCalculator whilst calculating the context of subject CraftPlayer{name=Scarpex}
This error appears when i ask the player about a permission.
hello, how can i check and get time of player's temporary rank?
you can then use the stream API (or just if statements inside a for loop) to search for temporary group nodes
Hi Luck, does storage.getUsersWithPermission
a) take into account all users known to LP?
b) take into account inhertiance etc?
yes, no
Ok. For that I have to load the users first, right?
Ok. But I mean I can load every player one by one and the check if they inherit the permission?
Yes
user.hasPermission or user.hasTransientPermission?
neither of those calls account for inheritance
if you want to run a "real" check you need to do it using the userdata class
Which do I need to use then, when I have the User object?
I've created Frankenstein's monster xD
private static Comparator<User> getUserComparator() {
return Comparator.<User>comparingInt(
user ->
user.getCachedData()
.getMetaData(lpContextsGlobal)
.getMetaMultimap()
.get("weight")
.stream()
.flatMapToInt(
weight -> {
try {
return IntStream.of(Integer.parseInt(weight));
} catch (NumberFormatException e) {
return IntStream.empty();
}
})
.findFirst()
.orElse(Integer.MIN_VALUE))
.reversed()
.thenComparing(User::getFriendlyName);
}
oh jeez
Erm, which events do I have to listen to, to catch all permission changes?
And can I use the default Bukkit event system, or do I have to use the EventHandler provided by the API?
UserDataRecalculateEvent
and you have to use the eventhandler
it's not possible for me to post the events to the bukkit system
So LuckPerms.getApi() .getEventBus().subscribe(UserDataRecalculateEvent.class, new PermissionChangeListener()); is right? (Assuming PermissionChangeListener implements Consumer<UserDataRecalculateEvent>?)
yep
I'm seriously wondering how bad my code would look without lambdas
Yes, I'm making a plugin that generates a list of all team members and adds their heads into a Head Database category (generating the list is complete, once the API of HeadDatabase allows adding heads, then I'm essentially done)
nice!
Any idea how I could speed that up? https://hastebin.com/icuvubilic.swift
Maybe using parallelStreams, or collecting and creating a new stream after the .map(lpUserManager::loadUser) call?
yes, definitely a valid use case for parallel streams
btw assuming you're using java8
TeamMemberFinder::waitForCompletion can be replaced with CompletableFuture::join
Ah! Good to know!
One more problem, I listen to the UserDataRecalculateEvent. When I recieve this event I schedule a refresher of the users, which in turns causes userdata recalculations...
Could I use the LogBroadcastEvent instead?
Yes
it's too hard, can you send me a code where i can get expiry of player's group vip?
Looks like the LogBroadcastEvent is never sent...
p. sure it is
will do some debugging in a sec
Feerko, there are plenty of examples on the wiki page. If you don't understand, then there's zero benefit in me (or anyone) just doing it for you π
ok, so can you add an example to get expiry on wiki?
you will help for others not only for me
can you? π
i did it π
ππ»
Luck, did you check the event?
I think it was something like getFriendlyName()
Thanks! I got it to work
Luck, what is taking most in LP database space? It's 5MB
wondering how to cleanup it
can you make it so it would be possible to clean up :D?
no because i don't store unnecessary data
5MB really isn't that much
Sorry for asking again Luck, but did you manage to debug the event?
Because so far it hasn't fired once even though I've personally recieved log messages
haven't had a chance to look yet
Ok
I don't think so
ya seems to be working for me
using
importPackage("me.lucko.luckperms.api");
var LuckPermsApi = Java.type("me.lucko.luckperms.api.LuckPermsApi");
var UserDataRecalculateEvent = Java.type("me.lucko.luckperms.api.event.user.UserDataRecalculateEvent");
var LogBroadcastEvent = Java.type("me.lucko.luckperms.api.event.log.LogBroadcastEvent");
var api = server.getServicesManager().load(LuckPermsApi.class);
var eventBus = api.getEventBus();
registry.with(eventBus.subscribe(UserDataRecalculateEvent.class, function(event) {
Bukkit.broadcastMessage("------------------------");
Bukkit.broadcastMessage(">> UserDataRecalculateEvent");
Bukkit.broadcastMessage("user: " + event.getUser().getName());
Bukkit.broadcastMessage("data: " + event.getData().toString());
}));
registry.with(eventBus.subscribe(LogBroadcastEvent.class, function(event) {
Bukkit.broadcastMessage("------------------------");
Bukkit.broadcastMessage(">> LogBroadcastEvent");
Bukkit.broadcastMessage("entry: " + event.getEntry());
Bukkit.broadcastMessage("origin: " + event.getOrigin());
}));
beautiful, the thing I wanted to confirm is right there in a pretty picture for me π
Was wondering what event would be fired if I modified somebodies player data, and it was right there in a picture confirming what I thought it would be π
Is there something like .getUser(p.getUniqueId()).gethighestPermissiongroup.getDisplayName()
(for the lobby scoreboard, I want to avoid 100 times if(p.hasPermission("blabla") {
somesh!t
}
another question. I am too dumb to figure out the displayname of group x using the API
getFriendlyName
and you can do the first thing using .stream() and then sorting by group weight
thx. will try it ^^
ended up doing this btw:
User user = Data.lpapi.getUser(p.getUniqueId());
Group group = null;
if (user != null) group = Data.lpapi.getGroup(user.getPrimaryGroup());
String groupname = "Β§4ERROR";
if (group != null) groupname = group.getFriendlyName().replace('&', 'Β§');
return groupname;
}```
π
Hey there, I looked at your BungeeConfigAdapter and your (bungee) config.yml, but I didn't figure out where you implement that config. Can you help me and say where you implement your (bungee) config.yml?
Thank you!
What exactly are you trying to achieve?
I want to create a default config with comments from me and the way to implemts this into bungeecord. I found out that the way to implement is different then in spigot. I want to find out how this works in luckperms to be able to understand the way how this works
LuckPerms might not be the best plugin to find out how it works, simply because there are many different layers of abstraction involved
Also as far as I know, the default config is copied out of the jar. And the comments persist, because the config is never written to
Hm, okay :/
Do you know a plugin where I am able to understand how this works? Maybe BungeeChat?
If your looking at BungeeChat look at the code of version 2.1.6. Because the current version uses a very different system!
@olive spade
Okay, I will have a look into it - thank you :)
If you donβt know how to look at a tagged version of a Git repo, I can tell you how to do it if you tell me where/how you prefer to browse the code
how to delete user with API?
player.clearnodes()?
Luck I tried, but when i use the command to get prefix, server crashes (Stop responding)
okay so
on the first line where you call join()
that's the problem
see: https://github.com/lucko/LuckPerms/wiki/Developer-API#blocking-operations for more info
if you know the user is already online, it's not necessary to make that call at all
Uhmm, youre right
command is used only when player is online
I'll try
Works perfect, thanks! π
Luck
Sorry to ask again
Im using the api to get Players prefix, i could get it work. The command fires a method that opens an inventory with an item in which one of the lores is rank what displays Rank prefix. Works fine, but when i use a PlayerInteractEntityEvent and check if clicked entity is not null, if its a player, and cast it to player. The console return NullPointerException. I'm using the same method than with the command. ("method that opens an inventory with an item in which one of the lores is rank what displays Rank prefix"). If boths are entities, and both are players. Why is this happening?
not sure
doesn't sound LP related though
would need to see the code to help further
What is the best way to check if a User is in a group (LP Bungee)
check for the permission "group." + groupName
ProxiedPlayer#hasPermission ?
ya
tried not working
it does work :p
ymm
Where can I find a list of event listeners within LP? Trying to build a listener for when a player changes groups
there's a list of them here
to listen for group changes specifically, you want NodeAddEvent and NodeRemoveEvent
Trying to compile lol for NukkitX and I'm getting this error
Can anyone tell me how the weighting system works for luckperms
The command to set weight per group, and what value sets the highest and lowest weight
@verbal lark the wiki page Command Usage has the command. And higher weight means higher priority
Hey,
Is there an easy way to get all the groups that a player inherits (directly and indirectly) using cached data?
Also can I get somehow the tracks a player is on from cache?
@still lintel stream all nodes the player has and filter for all group nodes
thanks v much
Is there a more elegant way to get an user's tracks other than something like this:
for (Track t : api.getTracks()){
for (String g : t.getGroups()){
if(userGroupSet.contains(g)) {
userTrackSet.add(t)
break;
}
}
}
thx
how to laod api
Donβt call the getter before the onEnable
Also make sure to add LP as a dependency or soft dependency in your plugin.ynl
where do i put the getting then?
In the onEnable
Or in a separate class, that you donβt call before the onEnable
Either works
Youβre welcome
is gettiing a group's prefix in wiki too
Just have a look
gd where do i get metadata π
String rank = api.getUser(n).getPrimaryGroup().getPrefix()?;
Use the autocomplete of your IDE to your advantage
ye i got it
how come this dont work?
public void onChat(PlayerChatEvent e) {
Player p = e.getPlayer();
String n = p.getName();
ContextManager cm = api.getContextManager();
Contexts contexts = cm.lookupApplicableContexts(api.getUser(n)).orElse(cm.getStaticContexts());
MetaData metaData = api.getUser(n).getCachedData().getMetaData(contexts);
String rank = api.getUser(n).getPrimaryGroup();
String suffix = metaData.getPrefix();
e.setFormat(suffix + " " + n + " " + e.getMessage());
}```
oh he left
Iβd recommend using the UUID to get the user from the API.
ππ»
You can get the prefix directly from the metadata
the prefix in chat
i tried changing prefix
it wont update
using command /lp group Owner meta addprefix 100 test and its not updating
still says Owner
I know. What Iβm saying is, donβt get the primary group
Get the prefix from the userβs metadata directly
im not anymore
String prefix = metaData.getPrefix();
e.setFormat(prefix + " Β§e" + n + ": Β§7" + e.getMessage());```
Also make sure the priority of the new prefix is higher than the old one
ohh
Or you remove the old one
Just gotta keep in mind that a computer has no fucking idea what you want it to do, so you have to be pedantically specific when giving it instructions
why is this not working
String n = p.getName();
UUID id = p.getUniqueId();
ContextManager cm = getOwner().api.getContextManager();
Contexts contexts = cm.lookupApplicableContexts(getOwner().api.getUser(id)).orElse(cm.getStaticContexts());
MetaData metaData = getOwner().api.getUser(n).getCachedData().getMetaData(contexts);
String prefix = metaData.getPrefix();
p.setNameTag(prefix + " | " + n);
}```
getowner is main
class
Name tags are very strange
What was it?
Lol
Except that you should use the UUID for the second getUser too
Or even store the user in a variable
yea ill do
In general, just assume getters are expensive, so if youβre calling the same getter twice, store the result
I mean if youβre getting the same object/result twice
ok
im so trigerred
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
String n = p.getName();
UUID id = p.getUniqueId();
ContextManager cm = api.getContextManager();
Contexts contexts = cm.lookupApplicableContexts(api.getUser(id)).orElse(cm.getStaticContexts());
MetaData metaData = api.getUser(id).getCachedData().getMetaData(contexts);
String prefix = metaData.getPrefix();
p.setNameTag(prefix + " | " + n);
}
```
not working
but work on playerChat
nukkit bug maybe
bc i been having problems with playerJoinevent
Trying to change a group of a player and yet their group will not change no matter what I do. Any suggestions?
See if thereβs maybe a save or update method for the user
Also is the debug Text being called?
Hm. If thereβs no save, store or update method, then I donβt know. Iβm sorry
the only thing remotely close to a 'save' method would be refreshCachedData, which seemed to have done nothing
all good, thank you
Youβll need to wait for Luck. Heβll know
alright, when's he around usually
He lives in GB and is around starting at about noon
One more idea
Did you check that rank is in fact different from the rank the player has? Try a quick debug Iβd say
I didn't, but it's worth a check
darn that's frustrating, I guess it's working in theory but there must be an obscure method to apply and save the data in game to cache.
Yeah. I hope youβll figure it out
woot woot api.getUserManager().saveUser(user).thenRunAsync(user::refreshCachedData);
π
the method ProxiedPlayer#hasPermission does not work for group.<group name>
But it returns false for some reason
if(u.getCachedData().getPermissionData(cm.lookupApplicableContexts(u).orElse(cm.getStaticContexts())).getPermissionValue("group."+g.getName()).asBoolean())```
cm is ContextManager from api.getContextManager()
so should this be correct
@jaunty pecan
Hey Cubxity! Please don't tag staff members.
Oh sorry
@mighty hearth why donβt you just use the permission check of the platform?
brainstone so I am using bungee, does it support offline player perm?
Can anyone provide an example of changing the permission for an offline player in Bukkit? The api docs suggest to use the Bukkit scheduler to handle the requests asynchronously. Does this mean I should create a bukkit event when the task finishes and add a listener?
there are examples on this page
If you don't understand how to load/modify data for offline players, then I suggest reading the first few sections, as it's explained in a lot of detail there
I think I've got that code worked out, I'm just concerned that it's being called synchronously
Would this be a good application for your helper Scheduler?
I'm looking at your api docs again and see this section mentioning using an executor, is this where I can apply that usage of the scheduler?
Yes
If I need to use the result of the operation once it's complete, would I need to send an Event and listen for that to work with the result?
For example, I create a function to update a permission or group for an offline user, but then want to perform a follow up operation elsewhere, once the update has completed?
Could someone tell me a method I can use to promote a player in code vs. command?
command I am using is /lp user PLAYER promote members
Track name is members
Anyone know why? https://hastebin.com/osenudikej.lua
what's in your which line is line 18 in your sourcegivePlayerPermission.java
NullPointerException suggest that you are trying to do something on/with a null object
Please disregard my above request. I found another issue that said the API doesn't support it. I came up with this solution instead: https://github.com/AlmuraDev/Almura/commit/649e2d46a7a6a42008fb3da28fd9c63b2d51ccd0
Yes you're right, the API doesn't support it
using a command isn't really the best solution, but I suppose it's probably the easiest
it is technically possible to do via the API, you'd just need to replicate the promotion behaviour
@still lintel line 18 is User user = luckPermsMain.api.getUser(player.getUniqueId());
Well, debug it and see which one of those is null when executing, i suspect the player instance
how come?
Command class:
public void execute(CommandSender commandSender, String[] args) {
if (commandSender instanceof ProxiedPlayer) {
ProxiedPlayer p = (ProxiedPlayer) commandSender;
p.sendMessage(ComponentSerializer.parse("{'text':'[Kick]','color':'red','clickEvent':{'action':'run_command','value':'/kick " + p.getName() + "'}},{'text':'[Kick]','color':'red','clickEvent':{'action':'run_command','value':'/kick \" + p.getName() + \"'}}"));
if (p.hasPermission("potsmc.violationalert")) {
removePlayerPermission.removePlayerPermission(p, "potsmc.violationalert");
p.sendMessage(new TextComponent("Staff mode disabled"));
} else {
givePlayerPermission.addPermission(p, "potsmc.violationalert");
p.sendMessage(new TextComponent("Staff mode enabled"));
}
}
}```
In the snippet you supply player using an argument
Either that or the api instance is null
public LuckPermsApi api;
public LuckPermsMain() {
api = LuckPerms.getApi();
}
}``````public void onEnable() {
new LuckPermsMain();
}```
Removing works or that fails too?
That fail
When you try using the command, you get back the message?
What was the way to fix it?
How to get a player group from sponge plugin?
ok
but
how to get list of the groups?
api.getGroups()

Thank docs
π
Hey. I was having a problem. I have a spigot server, and for some reason. My prefixes were not showing
@autumn kiln #support-1 is the better place to ask
ok
Luck, i know this may be a silly question. Can i get the prefix of a player using the api when creating a plugin for BungeeCord?
is this the place to ask for help with server crashings?
Hey luck, in user#inheritsGroup - is there a way to specify all contexts?
I want to get all groups, not just a specific context
You could iterate over all user nodes and filter everything out that isnβt a group @rain dome
That's horrendously messy, I'd prefer not to do that
If it's the only way, I will, otherwise I'd prefer something else
not sure i understand the question
To clarify, you can specify a context for inheritsGroup, is there any way I can make that context include multiple servers
Why is setPrimaryGroup not working? Is there something else needed besides save?
@proud crypt any clue? Since youre online x.x
Hey Albfred! Please don't tag staff members.
Rip
Isnt there a way of like, removing perms
Like to tag staff
Tag me if anyone responds i guess
Literally ran setPrimaryGroup(string) and sended the message of their primary group and it didnt change it at all
No there isn't and no I don't know.
hi
@rain dome best way to do that is just by querying the full set of nodes
No i canβt, you have my attention for about 1 min and then Iβve got to go π
Okay so what exactly does setPrimaryGroup do
Because when i run it on a user then do getPrimaryGroup it doesnt seem to change
you will need to set primarygroup-calculation-method to stored in the config for it to apply
Ty ily
Why does /lp user <nick> switchPrimaryGroup <group> <- doesn't remove old group from one which we are switching off?
and add new
Because you want to use parent set instead
is group set and parent set same?
because group set (removes other temproar group from player)
Yes.
Hey! For some reason, I'm on a group called "owner" with its prefix and everything, but it shows the default prefix instead. How do I fix this?
probably cause weights
Yeah, fixed it.
Can someone help me negate a permission in an inheritance with default for instance default has a prefix in tab. Merchant is parenting it also so it has that but also has the permission for the Merchant prefix, but it dose not show up because of the permission in the default, is there a way to negate it in merchant, but not take it away in default?
lp group merchant permission set default_perm false
And merchant group need bigger priority
And yeah #support-1
how do I check if user or any of their groups have a certain permission? user.hasPermission() returns true only if the permission is set directly to the user
I don't have Player instance so I need to check that with User instance
or I need to manually get all the nodes and check if they match the target permission?
Why donβt you use the platforms permission check?
it's asynchronous
Doesnβt matter
of course luckperms override default permissions π so it's thread safe right?
Sponge, Spigot and Bungee can handle Async permission checks if the plugin implements it. Which LP does
And I can also check how a permission check is done through the API. Iβve done it before
So youβll have both possibilities. Use what makes more sense in the context
OK thanks I'll try to do that with player instance
ππ»
found another problem, why user.getPrimaryGroup() returns always "default" but in /lp user someuser info I see another primary group?
or is there any other easy way how to get users primary group? Or I have to write my own method for that? π
it should return the correct value
yeah I just double checked
the API method calls the same method as the one used in the command
okay, does someone know "how async" bungee is?
e.g. if I do something like this:
public User getOfflineUser(UUID who) {
return user = luckPermsApi.getUserManager().loadUser(who);
}
Would caling that method will hog down my bungee instance?
depends on the context of the call
from scheduler tasks, that's fine
but probably not from standard events
you want to avoid blocking the networking threads
let's say I just call it when I execute a command
public void execute(CommandSender commandSender, String[] args) {
...
User u = getOfflineUser(pUUID);
System.out.println(u.getName());
}
is there no way to get a offline user by name or am I blind?
I did it like this:
~~```
api.getStorage().getUUID(userName).thenAcceptAsync(uuid -> {
api.getUserManager().loadUser(uuid).thenAcceptAsync(user -> {
//do something with user
});
});
Better solutions are welcome though
Also is there any difference between these? Can the second load the user from it's name when invalid/valid uuid is supplied?
api.getUserManager().loadUser(uuid)
api.getUserManager().loadUser(uuid,userName)
I've forgot to rtfm, the above is for an older api version
api.getUserManager().lookupUuid(userName).thenAcceptAsync(uuid -> {
api.getUserManager().loadUser(uuid).thenAcceptAsync(user -> {
//do something with user
});
});
does that only use the data LP has or also mojang requests?
Only LP data
alright good, will try that then, thanks
hm, it says that it is using the cache. Doesn't that mean it will only lookup the uuid of users who are online?
loadUser and lookupUuid loads from the storage backing (the reason you have to use it async)
getUser uses the cache
Hi, please how i have web app for add/remove groups?
Mind to elaborate a little bit? Not sure what exactly you are asking @delicate bough
How i can use API for add/remove groups from player π
The API is only available for other plugins. It's not a web API
Everything you need to know to get started can be found here: https://github.com/lucko/LuckPerms/wiki/Developer-API @delicate bough
Can I ask something about the api?
Is there a event that gets triggerd when player's rank changes?
Like API
@crystal sonnet ?
Hey TeAm6_AZLIK! Please don't tag staff members.
Wow stupid bot
you guys know skript-mirror?
No
never used it
Canβt help with that
Also if Iβm not entirely mistaken, LP uses itβs own event system, to make the API platform independent
En that means?
I bet this Skript thing uses the Bukkit event system. Which means that registering a handler for the even the way you do cannot work, because the events are handled through LPs own system
Does LuckPerms have an event for when someone is added/removed from a group? I had a look but couldn't find anything besides the ones about track and the closest thing I could find to what I'm after is UserDataRecalculateEvent
group are represented az nodes too,
so NodeMutateEvent should work here too
aha I had that but I was listenin on my own perm, forgot that lp does that so I guess listening on group. should work
I'll give it a go, thanks
Yeh works like a charm, many thanks
@crystal sonnet , got any idea to fix?
Hey TeAm6_AZLIK! Please don't tag staff members.
Its probably not possible using skript alone
Ive never used skript before so cant help you either
LP events are dispatched through a different event system to the other events running on the server
Alright. Then use that. The wiki has a page on how to use the API. Iirc it should contain an example how to use the LP event system
link?
How would I get the name of a group that a user is in.
Set<String> groups = user.getAllNodes().stream()
.filter(Node::isGroupNode)
.map(Node::getGroupName)
.collect(Collectors.toSet());
https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#reading-usergroup-data
@still lintel
Yes, @nocturne elbow?
At the moment I use the following in my plugins to set up colors and more:
if(player.hasPermission("group.administrator"))
{
team = "B";
color = "Β§4";
tablist = "Administrator";
}
Is there an option to set every group a meta for that and access it with the API?
I want to replace
String color = "Β§a";
String team = "Z";
String tablist = "Spieler";
with something like that:
String color = controller.getLuckPermsApi().getMeta("color");
String team = controller.getLuckPermsApi().getMeta("team");
String tablist = controller.getLuckPermsApi().getMeta("tablist");
But how can I get the meta?
@south sail you have to use java streams
Set<String> groups = user.getAllNodes().stream()
.filter(Node::isGroupNode)
.map(Node::getGroupName)
.collect(Collectors.toSet());
https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#reading-usergroup-data
Hm okay, will have a look at it
@nocturne elbow If you have a MetaData of a group then metaData.getMeta().put(key, value) might work
Okay
I guess it's technically an API made by luck π
Who has used luck's Helper?
I'm confused with commands
do they still need to be in an onCommand?
I couldn't find it used in LuckPerms' repo to find an example
@proud crypt ?
Hey Artitus! Please don't tag staff members.
I have no idea sorry
I only know stuff about LuckPerms
I'll just test ig
@jaunty pecan can u write me please? I have private question
Hey matyvane! Please don't tag staff members.
what's it about?
i send u to spigot
I don't really see how that's a private question :p
but uh, anyway
the API is explained in detail on these pages
Yes I read it. But it did not help me too much
all of the things you've asked for are covered in those pages :p
okey
i know it's a lot to read, but I think it's definitely worth just spending a few mins reading through everything
*reading through everything in order
π
@jaunty pecan , any chance spark will run on the client to profile the client itself?