#luckperms-api

1 messages · Page 10 of 1

glossy mesa
#

@here

agile silo
#

bump

glossy mesa
#

Help?

frozen veldt
#

Question, I'm trying to set TP permissions to a group so I can allow players to TP to waypoints with Xaero's Minimap. I've tried adding minecraft.command.tp which Xaero uses to TP but no success. any help?

languid scaffold
# glossy mesa Help?

The error message says it all.

First of all, check your server Logfile. You can fix the error with the error messages that are in the Logfile.

main dagger
#

and dont try mass pinging please

bold ore
#

can somebody help for some reason when i type something i get kicked and it says this

wooden knot
#

how do i get a player's primary group

wooden knot
#

nvm

marble fractal
#

I need help

wintry lodge
#

I am having issues with "Styled Chat" and Luckperms to work. I have the chat mod installed and got the PlaceholderAPI in place. This is on fabric, but the chat does not want to change. I did the works in the config file but get no dice.

#

Anyone got something?

main dagger
#

also wrong channel

wintry lodge
#

I will thanks

glacial fox
#

is there a way to check if player has permission set to true ? (ignoring the * permission) ?
i've tried that:

public boolean hasPermission(Player player , String permission) {
    return player.isPermissionSet(permission) 
    && player.hasPermission(permission);
}

and it does not work, also i've tried using LuckPermsAPI, but to no avail

public Tristate hasPermission(String permission) {
    return toLuckPermUser().getCachedData()
            .getPermissionData()
            .checkPermission(permission);
}

it returns TRUE instead of UNDEFINED, Tristate has: [TRUE,FALSE,UNDEFINED] ..
ping me if you have an idea

fast delta
#

CachedPermissionData#checkPermission(String) is the exact same kind of check performed by Player#hasPermission(String); the isPermissionSet check should work, if you do not have the permission set (neither true or false), it will return false, short-circuit the hasPermission check and return false; if you have the permission explicitly set to false, that will override the global wildcard *, otherwise if you have it set to true it will return true

#

could you share the output of /lp user <the user> permission check <the permission> ?

white osprey
#

Hey! I'm trying to check if an offline bukkit player has a permission, using code below. Unfortunately it returns a different value than Player#hasPermission, because it doesn't take player's op status into account. Is there a way to get the same result as using bukkit api?

if (luckpermsUser == null) return true;

return luckpermsUser.getCachedData().getPermissionData().checkPermission("something").asBoolean();```

*using join() because it's executed asynchronously*
fast delta
#

not really

#

such things only work when the live player is online

#

I wanna say "like contexts" but you can query permissions with your own defined context set, op works slightly different

white osprey
#

So I'll have to see how does the underlaying mechanic work on online player and try to reproduce it somehow using offlineplayer's op status?

#

I guess it checks for registered plugin permissions

fast delta
#

i mean, if the player is op it'll just return true, that's how that works lol

#

although the op processing can be disabled

wild whale
#

Yeah the root problem you're hitting is the OP calculator isn't active for offline players because LP doesn't check the platform's OP status - heck, I don't even know if you can query whether an offline player is opped or not easily

tardy quail
#

Oh dam, i bet its a race condition

#

because they all end up in the default group if it doesn;t work

main dagger
#

you should use the modifyUser method

#

it handles loading and saving the user for you

tardy quail
#

Does it also force a message?

main dagger
#

no, see pins for that

#

if you mean messaging service

tardy quail
#

that's the one

#

I will change this around now

#

thanks for rapid response

cloud locust
#

I want to retrieve the prefix of a group

tardy quail
#

Just to confirm, user.data().clear(NodeType.INHERITANCE::matches); only removed groups that are inherited from the new group to be added?

#

So if they have a paid rank completely seperate, that isn't inherited from the group being added, it wont be removed

main dagger
tribal jungle
#

@main dagger

frank driftBOT
#

Hey zaidffoo! Please don't tag helpful/staff members directly.

wild whale
#

Don't ping.

cloud locust
#

How can I retrieve the prefix of a group?
I'm using the docs and I understand that it is something to do with Nodes.
https://javadoc.io/static/net.luckperms/api/5.4/net/luckperms/api/node/types/PrefixNode.html

Right now I've reached this far:

import:
    net.luckperms.api.LuckPerms
    net.luckperms.api.node

set {_group} to (instance of the plugin "LuckPerms").getServer().getServicesManager().load(LuckPerms.class)```
finite leaf
#

Hi, i am trying to implement luckperms api to my forge project, the main thing i want to achieve is to check if player has certain time of playtime and if so then i want to add him to luckperms group. the playtime thing is basic i can do that but for that group i need to use api (well no shit, what else could i use? KEKW). So... i read documentation, did what i was told to do but i can't get it to work in my forgemdk project. Am i missing something or it's just no possible? If so what should i use to achieve my goal?

#

I have it in external libraries but i am not sure if it's working. shouldn't it be loaded as mod when i start task runServer, as any other dependencies and APIs would?

main dagger
finite leaf
#

Yeah i did that, but i don't know if i'm just plain stupid or it's not supposed to show up as mod when i start server in forgemdk, if so... how do i test it?

main dagger
#

you need to have the LP forge jar in your mods folder

#

but only on the server

#

it will not work on a client

finite leaf
#

oh, so that's what i'm missing... 😅 anyway sorry for being stupid and thanks for help

brave saffron
#

How to check if an offline user has permission?

