#luckperms-api

1 messages · Page 9 of 1

analog bison
#

hello! where could i get an older version of the fabric placeholder API? my server is running 1.20.6 but the latest only supports 1.21. i even checked Jenkins. :(((

#

all i want to do is show roles in chat and tab, if there is an another solution, i'm open to it :DD

ornate forum
#

i want to ask, how to set async permission because its delay, thanks

lavish rain
vital grove
#
if (FeatureHubPlugin.getPlugin().getProxy().getPluginManager().getPlugin("luckperms").isPresent()) {
            User user = LuckPermsProvider.get().getUserManager().getUser(entity.getUUID());
            user.data().clear(NodeType.PREFIX::matches);
            if (!FeatureHubPlugin.getConfig().getSection("RankColour.ranks-base-options").contains(entity.getGroup()))
                user.data().add(PrefixNode.builder(FeatureHubPlugin.getConfig().getString("RankColour.colour." + colour + "." + entity.getGroup()),
                        1).build());
            else
                user.data().add(PrefixNode.builder(FeatureHubPlugin.getConfig().getStringList("RankColour.colour." + colour + "." + entity.getGroup())
                        .get(getBaseOption(entity.getGroup()).indexOf(entity.getBaseColour())), 1).build());
            LuckPermsProvider.get().getUserManager().saveUser(user);
            LuckPermsProvider.get().runUpdateTask().thenRunAsync(() -> {
                Optional<MessagingService> messagingService = LuckPermsProvider.get().getMessagingService();
                messagingService.ifPresent(service -> service.pushUserUpdate(user));
            });
        } else {
            if (!FeatureHubPlugin.getConfig().getSection("RankColour.ranks-base-options").contains(entity.getGroup()))
                entity.setPrefix(FeatureHubPlugin.getConfig().getString("RankColour.colour." + colour + "." + entity.getGroup()));
            else
                entity.setPrefix(FeatureHubPlugin.getConfig().getStringList("RankColour.colour." + colour + "." + entity.getGroup())
                        .get(getBaseOption(entity.getGroup()).indexOf(entity.getBaseColour())));
        }```
I am also using the velocity api the latest and this is the error:

The entity class is a custom class from me
#

Also this error happens only when luckperms does not exist

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!

vital grove
#

oh ok 1sec

#

wait the server website is kind of down 1sec

main dagger
vital grove
#

when the plugin is not in the server

main dagger
#

well yeah

vital grove
#

like when its just my plugin being loaded

main dagger
#

if lp isnt loaded, its classes dont exist

vital grove
#

yes

#

but i put that if getPlugin("luckperms").isPresent()

#

and else

#

but it tries to load the classes anyway

#

but in the proxyinitialize event i have this:

if (proxy.getPluginManager().getPlugin("luckperms").isPresent()) {
            try {
                LuckPerms api = LuckPermsProvider.get();
                getProxy().getConsoleCommandSource().sendMessage(Text.colorize(Prefix() + "&aLoaded LuckPerms API."));

                PrefixChange listener = new PrefixChange(api);
                listener.register();

            } catch (Exception e) {
                getProxy().getConsoleCommandSource().sendMessage(Text.colorize(Prefix() + "&cFailed loading LuckPerms API."));
            }
        } else {
            getProxy().getConsoleCommandSource().sendMessage(Text.colorize(Prefix() + "&cSince LuckPerms is not detected the rankcolor function is disabled"));
        }```
which works just fine and doesn't crash when lp does not exist
main dagger
#

what is line 103 of FeatureHubPlugin.java

vital grove
#

lines 102-103:

    @Inject
    public FeatureHubPlugin(ProxyServer proxy, @DataDirectory Path dataDirectory) {```
main dagger
#

ok well this isnt an issue with luckperms

vital grove
main dagger
#

you should go to the velocity channel in the paper discord

#

but
luckperms literally cannot be the cause of any issue when it is not installed

vital grove
#

right i didn't think of that my bad sorry for wasting your time

#

and thank you for your time and everything

iron vortex
#

Hello
I'm using this code to give and take permissions from users when joining and leaving the server
the problem is it seems this method resets the whole player data, so if a player has a vip rank or something it gets reset permissions also get reset

#
CompletableFuture<User> lpUser = getluckPerms().getUserManager().loadUser(uuid);

        lpUser.thenAccept(user -> {
            for (String perm : permissions) {
                Node node = Node.builder(perm).build();
                user.data().add(node);
            }

            getluckPerms().getUserManager().saveUser(user);
        });
#

I also use this to remove permissions

#

just change .add to .remove

main dagger
#

show /lp user <name> info before and after this

#

also, unrelated, but you can use UserManager#modifyUser to load a player if needed and save automatically

#

so something like ```java
luckperms.getUserManager().modifyUser(uuid, user -> {
// do stuff with the user
});

opal python
#

what possible reason could there be that the permission node builder is blocking indefinitely?
it works on all permissions except probably ones containing :

#

nvm also not working on perms without :

#

fixed it by using Node#builder but still curious on why PermissionNode#builder would block

wicked locust
#

if i set the primary group to default, will the player still be able to use the "admin" perms? what's the idea behind this feature?

main dagger
coral owl
#

Is there a way to get what groups of a player are temporary?
So far this is basically what I have
LuckPermsProvider.get().getUserManager().loadUser(player.getUniqueId()).get().getInheritedGroups(QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build())

main dagger
#

if they have an expiry

coral owl
#

Yeah, whenever you addtemp

#

How would I be able to check for the expirations, if they have an expiration

fast delta
#

the Node will have an expiry date, you'd do like getNodes(NodeType.INHERITANCE).stream().filter(Node::hasExpiry)...

coral owl
#

Yea, I was able to figure it out, this is what I have (Yes it is Skript)

function getPlayerTempGroups(p: player):
    set {_user} to LuckPermsProvider.get().getUserManager().loadUser({_p}.getUniqueId()).get()
    set {_nodes::*} to ...{_user}.data().toCollection()
    loop {_nodes::*}:
        if loop-value is instance of InheritanceNode:
            broadcast "-----------------------------"
            broadcast (loop-value).getGroupName()
            broadcast (loop-value).hasExpiry()
            broadcast (loop-value).hasExpired()
            broadcast (loop-value).getExpiry()
            broadcast (loop-value).getExpiryDuration()
coral owl
#

Now, how can I go about removing a player from a temp group, using only the api

main dagger
#

just remove the node

#

there is no difference between normal nodes and temp nodes other than temp nodes having an expiry

#

also you should probably just learn java instead of using skript

coral owl
#

Learning Java is a big step for me right now, I learn here and there when I can

coral owl
# main dagger just remove the node

See, I've been trying to do that. But for some reason it doesnt work, this is what I have for the direct version, as well as the broader version

function removePlayerPerm(p: object, perm: string):
    set {_user} to getPlayerUser({_p})
    broadcast {_user}
    set {_node} to Node.builder({_perm}).build()
    broadcast {_node}
    {_user}.data().remove({_node})
    loop ...(server.getServer().getWorlds()):
        set {_wnode} to Node.builder({_perm}).withContext("world", (loop-value).getName()).build()
        {_user}.data().remove({_wnode})
    broadcast "Removing: %{_perm}% from %{_p}%"
    {-LuckpermsUM}.saveUser(getPlayerUser({_p}))
    
function TestRemove(p: player):
    set {_user} to LuckPermsProvider.get().getUserManager().loadUser({_p}).get()
    set {_node} to Node.builder("group.test").build()
    broadcast {_node}
    {_user}.data().remove({_node})
     LuckPermsProvider.get().getUserManager().saveUser(LuckPermsProvider.get().getUserManager().getUser({_p}))

I have been able to deduce, that, if the targeted group is not a temp group, it does work. It will get removed from the player.
But for some reason, the temp is just not working the same

fast delta
#

the node you pass to remove has to have an expiry to remove temp nodes iirc

#

it doesn't have to match, it just has to have one

fast delta
#

tbf that should be documented

coral owl
#

You were right, thank you for the help

clever tapir
#

I've been trying to find an example on the Developer-API wiki page of how to remove permissions from players.
This is the code ive made so far. But after testing it on the server it doesnt actually remove and permissions.
(I'm a noob so if my code looks wonky don't come for me)

        // Search for all users matching the pattern
        luckPerms.getUserManager().searchAll(NodeMatcher.key(pattern))
                .thenAccept(users -> {
                    // Iterate over each user
                    for (UUID uuid : users.keySet()) {
                        // Modify the user data
                        luckPerms.getUserManager().modifyUser(uuid, user -> {
                            // Remove nodes matching the pattern
                            user.data().remove((Node) matchPattern(pattern));
                            // Log the removal of permissions
                            plugin.getLogger().info("Removed permissions matching pattern '" + pattern + "' for user: " + user.getUsername());
                        });
                    }
                    // Log the completion of the bulk update
                    plugin.getLogger().info("Bulk update completed for permission pattern: " + pattern);
                });
    }

    // Method to create a Predicate for matching nodes based on the pattern
    private Predicate<Node> matchPattern(String pattern) {
        return node -> {
            String key = node.getKey();
            if (pattern.endsWith("%")) {
                // For patterns ending with %, match the prefix
                return key.startsWith(pattern.substring(0, pattern.length() - 1));
            } else if (pattern.startsWith("%")) {
                // For patterns starting with %, match the suffix
                return key.endsWith(pattern.substring(1));
            } else if (pattern.contains("%")) {
                // For patterns with % in the middle, split and match both parts
                String[] parts = pattern.split("%", 2);
                return key.startsWith(parts[0]) && key.endsWith(parts[1]);
            } else {
                // For patterns without %, do an exact match
                return key.equals(pattern);
            }
        };
    }

    // Method to update tags based on the pattern "tag.%"
    public void updateTags() {
        performBulkUpdate("tag.%");
    }

    // Method to update suffixes based on the pattern "suffix.1000.%"
    public void updateSuffix() {
        performBulkUpdate("suffix.1000.%");
    }

    // Method to update reclaims based on the pattern "reclaims.%.claimed"
    public void updateReclaims() {
        performBulkUpdate("reclaims.%.claimed");
    }

    // Method to update PlayTimeReward based on the pattern "ptr.level.%"
    public void updatePlaytimeReward() {
        performBulkUpdate("ptr.level.%");
    }
}```
main dagger
#

use triple backticks for code blocks

#

if you are trying to bulk update it might be faster and easier to just run the bulk update command since it doesnt look like there is any api for bulk updates

clever tapir
#

That's what im trying to avoid though, the whole point is to set up an automatic bulk update.
and i don't want to turn off the confirm bulkedit option in the config.

When set to true, operations will be executed immediately.
This is not recommended, as bulkupdate has the potential to irreversibly delete large amounts of data, and is not designed to be executed automatically.
** If automation is needed, users should prefer using the LuckPerms API.
**
skip-bulkupdate-confirmation: false

#

so... what do i do?
Cause i dont want my staff members to accidently run bulkedits and mess up permissions

main dagger
#

the command needs to be ran as console anyways iirc

clever tapir
#

yeah, the idea is i set up a schedule which will run it through console

fast delta
#

user.data().remove((Node) matchPattern(pattern));
private Predicate<Node> matchPattern(String pattern) {

#

you are creating a Predicate but casting it to a Node, that isn't gonna work

clever tapir
#

Oh, so what do i need to do instead? (Sorry im a noob and AI isnt helping very much rn)

fast delta
#

it's likely throwing a ClassCastException in the completablefuture itself which is swallowing the (unhandled) exception

#

well, it'd be far nicer if there was api for bulk updates, that's in the long lasting todo list, but you'd pass the predicate to the clear(Predicate<Node>) method, not the remove(Node) method

clever tapir
main dagger
#

when someone feels like working on it over all the other things they could be working on

#

basically

clever tapir
#

lol

fast delta
#

not with the api, using luckperms' internal bulkupdate mechanism but that is not accessible normally

main dagger
#

but anyone could make it and pr it

fast delta
#

it could work with a luckperms extension but then it's not in your plugin and you can't really call that from your plugin

clever tapir
#

Welp, have you ever heard of anyone that is using luckperms that are able to do automated permission changes?
i'm thinking if there's another way outside of bulkedits i could somehow reset permissions automatically

fast delta
#

i mean, "automate" how? it really just depends on the goal how you can tackle it

clever tapir
#

So my goal is that at the end of every month my server resets. with that reset some of the players permissions ''reset'' as well.
Currently im having to do it all by hand by bulkupdating and confirming the bulkupdate in the console.
there's 4 permission categories (tags, reclaims, suffix and ptr) that all have like 50 seperate permissions related to them. The one in the picture is the reclaims permissions
So my goal is to clear any
reclaims.(name).claimed
permissions from ALL players on the server while keeping
reclaims.(name).unclaimed
I have other permissions that are similar.
usually i do bulkupdates

lp bulkupdate all delete “permission ~~ reclaims.%.claimed” lp bulkupdate all delete “permission ~~ ptr.level%” lp bulkupdate all delete “permission ~~ tag.%” lp bulkupdate all delete “permission ~~ suffix.1000.%”

but i want to automate it by having the built in schedule on the pteradactyl panel run the bulkupdates once every month.
But i cant because it requires a generated confirmation code.
and i dont want to turn off the skip-bulkupdate-confirmation in the config because it's not recommended and if automation is needed i should use the luckperms API

This is not recommended, as bulkupdate has the potential to irreversibly delete large amounts of
data, and is not designed to be executed automatically.
If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation: false

main dagger
#

fwiw, luckperms isnt meant to be a data store

#

well, for other plugins that is

#

if you are on paper, you should probably use the pdc for your "claimed"/"unclaimed" and level stuff

jovial vapor
#

[solved]

grave forum
#

How i can improve this code

#

Im using luckperms api btw

#

It IS a top kills plugin

wild whale
#
  • Static abuse
  • Indentation and whitespace is super inconsistent, fix that up for your sanity
  • Hardcoded tag colors is less than ideal, at a minimum I'd switch that over to a config, though honestly I'd just use LP meta (store the tag color under i.e. a tagcolor key, and can easily pull the value off the User)
  • on a similar note, hardcoded messages, world names, and coords will make future you grumpy if you ever want to tweak something
  • I very much hope all of the methods in this class are only being called from an async context because otherwise you're going to have lag spikes from loading offline player data & doing SQL queries sync on the main thread
grave forum
#

This IS asyncronous right

#

The BukkitMain class has a runnable with runTaskTimerAsyncronous

#

That updates ALL holograms

wild whale
#

Yeah then that'd be async, that's fine

#

(well fine from an async standpoint anyways, I see the static abuse is not limited to just that one class)

grave forum
#

Im fetching The value of offlineplayer group from luckperms incorectly?

#

I use Bukkit.getOfflinePlayer(Nick)

#

And pull out his name from MySQL

#

And from The name get The group

#

To give a color to players on top hologram

wild whale
#

I mean, that part looked fine aside from the aforementioned messy indentation

grave forum
#

CompletableFutures dont lag The server out on a async runnable right

#

Like that one

wild whale
#

As long as you're only doing the blocking call (the .join on the CF) async, yeah it shouldn't affect the main thread (and thus your TPS)

grave forum
#

I have more holograms like this

grave forum
# grave forum

Topkills topwins topdeaths topcoins topranking topclans toploses

#

More holograms dont mean more lag right. Since all is asyncronous

#

The hologram code itself IS Fine since i use HolographicDisplays API

grave forum
wild whale
#

You passed null to getOfflinePlayer, nothing to do with LP

grave forum
#

Any clue on How to fiz?

#

Fix

grave forum
#

Fixed by doing a null check

#

Thanks for The help

upbeat swallow
#

Hi ! I'm listening NodeAddEvent and NodeRemoveEvent events and i would like to know if this is the right way to check the node type : NodeType.WEIGHT.matches(node) or not

carmine nova
#

Hi, i need help with the luckpermsAPI for velocity i use this but i have a error

public static LuckPerms luckPerms;
@Inject
public Main(ProxyServer server, Logger logger) {
 luckPerms = LuckPermsProvider.get();
}```

[16:22:03 ERROR]: Can't create plugin holocronmcproxy
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) [Guice/ErrorInjectingConstructor]: LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
fast delta
#

you can only get it in and after the proxy initialize event

#

not in the construction of your plugin instance

carmine nova
#

i have the same error

fast delta
#

care to share your main class and the whole error?

carmine nova
# fast delta care to share your main class and the whole error?
public class Main {

    private static Main instance;
    private final ProxyServer server;
    private final Logger logger;
    public static LuckPerms luckPerms;


    @Inject
    public Main(ProxyServer server, Logger logger) {
        instance = this;
        this.server = server;
        this.logger = logger;
    }

    @Subscribe
    public void onProxyInitializeEvent(ProxyInitializeEvent event){
        luckPerms = LuckPermsProvider.get();
    }


    public static Main getInstance() {
        return instance;
    }```
#
net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
This could be because:
  a) the LuckPerms plugin is not installed or it failed to enable
  b) the plugin in the stacktrace does not declare a dependency on LuckPerms
  c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
     (call the #get method in onEnable, not the constructor!)
        at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:53) ~[?:?]
        at be.shark_zekrom.Main.onProxyInitializeEvent(Main.java:48) ~[?:?]
        at be.shark_zekrom.Lmbda$1.execute(Unknown Source) ~[?:?]
        at com.velocitypowered.proxy.event.UntargetedEventHandler$VoidHandler.lambda$buildHandler$0(UntargetedEventHandler.java:56) ~[server.jar:3.3.0-SNAPSHOT (git-46f29480-b427)]
        at com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:598) ~[server.jar:3.3.0-SNAPSHOT (git-46f29480-b427)]
        at com.velocitypowered.proxy.event.VelocityEventManager.lambda$fire$5(VelocityEventManager.java:479) ~[server.jar:3.3.0-SNAPSHOT (git-46f29480-b427)]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]```
#

i change to compileOnly 'net.luckperms:api:5.4' in my gradle config and it's worked

fast delta
#

yeah the code looks correct, I assume you were shading the api

left osprey
#

I cant find the 1.20.1 placeholders anywhere 😦

left geyser
left osprey
#

idk joined the discord and asked lol

storm shore
#

Hello, anyone up? ♥️

night pier
#

no

storm shore
#

Ewww im stuck on adding api to my project. I'm making my first plugin and I took a big bite out of it, I know 😄 Maven didn't find the API library most likely.

fast delta
#

you need to tell intellij to refresh maven

#

it has a little button or tab somewhere for that

storm shore
#

already done

gilded plume
#

Am I having a bread dead moment?

wild whale
#

Nodes can be added to either groups or users, thus the event only has PermissionHolder NodeAddEvent#getTarget. Check it's type and cast to User

gilded plume
#

Thank you. Helped a lot

random acorn
#

how do I remove all suffixes of only some priority from a player?

grave forum
waxen jewel
#

Hello ~
Please tell me where to download LuckPerms-Fabric-PlaceholderAPI-Hook 1.20.1

random acorn
fleet knoll
#

When I unset a meta from a user (by command), the NodeRemoveEvent is not triggered. Does it work like this or a bug? I am looking for a way to listen to when a meta is being removed from a user.

echo herald
#

Can luckperms be tested using forgemdk with intellig idea running runClient?

main dagger
echo herald
#

I have, the commands aren't there, and I've add the dep to gradle and have the jar in the mod folder.

#

Also, how do you register the mod with forge?

#

Can it be done just accessing it statically?

ocean yacht
#

hm so i have a problem with syncing data. I have a backend command that removes/add a node with modifyUser. And i would like to know about this on the proxy. Is there any event I can listen on the proxy that catches this.

#

i have tried the nodeMutateEvent but that seems to only be called on the backend server where it happens. NodeRecalculateEvent also doesnt seem to be called unless im doing something wrong.

main dagger
#

theres some event when data is synced iirc

#

you could also piggyback off the messaging lp uses

#

i guess the javadoc hasnt been updated

ocean yacht
#

Alright I’ll try that

#

Thanks

frigid moss
ocean yacht
#

im using net.luckperms:api:5.4

main dagger
#

yeah its not in 5.4 since it was added later

#

not sure if/how you could get the latest version

fast delta
#

technically it's part of 5.5 which is not released yet, given that it was added after 5.4 released

ocean yacht
#

great.

#

is there a way to manually trigger a user reload? I guess some usermanager method?

fast delta
#

loadUser should do it

ocean yacht
#

I have tried it with pushUserUpdate yesterday but sometimes it doesn’t update. At least velocitab sometimes isnt updating the tablist. So I don’t know if it’s a lp or velocitab issue. Does lp have some threshold on how often or how fast it will update a user?

fast delta
#

uh there's some invalidateCache method or something somewhere, but that isn't the same as reloading from storage
pushing an update through the messenger just tells other LPs on the same network/messaging system that they need to reload from storage (not the self instance)

rugged tapir
#

Is a User object always up to date with the latest cached version of it?
So if I run getUser somewhere and later I run loadUser, will that update the previously retrieved user or will it create a new object?

fast delta
#

it'll load a new user object

#

I think, but I'd rather be safe than sorry

rugged tapir
#

Okay thanks

tame sparrow
#

Hey there, I can't seem to get the LuckPerms API object. This line of code always returns null. Is there something I may be missing?

  • luckperms is installed on my server
  • luckperms is in depend in my plugin.yml
  • this line is at the end of my #onEnable method
  • the api dependency is included in my plugin jar
fast delta
#

the api dependency is included in my plugin jar
that's the wrong thing, it shouldn't be

#

the api classes are provided by the luckperms plugin

tame sparrow
#

Not including it gave me a different error though

fast delta
#

what's the error?

tame sparrow
#

Something like a NoClassDefFoundError exception, however I just tried again and it's working now. I may have done something else wrong on accident

#

Thank you!

ivory prairie
#

how can ı do get "/lp user username parent info" with api

main dagger
#

filter a users nodes to just the inheritance nodes

ivory prairie
wild whale
#

There's PermissionHolder#getNodes(NodeType) which'll spit out all the nodes of the given type a user has set directly. So if you ask it for NodeType.INHERITANCE, it'll spit out all the InheritanceNodes a user has, which contains both the group name and expiry

ivory prairie
#

I'm sorry to bother you with the tag.

wild whale
#

Please don't tag.
On each inheritance node there's the group name and the expiry (as an Instant). However as per the javadocs, getNodes returns a Collection of nodes (since a user could have any number of inheritance nodes, or none at all)

stuck marsh
#

Hello, how can I hook LuckPerms into a Velocity plugin if it's even possible?

main dagger
#

use the static method on the wiki

#

that works on any platform

stuck marsh
#

tysm

#

It isn't getting picked up somehow

main dagger
#

idk where you got the systempath thing from

#

but have you restarted your ide

stuck marsh
stuck marsh
main dagger
#

why do you need it to be from a local file

stuck marsh
main dagger
#

its supposed to be in provided scope

stuck marsh
#

[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-site-plugin].dependencies.dependency.scope' for net.luckperms:api:jar must be one of [compile, runtime, system] but is 'provided'.

main dagger
#

!paste the whole file

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!

stuck marsh
main dagger
#

thats not your file

stuck marsh
main dagger
#

you need to put it in this section

stuck marsh
#

oh 💀

stuck marsh
languid briar
#

Does anybody know if subscriptions like this are called asynchronously?

fast delta
#

no guarantees, the api is thread safe so things can be used from any thread, and events can be called from any thread

languid briar
#

I see, I'm getting some weird scoreboard update problems, maybe it's because I'm trying to do some illegal bukkit stuff on some different thread

main dagger
#

iirc theres some method in bukkit that can tell you if you are on the main thread

languid briar
#

Yep

#

Bukkit.isPrimaryThread()

#

For now I'm doing Bukkit.getScheduler().getMainThreadExecutor(instance).execute ...

#

Let's see if that fixes it

#

Can confirm that fixed it! I was confused for a while about this and then I remembered Minecraft main's threadiness

#

For reference in the future, from my testing: It never runs in the main thread

fast delta
#

nice

#

commands run on their own thread, but with the api you can add/remove nodes on the server thread without issues so it can be called on either

rocky aurora
#

hey, how could I remove a permission from all users matching a context?
For ex.

/lp user User1 permission set some.permission true my_context=true
/lp user User2 permission set some.other.permission true my_context=true

I want to remove both (all) of the permissions by only knowing the context.

ocean yacht
#

isnt there bulkupdate?

#

or do you want do do it with code?

wild whale
#

bulkupdate can't do contexts unfortunately. It's simultaneously very powerful and very limited :/

ocean yacht
#

ah i see

fickle tangle
#

how is the uuid stored in the mongodb structure for luck perms? having a hard time decoding whats in there

#

(making an api for a webapp)

main dagger
#

use the REST API extension

fickle tangle
main dagger
#

assuming you have a messaging service setup, data would only ever be maybe half a second out of date

fickle tangle
#

awesome, thx

main dagger
#

you could also run the extension on a standalone LP instance on the same machine as the DB

fickle tangle
#

hm true ok. Thanks a bunch

rocky aurora
#

What does UserManager#getLoadedUsers() return? All the users that are in the database?

main dagger
#

javadocs are generally quite useful

#

also its just in the name, get loaded users

#

users that are not online are typically not loaded

rocky aurora
#

Is it possible for me to get all the users?

For this use case:
For ex.

/lp user User1 permission set some.permission true my_context=true
/lp user User2 permission set some.other.permission true my_context=true

I want to remove both (all) of the permissions by only knowing the context.

#

for each user, check if they have any permission that matches that context, if it does, remove it.

main dagger
#

theres a method to get all uuids. iterate over that to load the user and then iterate their nodes

rocky aurora
#

thanks

covert copper
#

"I’m facing an issue where I have the Admin rank and another rank, but when I type in the Minecraft chat, the default rank shows up instead of my actual rank."

fickle tangle
#

running standalone

main dagger
fickle tangle
#

ahhh literally has config in the volume

#

thx again

upbeat swallow
#

Hi ! Are luckPerms events async ?

fickle tangle
upbeat swallow
echo heart
#

When I ran the lp command to give a permission to a player (through paper api), when will this change have an effect on Player#hasPermission? It seems like it only propagates after a successful storage write

main dagger
#

you ran a command or used the api?

echo heart
#
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
#

where cmd is the luckperms command

rare shard
#

hello can someone tell me how I can put my ranks on the scoreboard and how via dm

#

pls

rare shard
#

Help me

rare shard
#

Hallo

upbeat swallow
#

Hi !
How can i get the Group of a User ? E.g. my User's group is group1 who inherits from group2 which itself inherits from default. How can i get group1 ?

wild whale
upbeat swallow
#

I didn't fully understand sorry ^^'

wild whale
#

Just the usual PermissionHolder#getQueryOptions should do it

upbeat swallow
wild whale
#

Should do it, yup

upbeat swallow
wild whale
#

Can you show your full code?

upbeat swallow
#

Actually :

#

I've removed me the default group and no longer have a log

#

If you have an idea ^^

echo heart
#

You sure that your other groups are actually inheriting from each other? Didn’t you just add every group to your parent groups?

#

Even the lp command pic says your primary group is default but you have other parent groups

upbeat swallow
echo heart
#

And it says your primary group is default

#

Give administrator a higher weight and make it inherit from default

echo heart
#

Yeah probably

#

If default group weight is less then 1 it should be fine

#

But I would leave more room to add other groups in between

upbeat swallow
#

default group weight is just not set

echo heart
#

Now set your parent to admin, you should have every perm you set on admin and default and your code also should work

upbeat swallow
#

Hum i think this is not working...

net.luckperms.api.model.user.User luckPermsUser = this.luckPermsInstance.getUserManager().getUser(event.getUser().getUUID());
                    Collection<Group> groups = luckPermsUser.getInheritedGroups(luckPermsUser.getQueryOptions());
                    LogUtil.warn("GroupId:" + luckPermsUser.getPrimaryGroup());
                    if (groups.isEmpty()) {
                        LogUtil.warn("La liste est vide mon reuf !");
                    }

                    for (Group g : groups) {
                        LogUtil.warn("GroupId:" + g.getName());
                    }```
echo heart
#

lp user name parent set admin

upbeat swallow
#

damn my parent was just not set ?

#

i'm i stupid at this point

echo heart
#

You just used add instead of set, but now since you have proper inheritence you can set it to admin

upbeat swallow
#

I see

#

Tysm ^^'

upbeat swallow
#

Another question, is there an event for /lp user ? parent set ?

echo heart
plain marlin
#

Does the suffix have an api?

coral marten
#

how can I use the api to give players any permission and set any prefixes through my plugin?

coral marten
fast delta
coral marten
wild whale
#

Declare a dependency on LP in your platform manifest (i.e. your plugin.yml)

coral marten
#

What name should I write?

main dagger
#

LuckPerms

mild mountain
#

I have question
I have velocity and 3 servers, but webstore plugin does not offer velocity version.
How i can make luckperms talk to 3 paper servers to one database and not mess up?

wild whale
#

!network

frank driftBOT
wild whale
#

#support-1 for general support queries in the future please

pulsar sundial
rugged hedge
pulsar sundial
#

It tells me that it is not found as in the log

fast delta
#

oh, you are

#

it should be compileOnly(libs.luckperms), not implementation(libs.luckperms)

pulsar sundial
#

Ok let me try

#

Solved works

ionic charm
#

Ah

ionic charm
pulsar sundial
# ionic charm Pro never die

I'm working on a Gui version for Luckperms it will work from 1.8 to 1.21.1 and you can do everything you do from command/editor but from gui

real meteor
#

I don't know why this error appearing, help me pls

#

i also tried this, but not working anyway

main dagger
#

are you shading LP into your plugin

#

if you are: dont

#

also make sure you depend on lp in your (paper-)plugin.yml

real meteor
#

maybe i do something wrong, but everything done

main dagger
real meteor
#

api 5.4

#

it is

main dagger
real meteor
real meteor
#

oooohh

night pier
#

you don’t need to shade it.
Change the scope to provided

main dagger
#

do not shade lp into your plugin jar

real meteor
#

dont do this

#

ill test this now

#

thx anyway

#

nope

real meteor
main dagger
#

it doesnt matter how you get the LP api instance in your code. if you shade LP it will not work

real meteor
#

now im not

#

oh

#

no

#

im idiot

night pier
real meteor
#

missclick

#

not working

#

i rebuilded after this

#

and not working

#

ill send u all code for sure

#

thats all

night pier
#

open the jar and see if LuckPerms classpaths are in it.

main dagger
#

no, also wrong channel

lethal trail
#

sorry

#

;)

delicate forge
#

Can sombody walk me though adding LuckyPerms API to my Fabric project in intelij

main dagger
delicate forge
#

ive read that, added it to my build.gradel file.
But ive not touched java in 10 years and this is confusing me. I cant see LuckyPerms classes in my project

main dagger
#

did you reload

delicate forge
#

I restarted intelij yes

wild whale
#

Can you show your build file

delicate forge
#

clyde wont let me 😦

main dagger
#

!paste it

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!

delicate forge
#

I fogot about pastebin and gist 😛

#

net.luckyperms is in my sources list though

#

nvm, its working now 😛

young osprey
#

How can I find out what is the context of the server running my plugin?

nocturne elbow
#

hm

#

hmmm

#

?

#

how do i even se dis

nocturne elbow
#

?

wild whale
#

What?

nocturne elbow
#

idk how to use it

wild whale
#

Use what?

short rapids
#

hello?

    override fun onEnable() {
        val provider = Bukkit.getServicesManager().getRegistration(LuckPerms::class.java)
        if (provider != null) {
            val api = provider.provider
        }
```Do I have to do this to use it?
#

how to use

short rapids
#

yes

short rapids
short rapids
#

How to add Permssion to user

delicate forge
#

Two Questions please help:
1: What is the best event to use to know lucky perms had loaded?
2: How do i add a perm node, that is visible in the editor?
Using Fabric API.

main dagger
#

for 2, its the same on all platforms

#

!cookbook

frank driftBOT
main dagger
#

you dont need to do anything special for nodes to appear in the editor

delicate forge
#

ive read all this and it explains how to use luckyperms but not how to add my own nodes

#

unless ive missed it some where

wild whale
#

You just check permissions and they'll automatically populate in the editor

#

Keep in mind the editor permission suggestions are just that, suggestions

delicate forge
#

so simply calling: PermissionNode.builder("mymod.mypermission.cool").build();
will add the perm to the editor?

wild whale
#

No, it won't appear until the permission is actually checked against a user. Just check permissions as normal and permissions will populate as needed

delicate forge
#

and i cant do somthing like add it to the know permissions registry?

main dagger
#

just check your permissions as needed, and document them on your mods download page

brisk lark
#

Why can't I pull the prefix?

#

I am trying to get the group prefix from my own plugin but I can't.

main dagger
#

are you trying to get a users prefix?

#

what exactly have you tried?

#

is there an error, or does it just return nothing?

brisk lark
fast delta
#

you don't need to try to manually get the prefix from the nodes yourself, LuckPerms already has that calculated

drifting otter
#

How does Luckperm's command system work?

#

I see the code for command in common but I don't see how it connects to the platform-psecific impelmentations?

ancient elk
ancient elk
drifting otter
#

So you get the command on every platform, turn it into this custom ArgumentList type the sender into your custom sender type

#

and then you do a bunch of null checks permission cehcks etc..

#

before actually executing

marsh river
#

hey there, this function here is throwing a duplicate key error when I try to reassign a key, do I need to save the clear key operation separately?

#

here's the exception and the code that calls it

#

my theory is that clearing in-memory without saving to disk, reassign the key and only then save makes it as if I am not clearing in the first place

marble root
#

How can I access luckperms via PHP?

main dagger
#

you need an instance of luckperms running with REST api extension

#

theres a page on the wiki for it

fast delta
marsh river
#

The stacktrace is buried within the logs, but Ill try to get it for ya

marsh river
#

here's the whole stack trace, sorry for the delay

#

and here's the relevant refreshnodes function

#

(red colors because I pulled up the view of the source from a mod that depends on the library)

fast delta
#

hm, my only concern is that you might be holding onto some old/stale User instance there in that lpUser field, personally I'd pass the User as an argument to refreshNodes

peak kettle
#

How to activate luckyperms chat format? because the prefix appears in the tab and in the players' heads but in the chat it does not

night pier
#

!lpc

frank driftBOT
night pier
#

that also has nothing to do with the api

lapis hornet
lapis hornet
#

!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

lapis hornet
#

!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.

lapis hornet
#

@wild whale sr ping

frank driftBOT
#

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

lapis hornet
#

find players group for player offline

wild whale
#

Don't ping

#

!api

frank driftBOT
lapis hornet
#

I couldn't find this information._.

lapis hornet
#
    for (String group : possibleGroups) {
        if (player.hasPermission("group." + group)) {
            return group;
        }
    }
    return null;
}```
wild whale
#

Disable the ping when replying.
If you want to access any data for offline players, or a more elegant way of getting a player's groups, you'll need to use our API

lapis hornet
wild whale
#

If you're going to get a LP User anyways, you can just query what groups they have directly, no need for that hacky iteration thing you have

lapis hornet
hearty saddle
#

Hi, is there a way in the api to parse durations in the same way that luckperms does when doing things like addtemp?

lapis hornet
#

Huh

hearty saddle
#

e. g. "2h" or "5d"

#

like some util method somewhere?

lapis hornet
#

Idk:)

hearty saddle
#

Huh

hearty saddle
#

well same

#

I think you just need to use the uuid and not offline player

lapis hornet
#

But can you help me with this problem?

hearty saddle
#

and then you do loadUser

lapis hornet
#

For example?

lapis hornet
hearty saddle
#

what does that mean

lapis hornet
#

I have seen Checkpermission

lapis hornet
hearty saddle
#

dude

#

just

#

read the docs

lapis hornet
lapis hornet
main dagger
#

!cookbook has examples

frank driftBOT
lapis hornet
#

hihi

#

I never forced it to convert to Layer

#

So frustrated, I deleted all the relevant lines of code

lapis hornet
hearty saddle
#

are permissions that you set through the api automatically synced using the messaging service?

#

if not how do I do it manually?

hearty saddle
#

bro why are you replying

#

I'm not talking to you

lapis hornet
#

Oh sorry

lapis hornet
fast delta
hearty saddle
#

oh thx I'm blind

lapis hornet
#

checkpermission always returns false , I tried ("group." + groupname) even though they are in the group but it is always false

#

I know it's an offline player, but I can guarantee that I got the uuid

fast delta
#

could you show more of the code?

lapis hornet
# fast delta could you show more of the code?
        Player p = Bukkit.getPlayer(playerName);
        if (p != null) {
            for (String group : possibleGroups) {
                if (p.hasPermission("group." + group)) {
                    return CompletableFuture.completedFuture(group);
                }
            }
        }

        OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
        UserManager userManager = luckPerms.getUserManager();

        return userManager.loadUser(offlinePlayer.getUniqueId()).thenApply(user -> {
            if (user != null) {
                CachedDataManager cachedData = user.getCachedData();
                CachedPermissionData permissionData = cachedData.getPermissionData();

                for (String group : possibleGroups) {
                    if (permissionData.hasPermission("group." + group)) {
                        return group;
                    }
                }
            }
            return null;
        });
    }```
#

I can guarantee that it's running the for loop all the way to the end of the list of possibleGroups, and in all cases it's taking the value at the end

karmic dew
#

I'm sure it's something i'm doing, though I'm not sure how, but players permissions just completely reset sometimes and I struggle to find a cause. Is there some debugging I can turn on to figure out why? We're using rabbit+mongo as our storage/messaging options. I do use the API to set/remove perms, dunno if something like this could cause a player's data to null out or something. Any help would be loverly!

strong carbon
#

Hi a question, Luckperms has webhooks to see who gives ranks/takes ranks ?

urban rune
#

hey,need help
the group.default is null
why return true?

wild whale
#

Check /lp user <who> permission check <the permission>, LP will output why it calculated that permission to be true

wild whale
#

Don't ping.

#

No it doesn't.

upbeat swallow
#

Hi ! Is it possible to change the server name via the API ?

main dagger
#

no. if you need a dynamic context, just register your own

upbeat swallow
#

Btw i don't really need a dynamic context, i just want to be able to set the server name via the API and not via the config

main dagger
upbeat swallow
#

except if you have a better idea*

main dagger
#

using an evironment variable or system property

upbeat swallow
#

to do what ?

main dagger
#

to set the value in the config

upbeat swallow
#

I just want to have for example lobby-1, lobby-2 etc etc

upbeat swallow
#

i don't think an env variable is a good idea the best idea*

main dagger
upbeat swallow
#

mhhhh i'll take a look

echo herald
#

LuckPerms on forge, do I need to do any casting for Player.hasPermission(String);?

echo herald
#

Because it's not working when trying to check if Player is in a group with the example shown in the docs.

empty dawn
#

👋

#

User#setPrimaryGroup(String s)#wasSuccessful(); returns false

#

Why might that be?

main dagger
#

with the default config, you cannot set the primary group

#

primary group is calculated based on the users inherited groups and contexts

#

and even if storing the primary group was enabled by the config, that method does not actually add an inheritance node to the player, so you would still need to do that

nocturne elbow
next sigil
wild whale
#

!api

frank driftBOT
next sigil
#

uhh

#

IDK WHAT TO USEEE AHHHHHH

#

@wild whale im still confused

frank driftBOT
#

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

next sigil
main dagger
ornate peak
#

Hey, for context i'm using the latest luckperms folia build.
I'm having the issue where the suffix im adding to the user isnt being adding, even when im restarting the server or rejoining the server. no suffix is being set to my player.
this is my code:

event.setCancelled(true);

UserManager userManager = luckPerms.getUserManager();
User user = userManager.getUser(p.getUniqueId());

SuffixNode node = SuffixNode.builder("try", 100).build();
user.data().add(node);
luckPerms.getUserManager().saveUser(user);

if (luckPerms.getMessagingService().isPresent()) {                                        luckPerms.getMessagingService().get().pushUserUpdate(user);
}
#

all the suffix is, is ""

main dagger
#

check /lp user <name> meta info

ornate peak
#

oh 💀

#

why doesnt it show up there 😭

main dagger
#

user info only shows the final prefix and suffix

ornate peak
#

i see ty

main dagger
#

as in, whatever appears there is what plugins will get when they ask LP for that players prefix

crystal musk
#

Hey guys, I am having issues shading the fabric-permissions api into my mod. Whenever I shade it PacketEvents crashes with the error:

Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

I am now trying to include it as jar in jar, but without success so far. Does anyone have an idea how I can fix this?

misty yarrow
#

I'm creating a bungeecord plugin so that when I type /promote (nick) (position) I add the position, which event can I use for this?

main dagger
#

because its part of fabric api

nocturne elbow
#

is there an event where i can check if a players role has been changed?

upper stratus
#

!Api

frank driftBOT
fickle tangle
#

PATCH request for /user/<uuid> only allows to update usernames?

Looking to edit parent groups with the rest api

main dagger
#

POST and PATCH to /user/{uniqueId}/nodes lets you add nodes

#

and DELETE to remove

fickle tangle
#

ahh nodes

#

ok thx

#

group.whatever to add

#

thx

spring plume
#

through the NodeAddEvent is it possible to check who added the node?

main dagger
#

well it might not be a user that added the node

#

so no

#

a plugin can add a node on its own, unrelated to the action of a player

gaunt steeple
#

Can someone teach me how to use LuckPerm, I think I do the right things but I can't put the permission, so I want to ask again, maybe I make a some mistakes

oak pagoda
main dagger
#

wrong channel too

cursive ruin
#

Hello you how know use or get rank's "displayname" in java:

main dagger
#

the displayname shouldnt be used for anything the player sees

#

also it just replaces the group name when other plugins ask for it

cursive ruin
celest acorn
#

I need to make all User instances always have a certain node set in the transient map, I can set it on UserLoadEvent, but it's async, so User instances appear in the API without that node for about half a second.
is there any way to prevent User instances from appearing in the API, until my handler finishes?
blocking in the handler doesn't work because the event is posted async

wild whale
#

XY problem, what are you trying to do? Why can't you just set this permission normally / why is it a problem if for half a second they lack this permission?

clever lichen
#

Is there a way to see who added a parent group to a user, like in the moment it is added

#

I know that NodeAddEvent exists, but i dont think there is a way to see who added the node

main dagger
#

no, that isnt tracked

#

it may not be a player that adds the node

#

since a plugin could do it entirely unrelated to a player

clever lichen
delicate forge
#

So Im getting this error with PaperMC when im trying to use the Luck pers API.
Apparently "net.luckperms.api.node.Node" does not exist, yes Luck perms is installed on the Paper Server

#

Paper 1.21.1

wild whale
azure galleon
#

What is the command so that people with rank can claim payerkits kits? Someone tell me

wild whale
#

Don't crosspost.

delicate forge
wild whale
#

Is that a plugin.yml or a paper-plugin.yml?

delicate forge
#

both

wild whale
#

Yeah don't do that. Pick one or the other. If you don't know the difference between the 2, stick with plugin.yml, paper-plugin.yml is still an experimental system.

delicate forge
#

Maybe its my Gradel dependancy:

    compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
    compileOnly("net.luckperms:api:5.4")
}```
#

im using brigadier commands so

#

Removed plugin.yml and same issue so, idk

wild whale
#

If you're relying on the experiemental paper plugin system (paper-plugin.yml) then you need to use the paper-plugin.yml's method for declaring dependencies - it's different than the bukkit plugin.yml syntax. See paper's docs

delicate forge
#

ah, paper needs you to allow access to dependant code classes 😛

#

Thank you, for the help @wild whale

frank driftBOT
#

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

delicate forge
#

Oh gawd Clippy is back, I thought we killed him in the 2000s and burried him under 6 foot ball feilds worth of concreate

frigid anchor
#

Are you able to load a user from the LuckPerms database through the plugin API with only a username? Or is there only way check if a user exists in the LuckPerms database only with a username?

#

I'm trying to avoid using the Mojang API to get a UUID given a username

wild whale
#

Not directly. LP does maintain a UUID <-> Username cache that you can access via the UserManager, but all LP data is stored only by UUID.
(That cache is only updated when a player joins the server so it could be out of date)

frigid anchor
#

Thank you!

rugged sand
#

hey i just installed the fabric version but there is no /lp what can i do

left geyser
silver sleet
#

How can I run the equivalent of a normal permission check using only LuckPerms API?
Using the method provided in the Wiki doesn't return true if luckperms.autoop is true.

celest acorn
# wild whale XY problem, what are you trying to do? Why can't you just set this permission no...

sorry for the late reply, but

  • goal: to add an inheritance node when the player is streaming (like on twitch, etc). the streaming state is retrieved from an external source (for simplicity, let's say, from twitch api)
  • why transient map: I don't need that inheritance node to be saved in the storage
  • why half a second is a problem: user load happens in a lot of cases (login, opening offline player's profile, server API, etc), and while I can block the login process for a little bit, there are cases where blocking isn't applicable like some stuff running on server thread
wild whale
#

In that case, why don't you just make a context provider for a yourplugin:is-streaming and just set whatever desired permissions in your permissions setup with that context?

celest acorn
#

context API looks really interesting to me thonk

#

but how would I use it to add a player to a group?

#

just add the group to everyone but with a custom dynamic context that actually decides if the inheritance node of that group should be applied?

wild whale
#

Correct

celest acorn
#

sounds a little unsafe

#

what happens if the plugin that provides the context isn't available? would the context check simply result in a context mismatch?

celest acorn
#

and how would the context calculator work for offline players whose data was loaded using the API if the target argument is an online player instance?

main dagger
celest acorn
# main dagger what?

permission checks are possible through the API, i.e. you can load a User instance for on offline player

#

but how would those checks work if an offline player's User has a node with context?

main dagger
#

only the global context applies to offline players

hazy blaze
fast delta
#

see the pinned message about messagingservice

hazy blaze
#

interesting

echo herald
#

In Forge, Player.hasPermissions(String), is not being resolved. Just the int variant.

echo herald
#

I can't figure it out. Is the hasPermissions(String) not available with Forge?

cursive ruin
somber oyster
#

Could someone help me? I want to remove a permission, but I dont how know. I tried it but it didnt work. I would be really greatfull if someone could help.

The console tells me that the error is suppose to be in Line 22

That is the code:

wild whale
#

What's "the error"?

fast delta
#

you can't just cast the player to LuckPerms User

#

you need to use the PlayerAdapter to convert from one to the other

ancient whale
#

trying to get highest group of an offline player

#

but the completablefuture is never accepting

#
        return LuckPermsUtil.getApi().getUserManager().loadUser(player)
                .thenApplyAsync(user -> {
                    System.out.println("primary group found!: " + user.getPrimaryGroup());
                    return ...;
                });```