#
            if (!annotation.permission().isEmpty()) {
                PlayerDTO player = PlayersData.get(event.getUser().getId());
                if (player.getUUID() == null) {
                    Language language = LanguageAPI.get(event.getUser());
                    event.reply(MessageAPI.embed(language, Color.RED, GlobalMessages.ERROR__NO_PERMISSION).build()).setEphemeral(true).queue();
                    return;
                }

                UserManager userManager = luckPerms.getUserManager();
                CompletableFuture<User> userFuture = userManager.loadUser(player.getUUID());
                User user = userFuture.join();

                user.

                if (!user.hasPermission(annotation.permission())) {
                    Language language = LanguageAPI.get(event.getUser());
                    event.reply(MessageAPI.embed(language, Color.RED, GlobalMessages.ERROR__NO_PERMISSION).build()).setEphemeral(true).queue();
                    return;
                }
            }```
tardy quail
# main dagger it removes *all* inheritance nodes from that player

Hm, I obviously misunderstand that method then

Is there any decent way of remove any groups that are children of the group to be added.

Eg; If a user has group.test1 but I want to add group.test2 and have it automatically remove the child group.

Without removing ALL groups incase they have a paid role

tardy quail
#

I think fixed it like this:

// Get all groups inherited by the new group
Set<String> inheritedGroups = group.resolveInheritedNodes(QueryOptions.nonContextual()).stream()
    .filter(NodeType.INHERITANCE::matches) //Get inhertiance nodees
    .map(NodeType.INHERITANCE::cast) // Filter out null
    .map(InheritanceNode::getGroupName) // Extract group names
    .collect(Collectors.toSet());

// Remove the groups
user.data().clear(NodeType.INHERITANCE.predicate(
        inheritanceNode -> inheritedGroups.contains(inheritanceNode.getGroupName())
));
tulip widget
#

i'm trying to use the getNode() method on the NodeMutateEvent, but it only seems to work on the NodeAddEvent and NodeRemoveEvent. is there a way to pull it from the mutate, or would i have to split it up into the two separate events?

fast delta
tulip widget
#

great, thanks!

marsh swallow
#

LuckPermsProvider.get(); is instantly crashing my plugin, even after ensuring LuckPerms is properly loaded.

        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.4</version>
            <scope>provided</scope>
        </dependency>

is in my pom
and i also have LuckPerms as a dependency in my paper-plugin.yml file

I don't know what to do from here, I can't use luckperms ;-;

wild whale
marsh swallow
wooden vault
#

how do I add custom context flags?

gritty turtle
#

Having some issued with the REST API. I am seemingly able to use it to do everyting i want, and i can confirm the changes done from the API are stored on the database, however the actual permissions doesn't seem to take effect unless i reboot the minecraft server i am testing on. /lp sync doesn't work either. Using in-game commands for promotion and demotion works instantly. Am i missing some command or setting?

calm hearth
#

My plugin can't get the provider, does anyone know why?

main dagger
calm hearth
#

The server is hosted locally, does it affect anything?

ocean yacht
#

no

cursive terrace
#

I just launched the Skyblock server with a friend of mine and I would like to have authorization to trade with a merchant. How do I do this?

brave saffron
#

How to load user sync?

#

CompletableFuture<User>.join() will return the user directly blocking the thread?

fast delta
#

yes

#

it will block for as long as it has to until the user is loaded, if the user storage or communication with it is slow

brave saffron
#

Great

tough panther
#

Hello, is there a way to find out when a rank expires, i.e., in days, hours, and minutes? If not, is there a solution?

tough panther
#

Thank you

wooden vault
wooden vault
versed swallow
#

Is it possible to check through the API if a player is in a running temporary parent group?

proper flume
#

How can I make it stop appearing like that?

main dagger
proper flume
#

yes there is no plugin

main dagger
proper flume
#

for LP api in not plugin

main dagger
#

so you arent making a plugin?

proper flume
#

I don't really know how to do this, do you have another solution?

next moon
#

Blast are you using the web editor?

#

If you are just replace it with the same code and instead of 0 try adding a 1. shrug

proper flume
#

well then it no longer shows 0 and shows 1

next moon
#

Is the prefix for a rank permission?

#

Cause no offense without much context just that screenshot alone it's hard to tell what your trying to do shrug

proper flume
#

I don't know if I'm allowed to post here.

#

so

next moon
#

Ahh color coding

proper flume
#

not

#

for staffchat

#

is not vault_prefix

next moon
#

You want to change it to suffix

#

That's your issue

proper flume
#

hmm I'm trying

night pier
#

Unless this is API related, use a support channel please

next moon
#

Will do but I think we figured it out ☺️

proper flume
#

but I think it will show suffix.0.rank

next moon
#

Blast let's go to support

proper flume
#

okey

wary violet
#

hi, i'm trying to use an external bot to modify luckperms database
currently, the system in question is using mariadb+rabbitmq, and i'm trying to make a discord bot to change some things (like user groups and permissions for example (yes i know, there is existing solutions, however the planned use case demands a custom made one))
i figure i have to send an update message through rabbitmq after modifying database, but its not immediately apparent to me what kind of data i should send
could someone give me a quick rundown of the classes inside api.messenger.message.type package (https://github.com/LuckPerms/LuckPerms/tree/master/api/src/main/java/net/luckperms/api/messenger/message/type) so i can save myself from a couple of hours of reverse engineering?

GitHub

A permissions plugin for Minecraft servers. Contribute to LuckPerms/LuckPerms development by creating an account on GitHub.

main dagger
#

the messaging service just tells other instances that something changed, and to pull from the database again

#

it doesnt actually apply any changes or include what was changed

wary violet
#

i didnt know that was a thing! that sounds wonderful
i initially intended to do exactly that; chaning DB and then "manually" informing clients of the change

#

could you please elaborate a bit about the REST api?

main dagger
wary violet
#

whatever code runs under lucko's name is always so well crafted

#

thank you very much for the heads up, i will check that out

fallen junco
#

Hi
I am developing minecraft website im thinking of using next js for frontend and i haven’t really thought about the backend yet. I was wondering how to automate rank purchase.

For example when user buys a rank which gives certain commands this process is automatically done and given to that user. Instead me manually checking who bought what and manually giving them the rank they bought.

I know a website called tebex does it where you easily set it up but I really dont want to use tebex. Plus I want to use this opportunity to learn about plugins, api etc

Is this process done through lucky perms api? If yes how?

main dagger
obtuse palm
#

ok big question. Rest API, if I include it as an extension to the velocity server, I get an error saying NoSuchMethod (ConfigurationAdapter.getKeys)

[14:24:50 ERROR]: Couldn't pass ProxyInitializeEvent to luckperms 5.4.157
java.lang.NoSuchMethodError: 'java.util.List me.lucko.luckperms.common.config.generic.adapter.ConfigurationAdapter.getKeys(java.lang.String, java.util.List)'

Do I use an incorect luckperms version?

fast delta
#

hm, what's the rest of the stack trace like? 🤔

versed swallow
#

Is it possible to check through the API if a player is in a running temporary parent group?

wild whale
#

Yup, just check for an inheritance node on the player with an expiry

obtuse palm
main dagger
obtuse palm
#

I fixed it dw, still thanks for trying <3

finite pelican
#

Can someone pls help me in support 1

night pier
#

When someone decides to, yes.
asking in unrelated channels is not going to speed that up.

finite pelican
#

Sorry

ruby sierra
#

can you help me out please X_plead

main dagger
frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
ruby sierra
#

bbut i didnt ping either ;c

main dagger
#

replying pings unless you turn it off

thin fog
#

how do i check if an user has a specific permission? do i need to stream the permission nodes of the user and all of its groups and subground or is there a more straightforward way? or does the user already have in its node data the permission of its groups etc

main dagger
#

eg bukkits CommandSender#hasPermission()

thin fog
fast delta
#

through the CachedPermissionData checkPermission

#

user.getCachedData.getPermissionData...

thin fog
#

cool ty

plain grail
#

Hello, I don't have much knowledge of APIs and imports, how do I solve the problem?

plain grail
#

I tried it but it didn't work
Do I have to do anything else specific?

#

I had also tried to change the version I had read online

fast delta
#

the artifact name isn't luckperms-api, just api

karmic dew
#

Is there a way to fully squelch these, also in console?

#

Secondly, it seems due to using mongodb+rabbit for x-server perms messaging/updates, my LP velocity updates are also propagating out to all the LP paper servers, how might I prevent that?

fast delta
#

you can't stop those messages from being logged to the console of where it originates from, but you can stop it from being broadcasted to players and sent to other servers, https://github.com/LuckPerms/LuckPerms/blob/7744913df2e8e2ad1670fd3374c47c80143fcb64/bukkit/src/main/resources/config.yml#L253-L261
i'm not sure what you mean with the velocity updates; updates caused in any LP instance will be propagated to all other LP instances in case any of the changes affect the resolved permissions loaded in any other LP instance, that's what the messaging system is for

karmic dew
#

well i have 2 proxies, both on LPV, then N SMP paper servers, with regular LP, the LP servers are hearing about the LPV updates which I wouldn't want crosspollinating

#

I suppose it makes sense as to why but is the only solution to, dunno, have a different rabbit vhost or something?

karmic dew
fast delta
#

yes, set those two settings to false in every LP config, proxy included

karmic dew
#

with push-log-entries: false, will they still update each other appropriately though?

#

or is this some separate messaging service (not rabbit, etc)

#

oh push logging entries

fast delta
#

yeah

karmic dew
#

that's an easy one to miss

#

ok cheers ❤️

fast delta
karmic dew
#

in this specific context i'd rather not even use frequent tempperms, but that's out of scope

mild jewel
#

is there an API they can be easily used for tablist/scoreboard, or any guide, the like the ranks are sorted etc or is it way better to use TAB

limber fog
#

wait a min, luckperms actually is out of date? no update since last yeah june

main dagger
#

what?

clear idol
#

how can i set limit per groups like only 5 players can get the vip or something like that
i made a plugin with chat gpt but dont work
please HELP

crystal sonnet
#

Isn't this how you check if a User has a permission?

                        user.getCachedData()
                            .getPermissionData()
                            .checkPermission(teamPerm)
                            .asBoolean()
#

user being a net.luckperms.api.model.user.User

#

This seems to only resolve inheritance up to 2 layer, which is super weird

#

Oh. Interesting. It only doesn't work for a specific rank...
I'll do some debugging

#

Ok yeah it's me being a dummy and mistyping a permission...

#

I do have one question however, which event is the best to use to listen to permission changes?
I found the LogBroadcastEvent, however that fires for each log message, which is a bit much. I only need it to fire once per edit (like if in the editor there are multiple changes=

main dagger
crystal sonnet
gusty frigate
#

Hello, I need to dynamically change the server name in the config, I need this so as not to change this value manually on each server. How to do this? (I have a plugin that takes responsibility for determining what the server identifier should be)

main dagger
gusty frigate
main dagger
dull sable
#

is there a way to check for x permission whilst completely ignoring the user is opped (aka has every perm by default)??

main dagger
#

if you are on bukkit, just dont give the perm to ops

frail breach
#

how can i get this groups?

#

api is returning me 3

#

vip4 has vip as child

#

but i dont want it to return child's

#

this is all the code

main dagger
#

filter the users nodes for inheritance nodes

frail breach
#

with Flag.RESOLVE_INHERITANCE?

#

oh this ? NodeType.INHERITANCE

#

i made it tysm

frail breach
#

I'm using the API for one thing, I want to make it so that when I do "/maintenance on" the temporary ranks don't continue applying the time, is it possible to do this?

solemn saffron
#

When I try to register a new ContextCalculator in my onEnable method, I get a NoClassDefFoundError: net/luckperms/api/context/ContextCalculator. What am I doing wrong?

main dagger
fast delta
solemn saffron
fast delta
#

share the server's complete startup logs & your paper-plugin.yml

solemn saffron
fast delta
#

hm that looks like it should work

#

what's the paper-plugin.yml inside the jar file on the server look like?

#

as in, directly extracted from the jar

solemn saffron
fast delta
#

are you shading the LP API? 🤔

solemn saffron
#

nope

fast delta
#

hm yeah then if you aren't and the yml in the jar is the correct one, it all looks fine from this end; you can probably ask in the pufferfish discord given you're using pf

jaunty pecan
solemn saffron
#

The Adventure api

obtuse palm
#

Hi do Star permissions return true at the permission check endpoint?

#

For example plugin.* for plugin.test

obtuse palm
#

Fixed

solemn saffron
#

In my implementation, the NodeMutateEvent is triggered only when a node is removed, although it is documented that it should also be triggered when a node is added. what is the problem? In the same way, the event is not triggered for the NodeAddEvent

rocky cloak
#

helloo everyone! can someone explain me how to integrate luckperms on server, to rest api, should i use more .jar plugins, THANKS!

main dagger
rocky cloak
main dagger
#

you dont need to use the standalone lp to use the rest api

main dagger
karmic radish
#

can you tell me how to get this temporary permission via API, I am specifically interested in the time (i.e. I want to display the information in my plugin for mute)

primal forge
#

Can I get a level of the group with the API?

gusty lotus
#

idk how to use anything

#

how do i give myself admin

wild whale
wild whale
main dagger
#

i would just modify the display name of the player with player#displayName() rather than adding and removing prefixes

primal forge
#

Thank you for the tip, but it wont let me use the API.

wild whale
#

The method Leah referenced is Paper API, not LP. LP isn't necessary for doing what you're trying to.

primal forge
#

Nevermind, I fixxed it thank you though for helping me!

jaunty torrent
#

Hi, I'm trying to use lp api, but it isn't working

primal forge
jaunty torrent
#

I tried add and refresh dependencies, but not worked

primal forge
#

We need a bit more informations and some code to help you

jaunty torrent
wild whale
#

Have you reloaded gradle since adding LP? After changing your buildscript, you need to tell Intellij you're done your change - there should be a little reload icon in the top right of the text area when you have your buildscript open

primal forge
jaunty torrent
primal forge
#

Can I get the weight of a Group with the api? And is there an event for if a user gets added to a group?

primal forge
#

let me show you, give me a second

jaunty torrent
primal forge
#

If you change your gradle file, there should be a little button in the right corner:

#

that reloads gradle which should fix it

#

Otherwise you can click this little thing on the right side and then click the little reload Icon

wild whale
primal forge
#

What do you mean with the first one, like is there a function?

primal forge
crude laurel
#

Hi, I was wondering if there's an event like UserDataRecalculateEvent but that lets me know the cause of the recalculation? Because I want to filter out recalculations on login

slender talon
#

Hi, I had this error on my 2 servers, I don't know where it comes from, it seems that the data of a player is not updated and that when I do /lp editor it completely stops the error and it displays my scoreboard, the tab etc.

#

[04:22:36] [Server thread/WARN]: [OMC] Task #61 for OpenMC v2.0.0 generated an exception java.lang.IllegalStateException: Unable to get a user for CraftPlayer{name=tuixy} at me.lucko.luckperms.common.api.implementation.ApiPlayerAdapter.getUser(ApiPlayerAdapter.java:59) ~[?:?] at OpenMC.jar/fr.openmc.core.features.scoreboards.GlobalTeamManager.getPlayerHighestWeightGroup(GlobalTeamManager.java:83) ~[OpenMC.jar:?] at OpenMC.jar/fr.openmc.core.features.scoreboards.GlobalTeamManager.updatePlayerTeam(GlobalTeamManager.java:66) ~[OpenMC.jar:?] at OpenMC.jar/fr.openmc.core.features.scoreboards.ScoreboardManager.updateScoreboard(ScoreboardManager.java:174) ~[OpenMC.jar:?]

wild whale
slender talon
wild whale
#

👍 Ok just checking, we have some people use this channel for general support sometimes, and your message was a bit ambiguous

Could I see the code for the class that's throwing the error please?

slender talon
#

Is it possible that I give it to you this afternoon?

slender talon
#

(in core/utils/LuckPermApi.java and in core/features/scoreboard/GlobalTeamManager.java)

slender talon
#

Is that enough or do you just want the classes?

fast delta
#

does that happen consistently or at random?

#

your code usage looks fine so i'm not sure what the issue could be

slender talon
#

For example, I just restarted my server. And I just got the error (no more errors appeared after the /lp editor)

#

(don't hesitate to ping me so I can be more responsive)

wary cedar
#

Ive made an private server system for players to host their private rounds. Is there any way to give players permissions (for example for the gamemode command) only on this server? I dont want to permanently add it to them. I have an api to check if the player is the host

empty crescent
#

For instance I have a competition plugin where people only inherit permissions to be able to do stuff in the world if they're in the competition. Managed with the context is_competing:true.

slender talon
fast delta
#

i don't really see how that could happen in the first place tbh since it's w/ online players

#

very confusing

slender talon
#

I'm like you, I did some research to see if this error has already appeared in someone else but nothing

#

and believe me my plugin will host a lot of people and if this error appears once in 20, and there are 200, the console will quickly explode.

fast delta
#

@slender talon could you try adding a listener to the UserUnloadEvent and printing a stack trace? I am failing to reproduce this issue myself, with a little bit of hope the event is called and that'd be of help
Also just to make sure, you are running with an up-to-date version of LuckPerms, and not on, like, v5.2 or something, right?

slender talon
quick ingot
#

i need help on how to do anything with ts

main dagger
frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
quick ingot
#

!ask

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
quick ingot
#

wait if you give them a perm to do something like /tpa does it also let them do /tpaccept or /tpa player name

slender talon
# fast delta <@487272702051090434> could you try adding a listener to the UserUnloadEvent and...
public class UserUnloadListener {

        public static void register(JavaPlugin plugin, LuckPerms luckPerms) {
            EventBus eventBus = luckPerms.getEventBus();

            eventBus.subscribe(plugin, UserUnloadEvent.class, event -> {
                System.out.println("[DEBUG] LuckPerms UserUnloadEvent : " + event.getUser().getUsername());
                System.out.println("*ceci est normal, j'en ai besoin pour capter le bug avec luck perm*");
                new Exception("debug UserUnloadEvent").printStackTrace();
            });
        }
    }

public class LuckPermsAPI {
    @Getter private static LuckPerms api;
    private static boolean hasLuckPerms;

    public LuckPermsAPI() {
        if (Bukkit.getPluginManager().getPlugin("LuckPerms") == null) {
            hasLuckPerms = false;
            return;
        } else {
            hasLuckPerms = true;
        }

        api = OMCPlugin.getInstance().getServer().getServicesManager().load(LuckPerms.class);

        if (api != null) {
            UserUnloadListener.register(OMCPlugin.getInstance(), api);
        }
    }
... methods
}
#

like this?

slender talon
#

Mh? I don't know

fast delta
#

that looks fine yeah

slender talon
#

and that will help you know what?

fast delta
#

like I said, hopefully the event is called when you run into this issue

slender talon
#

I had this, but when the player logged in he was registered in luck perm

silent sail
#

!ask

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
silent sail
#

what would the command look like for luckperms for everyone to have access to their own beds in the bedhome plugin

#

so they can teleport to their own beds

slender talon
#

@fast delta Sorry for the ping, but I just got the bug! I don't know if the stack trace will be useful to you.

frank driftBOT
#

Hey iambibi_! Please don't tag helpful/staff members directly.

slender talon
#

oops

fast delta
#

thonk the housekeeper unload is after you logged out and before you logged in, right? cuz the join is happening afterwards

slender talon
#

I left, after the data was unloaded and then when I logged in it unloaded my data then I had the bug

fast delta
#

hold up, how long does it take you to log into the server thonk

slender talon
#

it's a big big server

#

It's an open source server created by a French YouTuber, and he has a Minecraft company and they are the ones who provided us with this server.

fast delta
#

uhh

#

that doesn't really answer my question lmao

slender talon
#

that's why the mistake bothers me, your question?

wild whale
#

...I'm going to guess that's significantly longer than the housekeeper's threshold, since logging in should take a matter of seconds

slender talon
#

What is a housekeeper? Sorry, I'm French, my translator is telling me nonsense.

wild whale
#

The task responsible for unloading offline Users. Users remain in memory for at least 5 minutes after they were last interacted with via the API, or a time period I'm forgetting after they disconnect

slender talon
#

oh ok

wild whale
#

Ok dug it up, looks like the standard unload time is 1 minute, which is shorter than 1:07, so that's why the user isn't present

slender talon
wild whale
#

...and reading is hard apparently, I read your message as 7 minutes not 1:07. Looks like the effect is still the same though

slender talon
#

ah

fast delta
#

yeah there's something in there holding you up for over a minute, and that's enough time for LP to automatically unload the User because it did not quite finish logging in

#

at that point you gotta find out what that thing is as it's outside LP's control :/

lapis elm
#

Hello, to use LuckPerms api for my velocity plugin, I need to import to my project LuckPerms-API or the luckperms-velocity jar?

fast delta
#

the API, it's platform agnostic

slender talon
night pier
#

No the problem is whatever is causing you to have a minute plus login time.

slender talon
#

Well, it's a bug, so lol, imagine that on a server of 200 players there will be one person who has this bug.

main dagger
#

the issue is that some plugin is causing logins to take over a minute

#

thats not really a good experience for the players

slender talon
#

Yes, I agree, but it happens once in 200.

fast delta
#

might be a ping thing, i'm surprised that the client is able to take that long to log in

#

but it's left in this limbo state during login where they don't really finish logging in, so luckperms cannot register them as online

#

hmm

#

i forgot this setting existed; could you enable the debug-logins setting and share the log section when this issue happens during login

#

I am also kinda curious how you are consistently reproducing this issue, lol

slender talon
stone basin
#

I am wondering anyone can help me I have a paper server and the lp editor doesn't work I try to click the link and nothing .I can on other links just not Lp editor.

slender talon
#

I think login debugs don't matter much.

opal chasm
#

is there an event for when a player's temporary parent group expires?

#

or even better, when a player loses a permission, as a result of said temporary parent group expiration?

slender talon
fast delta
#

myeah,, there is something outside oḟ luckperms that is holding onto the login process, preventing it from finishing? the UserHousekeeper will not clean up the Users as long as the player is online but, at that point the player is not really online, so a minute goes by and it gets cleaned up

slender talon
fast delta
#

a plugin or a client mod, or if you are using bungeecord/velocity it could be a proxy plugin
does login take a minute with luckperms as the only plugin on the server?

slender talon
slender talon
#

Oh I have to know! ItemAdder applies a resource pack, and sometimes it takes a long time, the bug may be caused because of that.

fast delta
#

interesting

slender talon
#

I think the solution is to make a connection with ItemAdder which checks if there is ItemAdder and when the resource pack is loaded then you launch the last phase of the housekeeper

main dagger
#

because if that is the issue in your case, it wouldnt surprise me if the same thing happened with applying any resource pack it took long enough

flint willow
#

Would there be a setting in the configs somewhere to make UserHousekeeper wait longer than one minute to clean up players? That might fix iambibi_'s issue.

slender talon
#

otherwise try joining a server with a very very heavy resource pack in order to try to exceed 1 minute

flint willow
main dagger
#

"pretty sure" based on speculation is not confirming a bug. id think that if loading a big resource pack alone with no other plugins causes LP to unload the user, thats an LP bug

slender talon
#

Do you really want me to test this?

fast delta
#

i mean, it sounds probable that it can be caused by bombing the client with resource packs during the configuration stage, not specific to IA

#

adding a setting for the housekeeper timeout would "solve" the problem, but it's grunt patchwork than a proper fix

slender talon
#

yes it is related to the resource pack application, it is not specific to ItemAdder

flint willow
slender talon
#

So the bug fix can be launched? Is it possible to have an issue/pr to have concrete progress on the bug fix?

flint willow
#

If you want to test to see if that is what your issue is to make sure firet, then take out a few plugins (just temporary) that are safe to remove to get load times under a minute and see if it works. I'm unsure if they found a fix because he was only over by 3-7 seconds about every 5th login. I think he managed to tweak a few setting to bring it under a minute reliably. I can try to research it and see if I come up with anything. No idea because I haven't experienced that myself yet.

fast delta
#

what

flint willow
# fast delta what

About a UserHousekeeper function somewhere that unloads players taking longer than one minute load into a server.

fast delta
#

sure, but your message doesn't make much sense to me xD

flint willow
#

Oh lol I was responding to iambibi who I think(?) was asking me about testing or a patch. He was running into that issue and I just meant a quick test would be to remove some plugins to see if he can get user load time under a minute and see if that fixes it. Then he'd have a better idea if that is definitely his issue.

devout idol
#

anyone here to help ??

#

is there a setting in the config to op me back i was setting up luckperms and the rank i was testing didnt have op soo what can i do any help will be nice

primal forge
devout idol
#

It wouldn’t let me add myself back what I needed to do was delete both light, perms and EssentialsX than I needed to go into server settings and change the file back to operator rates on so I can give myself operator through the consul. Then I had to reinstall both essentials and lock perms. It was a interesting, but I got it done thank you for the information.

flint willow
# slender talon so?

Hey there. I'm still unsure if you're replying to me or not lol If you are referring to me, I don't have a guranteed fix for you, but I can explain it a little better and try to help.

You're players are being timed out by the UserHousekeeper function is in the .class files of LuckPerms because it takes longer than 1 minute for them to fully load in. I think that could be altered to extend the time that LP waits for a user to login before unloading them if they take too long. That would have to be done by getting hold of the original .java files to make an edit before changing it into a .class file and recompiling the plugin.

The best thing would be for LP devs to implement some type of solution (maybe a config option for server owners to increase the time?)

For now, I think your only workaround is going to be trying to get player load time under 1 minute. The easiest way will be to simply remove a few plugins you are ok going without (at least temporarily) and see if you get the time for the player to fully load in down under a minute. That would fix your issue until the devs could respond about whether they would consider extending the time on the UserHousekeeper function or adding the ability for server owners to set the duration.

Kind of a long shot alternative here, but some plugins that add new items compatible with bedrock clients have optional .mcpacks that can be placed in the geyser folders to ease the burden on the client side. That might decrease the time for the player to fully load in (slightly). Might try that if you're only a few seconds over.

There is also a product called Resource Pack Manager that will let you combine resource packs. It's meant to try to avoid conflicts, but can have the side effect of helping to streamline your stuff a little bit as well.

slender talon
flint willow
# slender talon But I've said everything, I think they have an idea of ​​how to reproduce the bu...

Well, nobody knows who you are asking questions to without some context. You're mostly replying at yourself and haven't had any one specific person dedicated to helping you. Are you sure the devs know you're waiting for them specifically to respond to you?

I was just trying to help, but again, the lack of context around who you're talking to in your responses makes it difficult to know who you're talking to about which subject.

slender talon
#

I don't even know what you are? A luck perm developer?

#

So I found a bug with UserHousekeeper.
If you have a very slow connection (more than 1 minute), often caused by loading a resource pack, then the username isn't loaded and this error occurs: java.lang.IllegalStateException: Unable to get a user for CraftPlayer{name=iambibi_}

So I'm asking you (the luck perm developers) this question.
Can the bug be fixed? If so, should I file an issue on GitHub?

flint willow
# slender talon Well, I'm going to give you the speech again as if I were new...

I'm not a dev, just one of the many people using the product that doesnt mind trying to jump in and help others out, as is pretty common in any game modding community.

Always feel free to search guthub issues and post there id it isn't already an open issue. They definitely want to make it as issue-free as they can for as many people as they can. They won't mind.

I'm certain this is an issue the devs can fix, just likely is something that has not occurred enough to be brought to their attention as an issue needing addressed.

slender talon
#

yeah but hey if they want me to pay them to fix this very annoying bug on a 100 player server well...

flint willow
#

I definitely get the frustration when it is dealing with a server handling that many players. I can make a post in the support channel and tag you for devs to try to follow up on? I think they keep up with people needing troubleshooting there a bit better.

I could definitely be wrong, but I don't think there's ever been anything paid related to LP?

slender talon
#

I don't think there were any payments around Luck Perm.

flint willow
#

Oh ok. I was just confused on the comment about paying them to fix it lol

flint willow
#

I went ahead and tagged you in a post in the support channel so that hopefully you'll get a better dev response. Hope they get you fixed up.

simple vector
simple mural
#

Hi, quick one, how would one use the api to delete a player from the luckperms database?

trail ember
ivory flame
#

hello, i have the placeholder api from luckperms and use the luckperms_expirytime .... is there any way to change this time to only show hours or day and hours? rn i use in my skript the temp permission for 3 months and i want that in my score board that it doesnt show like 2mo xxxdays xxhours... i onyl want to have the days and the hours.. pls help

main dagger
#

wrong channel

solemn saffron
#

Which event can I use to intercept player permission updates? Is there one?

main dagger
solemn saffron
solemn saffron
#

So basically, I want to have 4 custom Minecraft events that are triggered through LuckPerms. (Platform independent)

First, there’s PlayerPermUpdateEvent – this one should fire whenever a player’s permissions change.

Then PlayerGroupAddEvent and PlayerGroupRemoveEvent – pretty simple, they trigger when a player gets added to or removed from a group.

And last, PlayerTeamUpdateEvent – this should only fire when stuff like the player’s prefix or suffix changes.

neon sparrow
solemn saffron
main dagger
solemn saffron
trail ember
solemn saffron
#

This is my code, am I not doing it?

public void setDisplayname(String displayname) {
        CompletableFuture.runAsync(() -> {
                DisplayNameNode displayBuilder = DisplayNameNode.builder(displayname).build();
               group.data().add(displayBuilder);

    PermissionApi.getLuckPerms().getGroupManager().saveGroup(group);
        }).thenRunAsync(() -> PermissionApi.getLuckPerms().getMessagingService().ifPresent(MessagingService::pushUpdate));
    }
main dagger
vivid plover
#

how do I check if a group/player is inheriting a certain permission from another group (rather than that specific group/player being allowed that permission)... while still taking wildcards and stuff into account (so I can't just check the raw permissions list)?

My approach was to query the permission, then check if the group had the returned node
however, while testing my plugin, this seemed to falsely think that the permission was inherited... once (so I can't reproduce it)
but it shows that this method doesn't appear to be reliable?

So is there a better way to handle this?

main dagger
#

ok and?

graceful prism
#

@main dagger

frank driftBOT
#

Hey hinkxrao! Please don't tag helpful/staff members directly.

graceful prism
#

I need help

graceful prism
#

Guys I why does group doesn't appear in the chat only in tab

main dagger
frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

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!

List of chat/tablist formatting plugins that work with LuckPerms
main dagger
#

oh they already left the server 💀

celest acorn
#

Is there any way to make context calculation work for offline players? I'm on Paper

#

Also, why does it rely on platform player instances instead of LP's User instances?

fast delta
#

you can't "make context calculation work for offline players", but you can make a QueryOptions with a certain ContextSet to it (see the static factory methods in QueryOptions), then pass that QOpts to CachedDataManager#getMetaData/getPermissionData

#

and the reason you need an active player instance for the context manager and calculators is because, a User is basically just a simple NodeMap holder with a UUID attached to it, there is no context (ha) you can really get from it to make a useful context calculator work with

#

(probably, i wasn't there when this was designed)

celest acorn
#

I was trying to apply an inheritance node conditionally based on custom dynamic context, turns out my context calculator isn't even called for offline players because the subject type is Player and doesn't exist

celest acorn
fast delta
#

well, does your context calculator make use of the Player instance? or is it a StaticContextCalculator?

celest acorn
fast delta
#

can't you just calculate that context result directly given you have the id, and build a QueryOptions with it before passing that to getMetaData/getPermissionData?

celest acorn
fast delta
#

do context calculators not work on standalone LP?

celest acorn
celest acorn
fast delta
#

but there is no player

celest acorn
#

fair enough, but then /lp user SomeOfflinePlayer permission check spaghetti.monster returns undefined or false even if the context would evaluate to the expected value

celest acorn
fast delta
#

mkay yeah

fringe spear
#

guys somebody help me i put a rank but she inst appear in the chat

#

?

#

!chat

frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

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!

List of chat/tablist formatting plugins that work with LuckPerms
celest acorn
left geyser
fringe spear
#

i dowloaded lp api

#

ty

fast delta
#

it might just be "this is what 10 year old code looks like" that's fair enough but it might also not be

celest acorn
solemn saffron
main dagger
solemn saffron
solemn saffron
#

So somehow the server has to know when something gets updated, right? And then, on Velocity and Paper, a LuckPerms event should happen – or am I wrong?

night pier
#

the event is fired on the server the change is made on

solemn saffron
#

But when I test it, it doesn’t always work like that. I give a group a permission using Velocity, but only the Paper server fires an event.

wild whale
#

How are you making the permission change?

solemn saffron
#

I make the permission changes using the LuckPerms API. Here is my code

        CompletableFuture.runAsync(() -> {
            group.data().add(nodeBuilder.build());
            luckperms.getGroupManager().saveGroup(group);
        }).thenRunAsync(() -> luckperms.getMessagingService().ifPresent(MessagingService::pushUpdate));
solemn saffron
#

Am I using the messaging wrong, or did I forget something?

solemn saffron
#

Can someone help me?

rancid condor
#

How am i supposed to edit a users meta value? i'm doing

val node = MetaNode.builder("neodaycare.boxcount", data.maxFreeBoxCount.toString()).build()
user.data().clear(NodeType.META.predicate { it.key == "neodaycare.boxcount" })
user.data().add(node)
LuckPermsProvider.get().userManager.saveUser(user)

but checking it ingame it's doubled
https://pics.briar.rocks/zKqd0hBkLOpR/direct

fast delta
fast delta
rancid condor
#

does getUserManager().getUser(uuid) not used cached/offline users?

spark vale
#

when I do something like this:

MetaNode node = MetaNode
                .builder(key, data)
                .context(MutableContextSet.of("server", LuckPermsProvider.get().getServerName()))
                .build();

I assume I get a meta node exclusive to that server, but how can I respect that when retrieving data like this:

user.getCachedData().getMetaData().getMetaValue(key, valueTransformer).orElse(ifEmpty);

Or does it respect it already? Because I don't see any way of specifying the server name

wild whale
#

If I'm not mistaken that should already respect the user's active context. If need be, you can explicitly specify the QueryOptions on the getMetaData call

solemn saffron
versed wing
#

Is there some further info about next commands, to do same things using API

/lp user <user> parent settrack <track> <group_from_track>
/lp user <user> parent cleartrack <track>

i am trying to embed these command functionalities into my plugin, but i would like to use API rather than executing commands of course

Although, i only see this (https://luckperms.net/wiki/Developer-API-Usage#obtaining-a-grouptrack-instance), not stated anywhere that i can use player here(maybe it is not possible)
Any ideas how i could do this? i need user and not group to be targeted

versed wing
#

any ideas anyone?

obtuse jolt
#

"This behaves in the same way as the set command, except it only clears existing groups which are on the specified track."

#

so just loop through the groups the user is in and remove all groups in the track, then set the group you need

civic geode
#

How to get when an group of an player gets expired?

cedar ruin
#

hello i am building a team plugin and i want to use placeholders as prefixes on placeholderapi parse command i can see them but when i try to use it as a prefix in luckperms it won't work someone any idea to fix this?

wild whale
#

If you mean you're putting a placeholder in the prefix you set in LP, that won't work under normal scenarios. LP will not apply PAPI placeholders anywhere, and display plugins have no reason to recursively apply placeholders when displaying prefixes/suffixes.

cedar ruin
#

how am i supposed to display a team name for someones name

wild whale
#

You should provide your own placeholder if you want to manage your own display thing in addition to normal prefixes

cedar ruin
#

so i have to make like placeholders without placeholder api

#

but does the luckperms api be integrated?

fast delta
main dagger
#

note that (i assume) it wont fire for players that are unloaded (eg. offline) at least until they reconnect

velvet helm
#

Hello, I am a fabric modder and want to use permissions for my commands. How can I check if a player has some permission?

#

I can't find such method

main dagger
#

use the fabric permission api

velvet helm
#

I searched "permission" but found nothing...

#

well, it's a independent lib and isn't contained in the fabric api...

fast delta
#

correct

#

that luckperms (and in theory any permissions providing mod) bundles and responds to requests

inner jewel
#

Hello, I'm writing a fabric mod and I'm using the fabric-permissions-api on 1.21.5.
How can I register permissions so that they appear in the autocompletion of the luckperms commands/editor?
for bukkit based server you could add permissions to the plugin.yml, but how would I do that on fabric and are there ways to register permissions directly from code?

upper stratus
#

Hello, can someone help me? I don't understand why it doesn't work.

main dagger
inner jewel
main dagger
#

why would there need to be? just run a permission check if you really want to add it to the suggestions

inner jewel
#

I guess I could check against a random UUID, it just doesn't seem like the proper way to do this to me.
It would be nice to have some sort of register method that you can pass an array of permission strings into instead.

cloud grail
#

How to set default rank prefix to members

fiery minnow
fast delta
#

where did you get that from?

#

that domain is just not a thing

fiery minnow
#

erm i got that from gemini from fixing my code

main dagger
#

LLMs will make shit up

fiery minnow
#

chat gpt too

visual trail
#

anyone know why the default keeps popping up

crimson sky
night pier
#

is that intended to be an argument against LLM's, or are you disagreeing with Leah?

tawdry wraith
#

Hello, how can I get a list of permission a player has in api?

wild whale
white remnant
#

Im trying to use the following method in a PlayerJoinEvent:

public static void setPlayerRankFormatted(Player player) {
        UUID UUID = player.getUniqueId();
        System.out.println("this is  being run fcking hell");;

        luckPerms.getUserManager().loadUser(UUID).thenAcceptAsync(user -> {

            CachedMetaData metaData = user.getCachedData().getMetaData();
            if(metaData == null) System.out.println("meta data is null");;

            String prefix = metaData.getPrefix();
            if(prefix == null) System.out.println("prefix is null");
            if(prefix == null) return;
            PlayerSettingsData playerSettingsData = settingsManager.playersSettingsData.get(player);
            playerSettingsData.rankFormatted = prefix;
            System.out.println("lp rank for player " + player.getName() + " is " + prefix);
        });

    }```

But the function inside thenAcceptAsync() is never being run. The setPlayerRankFormatted does run.
#

I just found out it worked after a 20ticks delay but is there a way to make it actually run the method when the user is loaded in luckperms or so?

#

idk whats causing the issue of notbeing able to load the user on player join

stone otter
#

what import do i gotta use to get the player prefix? i cant seem to find one

stone otter
#
package com.wilzeus.wzutils.misc;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.entity.Player;
import io.papermc.paper.chat.ChatRenderer;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.luckperms.api.*;
import net.luckperms.api.model.user.User;

public class CustomChatFormat implements Listener, ChatRenderer {
   
    private LuckPerms luckPerms;

    public CustomChatFormat(LuckPerms luckPerms) {
        this.luckPerms = luckPerms;
    }

    @EventHandler
    public void onChat(AsyncChatEvent event) {
        event.renderer(this);
    }


    @Override
    public Component render(Player source, Component sourceDisplayName, Component message, Audience viewer) {
        User user = luckPerms.getPlayerAdapter(Player.class).getUser(source);
        String prefix = user.getCachedData().getMetaData().getPrefix();

        Component formattedPrefix = prefix != null ? Component.text(prefix) : Component.empty();

        return formattedPrefix
                .append(sourceDisplayName)
                .append(Component.text(" §7»§r "))
                .append(message);
    }
}