#

nvm got it

cursive ruin
main dagger
#

it literally gives you the displayname

cursive ruin
#

?

cursive ruin
main dagger
#

what are you trying to do?

cursive ruin
#

to make a webstocket that sends to my site to get the info, including the player's rank, except that I prefer to use the display (because it's capitalized, and cleaner)

main dagger
#

you should use the rest api extension

cursive ruin
#

huh? I want to use the luckperms api, is that possible?

main dagger
#

the rest api extension can run on the server and then your website can access that

cursive ruin
buoyant moat
#

When adding a permission with the Vault API (I'm aware this is LP API channel), specifically playerAdd(world, player, permissionNode), is there a way for LuckPerms to not add the server context?

fast delta
#

there's some setting in the lp config

#

vault-server or something, you can set that to global

buoyant moat
analog prairie
#

hi, is here some way to get all users with group "test1"? i dont want to foreach all users and check theirs groups. I want to get all users with this group

wild socket
#

currently, this is how I get the users primary group (Do not ask me why, this is the best and consistent method I found without it returning wrong primary groups)
Is there any way I get the same thing but for uuid? PlayerAdapter#getUser(Player) links to UserManager#getUser(UUID) but I am unsure whether that will work in terms of consistency.

main dagger
#

there is a method to get the primary group, however you should consider trying to avoid relying on a primary group as a player can inherit multiple groups

frosty apex
#

how do i clear all of both online players and data players suffixes but not groups

#

@main dagger

frank driftBOT
#

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

left geyser
frosty apex
#

alright

bleak fulcrum
#

does the UserManager#loadUser method cache the loaded user?

fast delta
#

yea

bleak fulcrum
#

and there is no way to just get the user?

fast delta
#

UserManager#getUser?

#

it has to be loaded or it'll return null otherwise

bleak fulcrum
#

but I don't wanna cache it

fast delta
#

huh, why not?

bleak fulcrum
#

because that would memory leak

#

I just need to get the metadata of the user

#

I mean that would be like 300 offline users cached and that would be useless

fast delta
#

I mean, it isn't a memory leak, it's managed and will be unloaded after a few minutes

#

but you can call UserManager#cleanupUser to manually unload it if you really want to

nocturne elbow
#

how do I get the duration of a perminission

wild whale
#

Node#getExpiry

signal drum
#

hey team.

After updating docker it seems that the luckperms API no longer works. The following is reported for the latest version

Error loading shared library libjli.so: Permission denied (needed by /usr/bin/java)
Error relocating /usr/bin/java: JLI_Launch: symbol not found
Error relocating /usr/bin/java: JLI_PreprocessArg: symbol not found
Error relocating /usr/bin/java: JLI_ReportMessage: symbol not found
Error relocating /usr/bin/java: JLI_StringDup: symbol not found
Error relocating /usr/bin/java: JLI_MemFree: symbol not found
Error relocating /usr/bin/java: JLI_InitArgProcessing: symbol not found
Error relocating /usr/bin/java: JLI_AddArgsFromEnvVar: symbol not found
Error relocating /usr/bin/java: JLI_List_add: symbol not found
Error relocating /usr/bin/java: JLI_List_new: symbol not found
  luckperms-rest-api:
    image: ghcr.io/luckperms/rest-api
    environment:
      - "LUCKPERMS_STORAGE_METHOD=mysql"
      - "LUCKPERMS_DATA_ADDRESS=sql.internal:3306"
      - "LUCKPERMS_DATA_DATABASE=omni"
      - "LUCKPERMS_DATA_USERNAME=omni"
      - "LUCKPERMS_DATA_PASSWORD=removed"
      - "LUCKPERMS_REST_HTTP_PORT=8004"
      - "LUCKPERMS_REST_AUTH=false"
    network_mode: host

Is this a known issue?

jaunty pecan
#

do you have any strange volume mounts setup or anything overriding /tmp?

signal drum
trail ember
#

Hello guys, first time here. I'm making a plugin that uses the LuckPerms API to check for permissions, but I'm having trouble to set up a permission with expiration. The problem is that when I leave and join the server, the added perm dissapears, I use User#data#add(Node) to do this

wild whale
#

Are you saving the user after making changes?

trail ember
#

I thought the plugin would manage that itself, my bad

#

That goes for removing data as well I imagine??

wild whale
#

Yeah any changes need to be explicitly saved
(That way i.e. if you need to make 5 changes to a single user at once, you can do all of them at once in a single save operation instead of LP needing to perform 5 separate saves)

main dagger
#

modifyUser exists too

wind moth
#

Are bukkit events fired if I modify a user with the modifyUser method on my proxy server?

trail ember
#

Do you know if modifyUser handles OfflinePlayer loading and all?

trail ember
wild whale
main dagger
#

but there is a sync event you can listen for on other servers

trail ember
wild whale
#

!cookbook

frank driftBOT
wild whale
#

Another useful resource, cookbook is a little example plugin that uses the API to demo doing some basic actions ^

trail ember
#

Thanks, I'll have a look at it 🙂

#

With this plugin I'll have to take a big look on Completable Futures as well

#

It seems like an important feature when loading stuff

wind moth
main dagger
#

idk look at the javadoc

trail ember
#

Another question I hope it's not stupid... When I remove a Node using User#data#remove(Node) I don't have a way of setting a Equality predicate, so the node I send as parameter has to be equaly exact to the one I want to remove?

main dagger
#

iirc remove cares about everything except the exact value of an expiry

trail ember
#

Well that's a bit of a relief... because looking for expiration would've been quite harder than the rest of the values. I was even considering checking the nodes with User#getNodes() and filter them by key to get the exact node

main dagger
#

yeah if you want to remove a node with an expiry you just need to give it an expiry, but it doesnt matter what it is

wild socket
#

however in the past I only received wrong results with the use of getPrimaryGroup, hence why I am using that one

quiet garden
#

Hi all! Is there an API event for timer expiration in LuckPerms? This may sound strange, but I need to know this.

wild whale
#

No, temporary permissions are stored as an expiry timestamp.

trail ember
#

I just tried it with a basic InheritanceNode referring to a rank with an expiration and it didn't remove it

#

This is what I tried and removeVip(FRPlayer) does not remove it

main dagger
#

^ ¯_(ツ)_/¯

main dagger
trail ember
#

Sorry sometimes my english derps...

#

You already told me it has to have an expiry

#

Thanks for your patience man

trail ember
#

You were right, it only needed a random expiry, thanks for everything man

tidal shale
#

Hey!
I would like to use LuckPerms to give a player permissions for 10 minutes as a reward. I have added LuckPerms as a depent in the plugin.yml of my plugin and executed the following.

LuckPerms api = LuckPermsProvider.get();
PermissionNode node = PermissionNode.builder("bskyblock.island.fly")
  .value(true)
  .expiry(Duration.ofMinutes(10))
  .withContext(DefaultContextKeys.SERVER_KEY, "skyblock")
  .build();

api.getUserManager().modifyUser(player.getUniqueId(), user -> {
  user.data().add(node);
});

The following error message appears when I run it: https://paste.md-5.net/awetoruhom.sql

Before the questions come:
LuckPerms is loaded correctly and there are no error messages in the console. The code is executed by a player at some point during the game and not at the beginning, so it cannot be that the API has not yet been loaded.

Technical:
LuckPerms: 5.4.146
Paper: 1.21.3-65-master@7e789e8
Java: 21.0.5

Does anyone have a solution?

jaunty pecan
tidal shale
#

Thank you! Works now!

random plank
#

how can i add a suffix ?

#

this is right?

silk jetty
#

You can try it to see if it works.

tidal shale
#

Hey, I get the group of a user as follows.

ProxiedPlayer player = (ProxiedPlayer) commandSender;
LuckPerms luckPerms = LuckPermsProvider.get();
PlayerAdapter<ProxiedPlayer> playerAdapter = luckPerms.getPlayerAdapter(ProxiedPlayer.class);
User user = playerAdapter.getUser(player);
Group group = luckPerms.getGroupManager().getGroup(user.getPrimaryGroup());

For each group I have saved a meta, e.g. meta.color.dark_red. How can I access this via API?

fast delta
tidal shale
#

Thanks!

#

Is there a performant solution from LuckPerms to check how many homes a player is allowed to set?
I would like to have a permission “home.create.<limit>” and be able to check what limit the player has.

main dagger
#

use meta

#

its just key/value storage basically

tidal shale
#

The person for whom I am programming the plugin wants to have it as I have described, which is why I cannot change the permission.

wild whale
#

There's no good way to do it as you're describing, that's why the meta system exists.

tidal shale
#

How do other plugins do this that do not work with a permission system, but simply have the option of Bukkit/BungeeCord?

wild whale
#

I'm not sure how home limits relates to bukkit/bungeecord?

tidal shale
#

The homes are just one example.

wild whale
#

Oh just in general...the usual janky solution is defining limits in some config file under some name, then checking for <some permission>.<limit name>. That way the limit names are known and the plugin can just brute force check them all, then map it back to the value in the config.

#

Meta lets you avoid all that, you just query the meta with the desired key and LP will give you the value the admin configured in LP

tidal shale
#

So you can't just query the value of “homes.create”, but theoretically have to use “meta.gomes.create”?

wild whale
#

Correct

tidal shale
#

All right, thanks!

wild whale
tidal shale
#

Ah okay, thanks for the tip!

#

Can I somehow get all of a player's permissions?

fast delta
tidal shale
#

Okay thanks, I'll have a look at that

spark barn
#

hey im trying to integrate luckperms (forge 1.20.1) into the Intellij test server so i can see the debug logs and dont have to manually start up the server, copy my mod across etc, the main luckperms mod is set as a runtime only dependancy and everything works in a proper dedicated server, but i cant get it (luckperms) to run via the forgeGradle runServer task it gives the following error ```[11:29:30] [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)'

java.lang.NoSuchMethodError: 'com.mojang.brigadier.builder.LiteralArgumentBuilder net.minecraft.commands.Commands.m_82127_(java.lang.String)'
at me.lucko.luckperms.forge.ForgeCommandExecutor.onRegisterCommands(ForgeCommandExecutor.java:57)

#

have i done something wrong in the build.gradle or something to cause this

echo heart
#
  1. What does UserManager#modifyUser do when the user is already loaded? It doesn't load the user again right?
  2. If I call the above method in a for loop (I'm dumb, I know, shh) for every permission I want to add, what will happen? I'm thinking I'm introducing a funny little race condition here. (but not sure though since the user is already loaded)
  3. Is the user already loaded in PlayerJoinEvent?
  4. If I call user.data().add(node); with a node that is already added, what will happen? Somehow it looks like I'm removing permission nodes that I should add, but I don't have any code that removes node. Just the line I wrote before. And I'm also pretty sure it is not called if the node already exists.

So then I'm pretty sure I'm just doing something wrong and same race conditions are basically tricking me. Can someone help a bit with this?

echo heart
#

I run all this in PlayerJoinEvent on another thread and seems like sometimes it is removing nodes. When I just run it after server is running for a while and player is also online for a while it works perfectly fine, so I'm a bit confused

echo heart
#

Seems like switching to a method that adds all nodes to the cached user and then calling save after that on that user fixes the issue

#

And if anyone wondering:

  1. Yes, modifyUser method does load the user again from storage
  2. Since the above answer is yes, this also seems like a strong yes sadly
  3. Yes data is loaded in PlayerJoinEvent already into cache
  4. I can't say anything about this, I guess my issues came from number 1 and 2
main dagger
#
  1. duplicate nodes arent stored
echo heart
#

Yeah I figured it out already that I was insanely dumb, but thanks for the confirmation though

main dagger
#

note that different contexts make it a different node

#

so you can have the same node in different contexts

echo heart
#

Yeah I’m always checking using exact comparison so thats okay

#

I’m like 90% sure now that I just created race conditions before, since everything is working fine now

spare umbra
#
    public void saveUserInfo(Player player) {
        UserManager userManager = luckPerms.getUserManager();
        User user = userManager.getUser(player.getUniqueId());
        if(user == null) {
            user = userManager.loadUser(player.getUniqueId()).join();
        }
        user.data().add(Node.builder("prd.user").build());
        userManager.saveUser(user);
    }

this is the method triggered when a player joined the server,
but I want to make it return document. not void

#

this method is to goal to reach under the code.
but after saveuserinfo, getPlayerDocument can't find any of that.

    private Document getPlayerDocument(Player player) {
        return playerCollection.find(new Document("name", player.getName())).first();
    }

    private void handleNewPlayer(Player player, String playerUUID, String playerName, long joinTime) {
        player.sendMessage("You are newface!");
        Document playerDoc = getPlayerDocument(player);
        playerDoc.append("uuid",playerUUID)
                .append("name", playerName)
                .append("joinTime", joinTime)
                .append("Money", INITIAL_MONEY)
                .append("wardrobe", new ArrayList<>())
                .append("wardrobeCount", 2);
    }
spare umbra
#

FUUUUUUUUUUU is There no way to combine luckperm db with my own db?

#

CompletableFuture -> fail

#

Thread.sleep -> fail

main dagger
spare umbra
#

I was trying to combine these dataset

main dagger
#

i still dont really get what you are trying to do

spare umbra
#

well, when luckperm makes user's data who just joined the server - of course, these are worked in my plugin- I'm about to make my plugin check the luckperm's user data and use that data.

waxen zephyr
#

how i create a command to remove all users from a specific group?

#

i want this command to remove all staff but not the donators and influencers and also exempt the sender

sly oxide
#

Hey guys I want to recode the CloudNET V4 SyncProxy Module to display the LuckPerms Prefix + Suffix. How can I do this?

frank driftBOT
main dagger
#

!cookbook

frank driftBOT
vague gorge
#

hey, what does luckperms event bus need for registering an event on velocity?

#

i gave a ProxyServer to it but i get: (com.velocitypowered.proxy.VelocityServer) is not a plugin.

#
class LPSecurity @Inject constructor(
    private val server: ProxyServer,
    @DataDirectory val dataDirectory: Path
) {
    private lateinit var luckPermsAPI: LuckPerms

    @Subscribe
    fun onProxyInitialization(event: ProxyInitializeEvent) {
        luckPermsAPI = LuckPermsProvider.get()
        luckPermsAPI.eventBus.subscribe(server, NodeRemoveEvent::class.java, this::onNodeRemove)
    }

private fun onNodeRemove(event: NodeRemoveEvent) {
        // some stuff ...
    }
}
wild whale
#

The first param is expecting an instance of your velocity plugin, you're giving it the server instance

cunning turret
#

how to get group member list through luckperms api?

woeful pelican
#

Currently my code works as intended, however it took quite a bit of trial and error, and I just wanted to make sure that during that process I am still following best practice in terms of running what needs to be run asycnhronously, if there's any glaring issues with best practice I'd greatly appreciate if someone could point them out to me

plugin.lp.getUserManager().modifyUser(player.getUniqueId(), user -> {
            Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
                Track track = plugin.lp.getTrackManager().getTrack("rank");
                if (track == null || user == null) return;
                track.promote(user, ImmutableContextSet.empty());
                plugin.lp.getUserManager().saveUser(user);
            });

            Bukkit.getScheduler().runTask(plugin, () -> {
                String rankTitle = rank.name.substring(0, 1).toUpperCase() + rank.name.substring(1);
                Logger.log("&7" + player.getName() + " has attempted to rank up to " + rankTitle);
                player.closeInventory();
                Bukkit.broadcastMessage(plugin.format("&5&l#A800A8&lR#B41BB4&lA#C036C0&lN#CD51CC&lK#D96DD8&lU#E688E4&lP#F2A3F0&l! &d" + player.getName()
                        + "&7 has ranked up to &d" + rankTitle));
                spawnFireworks(player);
            });
        });
wild whale
#

2 notes:

  1. That return in the runTaskAsync might just return from the runTaskAsync block but still continue to run the modifyUser block, meaning it's possible for this to either silently fail and/or throw a NPE
  2. modifyUser will save the user for you once the block is finished running, so with that explicit save you'd have 2 save operations. Not the end of the world in this case probably, but something to be aware of.
mellow cedar
#

hello guys.
Where can I get luckperms fabric api hook for version 1.20.1 ?

upper linden
#

If I want to query all perms a player has am I able to do that on the player or do I need to query groups too?

steep light
#

Hey guys, how i can do it simplifier? ```java
public String getPlayerRank(Player player) {
LuckPerms luckPerms = LuckPermsProvider.get();
User user = luckPerms.getUserManager().getUser(player.getUniqueId());

    if (user != null) {
        List<Node> groups = user.getNodes().stream()
                .filter(node -> node.getKey().startsWith("group.")).sorted((a, b) -> {
                    int aPriority = getNodePriority(a);
                    int bPriority = getNodePriority(b);
                    return Integer.compare(bPriority, aPriority);
                }).toList();

        if (!groups.isEmpty()) {
            return groups.getFirst().getKey().substring(6);
        }
    }

    return "Default";
}

private int getNodePriority(Node node) {
    return switch (node.getKey()) {
        case "group.Admin" -> 10;
        case "group.Moderator" -> 9;
        case "group.VIP" -> 8;
        case "group.Premium" -> 7;
        default -> 0;
    };
}```
main dagger
#

also you can just filter to inheritance nodes

burnt geode
#

if I update meta for a player, can I be sure it syncs between servers? I remember having issues with it setting values from the proxy

#

also, is using the vault api fine or is hooking into luckperms directly recommended?

main dagger
#

idk if using vault will cause a sync

#

but you have to do it manually if you use LP directly (see pins)

burnt geode
main dagger
#

if you modify a bunch of users, youd want to only do one sync after modifying all of them

burnt geode
#

seems like there are prettier ways to do that, but whatever works I guess

#

thank you

burnt geode
#

do the event subscription handlers run on the main thread?

main dagger
#

pretty sure they run async, but just check what thread your on

sinful fulcrum
#

[01:28:18 ERROR]: [LuckPerms] [STDERR] SLF4J: No SLF4J providers were found.
[01:28:18 WARN]: Nag author(s): '[Luck]' of 'LuckPerms v5.4.150' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[01:28:18 ERROR]: [LuckPerms] [STDERR] SLF4J: Defaulting to no-operation (NOP) logger implementation
[01:28:18 ERROR]: [LuckPerms] [STDERR] SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.

#

who know this error?

main dagger
#

some other plugin is messing with log4j

sinful fulcrum
#

But it say Luckperms xd

main dagger
#

also this is the wrong channel

fluid jasper
#
    @Override
    public void onEnable() {
        // Plugin startup logic
        loadConfig();
        serverConfig = new ServerConfig(this);
        luckPerms = LuckPermsProvider.get();

        SocialSpyCommand socialSpyCommand = new SocialSpyCommand(this);
        getProxy().getPluginManager().registerCommand(this, new MessageCommand(this, socialSpyCommand, luckPerms));
        getProxy().getPluginManager().registerCommand(this, socialSpyCommand);
        getProxy().getPluginManager().registerCommand(this, new ReloadCommand(this));
        getProxy().getPluginManager().registerListener(this, new ChatListener(this, luckPerms));
    }```
#

@main dagger Hope you don't mind the ping

frank driftBOT
#

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

fast delta
#

make sure you aren't shading LuckPerms into your jar

fluid jasper
night pier
#

add the provided scope to LuckPerms

#

and then make sure you’re not grabbing a jar that still has LP shaded

still leaf
#

Yo, good morning all. I'm writing a velocity plugin and am trying to hook into luckperms api but it seems the docs only cover bukkit / sponge.. any help? is it possible?

still leaf
#

no worries guys, working now: this.luckPerms = LuckPermsProvider.get();

fluid jasper
main dagger
harsh epoch
#

Same thing on Gradle but I'm not shading LuckPerms.

#

And still not working.

night pier
#

show your code

turbid solar
#

Is there an 'easy' built in way to get metadata based on their current server (from luckperms' config field)?

harsh epoch
main dagger
#

but might be worth a shot just in case

fast delta
#

make sure your luckperms dependency in your build script is compileOnly and not implementation/api

dense marsh
#

How could I use the api if would like to add a command that grants, removes permissions to players

timber ravine
#

Hey, Does the proxy fire the events for things that happen on the backend servers?

#

Ping me if anyone responds

night pier
#

Don’t believe so, only on the server it happened on

flat mauve
#

sry, by api how to get highest weight of rank

brittle kayak
#

Hello,

I am using this line of java in my plugin to remove a node from a player but I believe I'm getting unusual results.
plugin.getLuckPerms().getUserManager().modifyUser(player.getUniqueId(), user -> user.data().remove(Node.builder("feather.keepinventory.keep").build()));

This line may be responsible for removing users from the default LP group. does this make sense to anyone or would you not expect it to do that?

brittle kayak
#

please ping me if you respond to me.

night pier
#

What would make you believe that? It should only be removing that specific node

brittle kayak
#

Well empirically when that line of code is executed at that point in time (1 hour into gameplay on my server), there's about 50% chance the player loses their membership of the default group.
I agree that line looks clean like it should just be removing the node itself but I wanted to doublecheck. I'm not very familiar with the LP API yet.

It seems something else is at play here in my plugin or another plugin I'm using but that's most likely beyond the scope of LP support.

chilly sorrel
#

Hey

#

can this be backported to 1.21.1 ?

#

looks like i'll have to build my own jar 👍

polar walrus
#

Hi there,
I am currently working on an project where I am setting the players group with the permission node API end point.
After saving the user I am not seeing anything change on the server until I execute /lp editor or /lp sync.
Am I missing something or is this normal?

polar walrus
#

Please ping me if you are able to help me out

#

So that group has an prefix but somehow when I use only the part before the bukkit run console command it does not update the prefix. Only after that console command it does

vital grove
polar walrus
#

aaaa oke, but the wiki doesn't say that I need to run the update task after an edit of data

main dagger
#

someone made it work with space engineers (through c#), so yeah, you can. you just wont really get support with doing so here

fast delta
#

standalone instance + rest api suffoChefKiss

craggy tiger
#

I have a plugin for Bungee, and when I use lp user <user> parent remove group, it sends a ping to BungeeCord, but it does not trigger the NodeAddEvent. However, when I use luckpermsbungee user <user> parent remove group, it triggers the event. Can anyone help me make it work?

main dagger
#

events only fire on the server where the change occurs

#

there is an event fired when it gets a ping though but youd have to figure out what actually changed yourself

solemn saffron
#

Hi, is it possible to change the server name in the config.yml via the API?

main dagger
solemn saffron
main dagger
cedar gust
#

Would anyone be able to help me troubleshoot my luckperms?

wild whale
#

#support-1 for support running LP. This channel is for people using our API.

cerulean sluice
#

how do i remove a group from a user?
i see that i can do user.data().remove(node), but can i just build a node instance each time i need a group, or should i somehow retrieve it? how?

cerulean sluice
#

have you found the solution?

tawny cape
#

I honestly don't remember, sorry

cerulean sluice
#

ig it has been almost a year now. Sorry for the ping

tawny cape
#

all good 🙂

tawny cape
main dagger
#

you just need to remove the inheritance node for that group

analog galleon
#

Hi, could anyone help me? I'm creating a plugin for Minecraft and I need to add the LuckPerm API but I can't import them into the pom.xml it gives me the following errors

sour yew
#

Hi, i have this Code,

                        .expiry(7 * 24 * 60 * 60) // 1 Woche in Sekunden
                        .build();
                user.data().add(node);```
Can someone tell me why its not working? Am i using the wrong node?
wild whale
#

"not working" in what way?

sour yew
#

The group isnt beeing assigned to that user

wild whale
#

Are you saving the user after making the modification?

sour yew
#

luckPerms.getUserManager().saveUser(user);
That should do that right?

#

ahh i fixed that

#

i dont know how but yeah

exotic swallow
#

Could someone tell me what I'm doing wrong?

This is my code

            Bukkit.broadcastMessage("" + playerNextRank);
            Bukkit.broadcastMessage("" + user);

            if (luckPermsApi.getGroupManager().getGroup(playerCurrentRank).getWeight().getAsInt() > luckPermsApi.getGroupManager().getGroup(playerNextRank).getWeight().getAsInt()) {

                user.setPrimaryGroup(playerNextRank.toLowerCase());
                Bukkit.broadcastMessage("§c" + player.getName() + " §fdegraduje: §f" + currentIcon + "  §c▶ " + nextIcon);
                Bukkit.broadcastMessage("" + user.getPrimaryGroup());
                break;

            }

            Bukkit.broadcastMessage("§a" + player.getName() + " §fawansuje: §f" + currentIcon + "  §a▶ " + nextIcon);
            user.setPrimaryGroup(playerNextRank.toLowerCase());
            TotemAnimations.playTotemAnimation(player, rank.getModel());
            Bukkit.broadcastMessage("" + user.getPrimaryGroup());
            break;```

getPrimaryGroup returns wood, playerNextRank returns iron, Broadcasts show as intended and... last getPrimaryGroup returns wood
#

I added LuckPerms as depend, everything should work fine

#

my ranks

exotic swallow
#

even this doesnt work at all

#

im losing my mind

#

😵‍💫

main dagger
# exotic swallow Could someone tell me what I'm doing wrong? This is my code ``` Bukk...

with the default config, setting the primary group in code does nothing as it is calculated at runtime. the "primary" group only really exists so that plugins like vault that expect the player to only have 1 group can still work, however you should assume the player could have multiple groups. setting the primary group does not add the player to that group if they were not already in it

#

!cookbook

frank driftBOT
main dagger
#

there are some examples of how to get and change groups in there

teal kelp
# exotic swallow even this doesnt work at all

Thas how I do that and It works

private LuckPerms luckPerms;


luckPerms = Lobbysystem.getInstance().getLuckPerms();
PlayerAdapter<Player> playerAdapter = luckPerms.getPlayerAdapter(Player.class);
        User user = playerAdapter.getUser(player);

if (user != null){
            Collection<Group> groups = user.getInheritedGroups(playerAdapter.getQueryOptions(player));

            if (groups.size() == 1 && groups.stream().anyMatch(group -> group.getName().equalsIgnoreCase("default"))) {
                user.data().add(net.luckperms.api.node.Node.builder("group.spieler").build());

                luckPerms.getUserManager().saveUser(user);
            }
        }
exotic swallow
#

Thank you both

#

🫶

teal kelp
true hawk
#

Hi, is it intentional that resolveInheritedNodes get affected by just including other groups higher? For example I have permission from one of my mods with distance context and have have 3 groups:

  1. distance = 100 weight.1
  2. distance = 200 weight.2
  3. group.1 weight.3
    Is it intentional when I apply all 3 groups I get distance 100 instead of distance 200? If I remove group.1 from third group everything will be okay
#

This issue don't happens when you use fabric-permission-api, only with luckperms api, but fabric's api don't have contexts

main dagger
exotic swallow
#

Im trying to remove all other groups from player when giving new one, could someone help me?

#

What should I put in getData if node is wrong

true hawk
buoyant basin
#

were can I find the luckperms placeholder API for fabric 1.20.1??

#

this is kinda urgent

main dagger
#

wrong channel, but compile from source

buoyant basin
#

wdym with compile from source

main dagger
#

clone the repo, checkout the older version, and compile the project

buoyant basin
#

where can I find the repo

#

can you guys just help me out, am not that big of a programmer

main dagger
#

still wrong channel

random plank
#

Does luckperms have any API to get a user's uuid from the player's name?

waxen zephyr
random plank
#

and bukkit#getofflineplayer do a mojang request

wild whale
#

(The exact same behavior as /lp user commands - that's the primary purpose of that cache)

random plank
#

And there are no name collisions?

daring spire
#

With lpapi how do i define a cererten permission nodes go to certen servers

main dagger
daring spire
#

I make my groups and populate perms like greif defender but i have multiple servers how do i define what server that the perms work on

#

Found it

main dagger
daring spire
#

Group

#

Yea

main dagger
# daring spire Yea

then you need to put a context on the node. theres an example of that in the screenshot you sent

daring spire
#

I seen it thank you

olive axle
#

Hi, good morning or evening or whatever. I am trying to use the luckperms api in my plugin for the first time. This is what I got (See screenshots). No errors nor warnings while compiling. But when I try to use the LuckPerms API in my code (I use a precise comand), this is the error I get:

#

Sorry, i forgot to link the error

night pier
#

!paste

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!

olive axle
#

Password is LuckPerms Support

night pier
#

Okay so there 1 thing you need to do when using the provided scope

#

Provide the LuckPerms jar to your server

olive axle
#

That might be smart, indeed

#

Lol

#

If I defined some roles see some things, do i need to add my roles to my lp while testing ?

night pier
#

You should also depend in your plugin config so you know it’s missing instead of erroring

olive axle
#

How do I do that, sorry I'm quite new to plugin development

night pier
#

I’m in Pittsburgh traffic right now so I can’t help with that. Google depending on plugins in spigot plugin

olive axle
#

Alright, thanks!

tacit bloom
#

Hi. I need help, please

#

Any staff that can help me with a problem?

slow swift
#

How would I go about checking if a fabric player has a permission, I'm not seeing anything other than the permission level which wont work for this

night pier
#

the fabric permission api should have a way to check it.

slow swift
#

Perfect, grabbing that now lol

slow swift
#

I am having an issue with getting the API to work with my mod.

No matter what I try, every time I try to make a call to get the instance of LuckPerms it throws an error about it not being loaded yet.

But I also am not seeing anything in console about LP loading or any error relating to it.

I tried to add LP directly into my run folder for my IDE but it still isn't being loaded properly

main dagger
slow swift
#

It's not.
I added it to the run folder and then ran the client from intelij.

My mod loads up fine, but I don't see anything about luckperms, despite it being in the mods folder.

The first time that luckperms is mentioned is after I try to get the instance of LP

main dagger
#

unzip your mod and double check

slow swift
#

I don't have it set up to shade anything, but I built the mod anyways to check, and it's not inside of the jar.

If it was though, wouldn't it load or cause issues with the other LuckPerms that I had in the folder?

And just to make sure, I am trying to run it in my IDE in order to debug things, so the mod isn't built when I am running the client

fast delta
#

luckperms fabric isn't really meant to run outside of a "real" fabric server; the jar and mixins are compiled using intermediary mappings

main dagger
#

oh i didnt even realize it was a client lol

#

yeah it doesnt work on clients, only dedicated servers

radiant harness
#

Is there a significant speed difference between just using bukkit's player.hasPermission() when using LP as the permission provider and directly hooking into LP for permission checks?

waxen zephyr
#

no need to go all way to LP

#

to just check permissions

radiant harness
night pier
#

it’s not going to hurt to hook into LP for perm checks, but it’s definitely not necessary. Lots of plugins use bukkits method and it’s fine

main dagger
#

itll be like a handful of cpu cycles because extra calls, but also it wont work if a different perm plugin is installed

hexed eagle
#

[Guice/MissingImplementation]: No implementation for LuckPerms was bound. How to fix that?

main dagger
hexed eagle
main dagger
#

idk, i just know that its not coming from luckperms

agile silo
#

how can i delete player's suffix?

glossy mesa
#

Hi

#

Pls help

#

How fix

#

@everyone

#

@upbeat tusk

frank driftBOT
#

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

glossy mesa
#

Why not helping helpppp

#

How fix