#

ion really understand why line 29 errors

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ for easy pasting!

For console errors:

Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!

Other errors:

Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!

fast delta
#

Cannot invoke "...LuckPerms.getPlayerAdapter(...)" because "this.luckPerms" is null
you are passing null to your listener ctor

tawdry wraith
# wild whale A couple options depending on what you want, all on `PermissionHolder` (which bo...

Hey, thanks for quick reply, this is what I ended up using, however it returns [] every time, do you know what might be the issue?

private List<String> getPlayerGroups(Player player){
        if (luckPerms == null) return EMPTY_LIST;

        User user = luckPerms.getUserManager().getUser(player.getUniqueId());
        if (user == null) return EMPTY_LIST;

        var options = QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build();

        var r = user.resolveInheritedNodes(options).stream()
            .filter(node -> node.getType() == NodeType.INHERITANCE)
            .map(Node::getKey)
            .filter(t->t.startsWith("groups."))
            .toList();

        getLogger().info("[LINKDEBUG] Found " + r + " groups.");

        return r;
    }
fast delta
#

what's the point of the .filter(t->t.startsWith("groups."))?

#

all nodes are InheritanceNodes at that point so the filtering doesn't really make sense to be there at all

#

but, that's what is wrong, because inheritance nodes are group.foo instead of groups.foo, but you don't even need this filter so you can just get rid of it

tawdry wraith
#

Thanks, seems to be fixed now

vale notch
#

guys, i need your help, please!
Please check, if my build.gradle is correct for luckperms api?

plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

group = 'org.mjadapter'
version = '1.0.1'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
maven { url 'https://repo.papermc.io/repository/maven-public/' }
maven { url 'http://oss.sonatype.org/content/repositories/snapshots'
allowInsecureProtocol = true}
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}

dependencies {
compileOnly 'io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT'
implementation 'com.zaxxer:HikariCP:5.0.1'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'net.dv8tion:JDA:5.0.0-beta.20'
implementation 'org.springframework.boot:spring-boot-starter-web:3.1.5'
compileOnly 'net.luckperms:api:5.4' // LuckPerms API

// OAuth2
implementation 'com.github.scribejava:scribejava-core:8.3.3'
implementation 'com.github.scribejava:scribejava-apis:8.3.3'

// JSON обработка
implementation 'com.google.code.gson:gson:2.10.1'

// Веб-запросы
implementation 'com.squareup.okhttp3:okhttp:4.12.0'

}

processResources {
from('src/main/resources') {
include '**/*.yml'
duplicatesStrategy = 'include'
}
}

shadowJar {
archiveFileName = "RefSystem-${version}.jar"
mergeServiceFiles()

// Явно включаем все ресурсы
from(sourceSets.main.resources) {
    include '**/*.yml'
    duplicatesStrategy = 'include'
}

}

#

Cause i have error in console

wild whale
vale notch
# wild whale If you're getting an error, please share it.

00:02:08 ERROR]: Error occurred while enabling refSystem v1.0 (Is it up to date?)
java.lang.NoClassDefFoundError: net/luckperms/api/node/Node
at org.mjadapter.refSystem.ReferralSystem.onEnable(ReferralSystem.java:45) ~[RefSystem-1.0.1.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[purpur-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[purpur-1.20.1.jar:git-Purpur-2062]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[purpur-1.20.1.jar:git-Purpur-2062]

#

ReferralSystem 45: this.luckPermsManager = new LuckPermsManager(this);

wild whale
vale notch
#

name: RefSystem
main: org.mjadapter.refSystem.ReferralSystem
version: 1.0.1
api-version: "1.20"
authors: [mjadapter]

depend: [LuckPerms]
softdepend: []

#

This?

hardy wraith
#

Hello, I am trying to build a Velocity chat plugin with leverages Luckperms prefixes/suffixes and am struggling to fetch them from the api. When I attempt too I get an error telling me the Luckperms API hasn't loaded yet. I have only been able to find very limited information on implementation so any pointers are welcome as well.

As a bit of context this is being called on a PlayerChatEvent, if more information would make it easier don't hesitate to ask! 🙂

    private String getLuckPermsPrefix(UUID uuid) {
        LuckPerms api = LuckPermsProvider.get();
        
        User user = api.getUserManager().getUser(uuid);
        if (user == null) return "";

        CachedMetaData metaData = user.getCachedData().getMetaData();
        String prefix = metaData.getPrefix();
        
        return prefix != null ? prefix : "";
    }
main dagger
hardy wraith
main dagger
#

you need to set the scope to provided

hardy wraith
crimson sonnet
#

!help

frank driftBOT
#
Available commands

!advanced
!api
!argumentbased
!ask
!bedrock
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!forgepermissions
!formatting
!hack
!helpchat
!inheritance
!install
!libsdir
!locale

!lpc
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!permplugin
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!velocitycheck
!verbose
!version
!weight
!whyluckperms
!wiki

late void
#

!api

frank driftBOT
zinc swan
#

How i can get meta data with key but only that one with server=[servername]?

spiral plinth
#

!ask Where can I learn more about the LP api

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
zinc swan
#

How does LuckPerms get the exact server name? I want to compare server=[servername] with the current server so I can use the plugin on multiple servers.

#

or use luckperms the named server in the config

main dagger
main dagger
frank driftBOT
charred rover
#

Hello!

For a Discord/MC role sync plugin, I want to perform an action for each group added/removed to the player. To do this, I thought the NodeAddEvent and NodeRemoveEvent events would be appropriate, as groups are symbolized by permissions that start with group.. But the add/remove parent command doesn't trigger these events. I still can use the UserDataRecalculateEvent instead, but I'm afraid it might be triggered too frequently in my case. Just to be sure, am I missing something else that would fit better?

Thanks a lot!

night pier
#

Use NodeMutateEvent, and Event#isGroup

#

no im lying

#

isGroup would only work if you were modifying a group

fast delta
#

those commands should certainly fire the events

night pier
#

if the plugin listening to it is on the same server it was fired on, yeah

charred rover
#

The 3 events I mentioned are triggered if I add/remove a permission to the player with permission set/unset command, but if I add/remove a group to him with parent add/remove command, I only have the UserDataRecalculateEvent triggered. My plugin is of course on the server where the command is executed. Anyway, it seems to work as intended with the NodeMutateEvent, so I'll probably use that one. Thanks a lot! 😄

storm harness
#

!config

frank driftBOT
storm harness
#

!placeholders

frank driftBOT
storm harness
#

!formatting

frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

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!

List of chat/tablist formatting plugins that work with LuckPerms
left geyser
#

Not a bot commands channel, @storm harness. If you need support, please use one of the support channels instead.

#support-1 / #support-2

zinc swan
#

What is the easiest and best way to sort LuckPerms users based on weight from meta data?

slow swift
#

I just wanted to check to see, but does this only return TRUE if the player has that permission node or does it also look for wildcards?
Like, if I check for test.example.permission.node and they dont have it, but they do have text.example.permission.* would it return UNDEFINED or TRUE
CachedPermissionData.checkPermission()

tall geyser
#

Ok so ive gone through this for like hours since last night

#

TSSM Access Guard is a mod I made for Fabric 1.21.1 that blocks players from using Tom’s Simple Storage terminals unless they have a specific permission.

I built it for my server to make sure only trusted players can access shared storage. If they don’t have the right permission through LuckPerms (or any mod using fabric-permissions-api), the terminals just won’t work for them.

#

I'm trying to build a Fabric mod that uses Lucko's fabric-permissions-api version 0.3.1, but I'm getting a Could not find error during the Gradle build. The artifact is available on Maven Central — I can access it in the browser at the correct path — but Gradle still can’t resolve it. So the issue persists even though the dependency exists online.

#

this is my first experience doing any mod and my first experience using java

#

all of this code is ai built so keep that in mind

#

literally any help at all would be very appreciated

#

PS F:\TSSM-Access> .\gradlew.bat clean build --refresh-dependencies

Configure project :
Fabric Loom: 1.8.13
Refresh dependencies is in use, loom will be significantly slower.
:remapping 50 mods from modImplementation (java-api)
:remapping 50 mods from modImplementation (java-runtime)
:remapping 1 mods from modCompileOnly (java-api)

Task :compileJava
F:\TSSM-Access\src\main\java\com\midweekmouse505\tssmaccessguard\TSSMAccessGuard.java:3: error: package me.lucko.fabric.permissions.api does not exist
import me.lucko.fabric.permissions.api.Permissions;
^
1 error

Task :compileJava FAILED

FAILURE: Build failed with an exception.

#

Ping me if responding to me please otherwise i probably wont see it 🙏

#

also i noticed this in the USAGE.md but on the old Support for 1.21.1 github issue it its noted that the correct version for 1.21.1 us 0.3.1

#

lmao i probably shouldve made a thread but again any help so i could just get the file to compile would be great

tall geyser
#

well now ive made it past that and am getting a different error

#

cannot access class_1297

#

PS F:\TSSM-Access> .\gradlew.bat clean build --refresh-dependencies

Configure project :
Fabric Loom: 1.8.13
Refresh dependencies is in use, loom will be significantly slower.
:remapping 50 mods from modImplementation (java-api)
:remapping 50 mods from modImplementation (java-runtime)

Task :compileJava
F:\TSSM-Access\src\main\java\com\midweekmouse505\tssmaccessguard\TSSMAccessGuard.java:33: error: cannot access class_1297
if (!Permissions.check(source, PERMISSION_NODE)) {
^
class file for net.minecraft.class_1297 not found
1 error

Task :compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileJava'.

Compilation failed; see the compiler error output for details.

  • Try:

Run with --info option to get more log output.
Run with --scan to get full insights.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1m 2s
2 actionable tasks: 2 executed
PS F:\TSSM-Access>

lone falcon
#

Hello, which events correspond to parent set/add/remove ? And if i work with multi server, if server 1 do parent add it will propagate the event to other server too ? Thanks you

grizzled rapids
#

Hi, will the String returned by getPrefix include the prefixes formatting?

harsh epoch
rare summit
#

Hello, does getPrefix method respects the server context? As for me it seems to ignore it (if there's server=...) it ignores it & uses the global one

late salmon
#

java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms

#

anyone know how to fix this?

#

im on paper 1.21.7

#

using the wiki code

wild whale
wild whale
rare summit
drowsy zephyr
#
    public Group getGroupFromTrack(User user, Track track) {
        List<String> groups = track.getGroups();

        Collection<Group> userGroups = user.getInheritedGroups(user.getQueryOptions());
        for (String groupName : groups.reversed()) {
            Group group = getPlugin().getLuckPerms().getGroupManager().getGroup(groupName);
            if (userGroups.contains(group)) return group;
        }
        return null;
    }

Is this the way to go, or am I missing something

drowsy zephyr
#

any reason why:

track.promote(user, MutableContextSet.create()) puts the user on the same track multiple times

unborn orbit
#

Hey! This possible collect NodeAddEvent and NodeRemoveEvent in Velocity? If yes, how?

#

I tried this but not work

wild whale
# unborn orbit Hey! This possible collect `NodeAddEvent` and `NodeRemoveEvent` in Velocity? If ...

In a network setup when modifying LP data, all the normal events for that modification only fire on the LP instance that the changes were made on. Every other instance will only get the network sync events. For instance, if you have servers A & B behind a proxy and a LP command is ran on server A, server A will fire the normal NodeAdd or NodeRemove or whatever events, while server B and the proxy will only get the network update related events.

unborn orbit
#

exists a event trigger when the modification occur?

supple seal
#

Is it possible to alter the way LuckPerms gets the players UUID to intercept it and replace it with a different value?

#

I'm aware how crazy this sounds haha

main dagger
#

altering uuids is not supported

supple seal
#

Is there any way to alias UUID's?

wild whale
#

No, that would fall under "altering UUIDs". The whole contract of a player's UUID is exactly one UUID maps to exactly one player, and that said UUID will never change. Attempting to modify it will break all sorts of things beyond just LP.

What are you actually trying to accomplish? There's probably a sane way to accomplish your goal without messing with UUIDs

supple seal
#

We're trying to make our character switcher less janky w/ a Velocity plugin that creates entirely separate "users" for each. Our previous implementation felt pretty fragile since it was copying around items, potion effects, etc.

wild whale
#

Yeah so modifying UUIDs is definitely not the way to go for that, that moves you into even more janky territory. At least for LP, providing a custom context calculator might be a more reasonable alternative? You could provide a context that's i.e. character=<who>, then set any permissions that depend on which character is selected with the appropriate context. This also means you can set any permissions that don't depend on which character is selected (i.e. staff groups, any purchased perks, etc) without a context, so they always are active regardless of selected character.

#

!context
Below is the documentation of context intended for admins configuring LP, and here's the documentation section for registering your own context calculator via the API

frank driftBOT
supple seal
#

Yikes, alright.

manic quail
#

!forge

frank driftBOT
#
Why not make LuckPerms work on older versions of Forge?

Forge added the Permissions API only recently in 1.18. That API is what allowed a native Forge version of LuckPerms to be made, however that API does not currently exist on older versions of Forge, and is unlikely to be backported. Without the Permissions API existing on older versions of Forge, it is impossible to make LuckPerms work on those versions of Forge natively.

Is there any other option?

There is a Sponge version of LuckPerms! You can add SpongeForge and the Sponge version of LuckPerms to use LuckPerms on older Forge versions.

round veldt
#

!offline

frank driftBOT
#
Offline mode/cracked servers

Running a Minecraft server in offline mode can cause a lot of issues, particularly with UUIDs and security vulnerabilities. Some people also view it as unethical (piracy). We understand that some people need to run their servers in offline mode. However, due to the reasons mentioned, some users will choose to not support those running a server in offline mode (this does not apply to those running in a Bungeecord network). Please respect their decision, you may continue to seek help for your issue but in most cases, it can be resolved by setting online-mode=true in server.properties.

manic quail
#

Hello,

I've been trying for several days to add LuckPerms as a Gradle dependency in my IDE for a Forge 1.20.1 mod, but I keep encountering compilation errors during development.
However, when I run the mod on an external server (outside the IDE) with LuckPerms installed in the mods folder, everything works fine and the mod starts without any issues.
Is there something specific I need to do to include LuckPerms properly as a dependency during development?
Thank you in advance for your help.

Error :

[16:16:29] [main/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: 'com.mojang.brigadier.builder.LiteralArgumentBuilder net.minecraft.commands.Commands.m_82127_(java.lang.String)'
    Index: 3
    Listeners:
        0: NORMAL
        1: ASM: net.minecraftforge.common.ForgeInternalHandler@71c16f03 onCommandsRegister(Lnet/minecraftforge/event/RegisterCommandsEvent;)V
        2: ASM: class fr.woe.serverrpmod.event.ModEvents onRegisterCommands(Lnet/minecraftforge/event/RegisterCommandsEvent;)V
        3: net.minecraftforge.eventbus.EventBus$$Lambda$4013/0x00000218c3a29338@5ecb30f1

Best regards.

umbral brook
#

I'm getting the "net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!" exception as my plugin starts, although I have the "LuckPerms-Bukkit-5.5.10.jar" in my server file, and it enables correctly "[LuckPerms] Successfully enabled. (took 1449ms)". I have depend: [ LuckPerms ] in my plugin.yml and also obviously in my pom.xml and I'm enabling the Plugin in the onEnable method and not in the Main constructor or so: https://pastebin.com/wbH9EWsB
My server is on 1.21.5 Paper with Velocity as Proxy

main dagger
umbral brook
night pier
umbral brook
chilly condor
#
        api.eventBus.subscribe(nexus, NodeAddEvent::class.java) { event ->
            NexusLogger.debug("⚙️ LP NodeAddEvent for user=${(event.target as User).uniqueId}, node=${event.node.key}")
            onNodeChange(event.target, event.node, added = true)
        }
        api.eventBus.subscribe(nexus, NodeRemoveEvent::class.java) { event ->
            NexusLogger.debug("⚙️ LP NodeRemoveEvent for user=${(event.target as User).uniqueId}, node=${event.node.key}")
            onNodeChange(event.target, event.node, added = false)
        }

I'm using these on a Velocity plugin. Whenever I run /lpv user <username> parent add <group>, I get the debug log and onNodeChange fires successfully. However, whenever I use /lp user ... on the backend instance, nothing fires, even though I get [luckperms]: [Messaging] Received user update ping for... in console on proxy.

I'm using MariaDB, have tried auto, sql, pluginmsg, and redis for messaging-service, have attempted modifying sync-minutes, and just about everything else. Does anyone have any idea why this wouldn't be working? as I've been on this for over 4 hours and I'm about to lose it

main dagger
#

there is a sync event though, you can use that but you have to figure out what changed on your own

snow willow
#

I'm having some issues using the LuckPerms API:
whenever I want to promote a player (adding a new group but also deleting the old one) I use this code:

u.data().add(Node.builder("group.friend").build());
Main.lp.getUserManager().saveUser(u);
u.data().remove(Node.builder("group.default").build());
Main.lp.getUserManager().saveUser(u);```
but sometimes the player has two groups afterwards...my best guess is that its caused by the LuckPerms methods being called asynchronous but does someone know how to work around this problem?
#

*my only idea is to run the lp user name promote command via console but doing that in a plugin is kind of weird...i think🤷‍♂️

fast delta
#

well, first you don't need to save the user data after every individual change lol, you should do all the changes and then save the user
but for this you can get the Track from the TrackManager and then call Track#promote

snow willow
#

Thanks a lot

#

can I put in null into the context field when I don't want any specific context or is there an identifier for "no-context"?

#

*and do I also need to call saveUser() afterwards?

wild whale
snow willow
#

Yeah thats exactly what I needed thx

wild whale
#

As for saving...I'm honestly not sure. My gut says probably, but I'd need to check the source

snow willow
snow willow
wild whale
#

"global" just means no context, there's no actual "global" context

snow willow
#

Oh ok

#

that makes sense...thx

wild whale
#

Ok yeah quick 2 minute look at the implementation, there's no obvious saving happening. As long as you're not calling this several times a second, it shouldn't really matter anyways

snow willow
#

ok so theoretically I need to save it but it only matters if I make many different changes fast?

#

and also why does the following code end up in the user having two groups? (the old one and the new)

                Main.lp.getUserManager().saveUser(u);```
chilly condor
# main dagger events only fire on the server the change occurs on

I figured it out using UserDataRecalculateEvent, since that occurs on all servers it seems.

subscribe(UserDataRecalculateEvent::class) { onUserDataRecalculate(it.user) }
// ...
    private fun onUserDataRecalculate(user: User) {
        val now = user.getInheritedGroups(QueryOptions.nonContextual())
            .map(Group::getName)
            .toSet()
        val before = groupCache.get(user.uniqueId) { emptySet() }

        if (now == before) return
        groupCache.put(user.uniqueId, now)

        (now - before).forEach { modifyNode(user, it, added = true) }
        (before - now).forEach { modifyNode(user, it, added = false) }
    }
pine jacinth
#

Hello, is it possible to run a command when a player's primary group is changed?

narrow meteor
# snow willow and also why does the following code end up in the user having two groups? (the ...

Having the same issue. It keeps them in both groups, then any demotion/promotion fails afterwards because the user is seen as being on 2 tracks.

Using LuckPerms v5.5.10 on 1.20.4 & 1.21.8

public boolean promote(Player player, ModModeGroup group) {
        Track track = getAppropriateTrack(group);
        User luckpermsPlayer = _luckpermsAPI.getUserManager().getUser(player.getUniqueId());
        if(track != null && luckpermsPlayer != null) {
            Result result = track.promote(luckpermsPlayer, ImmutableContextSet.empty());
            if(result.wasSuccessful()) {
                _luckpermsAPI.getUserManager().saveUser(luckpermsPlayer);
                return true;
            }
        }
        return false;
    }

If anything else is needed to help, please let me know. This could be PEBCAK but I saw the other person mention this and wanted to make sure.

wintry hare
#

I'm listening to the UserPromoteEvent and if I wanted to remove another node when that event is called would this be the right code?
e.user.data().remove(Node.builder("group.default").build())

wintry hare
#

Nevermind I figured it out, this works:

e.target.data().remove(InheritanceNode.builder("default").build())
e.luckPerms.userManager.saveUser(target)
valid wren
#

Is PermissionNode.builder("test").expiry(Duration.ZERO).build(); going to create a permission node which doesn't expire?

vague dagger
#

Is it possible to create a transient group or add transient permission nodes to the player?

nocturne elbow
#

can help me ?

valid wren
fast delta
#

no, it's going to create a permission that's going to expire in 0 seconds (so, already expired basically)

#

you don't need to define an expiry at all if you don't want one

tacit solar
#

I am making a plugin that can create different "profiles". Basically, when a player is logged into a profile, their UUID changes (modifying the GameProfile using NMS).
However, LuckPerms seems to break when that happens. It's not working when a player doesn't have the UUID it is supposed to have.
I tried to invalidate cache when switching profile, to no success.
Would it be possible to have different permissions based on what profile is currently selected? Knowing that the username doesn't change, but the UUID does.

wild whale
tacit solar
#

Yeah I did try contextcalculators first. It worked, but it really only works for luckperms. My goal is to make all the other plugins automatically support each character, by assigning new data to each new profile based on the UUID. Right now, my server is mostly plugins that I made myself, so I could technically store all the data in a way to would work with this system. However, we are probably going to have at least one plugin that doesn't support it, that is made externally and that we just don't really have any control over. So that's why modifying the UUID seems like the most logical option. Right now I am almost there, just need to refresh luckperm's cache and Permissible injector. Thanks though.

empty dawn
#

👋

#

If a player has multiple ranks that has permissions like plugin.perm.1, plugin.perm.2, plugin.perm.3 etc. does Player#getEffectivePermission(); return all of them?

glass whale
#

in next update, can you add a column in luckperm interface to put some note

glass whale
gleaming pulsar
glass whale
gleaming pulsar
wild whale
# glass whale something like that

This has been suggested in the past, but the (surprisingly considerable) effort required to implement it currently makes it unlikely to happen in the near future. I've also closed your issue as a duplicate.
-# (also technically this whole convo should have been in a support channel or #luckperms-web, this channel is supposed to be for developers discussing interacting with LP programmatically)

hard frigate
#

does someone have expereince with luckperms-rest-api?

gleaming pulsar
#

!ask

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Or, try here first:
Why shouldn't I ask to ask?
native berry
#

Hello - is there an API method to add permission nodes to the suggestions LuckPerms provides to users in its permission commands, to make it easier for users to use these nodes?

obtuse jolt
native berry
#

Ah, I should have clarified this is a Fabric mod

obtuse jolt
#

Oh

solemn saffron
#

Is it possible to add an entire list directly to the transientData for a player?
Because otherwise the event will be triggered so often, and I don't want that

wild whale
solemn saffron
#

I want to add a list of permissions, but I want the event to be triggered only once so that my plugins don't have to process the event 20 times

wild whale
#

Yes I figured that from your original message, I'm asking why the event being processed 20 times is a problem - this is implying there's a larger problem at play

#

Like there's plenty of reasonable situations where 20+ permission mutations can occur at once outside of whatever you're doing, so if your system can't handle that then you're probably going to encounter problems regardless

fast delta
#

isn't there a method to add a Stream of permissions?

#

i guess I'm having delusions

solemn saffron
#

Hm thats bad

cold turtle
#

Hi, is there any method to get formatted duration of node? (like from a placeholder - "10d 5h ..")

fast delta
cold turtle
#

uh, okay

strong tiger
#

how i can reload the sorting manager to get the new player list sorted?

strong tiger
#

why with lp user work but with setTemporaryGroup nop?

wheat lake
frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

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!

List of chat/tablist formatting plugins that work with LuckPerms
strong tiger
#

but with the debug i see that it work

cold turtle
# fast delta No, but you can get the Duration of a Node (`Node#getExpiry()`) and replicate th...

Hi, I did something like this (it's in Skript but you will probably understand).

  1. I got the duration of node: set {_expiration} to {_node}.getExpiry()
  2. Then I'm getting remaining time: set {_remaining} to Duration.between(Instant.now(), {_expiration}).getSeconds() + 1
  3. At the end I'm formatting remaining time to timer format: secondsToTimer({_remaining})
    if {_num} >= 10:
        return "%{_num}%"
    
    return "0%{_num}%"


function secondsToTimer(seconds: number) :: text:
    set {_totalSeconds} to {_seconds}
    
    set {_days} to floor({_totalSeconds} / 86400) # 24*60*60
    set {_hours} to floor(mod({_totalSeconds}, 86400) / 3600)
    set {_minutes} to floor(mod({_totalSeconds}, 3600) / 60)
    set {_seconds} to mod({_totalSeconds}, 60)
    
    set {_d} to timerFormat({_days})
    set {_h} to timerFormat({_hours})
    set {_m} to timerFormat({_minutes})
    set {_s} to timerFormat({_seconds})
    
    return "%{_d}%:%{_h}%:%{_m}%:%{_s}%"```
    
    
But when I add myself node for more than 1mo, the time I get from lp placeholder and from this function is different. Do you know why?
#

(my goal is to format this in DD:HH:MM)

#

days are correct but the reset is not

#

I tried to format this from millis but the result was the same

cold turtle
fast delta
#

hm, that looks correct

cold turtle
#

this too?

#

like why there's 52 sec in my version and 34 sec in a placeholder

#

did I break something in my code?

#

I can't figure this out

fast delta
#

yeah i mean the code looks correct, idk what could be wrong lol

cold turtle
#

huh

charred bone
#

Are you able to read the contents of config.yml OR get the "server" in config in the java api?

glacial fox
#

is there an event to listen whenever a player group get changed?

loud ridge
#

а где скачать плагин 1.16.5 на Bukkit Legacy

#

ээээ

#

э

#

э

main dagger
ripe thorn
#

I'm a bit confused on the Value part of a Node.
Like for a PermissionNode, is the value as simple as "true = has permission and is true; false = does not have permission OR has permission, but is set to false", or is there more to it?

My goal is to return whether the player has the permission, and said permission is actually true/granted.

I can't use stuff like the hasPermission method on Servers/Proxies because A) I'm designing this in a way that works platform independant and B) the Player is not available when I want to check this (It happens while they ping the server/proxy from their multiplayer screen)

fast delta
#

the value of a Node is the explicit value granted to it, true or false
a Node having a value implies the existence, the presence of the node, so if you have a Node that you got from a User, then the node is present to begin with

ripe thorn
#

Actually, I made an obviousl logic error.
If the user does not have the permission assigned, then they obviously don't have the node.

fast delta
#

yep!

#

you got that right

#

true/false/not set

ripe thorn
#

I assume I would obtain the CachedPermissionData via getCachedData().getPermissionData() of the User object?

fast delta
#

yep

ripe thorn
#

Would this be recommended for group checks too, or would streaming over getInheritedGroups be a better aproach?

fast delta
#

that check includes inherited nodes by default

#

as if performed by a regular hasPermission check on the platform's permission api (bukkit's Player#hasPermission etc)

ripe thorn
#

Something I wonder.
When calling loadUser, will the return CF always be a new one, or does LP cache it for a while?

fast delta
#

that method will load directly from storage

hearty sigil
#

@alll this cool?

#

@all this cool?

ocean terrace
#

please help with the luckeperms mod with the NotLoadedException error? How do I load luckperms first and then my mod to initialize luckperms?

Fabric 1.21.8

real blaze
inland briar
#

hi. I have created a lil helper methods for adding permissions:

        Main.lp.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
            PermissionNode permissionNode = PermissionNode.builder(permission).value(value).build();
            user.data().add(permissionNode);
        });
    }

    public static void setPermissionForUser(OfflinePlayer player, String permission, boolean value, int durationSeconds) {
        Main.lp.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
            PermissionNode permissionNode = PermissionNode.builder(permission)
                    .value(value)
                    .expiry(Duration.ofSeconds(durationSeconds)) // Temporary permission
                    .build();
            user.data().add(permissionNode);
        });
    }```

First one works great, but second one adds "default" parent group when executed, and I don't get why
wild whale
#

Did the player have any other permission data before you added the temporary node?

(Side note, static abuse. Neither of these methods nor Main.lp should be static )

inland briar
#

Yes, it has. Actually, it happens only if I call that method twice, i.e. for different permissions:

Util.setPermissionForUser(victim, "cmi.command.warp.koth", false, times * 60);    Util.setPermissionForUser(victim, "cmi.command.warp.spectate", false, times * 60);

(I'm a recovering staticholic)

wild whale
#

Interesting. Does that existing data include a group inheritance node with no context set, or was it only permissions?

inland briar
#

Account already has group.laisvas w/o context

wild whale
#

🤔 What LP version is the server running?

#

(/lp info)

inland briar
#

5.5.16 on newest 1.21.8 Paper build. This issue is present for a long time, not something new, it was just deep down in my to-do list. 😄

fast delta
#

if i had to guess it's because of the two modifyUser calls happening concurrently, since the whole process is async and it loads the User data from storage directly

wild whale
#

My rough recollection was adding the default group was performed sync during the load? Maybe I'm mistaken though

inland briar
wild whale
#

If the player is online, yeah you can just get their loaded user instead of using modifyUser (which will load from storage regardless of their online state)

wild whale
# fast delta if i had to guess it's because of the two modifyUser calls happening concurrentl...

Ok no race condition, at least within modifyUser. Maybe there's some race condition if they're also online though ```java
// ApiUserManager
@Override
public @NonNull CompletableFuture<Void> modifyUser(@NonNull UUID uniqueId, @NonNull Consumer<? super net.luckperms.api.model.user.User> action) {
Objects.requireNonNull(uniqueId, "uniqueId");
Objects.requireNonNull(action, "action");

    return this.plugin.getStorage().loadUser(uniqueId, null)
            .thenApplyAsync(user -> {
                action.accept(user.getApiProxy());
                return user;
            }, this.plugin.getBootstrap().getScheduler().async())
            .thenCompose(user -> {
                this.plugin.getUserManager().giveDefaultIfNeeded(user);
                return this.plugin.getStorage().saveUser(user);
            });
}
fast delta
#

i mean, the process is not atomic

inland briar
dawn cloud
#
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            LuckPerms api = provider.getProvider();
            if(jailedPlayers != null) {
                for(String str : jailedPlayers) {
                    UUID uuid = UUID.fromString(str);
                    Player player = Bukkit.getPlayer(uuid);
                    if(player != null) {
                        if(!player.hasPermission("group.jailed")) {
                            api.getUserManager().modifyUser(uuid, user -> {
                                // Add the permission
                                user.data().add(Node.builder("group.jailed").build());
                            });
                        }
                    }
                }
            }
        }
#

is this an appropriate way of adding someone to a group?

celest salmon
#

Is it possible to get the actor in events (example: CONSOLE, API, PlayerName123)?

I managed to get the type (ENTITY) by doing String actor = e.getSource().getType().name();, but I can't find a way to get the actor or the actor's name if it's a player.

dawn cloud
#

hey, i keep getting this error whenever I try to call LuckPerms api = LuckPermsProvider.get();
i have shadowJar'ed the dependency into my plugin and i have the luckperms plugin installed on my server. This method is also being called in a command, which means the plugin would have been enabled by now.
do i need to include a dependency in my plugin.yml maybe?

#

would this work?

wild whale
wild whale
#

(This doesn't just apply to LP fyi - if you're depending on any API provided by another plugin, you can't shade it)

#

Oh, but also yes, you do need to declare an [optionally soft] dependency on LP in your plugin.yml

dawn cloud
#

Ah ok, that’s my bad I thought APIs were the same as any other dependency

#

How do you use softdepend? Do i need to check if the luckperms api class exists or not in my code?

#

Because if I don’t shadow jar it it gives class not found errors

wild whale
#

Use a normal dependency in your plugin.yml if you require LP to be present. softdepend is an optional dependency (i.e. your plugin can work without the other plugin, but if it's installed then you do use it), while depend is a required dependency (if it's not present, the server will throw an error and your plugin won't be enabled).

#

If you require LP for your plugin to work, you can just make it a hard depend & you know for sure LP will be loaded when your plugin is enabled. If it's optional, then yes, you'll need to do some extra steps to handle that.

#

As for the ClassNotFounds, check your server's logs; make sure a) LP is actually getting enabled, and b) it should be getting enabled before your plugin

celest salmon
dawn cloud
wicked bay
#

What do i need to do to get an instance of the api on the bungecord?

wicked bay
# wicked bay What do i need to do to get an instance of the api on the bungecord?

I allready tried to get it later but this also dont work. What am I doing wrong?

        try {
            api = LuckPermsProvider.get();
            getLogger().info("LuckPerms API hooked.");
        } catch (Throwable t) {
            getLogger().warning("LuckPerms API not available yet, retrying in 1s...");
            getProxy().getScheduler().schedule(this, () -> {
                try {
                    api = LuckPermsProvider.get();
                    getLogger().info("LuckPerms API hooked (delayed).");
                } catch (Throwable t2) {
                    getLogger().severe("LuckPerms API still not available.");
                }
            }, 1, java.util.concurrent.TimeUnit.SECONDS);
        }```
wild whale
#

You definitely shouldn't be doing that sleeping thing, that's super unreliable. Common problems:

  • Make sure you are not shading LP (declare the LP API dependency as compileOnly in gradle / with the provided scope in maven)
  • Make sure you've declared a dependency on LP in your plugin manifest file (whatever bungee calls it)
  • Make sure LP is actually running on the test instance
wicked bay
drowsy forge
#

Not about API, but: if I decide between online/cracked authentication on velocity in preloginevent, does luckperms save user uuid after this event, during or before? (So premium users won't have offline uuids in db etc.)

#

It's kinda hard for me to test it, but my point is to allow premium players and cracked players with password onto my server using PreLoginEvent and I wonder if luckperms will work fine or will it check/save etc. Uuids at this event (and do it potentially before I change user from Mojang authentication with premium UUID into cracked account with offline uuid). I'm talking about velocity

wild whale
#

Modifying UUIDs is not supported, doing so is almost always a 1-way trip to data loading errors.

drowsy forge
#

I'm really not modifying it at all. Rather I'm changing between authenticating them (premium) and not authenticating them (cracked), which to my understanding changes their uuids

#

Okay, maybe different question: is luckperms doing something during preloginevent or before it? And if it is, then what?

wild whale
#

I'd suggest taking a look through the code yourself, it sounds like you have at least a rough idea what it is you're looking for. All the platform modules are relatively small and simple, so it shouldn't be too hard to find the relevant stuff in the velocity module

#

!github

frank driftBOT
#

Sorry! I do not understand the command github
Type !help for a list of commands

wild whale
#

...do we seriously not have a command for that

drowsy forge
#

Aight, thanks for response though

#

I have good enough knowledge to know it could be a problem and to know how to ask a question and to know that i don't know what the f I'm doing with velocity

#

But from what I see luckperms does it's stuff after preloginevent

#

So it should be working alright

lapis elm
#

Hi, i'm making a rankup plugin using Luckperms api, I create a track named "ranks" and put all groups of ranks there, and in my plugin i just make the api promote player in ranks track, and this works, but only if I "refresh" with /lp user <nick> parent info, when I don't do that, luckperms accumulates 2 ranks, and for the following ranks, an error occurs (only if I "refresh", if i don't refresh it works normaly). I can't explain it very well because it's a strange bug, but I made this video that shows what's happening.
Explain video: https://youtu.be/Xfbw_TM-S1A

molten shore
#
        val result = user.data().add(builder.build())
        luckPermsApi.userManager.saveUser(user)

        luckPermsApi.messagingService.ifPresent {
            it.pushUserUpdate(user)
        }

player need to relog in server to update the group, why?

molten shore
#

the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync

#

why?

fading raft
#

I am trying to listen for events when a user gets a permission added or removed.

Setup:

  • Minecraft server with the LuckPerms plugin installed (this is where I’m editing the user’s permissions)
  • Redis is set up
  • PostgreSQL database where the LuckPerms data is stored
  • LuckPerms REST API connected to the database
  • LuckPerms REST API Java client connected to the REST API

I have verified that the Java client is working (LuckPermsRestClient.groups().list().execute() returns all my groups).

I thought I needed to subscribe to the LogBroadcastEvent to detect when permissions are changed on the Minecraft server. Is this assumption correct, or are the events only triggered when changes are made via the REST API, and not on the server, because there is no Redis connection between the REST API and the Minecraft plugin?

I looked at https://github.com/LuckPerms/rest-api-java-client/blob/main/src/test/java/me/lucko/luckperms/rest/EventServiceTest.java

import net.luckperms.rest.LuckPermsRestClient;
import net.luckperms.rest.event.EventProducer;
import net.luckperms.rest.model.LogBroadcastEvent;

public class LogBroadcast {
  public static void main(String[] args) throws Exception {
    try (var client = LuckPermsRestClient.builder()
        .baseUrl("http://127.0.0.1:6457/")
        .apiKey("LH5dRq2koqE792RSWGAb4MKmPGe5d99X")
        .build()) {

      EventProducer<LogBroadcastEvent> sub = client.events().logBroadcast().subscribe();
      sub.subscribe(e -> System.out.println("[LogBroadcast] " + e.origin() + " " + e.entry()));
      System.out.println("Listening for LogBroadcast events...");
      Thread.sleep(300_000); // keep alive 5 min
    }
  }
}

Or is what I’m trying to do not even possible? Do I need to listen to Redis Pub/Sub with my Java application to detect changes made on the Minecraft server?

GitHub

A Java client for the LuckPerms REST API. Contribute to LuckPerms/rest-api-java-client development by creating an account on GitHub.

molten shore
#
        val result = user.data().add(builder.build())
        luckPermsApi.userManager.saveUser(user)

        luckPermsApi.messagingService.ifPresent {
            it.pushUserUpdate(user)
        }

player need to relog in server to update the group, why?

the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?

frank driftBOT
tardy raptor
#

If i delete a group with getGroupManager().deleteGroup(group); it deletes the group but the mebers will still have the InheritanceNode. Is there a way to auto delete it from every group member or do i need to loop through every player of this group to delete the InheritanceNode?

celest sable
#

What is the latest luckperms api version

#

I use LuckPerms v5.5.17 on the server and as API Version 5.4 but i get this error:

java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider

wild whale
# celest sable What is the latest luckperms api version

Latest API version is 5.5. If you're getting a NoClassDef, that's unrelated to a version mismatch though; make sure you've declared a dependency on LP in your plugin/mod manifest (i.e. on Paper that'd be your plugin.yml or paper-plugin.yml) & that LP is actually starting up before your plugin/mod

nimble hawk
#

does LuckPerms API have any way to retrieve a group's prefix as an Adventure Component? or am I stuck guessing whether the user used legacy or MiniMessage in the field?

night pier
nimble hawk
night pier
#

highly unlikely.
what's the use case of this, just so i understand better what you're attempting to do?

nimble hawk
#

it is for a placeholders thing, I was aiming to not have to parse legacy format if I could help it but I guess there's no escaping it if there are plugins which will inevitably support it still

night pier
#

this also isn't really a "one or the other" situation.
plugins can support literally any format they choose, even if they use ! in place of the & or section symbol.
it's easier to allow them the option, than to try and limit what they can do.

nimble hawk
#

the issue with that is that it ends up being really ugly codewise but it is whatever

main dagger
#

pick a format and support that format

#

¯_(ツ)_/¯

molten shore
#
        val result = user.data().add(builder.build())
        luckPermsApi.userManager.saveUser(user)

        luckPermsApi.messagingService.ifPresent {
            it.pushUserUpdate(user)
        }

player need to relog in server to update the group, why?

the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?

molten shore
#

up...

snow willow
#

I feel like I've overengineered but this is my way of getting the highest weight-node a user has:

            try{
                return Integer.parseInt(x.split("\\.")[1]);
            }catch(Exception ex){
                return 0;}
        }).max(Integer::compareTo).orElse(0);```
...is there any shorter/cleaner way?
#

*or precisely getting the actual weight of the highest weight node

#

and as an explanation:
first I take a collection of every node and map it to the key
then I filter for the weight nodes
then I map them to the actual weight while all weight nodes that doesnt look like this weight.xyz (where xyz is an int) are castet to 0 through the exception parseInt throws when encountering unvalid ints in the string
I now take the Collection of Ints (the weights) and put them (as a list) in the Collections.max function to get the highest weight of the user

snow willow
#

...nvm
for anyone wandering the same (especially for future reference cause I don't know if this is wide knowledge)

Although there isn't a method for getting a users weight, there is one for getting a groups (since weights are nodes specifically for groups)
That means it suffices to get a players primary group and get its weight like this for example:
Main.lp.getGroupManager().getGroup(Main.lp.getUserManager().getUser(p.getUniqueId()).getPrimaryGroup()).getWeight().orElse(0);

#

*and if someone has an even cleaner solution please let me know👍

mint pivot
#

what is the proper way of using the LP dev api on Velocity? I cant get it working, no matter what I do it errors with "The LuckPerms API isn't loaded yet"

night pier
#

otherwise, make sure LuckPerms is loading before your plugin

mint pivot
gleaming pulsar
mint pivot
#

this is velocity

#

plugins are lowercase

gleaming pulsar
#

mh you're righ

#

Can you show us your code 🤔

mint pivot
#

Fixed it

molten shore
short cedar
#

or wtv

#

there's a save method

#
user.data().add(PermissionNode.builder(luckpermsId).build());
LuckPermsProvider.get().getUserManager().saveUser(user);```
molten shore
short cedar
molten shore
#

player need to relog in 1.21.8

short cedar
#

Tho

molten shore
#

yeah its kotlin

short cedar
#

getUserManager

molten shore
#

getUserManager = java
userManager = kotlin

short cedar
molten shore
#

u use mongodb?

short cedar
molten shore
#

I think its mongodb

short cedar
molten shore
#

in mysql works fine

short cedar
#

I think mongodb is officially supported

#

Over mysql

molten shore
#

idk why doesnt working 🙁

umbral notch
#

can someone help:
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms
i allreay have depend: [LuckyPerms] in paper-plugin (with LuckPerms also not work)

wild whale
velvet helm
#

how to check player permission in forge 1.20.1?

#

there is no method hasPermission in Player

frank driftBOT
snow willow
#

I updated from PaperMC 1.21.8 to PaperMC 1.21.10 and got this at first login:
[20:41:59 INFO]: [HorriblePlayerLoginEventHack] You have plugins listening to the PlayerLoginEvent, this will cause re-configuration APIs to be unavailable: [LuckPerms]
do I need to do anything?

wheat lake
short cedar
#

will loadLuckPermsUser(UUID) get from session if in session?

limpid mural
#

So

fierce lotus
sullen venture
#

how would I get a player's permission during the configuration phase? i'm making a neoforge mod and get the permission using PermissionAPI, but the player isnt loaded by luckperms yet so lp falls back to the default handler.

i'd prefer not to add luckperms as a dependency but will if needed.

#

not sure if this is the right channel for this

obtuse jolt
# fierce lotus

I think val mutableContext = MutableContextSet.create() be the first line, outside of both for loops, and then it.context(mutableContext) be the last line after the loops

cold harbor
#

I have a question. Im coding a plugin for colored prefixes. my standard prefix for owner is "&4&lOwner", and if i make the meta thing a gradient with mini message, is it possible to do it like this: "&4&l%placeholder%Owner" and the placeholder gets replaced with the gradient and then i have a gradient prefix?

frank driftBOT
#
LuckPerms does not perform any chat/tablist formatting of its own!

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!

List of chat/tablist formatting plugins that work with LuckPerms
gleaming pulsar
#

No need for placeholders. Just use a chat/tab plugin which supports the format

cold harbor
#

No i mean i am coding a plugin in which you can change your prefix for example from &6Player -> &4Player

gleaming pulsar
#

Oh yea, but it basically results in the same. You technically dont have to use placeholders. You just need to support and parse the format

molten shore
#
        val result = user.data().add(builder.build())
        luckPermsApi.userManager.saveUser(user)

        luckPermsApi.messagingService.ifPresent {
            it.pushUserUpdate(user)
        }

player need to relog in server to update the group, why?

the message log is arriving on the other servers, but the user itself has to relog, or I use /lp networksync
why?

alpine marsh
#

java.lang.NoClassDefFoundError: net/luckperms/api/node/Node I have the latest release and maven dependency version 5.4

alpine marsh
#

help?

gleaming pulsar
#

Latest is 5.5

alpine marsh
#

and the dependency version is 5.5

twilit ledge
#

I'm making a plugin with a GUI and some of the items need to be permission locked (as in, the player requires the certain permission to get/click that item) is it just as simple as checking if they have the permission?

wild whale
twilit ledge
#

yea, I realised that and ended up doing that and just forgot to delete my msg

wild whale
#

👍

sacred marsh
#

Hey guys, is this safe?

#

    public static void init(){
        for(Rank rank : Rank.cachedValues){
            rank.setCachedGroup(LuckPermsUtils.getGroupFromName(rank.name()));
            if(rank.getCachedGroup()==null){
                Log.warn("Rank "+rank+" doesn't have a group! Creating one now...");
                LuckPermsUtils.API.getGroupManager().createAndLoadGroup(rank.name()).thenAccept(rank::setCachedGroup);
            }
        }
    }
    public static void clearPermissions(Rank rank) {
        Group group = rank.getCachedGroup();
        if (group == null) return;

        group.data().clear();
        Track track = Track.ofRank(rank);
        if(track!=null) {
            track.getRanksLowerOrEqualThan(rank).forEach(x -> {
                Node node = PermissionNode.builder(x.getPrefixPermissionRequired()).value(true).build();
                group.data().add(node);
            });
            Node node = WeightNode.builder().weight((int) track.getTotalWeight(rank)).build();
            group.data().add(node);
        }
        LuckPermsUtils.API.getGroupManager().saveGroup(group);
    }

    public static void addPermission(Rank rank, String perm) {
        Group group = rank.getCachedGroup();
        if (group == null) return;

        Node node = PermissionNode.builder(perm).value(true).build();

        group.data().add(node);

        LuckPermsUtils.API.getGroupManager().saveGroup(group);
    }```
#

and this will be configured in skript, first it clears perms, then adds a list perms.
Just making sure im not doing anything wrong here.
.

#

Because I'm having a SUPER WEIRD issue where permissions are shuffling and buggy randomly, so maybe a few hours after startup it will happen, or not at all, it's all random. for example staff perms may hop onto default group for no reason. I'm not so sure what's going on

#

If anyone can help me that would be great

#

Im probably the first person to ever have this issue

gleaming pulsar
sacred marsh
gleaming pulsar
#

Or in general your custom classes

#

thx

gleaming pulsar
# sacred marsh

Wouldn't it be much simpler if you were using API#getGroupManager#modifyGroup(name, consumer)?`
https://luckperms.net/wiki/Developer-API-Usage (here are quite a few examples you can find)
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java#L56 (yet another example of how to modify the users group)
I feel like you're holding and modifying the cached group which is shared across the whole server, or not really waiting for a user to be loaded

https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/group/GroupManager.html#modifyGroup(java.lang.String,java.util.function.Consumer)
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html#modifyUser(java.util.UUID,java.util.function.Consumer)

sacred marsh
sacred marsh
sacred marsh
#

Damn, my problem must be the hardest one on this discord server

gleaming pulsar
# sacred marsh yea but like is my code the reason it's shuffling permissions

Oh yea sorry forgot to answer - it indeed is.
You are holding onto the user/group even if stuff has changed. Try replacing it with #modifyGroup and #modifyUser - as already said above.
And don't cache/load the user/group - just use the functions below
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/group/GroupManager.html#modifyGroup(java.lang.String,java.util.function.Consumer)
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html#modifyUser(java.util.UUID,java.util.function.Consumer)

And you might as well want to drop the Rank caching, LuckPerms already has a cache built-in. Double-caching is kind of too much imo and will most likely lead to new/other issues

mossy tapir
#

Hey, i was wondering if there was a way to set a transient permission for a user?
Didnt look into the unloading, but i basically want the permission to be transient on the users session (connected to proxy).

mossy tapir
#

I would just listen for the disconnect events, but this poses the risk of fragmented permissions in case of an unplanned shutdown or crash.

wild whale
#

Yeah, transient permissions are definitely something we natively support, pretty sure it's exposed to the API too, let me check

#

Ok, yup it indeed is. Normally when you want to modify a PermissionHolder's nodes, you'd get the NodeMap from PermissionHolder#data and then modify that. For transient data, you simply use the NodeMap returned by PermissionHolder#transientData instead. You can also use PermissionHolder#getData(DataType) to dynamically grab either their normal or transient data if you want

#

Worth noting though, you said this was a network environment - as far as I know, transient data will only apply to the current LP instance (i.e. if you set a transient node for a player on the proxy, the backend server won't see it)

mossy tapir
#

Ah i see. Important to know that its not synced, but i can handle that. Thank you 😄

unique harness
#

Hello, I have a question: shouldn't UserManager#modifyUser also push update if messaging service is present?

#

it's kind of confusing

unique harness
#

yes i know but i think it should be included in the API

fast delta
#

what should be included where?

#

you can queue an update yourself via the API already

#

there's a pinned message here as example

unique harness
#

modifyUser should also push update

#

that's my point

main dagger
#

it doesnt because you may want to update many users

#

it would be inefficient to ping for each user

unique harness
#

well there is no option for a batch database save in luckperms either

fast delta
#

batch loading and saving of users/groups would definitely be nice to have

#

but i do not think the api should be doing things without you telling it to when it is not specified

unique harness
#

we could add modifyUser(UUID, Consumer, boolean)

fast delta
#

and what is the advantage of that over.. just.. pushing an update through the messaging service?

#

like you would be adding api to that adds nothing of value and you need to call explicitly, might as well just do the thing explicitly already

#

which is already the case

unique harness
#

it would be much more clear that modifyUser default behavior does not include pushing the update

fast delta
#

then maybe it's the api contract that needs clarifying in the javadoc to mention that it does not do that, as it isn't part of the contract that it does

unique harness
#

for me it doesn't make sense why this wouldn't push a update, like in what case you don't want your data to stay in sync other than batch updates, which are not the issue here because any implementation of messenger will handle 50k< publishes or subscribes (other than sql messenger), the issue here would be the database because even if you send one push update the database still has to do X amount of inserts on the sender server and X amount of selects on receiver server due to luckperms not having any batch handling (that I know about)

fast delta
#

let's just agree to disagree

#

you need to do this manually already, adding more api that you need to call manually does not add value

#

further clarification on the existing methods' contracts, however, would

unique harness
#

yes that's correct

#

however, as I mentioned I don't see any user case where this would be non-beneficial

fast delta
#

just push the update through the messaging service

#

what's so difficult about that

wild whale
#

For what it's worth, I'd agree that an overload or some other thing to handle flushing would be some nice sugar syntax. It's like loadUser -> modify -> saveUser vs modifyUser; we don't need modifyUser since it's essentially just sugar syntax for the first option, but it's a great safety net for API consumers to ensure they don't forget to save things.

If an API break was an option, I'd go so far as to argue the default behavior should be to push an update alongside any save operations, and make it opt-out instead for those rarer cases where such behavior isn't desired

fast delta
#

why is it needed and how does it add value?

unique harness
#

It reduces the probability that API user will forget to push update. From my point of view at first look modifyUser method seems like it's doing all the work needed to save the user but it doesn't. It would also reduce lines of code that needs to be done on user end, however if you don't want this behavior you can use standard future chain. Or at least it should be mentioned in javadocs

fast delta
#

I suppose so

#

feel free to open an issue or a pr, though I will say a modifyAndPush is more.. mm, appetising than a boolean parameter overload

rich hollow
#

i can't use and review lp right now; i need to ask you first

#

does lp register players directly in the database upon their first login to the server? or does it register them at all?

#

@fast delta OOHOHOHOHOHO OEMİLLYYYY XD

frank driftBOT
#

Hey dragonblade07! Please don't tag helpful/staff members directly.

rich hollow
#

i smile for some reason every time i see you nvm

rich hollow
drifting otter
#

Does the Luckperms API have a way for you to detect when a context has changed? I can't find anything for it.

To be clear, I don't mean when the contexts assigned to a permission have changed, but when the output of a context has changed, IE a player has changed world if the context is = that world.

My use case is for Grim where we allow users to specify permissions to exempt from cancelling packets, setting back, or just fully exempting them from specific checks

https://github.com/GrimAnticheat/Grim/issues/2417

For performance reasons we obviously can't poll the permissions every time a packet comes in for every check we have

GitHub

Describe the bug and how to replicate it I am using a mixin to one of the things that gets called after the ServerPlayer's ServerLevel is changed to the target dimension. I call MyLuckPermsCont...

tough reef
#

Can I get baned?

opal chasm
#

Hello, I want to register a context calculator for whether a player is muted with the LiteBans plugin. Here is my code:

public class LiteBansMutedContextCalculator implements ContextCalculator<Player>
{

    @Override
    public void calculate(@NonNull Player target, @NonNull ContextConsumer consumer)
    {
        consumer.accept("litebans-muted", Boolean.toString(Database.get().isPlayerMuted(target.getUniqueId(), null)));
    }

    @Override
    public @NonNull ContextSet estimatePotentialContexts()
    {
        ImmutableContextSet.Builder builder = ImmutableContextSet.builder();

        builder.add("litebans-muted", "true");
        builder.add("litebans-muted", "false");

        return builder.build();
    }

}

Unfortunately this does not work, because the LiteBans does not allow the check to be run on the main server thread. Can it be done async instead? And if so, how?

obtuse jolt
#

Have a cached layer for wtv liteban data you need is probably the better option, bcu context calculation should be quick and not do db queries

opal chasm
#

alrighty ty

mossy tapir
#

Hey, im implementing a hook for votifier, and i dont feel like requesting and caching Name:UUID mapping.
There is probably an easy way to access and use the cache that Luckperms maintains, right? 😄

#

Wait is it literally just this?

  private UUID getUUID(String name) {
    return LuckPermsProvider.get()
        .getUserManager()
        .lookupUniqueId(name)
        .join();
  }
#

Wait the UUID could be null? 🙁
In what case? On a cache miss or when the username doesnt exist on mojangs end?

gleaming pulsar
fast delta
quaint haven
#

I know it's not java, but i guess i use the same methods

import:
    net.luckperms.api.LuckPermsProvider
    net.luckperms.api.context.ImmutableContextSet


on load:
    set {api::lp} to LuckPermsProvider.get()
    set {api::trackManager} to {api::lp}.getTrackManager()
    set {api::ContextSetFactory} to {api::lp}.getContextManager()
    set {api::UserManager} to {api::lp}.getUserManager()

function getTrackPosition(p: player, curr:string, track: object) :: integer:
    if {_track} is null:
        return -1

    set {_groups} to {_track}.getGroups()
    return {_groups}.indexOf({_curr})

command /rankup:
    trigger:
        if player's groups contains "Dommer":
            send "%nl%<#ff9100>&lREBIRTH <#ffb047>Du er i maks rank, du skal /Rebirth!%nl%" to player
        else if player's balance >= {price::rankup::%player's uuid%}:
            #Remove Money
            remove {price::rankup::%player's uuid%} from player's balance

            #Get track and user
            set {_track} to {api::trackManager}.getTrack("rankup")
            set {_user} to {api::UserManager}.getUser(player's uuid)

            set {_group} to the value of the placeholder "luckperms_current_group_on_track_rankup" for player
            set {_pos} to getTrackPosition(player, {_group}.toLowerCase(), {_track})

            #Promote player
            {_track}.promote({_user}, ImmutableContextSet.empty())
            {api::UserManager}.saveUser({_user})

            #Calculate new price
            set {_rank} to {_pos} + 1
            set {_factor} to 1.97
            set {price::rankup::%player's uuid%} to 100 * ({_rank}^2) * exp(ln({_factor}) * ({_rank}-1))

            send "%nl%<#00ff11>&lSUCCES &aDu er nu ranket op til!%nl%" to player
        else:
            send "%nl%<#ff1100>&lFEJL &cDu har ikke råd til at ranke op!%nl%" to player```
When I promote it sometimes does remove the previous group, so i get all of them.
#

I might have fixed it, I parented the previous groups on each other ....

quaint haven
quaint haven
#

I tried this too

function promote(p:player, g:string) :: boolean:
    set {_track} to {api::trackManager}.getTrack({_g})
    set {_user} to {api::UserManager}.getUser(uuid of {_p})
    if all:
        {_track} is set
        {_user} is set
    then:
        set {_result} to {_track}.promote({_user}, ImmutableContextSet.empty())
        if {_result}.wasSuccessful():
            {api::UserManager}.saveUser({_user})
            return true
    return false```
quaint haven
#

I can promote untill i check my info /lp user Nydt info, then i cant promote anymore because i have all the roles.

sly oxide
#

i get an error when i want to use the luckperms api. I get an NoClassDefError

gleaming pulsar
gleaming pulsar
frank driftBOT
quaint haven
#

If you have a fix for Java I would appreciate that too

wild whale
quaint haven
# wild whale I'm not understanding your description of the actual problem (what do you mean b...

Example of how i can force the error:
promote twice or the amount of groups i want to "bug?"
then lp user me info (now i have all the groups i promoted through from the track)

Example of when it works
promote untill i finish then track
then lp user me info (now i only have the last group of the track)

Example of how it works too
promote once
lp user me info after every promote

hope you understand

crude flax
#

is it possible to add a prefix to a user or a group via the API?

crude flax
#

How would I convert an adventure text component into a PrefixNode?

#

What sort of formatting is used by PrefixNode?

gleaming pulsar
#

You just need to convert it into a String

crude flax
gleaming pulsar
#

This should work if I'm not wrong:

String prefix = MiniMessage.miniMessage().serialize(component);

luckPerms.getUserManager().modifyUser(uuid, user -> {
    user.data().add(node); // the PrefixNode you created
});
quaint haven
little shard
#

Could anyone please provide a rough estimate of the time it takes for LuckPerms to retrieve player data from the database and return it to the API's CompleteatableFuture? I know the answer isn't fixed depending on the context, but I'd like to hear the experiences of people who have used the API because I am just very new

#

Like under what circumstances can it be completed very quickly, in just tens of milliseconds or even instantaneously, and under what circumstances might it take several seconds?

gleaming pulsar
# little shard Like under what circumstances can it be completed very quickly, in just tens of ...

It really depends on caching and storage backend.

If the user is already cached, the CompletableFuture will usually complete instantly (0–1 ms). If LuckPerms needs to load from local storage, it’s typically just a few milliseconds.
With a remote database (MySQL/Postgres), uncached loads are usually in the 10–50 ms range on a healthy setup, but can be slower if the DB is under load or there’s high network latency.
Multi-second loads generally only happen in pathological cases (DB issues, cold connections, extreme latency, or very large/complex permission data).
The async API just ensures this work doesn’t block the main thread - it doesn’t guarantee a specific completion time.

little shard
little shard
#

Ok how is searchAll method implemented internally luckythonk

wild whale
#

Source is on GH for perusing, implementations for anything not concretely implemented in the API module is usually implemented in the common module under net.luckperms.common.api or such iirc

GitHub

A permissions plugin for Minecraft servers. Contribute to LuckPerms/LuckPerms development by creating an account on GitHub.

little shard
#

I am not familiar with database or storage stuff uhmm
Just curious if calling that is expensive

wild whale
#

Oh, it'll vary by storage method but shouldn't be too bad. Definitely don't run it on the main server thread, but the database-based storage methods should all be able to do that lookup pretty quickly barring any network latency. Plaintext methods are inherintly a little slower, but still shouldn't be horrible

magic granite
#

hello, i'm looking to add LuckPerms support to my hytale plugin. the API documentation is very helpful, but i'm unclear about something. API documentation shows interaction with a Player class. but the API documentation is general, not specific to hytale. the hytale API also exposes a Player class. is the Player class mentioned in the LuckPerms API docs a game Player class or a LuckPerm class?

this is my first time using the LuckPerms API so this might be a stupid question. 🙂

jaunty pecan
#

In Hytale it’s a PlayerRef :)

#

We will update the docs to reflect that after it’s out of beta and all merged in

magic granite
# jaunty pecan In Hytale it’s a PlayerRef :)

the Player class has virutally all the same methods implemented on it as PlayerRef, and by my understanding, PlayerRef isn't even an entity class. the hytale api really confuses me sometimes lol, especially since PlayerReference ISN'T a ref. /sigh

#

but ty, you mean to say i should be calling hasPermission on the game class?

#

also just to be clear, is LuckPerms implemented on Player or ONLY on PlayerRef?

jaunty pecan
#

You can call the hasPermission methods yes and LP will handle them

#

Sorry for the confusion, your original question was about the LuckPerms API which is different

#

The methods there that expect a platform “player” object are expecting PlayerRef

magic granite
#

ok thank you!

neat oracle
#

they have the same default rank, within4glade got it back after leaving and rejoining

#

he was afk for like an hour not sure if thats the reason why

neat oracle
#

happened to someone else too

magic granite
#

hello, i'm having a hard time figuring out how to list LuckPerms for hytale as a dependency for my plugin in manifest.json. what value should if use for the key in OptionalDependencies?

from server loading logs with LuckPerms installed, i thought it would be LuckPerms:LuckPerms, but that doesn't work and causes a server error on startup...