#luckperms-api

1 messages · Page 8 of 1

opal chasm
#

is there a way to force-recalculate a custom context for a player?

fast delta
#

you can manually call ContextManager#signalContextUpdate(player), but contexts are invalidated 50ms after they are calculated, so they should be pretty much updated every tick they are needed

opal chasm
#

thank you!

#

in my case, the default group inherits another group if my context is true. I have a WorldGuard region which has the "another" group added as a member, and disallows its members from exiting it - i.e. if a player is in the group, they are not allowed to leave the region.

when my code that causes the context to be true is run, WG is not realising the group change, so I reset its cache. this normally works to make WG realise group changes immediately, but it didn't in this case, so my suspicion is that the group inheritance was not being applied as soon as the context became true.

calling ContextManager#signalContextUpdate(player), and then resetting WG's cache, seems to have fixed the problem, but I'm not sure if this is the best way of doing it

wheat veldt
#

can you iterate through group members and make permission changes async?

main dagger
#

most changes occur off the main thread

tranquil cave
#

I made a method that returns the current rank on a given server, is there a simpler way?

return user.getNodes(NodeType.INHERITANCE).stream()
    .filter(node -> node.getContexts().getAnyValue(DefaultContextKeys.SERVER_KEY)
        .map(value -> value.equals(server)).orElse(false))
    .map(InheritanceNode::getGroupName)
    .map(luckPermsHook::getGroup)
    .filter(Objects::nonNull)
    .sorted(Comparator.comparingInt(group -> group.getWeight().orElse(0)))
    .map(Group::getFriendlyName)
    .findFirst()
    .orElse(user.getPrimaryGroup());
fast delta
#

uhhh

#

user.getCachedData().getMetaData(QueryOptions.contextual(ImmutableContextSet.of("server", "lobby"))).getPrimaryGroup() 😃

tranquil cave
#

U

#

Thanks :-:

#

How get expiration time for primary group? (If possible)?

main dagger
#

the primary group isnt always temporary

#

but you get the expiry date of temp nodes

tranquil cave
#

So the best thing to do would be to get all the nodes from a given server, compare to the primary group and see if it's expired?

main dagger
#

you wont get an expired node

#

once lp realizes its expired, its removed

tranquil cave
#

I meant a node that has time to expire

#

my fail*

main dagger
#

depending on the setup, a user may have a temp parent that isnt their primary group

#

its also possible they dont directly inherit their primary group

#

what exactly are you trying to do?

tranquil cave
#

On the hub server, I retrieve what primary group someone has on the survival server and possibly how long it lasts (for example, if someone has a VIP rank they have it for a certain amount of time)

zenith snow
#

Hey, Gemini gives some old/wrong info about this, so how can i unset a permission from a user? Ive used this (untested) for adding perms until yet:


public void addPermission(UUID playerUUID, String permissionString) {
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

        if (provider != null) {
            LuckPerms api = provider.getProvider();

            if(Bukkit.getPlayer(playerUUID) != null && Bukkit.getPlayer(playerUUID).isOnline()) {
                User user = api.getUserManager().getUser(playerUUID);

                user.data().add(PermissionNode.builder(permissionString).build());
                api.getUserManager().saveUser(user);

            } else {
                api.getUserManager().loadUser(playerUUID).thenAccept(user -> {
                    if (user != null) {
                        user.data().add(PermissionNode.builder(permissionString).build());
                        api.getUserManager().saveUser(user);
                    }
                });
            }

        }
    }```
main dagger
#

!cookbook

frank driftBOT
main dagger
#

theres probably something about removing nodes there

zenith snow
thorn coyote
#

help me pls
is not a valid username/uuid

left geyser
frail quiver
#

Hey, I have a question, how do I check whether a user has had a rank taken away and if so, which one? The same with adding who was added and to whom.

main dagger
#

listen to the events

#

!cookbook has examples

frank driftBOT
haughty hare
#

I have a Forge related question (Running 1.18.2 but I'm guessing it will be the same for NeoForge)
At what point it's safe to initialize API? Is it safe to add api as compileOnly? I don't want to break runServer task, because I'm guessing adding a compileOnly won't add forge distribution of LP to the runServer configuration

frail quiver
main dagger
#

youd have to share code then

frail quiver
#
public class RankSyncListener {
    private final LuckPerms luckPerms;

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

    public void register() {
        EventBus eventBus = this.luckPerms.getEventBus();
        eventBus.subscribe(VelocitySystem.getInstance(), NodeRemoveEvent.class, this::onNodeRemove);
    }

    private void onNodeRemove(NodeRemoveEvent e) {
        // Check if the event was acting on a User
        if (!e.isUser()) {
            return;
        }

        // Check if the node was an inheritance node
        Node node = e.getNode();
        if (node.getType() != NodeType.INHERITANCE) {
            return;
        }

        // Cast the node to InheritanceNode, and the target to User.
        InheritanceNode inheritanceNode = ((InheritanceNode) node);
        User user = (User) e.getTarget();

        String groupName = inheritanceNode.getGroupName();
        for (Player player : VelocitySystem.getInstance().getServer().getAllPlayers()) {
            player.sendMessage(Component.text(user.getUsername() + " removed from the " + groupName + " group!"));
        }
    }


}
#

And

#
@Subscribe
    public void onProxyInitialize(ProxyInitializeEvent event) {
        MessageLoader messageLoader = MessageLoader.getInstance();
        server.getChannelRegistrar().register(CHANNEL);
        MySQL mySQL = new MySQL();
        Connection connection = mySQL.getConnection();

        setupDiscordBot();

        instance = this;
        server.getEventManager().register(this, new Listeners(server, logger));
        this.luckPerms = LuckPermsProvider.get();

        // Kommandos registrieren
        registerCommands();

        if (connection != null) {
            logger.info("Datenbankverbindung erfolgreich hergestellt.");
            mySQL.checkAndCreateTables();
        } else {
            logger.error("Es konnte keine Verbindung zur Datenbank hergestellt werden. Bitte überprüfe deine Datenbank einträge.");
        }

        logger.info("Das VelocitySystem wurde erfolgreich geladen.");
        new RankSyncListener(this.luckPerms).register();
    }
main dagger
#

is the permission being removed on velocity or the backend

#

because if its removed on the backend, the even will only be emitted on that backend server

frail quiver
#

So... can I do this somehow so that I can continue to use it on the subserver

opaque lion
#

How to get metadata without CachedData ?

shy jackal
#

How can I remove an expiry permission from a player?
user.data().remove(permissionNode) don't working. I think it's because the expiration time is changing.

shy jackal
celest acorn
#

is there some luckperms library that I can shade into my standalone application?

#

from what I can see in the github repo, it seems that the standalone module is the closest I can get, but still not quite what I need

main dagger
#

xy. what are you trying to do

shy jackal
#

How can I do permission node tab complete hints like in luckperms commands?

terse sand
#

Player possiblePeer = Bukkit.getPlayer(event.getPeer().getActor().getUniqueId()); how can i check if permission have changed,i think i need the UserDataRecalculateEvent. but how can i use it in an event?

upbeat tusk
terse sand
#

becouse that if statement doesnt work i need to check if permission changed

#

with the uuid provided from the openaudio event

terse sand
#

later

terse sand
#

it should listen when voicechat.talk gets removed

fast delta
#

i'm not exactly sure what you're really asking about

#

do you want to do something when a permission is revoked?

#

UserDataRecalculate should be fine for that, just check for the user's permission there to see if for the updated data they have the permission

terse sand
#

i need something like this: if (event.getPeer().getActor().getUniqueId()== UserDataRecalculateEvent )

#

so i need to use an event in an event

wild whale
#

you can't do something when 2 different events fire "at the same time", since they will never fire at the same time.
XY problem, what is it you're actually trying to accomplish?

terse sand
# wild whale you can't do something when 2 different events fire "at the same time", since th...

i want an channel talk permission: voicechat.talk, so that players can only talk with the permission, unfortunately it only works if player gets in the channel, it cant hear if player gets the talkpower removed, so i have to make an luckperms event listener inside the ClientPeerAdd (only when client peer gets added, not when its should get removed, Event so i can kick him, to retrigger the ClientPeerAdd event from open audio

wild whale
#

Why can't you just trigger the disconnection from the LP event listener?

terse sand
#

i think i need the uuids event.getPeer()
event.getClient().

#

client should get disconected from peer whos permission got removed

#

event.getClient().kickProximityPeer(event.getClient()); // Call kick method

#

but it could be that it automaticly detects

#

i could try

#

it should be that it automaticaly detects the other client

terse sand
#

thank yall, it did work

celest acorn
# main dagger xy. what are you trying to do

a pretty late reply, but...
I'm building an API server for the server's website and we want to rely on LuckPerms API for permissions and groups instead of reinventing the wheel

main dagger
#

well, you are reinventing the wheel

#

standalone lp is designed for running the rest api extension

upbeat tusk
#

Loop through all registered permissions, add them to a list and return the list

wild whale
#

It's worth noting that will not get everything. Only maybe half the plugins actually register their permissions properly, and a ton have "dynamic" permissions (i.e. derrived from stuff in your config) which typically aren't registered either.

LP builds it's list by saving all permissions that have been checked since the last server startup.

#

(that method also has the additional benefit of being completely platform-agnostic, so we don't need to write any hooks to the platform's permission registration manager)

languid walrus
#

If I want to modify an existing permission for a player, do I just add it to the data again or how does that work?

fast delta
languid walrus
fast delta
#

"it depends"

#

on what you're altering exactly

#

if you're just changing the true/false value, it will be replaced yes

languid walrus
#

I'm changing meta data

fast delta
#

like, a meta node's value? or metadata on a node?

languid walrus
#

Not sure what the difference is, just changing a node based on rank

public enum Rank {
    GREEN,
    YELLOW,
    RED;

    public static final NodeMetadataKey<String> META_KEY = NodeMetadataKey.of("rank", String.class);
    public static final String RANK_PERMISSION = "rankupdater.rank";

    public Node getPermission() {
        return Node.builder(RANK_PERMISSION).withMetadata(META_KEY, name()).build();
    }
}
fast delta
#

right, uh

#

node metadata is not stored, it's ephemeral

languid walrus
#

Oh...

#

I thought it was kinda like pdc

fast delta
#

meta nodes are nodes that let you store arbitrary information on a group/user as a node

#

those will show up in the editor, there are meta node commands, the data is query-able, etc

fast delta
languid walrus
#

Oh as in a different type of node? How is that used?

fast delta
#

see ^

#

cc @night pier PepeLaugh

languid walrus
#

I might be misunderstanding you, but I need to use something else than the regular node right?

fast delta
#

you'd be using MetaNodes, yeah

languid walrus
#

Ah yeah I see, nice, basically like pdc it seems

fast delta
#

there are several kinds of nodes, you have every day permission nodes, inheritance nodes (that define parent groups), prefix/suffix nodes, and others

fast delta
#

it's okay, you learned

#

:patevident:

#

at least i hope so...

night pier
#

learned that was the worst way to do it, sure

languid walrus
#

So this looks right?

    public Node getPermission() {
        return MetaNode.builder("rank", name()).build();
    }
fast delta
#

yep

languid walrus
#

Yeah this seems way better, ty! :))

#

Difference between meta key and node key?

languid walrus
#

Referring to MetaNode#getKey and MetaNode#getMetaKey btw

#

ig I need to also add key in the builder

fast delta
fast delta
#

the whole node key is gonna be meta.<key>.<value>, but that isn't exactly important

shy jackal
#

How can I do permission node tab complete hints like in LuckPerms commands? Like this:

fast delta
#

lol

shy jackal
wild oxide
#

Hello everyone, how do I transfer all Fabric mod permissions to luckperms so that they are displayed as suggested in the editor?

fast delta
#

not entirely sure what you mean by "transfer all fabric mod permissions to luckperms"? but just performing a permission check will suffice, LP will add it to its known permissions set to be suggested

reef cove
#

if my luckperms is running cross-server, will User user = luckPerms.getUserManager().getUser(uuid); ran in server A return a player that is in server B?

upbeat tusk
#

No

main dagger
#

well, itll get the luckperms user with that uuid

#

that user will only have data loaded if they are on the server that ran it

#

afaik, luckperms doesnt communicate anything between multiple instances on its own beyond simple permission changes

marsh osprey
#

How do you check if a player has a permission, either in their custom permissions or of some inherited group? Is there an easy way to do that or do you have to traverse the entire inherited group tree?

main dagger
#

use the platform provided method to check permissions

#

eg on bukkit, you use Player#hasPermission(String permission)

marsh osprey
#

oh i see

#

the permissions system is not made by lp just used by it

main dagger
#

yes

marsh osprey
#

i forgor

main dagger
#

there are times where you would need to use LPs api directly, such as modifying player data or getting prefixes, but you shouldnt use the LP api for basic permission checks since that prevents people from using other permission plugins/mods with your plugin/mod

marsh osprey
#

thank you for the help!

novel prairie
#

Hello did you figure out why your players lose permissions?

main dagger
#

if you are having an issue, you should share as much information as you can in one of the support channels

#

instead of replying to a message from several months ago

wide hinge
#

Is using LP API a more wise decision than using the Forge permissions API?

pallid tusk
#

is there a way to get user's current group in a track?
I'm trying to get player's rank prefix

upbeat tusk
pallid tusk
main dagger
#

what does their position on a track have to do with their prefix?

pallid tusk
#

user's prefix is not its rank prefix and im trying to display users rank prefix

main dagger
#

xy, what are you actually trying to do

pallid tusk
#

actually

main dagger
#

why do you need to get the group prefix manually and not just the users prefix which inherits from groups

pallid tusk
#

user's actual prefix is not its rank by intentional

upbeat tusk
pallid tusk
upbeat tusk
pallid tusk
#

ranks are different from other groups which user uses for their prefix

languid walrus
#

Anyone know how lpUser.setPrimaryGroup() works? Because a user can have multiple primary groups?

wild whale
#

Primary group =/= parent group. Parent groups is every group a player inherits directly from. "primary group" is a concept other plugins use, with the default config it's calculated as the highest weighted group a user directly inherits. With the default config, that method, and it's command equivelant /lp user <who> setprimarygroup <group> do absolutely nothing.

main dagger
#

they cannot have multiple primary groups. they can have many parents. primary group is kinda an arbitrary concept and defaults to "the parent group with the highest weight", and this is calculated on demand as it could change with contexts

languid walrus
#

Ahhhh I see, so I have 3 groups, green, yellow and red. Players cannot have multiple of these as they're setup as a progression. I'd need to manually add and remove the user from groups right?

wild whale
#

Nope, users can inherit multiple groups (even if some of the groups are both contained on the same track), LP doesn't care.

#

Primary group is only used to be exposed to other plugins to request as needed, LP does absolutely nothing with primary group on it's own

#

it's a bit of a weird concept since every sane permissions plugin allows a user to have multiple groups, so it's only really used by a handful of plugins

languid walrus
#

Is it not possible to get all inherited groups for a user?

upbeat tusk
#

yeah it needs the primary group concept for Vault's getPrimaryGroup method too

frank driftBOT
upbeat tusk
languid walrus
#

So if I had a node called group.whatever it adds an inherited group to the user called whatever if the group exists?

wild whale
#

Correct

languid walrus
#

Ahhh alright, thanks guys!

upbeat tusk
#

btw I suggest you take a look at the Cookbook, it's a project with code examples on how to use the LP API

#

!cookbook

frank driftBOT
languid walrus
#

Probably a good idea yeah, thanks

#

What does lpUser.setPrimaryGroup even do then? If I only need to add a node with the group. prefix?

wild whale
#

Admins can configure the primary group calculation to "manual", where instead of calculating it automatically via weight, they need to manually specify the primary group via either commands or that API. I don't think I've ever encountered a single case where that was legitimately better than automatic calculation though.

#

But with the default config it'll do absolutely nothing

languid walrus
#

Ah alright, I'll just add the node then, thanks!

wild whale
#

Yeah, especially since setting the primary group does not add that group as a parent if it wasn't already

languid walrus
#

Yeah ran into issues because I misunderstood that part

wild whale
#

Like I said, it's a weird system, and in an ideal world I'd nuke it from orbit since it's got so little usage. but alas, we need it for vault and a few legacy plugins

languid walrus
#

Hahah yeah vault is kinda annoying sometimes but it's just used in so many plugins

orchid badge
#

does luckperms not support color codes in PAPI placeholders ?

#

i'm stuck with this rigth now and its very annoying

left geyser
orchid badge
#

uhh

#

i didnt know where to ask that

#

where should i ask

#

sorry

left geyser
orchid badge
#

me when the effect hits

#

alr thanks

fathom oak
#

How do I show the ranking next to my name in the list Tap?

shy jackal
#

How can I get list of all permissions on server from LuckPerms, not from bukkit?

fast delta
#

you can get the Platform from the LuckPerms instance

nocturne elbow
#

how does one get group of a offline player

upbeat tusk
nocturne elbow
#

ty

nocturne elbow
upbeat tusk
#

No

night pier
#

How do you not have their UUID

main dagger
#

do not store any player data by username. username changes have been a thing for almost a decade now

umbral anchor
#

If it's from a command, you could use Bukkit.getOfflinePlayer

main dagger
#

see pins

umbral anchor
#

I don't mean propagating changes via the messaging service, I mean the update task. I think I found LuckPerms#runUpdateTask though, thanks.

main dagger
#

you should never need to manually perform a sync

#

what are you trying to do?

umbral anchor
#

My case is that plugin messaging is not cutting it for an empty server and I'd like to sync the perms when checking a permission in a prelogin event. I guess I could switch to MySQL but I really do prefer Postgres.

main dagger
#

you can configure LP to use a message broker like redis

#

but are you actually having issues with permission changes not taking effect when the player joins?

umbral anchor
#

If another player is already on the server everything's fine, but plugin messaging only works over a player connection, which I don't think is fully established during AsyncPlayerPreLoginEvent.

main dagger
#

sure, it wont be able to sync before the player is at least in the configuration state, but are you actually having issues related to this?

fast delta
#

uhhh technically because the way craftbukkit does it it won't be available until a bit after they join

#

but that isn't important

novel prairie
rustic laurel
#

Do you have a plugin resetting people's permissions? Or just taking a few at a time randomly? Better to link to you posting your issue than this other guy.

versed night
#

I am trying to log when a user is promoted and I have all the details in order to log them in my database except for the promoter's uuid. Is there any way to get the user AND admin's uuids? This is my method:

private void onGroupChange(UserDataRecalculateEvent e) {
        User p = e.getUser();
        try {
            Players player = plugin.getDatabase().getPlayerByUUID(p.getUniqueId().toString());
            if (player != null) {
                String oldRank = player.getRank();
                String newRank = e.getData().getMetaData().getPrimaryGroup();

                if (!oldRank.equals(newRank)) {
                    player.setRank(newRank);
                    plugin.getDatabase().updatePlayer(player);

                    // Log the promotion
                    logPromotion(<admin uuid here>, player.getUuid(), oldRank, newRank);
                }
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }```
rustic laurel
#

Are you looking to get the source (user source) of the event?

#

The user data recalc event?

versed night
#

Nah i just need the UUID of both parties

rustic laurel
#

Because I have a hunch that is what you're looking for, but I haven't actually tried it

versed night
#

unless there would be a different way to do this

#

this is all i could find

rustic laurel
#

Events have sources and those sources can be players and you can use the api to get their uuids

#

Huge disclaimer is that it seems to be what you're looking for on the tin. But I haven't used this myself so I can't confirm from experience

versed night
#

Okay, I'll try it out. Thanks 👍

weary basin
#

hi guys, how can i get the weight of a group?

feral drum
#

by any chance:
Can i check if the player is in group with luckperms api or do i have to use permission check cause when a player has op it already has *

upbeat tusk
feral drum
#

luckperms downfall

#

anyway:
i had this

   public static Group getPrimaryGroup(Player p){
        return luckperms.getGroupManager().getGroup(luckperms.getUserManager().getUser(p.getUniqueId()).getPrimaryGroup());
    }```

and  i get error:
```java
Caused by: java.lang.NullPointerException: Cannot invoke "net.luckperms.api.LuckPerms.getGroupManager()" because "de.whoscanel.isaserver.IsaServer.luckperms" is null```
upbeat tusk
upbeat tusk
#

Yeah, you never initialized your luckperms field

honest current
#

Hi, I have a plugin that needs to know when a player's groups HAVE changed.
After that, it will check the player's current groups against its internal database and execute some operations.
However, I'm not sure of what events I should listen to.

NodeAddEvent/NodeRemoveEvent don't get fired if the change is from another server.
(also I get a race condition because I need to wait for them to be applied, and a scheduler is a dirty solution)

UserDataRecalculateEvent and PostSyncEvent sound like a bad idea: I'd execute lots of unneeded checks on my plugin.

fast delta
honest current
# fast delta idk what you mean by needing to wait in node add/remove events, the events are f...

Thanks for the response. So, this is a plugin for managing temp vips. It executes a bunch of stuff when a package is enabled or disabled (for example managing fly, homes, etc), and uses LP as a truth source on the player's active vip package.

At logins, or after a group change is detected, it compares the current player's groups to the old known "primary vip"*. This is stored in the plugin's internal database, instead of trying to listen to events, because it's more solid: if the plugin is offline I don't get a desync, and it has a way to revert the transaction if something goes wrong and don't get in an illegal state. And stuff like that.

Obviously, after the operations gets completed, the new primary vip gets updated in the plugin's database, so that future group edits will check if the primary vip is different to the new one.

*effectively, the highest group the player inherits in the "vip" track. I also considered storing it as a meta key but that didn't seem to work well, and I need to store stuff like home data anyway.

#

I was under the impression that NodeAdd/NodeRemove were fired before because they were cancellable or something, my bad... Still, they don't get fired from network syncs, so they're useless here.
The only way way I found to run the plugin's checks only on groups, is to listen to UserDataRecalculateEvent, save the permission map state (filtered by "group.") in a map keyed by user and each time its fired get a diff of the permission map. If "group." nodes have changes, then let the plugin do its thing. That looks horrible, though. I feel like there's a better way?

fast delta
#

uhh NodeAdd/RemoveEvent aren't cancellable, don't know where you saw that lol
I think the data recalculate event is fine, but the way i would do it is i would store in the vip groups some key with a unique value per vip group you can weigh and compare, like meta.vip-weight.123 (it can be the LP group's own weight but you can query it from the CachedMetaData), then store the "current" vip weight in the db and in the data recalc event compare the stored with the (potentially) updated one

honest current
#

With the track I can use the API to easily get all the steps to go from a group to another one (it does them one-for-one to compute which operations are needed), and no weight collisions are possible.

But you're right, even better, the plugin should probably assign to each group an uuid meta.vip-id.1A2B3C4D..., so that names/weights can be edited without worry. Thanks for the help!

fast delta
#

yah, I guess if your vip structure allows you to put them on a track I'd go for that and fetch the current position the player is on that track, but the meta key is more flexible despite it being slightly more setup

#

it also doesn't lock you into a linear structure a track imposes

#

actually that's not true, I wouldn't go for that even if it was the case lol

#

but it's something you can do

honest current
#

The track is actually abstraced in a class which tells me what the next step is, if I ever need a more complex structure I can write the logic there. By putting conditional relations between the groups (in a config) i can go crazy. I'll probably do that when this becomes a rank plugin. But for now I'll be happy to just put it in production, lol

mellow garnet
#

Good afternoon, I have a question:
if I give a player a group for a certain time, will NodeAddEvent be called after it ends?

cobalt hawk
#

Hey, im actually developping a plugin for my server Minecraft, my server have an BungeeCord with LuckpermsProxy installed on it and an Lobby server with spigot and Luckperms bukkit installed.

And i want to get the group of the player who join the server with the spigot.

In my IDE i have import the Spigot and Luckperms API how i supposed to do ?

frank driftBOT
cobalt hawk
# left geyser !api

I read it but i don't know to get the Group Prefix of the user with spigotAPI 'cause the group is made with the LuckPerms in the BungeeCord

#

sorry for my english im french

cobalt hawk
# left geyser !api

In fact I have a BungeeCord server with LuckPermsBungee installed then I have a Lobby server with LuckPermsBukkit installed, now put Grade are stored with LuckpermsBungee, I code my plugin with the Spigot API therefore for my Lobby Server and I wish to recover the Player grades with the Luckperms API but what do I do knowing that the grades are stored in the bungee?

left geyser
#

Iirc, the cookbook plugin provides an example class for getting player prefixes. You can have a look below:

frank driftBOT
cobalt hawk
left geyser
cobalt hawk
cobalt hawk
#

But if everythings is correct if i create a group with the /lpb command is the group was also created in the /lp command ?

left geyser
cobalt hawk
#

but how did i sync the instance in LP ?

left geyser
frank driftBOT
left geyser
mellow garnet
#

Thank you!

fast delta
#

it's also called when a node is added fwiw

#

there's NodeRemove as well

#

and NodeClear might be relevant

cobalt hawk
#

So if on the config off every Luckperms i link an Database all the group from the bungee will also be on the Bukkit one ?

lavish path
#

Hey guys! I want to save the discord id regarding to a group in the groups meta with /lpv group admin meta set discordid <id>

got this code for that, but the optional is empty. with /lpv group admin meta info it shows the right info:


        if (user == null) {
            System.out.println("User not found");
        } else {
            System.out.println("User found: " + user.getUniqueId());
            System.out.println("Meta nodes:");

            user.getNodes(NodeType.META).forEach(n -> {
                System.out.println("Node: " + n);
                System.out.println("Contexts: " + n.getContexts());
            });

            Optional<Long> optionalMetadataValue = user.getNodes(NodeType.META).stream()
                .filter(Node::hasExpiry)
                .peek(n -> System.out.println("Node with expiry: " + n))
                .filter(n -> {
                    boolean hasKey = n.getContexts().containsKey("discordid");
                    System.out.println("Has discordid key: " + hasKey);
                    return hasKey;
                })
                .map(n -> {
                    String value = n.getContexts().getAnyValue("discordid").orElse("0");
                    System.out.println("discordid value: " + value);
                    return Long.parseLong(value);
                })
                .findFirst();

            System.out.println("optionalMetadataValue: " + optionalMetadataValue);```
fast delta
#

the node exists in the group, not the user, you get the value for that meta key from the metadata cache ^

cobalt hawk
#

!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

cobalt hawk
#

!errors

frank driftBOT
cobalt hawk
#

!parseit

frank driftBOT
#

Sorry! I do not understand the command parseit Did you mean pasteit?
Type !help for a list of commands

cobalt hawk
#

!pasteit

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!

cobalt hawk
frank driftBOT
fast delta
#

this is not a bot commands channel

cobalt hawk
#

for the mysql link i change in the line "adress" i put the url of my VPS but it still don't work

left geyser
normal hedge
#

Is this the correct way to check if they got the node?

fast delta
#

why not just do player.hasPermission ?

normal hedge
#

It returns true if the player is opped.

fast delta
#

i'm assuming this is on bukkit? that's only bukkit behaviour really, you can change that in the LP config or you can use player.hasPermission(Permission) with PermissionDefault.FALSE as defaultvalue; but uh yeah if you wanna stick to the lp api you can do that lol

normal hedge
#

final boolean res0 = player.hasPermission(new Permission(permission, PermissionDefault.FALSE));

Like that you're saying? This will return false if the player is opped and does not have the permission?

fast delta
#

yeah that should do it

normal hedge
#

Okay thanks.

scenic shore
#

hi

#

why is the user not assigned a group when executing the /hire command? you can understand from the tab that I set a prefix for it

#
public static void addGroup(Player player, Group group){
        api.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
            Node node = InheritanceNode.builder(group).build();
            user.data().add(node);
        });
    }
#

this is the addGroup() method

vestal violet
#

modifyUser returns CompletableFeture<Void>, try await operation

limpid hare
#

how can i use luckperms events in Skript? it gives me this error

#

i imported net.luckperms.api.event.node.NodeMutateEvent with skript-reflect

fast delta
#

i don't know about skript, but luckperms has its own EventBus system

frank driftBOT
left geyser
#

This isn't a bot commands channel.

lean minnow
#

Is there a simple way to get %luckperms expired_time% via api or placeholderAPi?

upbeat tusk
#

PlaceholderAPI placeholders:

#

and as for the API, there is Node#getExpiryDuration

lean minnow
#

Ty

slender marsh
#

Would there be any issues with frequently switching around 5-10 nodes from players? Pretty much temporarily taking them away and storing them elsewhere. Or is there any way to just deactivate them?

fast delta
#

why so frequently? based on what are you wanting to do that?
but, what do you mean exactly by "switching", "taking away" or "deactivate"?

left geyser
#

Are you sure you're using the right channel? This seems like a #support-1 / #support-2 type of question.

slender marsh
# fast delta why so frequently? based on what are you wanting to do that? but, what do you me...

Essentially players are able to unlock specific permissions that I use luckperms for. I want to interface with it by taking away some groups when the user is in a specific state to keep everything balanced. To do this, I want to deactivate ||which would be the right word, mb|| the group, whether this be something that is doable in luckperms or perhaps simply taking several groups away, storing it somewhere, and then giving it back when the user is outside of the state

#

Perhaps I'm looking at it all wrong? Unsure.

fast delta
# slender marsh Essentially players are able to unlock specific permissions that I use luckperms...

i was tryna see if you could use custom contexts for this, e.g. you give the player the node with a context (e.g. some_custom_state=state_value) and then have a context calculator where you provide the state value for the current subject, then the node will basically apply/unapply "automatically" depending on whether the context of the node is satisfied by the player's current context
https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/context/ContextCalculator.html
in case you need to trigger a context update when the state changes and you wanna recalculate it https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/context/ContextManager.html#signalContextUpdate(java.lang.Object)

remote swallow
#

Hey, someone know why its not working ?

#

im using redis and a proxy

dense marsh
#

How can you give/remove permissions with the api?

upbeat tusk
remote swallow
#

why it only save when i logout?

upbeat tusk
#

It looks fine to me, except that you should make the group variable and send the message outside of the consumer code block

spice wind
#

How do i set the players Suffix?

main dagger
fast delta
#

are you using paper's new command api?

lime pulsar
#

nvm figured it out

fast delta
lime pulsar
#

forgot to add null check, so if it is null its a public command

fast delta
#

ah

pulsar meteor
#

Hi sorry I'm losing my 💩

#

I've been trying for hours to change a group displayname (not actual name) and the docs aren't completely helping

main dagger
#

why does your plugin need to change the displayname instead of letting the user decide what it is?

pulsar meteor
fast delta
#

add a DisplayNameNode to the group's node map

pulsar meteor
#

The node builder value asks for a boolean

#

The value of "displayname" should be a string

#

Pretty sure there's a fat oversight but I'm barely functioning rn

fast delta
#

you can just do DisplayNameNode.builder("funny display name").build()

pulsar meteor
#

Why does it have a separate Class 😭

main dagger
#

because its a special type of node

fast delta
#

all node types have a separate class

#

that is explained in the wiki lol

pulsar meteor
#

Oh so "Node" is a parent class

#

That..... Explains much, Thank you.

pulsar meteor
#

If I add a displaynamenode does it override the older one or do I have to dispose it?

pulsar meteor
upbeat tusk
pulsar meteor
upbeat tusk
#

there's a clear method

fast delta
#

clear(NodeType.DISPLAY_NAME::matches) or smth

fast delta
upbeat tusk
#

I forgot what data returns

fast delta
#

a nodemap

upbeat tusk
#

yeah right it's NodeMap#clear

pulsar meteor
#
public static void setGroupDisplayName(Group group, String name) {
        group.data().clear(NodeType.DISPLAY_NAME::matches);
        DisplayNameNode displayNameNode = DisplayNameNode.builder(name).build();
        group.data().add(displayNameNode);
        LuckPermsProvider.get().getGroupManager().saveGroup(group);
    }
#

now we pray

fast delta
#

yep

pulsar meteor
#

Help i have 2 cursors in IntelliJ 😭

#

Problemo Fixedo

main dagger
#

what is "Luckyperms"

pulsar meteor
boreal eagle
#

Hey, how can I check if a player has a group that is lifetime with the API?

upbeat tusk
solar cedar
#

Why dose that error occur?

dependencies {
    compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
    compileOnly("net.luckperms:api:5.4")
}

    LuckPerms luckperms = LuckPermsProvider.get();
[15:57:43 ERROR]: Error occurred while enabling LobbySystem v1.0 (Is it up to date?)
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
    at lobbysystem-1.0.0-all.jar/net.limeprog.server.lobbysystem.utils.Luckperms.<init>(Luckperms.java:11) ~[lobbysystem-1.0.0-all.jar:?]
    at lobbysystem-1.0.0-all.jar/net.limeprog.server.lobbysystem.LobbySystem.onEnable(LobbySystem.java:19) ~[lobbysystem-1.0.0-all.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:287) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:519) ~[paper-api-1.20.6-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:604) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:553) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:675) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:323) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
#
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1136) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.luckperms.api.LuckPermsProvider
    at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:146) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader.loadClass(PaperPluginClassLoader.java:107) ~[paper-1.20.6.jar:1.20.6-115-9d6f2cc]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
    ... 14 more
main dagger
#

do you have luckperms installed?

solar cedar
fast delta
#

did you add LuckPerms as a dependency in your plugin.yml/paper-plugin.yml?

solar cedar
fast delta
solar cedar
fast delta
#

that is not how you declare a dependency in paper-plugin.yml

zenith compass
#

Lost formatting because first try was caught on the automod, I guess for a masked link?

Regarding fabric-permissions-api-v0, which I assume is okay to cover in the LuckPerms server. Can write a more formal issue up later but just wanted to make sure

Is it intended that Fabric API is a transitive dependency in 0.3.1? I'm not sure if this was the behavior of 0.2-SNAPSHOT. The main annoyance is that the 0.97.0+1.20.4 Fabric API dependency will override an older Fabric API dependency such as one in a mod targeting an old Minecraft version, but as far as I'm aware, fabric-permissions-api-v0 is meant to support a wide range of versions. I'm sure I can just exclude it if transitiveness intended

main dagger
#

masked links are mostly used for scams

urban jacinth
#

can i use the luckperms api in my own app somehow?

paper salmon
#

help me

#

please

#

luckperms does not connect to the database as to the device? I set everything correctly

left geyser
paper salmon
#

okey?

oblique valve
#

Hello

#

How to use luckperms

wild whale
#

!usage

frank driftBOT
wild whale
oblique valve
#

Hello

#

All players

frank driftBOT
#

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

upbeat tusk
#

reload maven

pine oasis
#

try adding the repo to maven

celest acorn
#

Is there any way to make a group that a player can have depending on the value returned by some plugin whenever a permission check is needed?

#

(XY: allow using a certain command when streaming)

#

the problem is that there is a possibility of a server crash, power outage, etc. and a 'manually' added group may be retained for the player

fast delta
#

do you care about the player retaining the group if they log out?

celest acorn
#

In other words, the state of a node, say group.streaming (is that how groups are added to players?) should always be provided by my plugin, regardless of whether the player is online or not

#

found that there are temporary permissions that I can use by setting group.streaming to true for 5 seconds every 3 seconds or something, but it seems more like a workaround than the proper solution

remote swallow
#

hey you know why this not update ?

#

i have to deco reco

edgy wedge
#

hi i got a question those imports are not working ?

import me.lucko.luckperms.LuckPerms;
import me.lucko.luckperms.api.Group;
import me.lucko.luckperms.api.User;

#

i want to import and use classes like LuckPerms, Group, and User

#

i am using luckperms api

wild whale
#

!javadoc

frank driftBOT
stone root
#

hi

#

api.getUserManager().getUser(player.getUniqueId()).getCachedData().getPermissionData().checkPermission(permission).asBoolean()

this function why alltime return true ?

#

can help anybody me ?

main dagger
#

is the user op?

#

also you can just use your platforms api for checking permissions

#

eg player.hasPermission(string) on bukkit

stone root
#

Yes 🙂

#

sorry that ...

#

How did I forget...

sly glacier
#

Hi, I am writing a plugin where I need to check what group a player is apart of. I am able to get this information directly from Vault?

main dagger
#

a player can inherit several groups

sly glacier
delicate thistle
#

Does anybody know how to add LuckPerms as a dependency to a Forge mod?
This is the error I get when running the mod:

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:59)
turbid solar
#

wrong version

#

1.20.6

delicate thistle
#

and i tried with 1.20.6 too

#

basically I'm making a mod that's compatible with luckperms forge, but I don't know how to get it into runtime

turbid solar
#

the current forge version is for mc 1.20.6

delicate thistle
#

I put it in my run's mod folder too

#
Caused by: java.lang.NoSuchMethodError: 'com.mojang.brigadier.builder.LiteralArgumentBuilder net.minecraft.commands.Commands.m_82127_(java.lang.String)'```
#

.-.

delicate thistle
#

5.4.131

main dagger
#

on forge, you need to use an older version of LP on older minecraft versions

delicate thistle
#

i mean there is documentation for installing the API but it's not very clear for forge

#

implementation fg.deobf("net.luckperms:api:5.4")

#

this is what i am doing

main dagger
#

idk build tools, but make sure its not including luckperms inside your jar

delicate thistle
#

uhh

#

i dont think it is..?

main dagger
#

check the jar

turbid solar
#

it shouldn’t be implementation

delicate thistle
delicate thistle
turbid solar
#

compileOnly likely

delicate thistle
#

that

turbid solar
delicate thistle
#

won't do anything

delicate thistle
#

why would it

turbid solar
#

check it luckperns is there

#

also there should t be a need to de obfuscate it

delicate thistle
#

its not there

turbid solar
#

pan asked if it was in the jar

#

so it was relevant, as it’s not

delicate thistle
delicate thistle
#

I can't figure it out..

delicate thistle
#

The support for forge is terrible, is there no work around apart from making an independent production server and then testing it there? That's awful, how do you expect people to make mods like that?

fast delta
#

wat

#

is having a test server all that difficult?

#

not sure what else you mean, how else are you gonna test it?

#

on your gradle project, for LuckPerms you just depend on the api because that's all you should use

#

then have the mod run on the server

delicate thistle
#

rather than simply using the runServer task forge provides

fast delta
#

could you not just put the LP mod in whichever server directory that task creates..?

delicate thistle
#

perhaps.. but why is forge support so.. well.. bad? This isn't how it is usually done..

fast delta
#

because luckperms api is entirely platform agnostic, so there is a single api that has to be shared across all platforms

#

then the respective mod/plugin for a given platform implements the api

delicate thistle
#

So I'm going to have to create this kind of setup where the jar file is built in the mod folder of a separate test server folder? I mean, there has to be a workaround for this?? Then how do other people do it

fast delta
#

wat

#

no you don't?

#

does the runServer task not create a server directory where the server runs?

delicate thistle
#

well thats the problem

fast delta
#

i guess a non-reobf jar can be provided for that

delicate thistle
#

i searched probably the only mods that have compatibility with luckperms and barely found anything

fast delta
#

there was a big one, uh, I don't remember the name but it was from bloodshot

quick raven
#

If I were to make a prefix selector/unlocker

#

How would I reference and save group data?

slow orbit
#

Would anyone be able to answer why the placeholder api isn't working on Fabric 1.20.1? Tried everything to no avail

main dagger
#

PlaceholderAPI is a bukkit plugin

slow orbit
#
main dagger
#

also this is the wrong channel

slow orbit
#

I understand, I had just been having issues getting help for this specific problem there

delicate thistle
#

Eitherway, through the api, it's possible to create groups and assign them to players, right?

main dagger
#

!api

frank driftBOT
delicate thistle
#

..

delicate thistle
#

how do you add player to a group

upbeat tusk
#

add an InheritanceNode to them

spring saddle
upbeat tusk
delicate thistle
#

no im talking about api bro

#

lmao

delicate thistle
delicate thistle
#

Hey, was wondering if there's anything wrong with my method. Never used luckperms api before, basically trying to assign players the groups of empire, kingdom and the motherland

    public static void doLuckpermsStuff(String s) {
        LuckPerms luckPerms;
        try {
            luckPerms = LuckPermsProvider.get();
        } catch (IllegalStateException e) {
            return;
        }
        if (s.contains("emp")) {
            Group g = luckPerms.getGroupManager().getGroup("empire");
            luckPerms.getUserManager().modifyUser(Minecraft.getInstance().player.getUUID(), (User user) -> {

                user.data().clear(NodeType.INHERITANCE::matches);

                Node node = InheritanceNode.builder(g).build();

                user.data().add(node);
            });


        } else if (s.contains("king")) {
            Group g = luckPerms.getGroupManager().getGroup("kingdom");
            luckPerms.getUserManager().modifyUser(Minecraft.getInstance().player.getUUID(), (User user) -> {

                user.data().clear(NodeType.INHERITANCE::matches);

                Node node = InheritanceNode.builder(g).build();

                user.data().add(node);
            });
        }  else if (s.contains("mth")) {
            Group g = luckPerms.getGroupManager().getGroup("motherland");
            luckPerms.getUserManager().modifyUser(Minecraft.getInstance().player.getUUID(), (User user) -> {

                user.data().clear(NodeType.INHERITANCE::matches);

                Node node = InheritanceNode.builder(g).build();

                user.data().add(node);
            });
        }            }```
#

if this helps

delicate thistle
#

Was wondering if the code looked correct, because I never interacted with luckperm’s api

fast delta
#

is this running on the client?

#

LuckPerms is a server mod/plugin, idk about forge but on fabric it will only be loaded on a server, not the client

delicate thistle
fast delta
#

Minecraft.getInstance().player smells a lot like client code

delicate thistle
#

heck ya, im stupid

#

thank you so much, Emily, for pointing that out, sorry for being stupid, it works 👍🏽

delicate thistle
#

hey! what event should I use when a player gets assigned a group? is it NodeAddEvent?

upbeat tusk
#

yes, you can check if the node is a group

delicate thistle
upbeat tusk
#

It's not always a player. That event is also called when a node is added to a group. Eitherway, the method is NodeMutateEvent#getTarget and you can check if it's instanceof User

delicate thistle
upbeat tusk
delicate thistle
#

makes sense

delicate thistle
# upbeat tusk You can't cast User to Player. Instead, you can try retrieving it using the User...

I mean, it's kind of hard to do that too

    public static void addCultureGroup(NodeAddEvent event) {
        if (event.isGroup() && event.getTarget() instanceof User user) {
            if (event.getNode().getKey().contains("empire")) {
                //MinecraftServer server
                //server.getPlayerList().getPlayer(user.getUniqueId());
            } else if (event.getNode().getKey().contains("kingdom")) {
            } else if (event.getNode().getKey().contains("motherland")) {
            }

        }

    }```
upbeat tusk
#

Why wouldn't that work?

delicate thistle
upbeat tusk
#

That's for you to figure out. I don't use Forge

delicate thistle
#

any idea how to do something like that in forge?

upbeat tusk
#

Also where did you get a message nearly 2 months old from ._.

delicate thistle
#

discord has a search feature :>

#

it sucks that luckperms is primarily Bukkit/Spigot focused but its not that their API is bad or anything

upbeat tusk
#

It's not, you literally can use the API in any platform

delicate thistle
#

yeah

delicate thistle
#

the event does fire

coarse bluff
#

How can I use User#getInheritedGroups to only get groups with no expire time on the user? Only permanent groups, not temporary. Or should User#getNodes be used and then getGroup(group name)?

delicate thistle
#

or do i have to do this
if (e.isGroup() && e.getNode().getType() == NodeType.INHERITANCE)

upbeat tusk
upbeat tusk
delicate thistle
#

I was wondering if the condition I used is wrong

#

I mean it looks right

upbeat tusk
#

Do note that it's way easier to use User#getNodes with NodeType.INHERITANCE but if you persist on using User#getInheritedGroups ^^

delicate thistle
#

So basically when the group is added to a player, it does something to the player. The condition seems right?

#

Then I have no clue why it’s not working

upbeat tusk
#

actually wait it is

coarse bluff
upbeat tusk
#

You're checking if the target is a Group and checking if it's a User at the same time

delicate thistle
#

hmm

#

I’ll check when I get on my laptop

upbeat tusk
#

This simply means "if the node is added to a group AND added to a user {"

#

which doesn't make sense

delicate thistle
# upbeat tusk This simply means "if the node is added to a group AND added to a user {"

yeah, forgot to mention i changed some stuff

    private void onNodeAdd(NodeAddEvent e) {
        if (!e.isUser()) {
            return;
        }
        User target = (User) e.getTarget();
        Node node = e.getNode();
        ServerPlayer player = ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayer(target.getUniqueId());

        if (player==null) {
            return;
        }
        BlockPos empSpawn = new BlockPos(Config.empSpawnX, Config.empSpawnY, Config.empSpawnZ);
        BlockPos kngSpawn = new BlockPos(Config.kngSpawnX, Config.kngSpawnY, Config.kngSpawnZ);
        BlockPos mthSpawn = new BlockPos(Config.mthSpawnX, Config.mthSpawnY, Config.mthSpawnZ);
        if (e.isGroup()) {
            if (node.getKey().contains("empire")) {
                player.setRespawnPosition(ServerLevel.OVERWORLD, empSpawn, 0.0F, false, false);
                player.sendSystemMessage(Component.literal("what the hell"));
            } else if (node.getKey().contains("kingdom")) {
                player.setRespawnPosition(ServerLevel.OVERWORLD, kngSpawn, 0.0F, false, false);
            } else if (node.getKey().contains("motherland")) {
                player.setRespawnPosition(ServerLevel.OVERWORLD, mthSpawn, 0.0F, false, false);
            }
        }

    }```
#

Doesn't this look fine?

delicate thistle
#

figured it out

hearty crater
#

where can i download lp api i cannot find it for the life of me

hearty crater
#

o i totally missed that

#

thanks !

cold turtle
#

Hi, I have to get players names from Luckperms User
User#getUsername. Unfortunately, nicknames are in lowercase. Is there any way to get them properly? (including uppercase if needed)

#

I need this especially for offline players

cold turtle
fast delta
#

no

#

you should keep your own cache or query mojang (risk hitting the rate limit)

cold turtle
#

ok thanks

proud mortar
#

Hey, I am too dumb for Collections / Maps / streams. How can I get the highest weight amount of a user?

        this.weight = user.getNodes(NodeType.PREFIX).stream()
                .filter(n -> !n.hasExpiry())
                .mapToInt(ChatMetaNode::getPriority)
                .max()
                .orElse(1);
#
package org.bendersdestiny.staffpro.staffplayer;

import lombok.Getter;
import lombok.Setter;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.NodeType;
import net.luckperms.api.node.types.ChatMetaNode;
import org.bendersdestiny.staffpro.StaffPro;
import org.bendersdestiny.staffpro.methods.GeneralMethods;
import org.bukkit.entity.Player;

import java.util.*;

public class StaffPlayer {
    private static final Map<UUID, StaffPlayer> PLAYERS = new HashMap<>();
    @Getter
    private static final Set<UUID> STAFFMODEPLAYERS = new HashSet<>();
    @Getter
    private UUID uuid;
    @Getter
    private Player player;
    @Getter
    private User user;
    @Getter
    @Setter
    private int weight;
    @Getter
    @Setter
    private boolean isStaffMode;

    public StaffPlayer(Player player) {
        this.uuid = player.getUniqueId();
        this.player = player;
        this.user = StaffPro.getInstance().getLuckPerms().getPlayerAdapter(Player.class).getUser(player);
        this.weight = user.getNodes(NodeType.PREFIX).stream()
                .filter(n -> !n.hasExpiry())
                .mapToInt(ChatMetaNode::getPriority)
                .max()
                .orElse(1);
        this.isStaffMode = false;
    }

    public void enableStaffMode() {
        isStaffMode = true;
        GeneralMethods.enterStaffMode(player);
        STAFFMODEPLAYERS.add(player.getUniqueId());
    }

    public void disableStaffMode() {
        isStaffMode    = false;
        GeneralMethods.leaveStaffMode(player);
        STAFFMODEPLAYERS.remove(player.getUniqueId());
    }

    public static StaffPlayer getPlayer(Player player) {
        if (PLAYERS.containsKey(player.getUniqueId())) {
            return PLAYERS.get(player.getUniqueId());
        }
        StaffPlayer newStaffPlayer = new StaffPlayer(player);
        PLAYERS.put(player.getUniqueId(), newStaffPlayer);
        return newStaffPlayer;
    }

    public static Map<UUID, StaffPlayer> getPlayers() {
        return PLAYERS;
    }
}```Whole class
grizzled wagon
#

How can I find out how long it will take for a player's group to end? like vips

#
        user.getNodes(NodeType.PREFIX).stream()
                .filter(Node::hasExpiry)
                .mapToInt(value -> value.getExpiryDuration().getNano());
``` is true?
lilac kettle
stuck badger
#

How can i check if a player thats offline have a specific permission?

arctic plume
#

is it possible to remove all permissions under the prefix permission? like remove prefix.*
clear the player's prefix permission

marsh falcon
#

Hello, I have a problem here. I don't know why. I use Kotlin's when judgment to judge LuckPerms, which will trigger NoClassDefFoundError. I directly use when(plugin){ is LuckPerms -> xxx}

#

Is it because I directly judge the main class of the plug-in instead of judging the plug-in name?

main dagger
#

im not very familar with kotlin, but why do you need to do that?

marsh falcon
#

Kotlin's when (plugin) is the same as Java's switch, except that Kotlin's when can do more complex Java operations. For example, Java's switch requires break to interrupt, but Kotlin does not need to write

#

I want to determine permissions. I know Vault can also do this, but I want to use the LuckPerms API to determine permissions directly, rather than having all permissions determined by Vault. So I prioritize LuckPerms, and Vault is compatible with older permission plugins.

fast delta
#

when you use when to match on classes and types, the class has to exist, so if luckperms isn't installed then it won't exist and your code will blow up

marsh falcon
#

I have checked Bukkit.getPluginManager().isPluginEnable(String name). I have read its implementation. It makes two judgments, one is not null, the other is inclusion, that is, plugins.contains(plugin). But it still reports NoClassDefFoundError. However, if I don't install Vault and use GroupManager directly, there will be no such problem.

marsh falcon
fast delta
#

could you share some code and the stack trace? where do you have this when expression?

#

but as i said, this approach won't work because the Plugin class won't implement LuckPerms interface

marsh falcon
#

fun getPlugin(): Plugin? = Bukkit.getPluginManager().let {
when {
it.isPluginEnabled("LuckPerms") -> it.getPlugin("LuckPerms")

    it.isPluginEnabled("Vault") -> it.getPlugin("Vault")

    else -> null
}

}

#

I don't know if you can read Kotlin, the specific judgment code is like this

#

fun OfflinePlayer.checkPermission(permission: String): Boolean = when (getPlugin()) {
is LuckPerms -> XXX

is Vault -> XXX

else -> XXX 

}

fast delta
#

yes, that won't work with luckperms regardless of the NoClassDefFound

#

do you have a stack trace ?

marsh falcon
#

I can tell that the LuckPerms class is missing, but I don't know why it's not skipping even though it's not there.

fast delta
#

was luckperms installed when that error happened?

marsh falcon
#

No, but the problem is very strange. I know it is because it is not installed, but I don't know why it does not skip the judgment because it does not exist, but directly feedback the exception to me.

fast delta
#

well, yeah that's the thing, kotlin's when expects the class to exist, if luckperms isn't installed, the class won't exist

#

so it will blow up

marsh falcon
#

That means I should judge String instead of judging the inherited class of Plugin? That is, judging the plugin name

fast delta
#

yes that would work
and keep in mind that you can't cast LP's Plugin to LuckPerms, you need to obtain it from the static accessor or the services manager

marsh falcon
#

So, why doesn't it throw this exception when there is no Vault, but only after I installed it? When there is no Vault, my getPlugin method returns null

#

You have also seen my code. I used static getPlugin to get LuckPerms after judging it.

fast delta
#

no vault but LP installed? or what?

#

my guess is that kotlin will skip the checks altogether if it's null

#

and will fallback to the case null if you have one, or the fallback else

marsh falcon
#

I benefited a lot from your words. I will now look at the content compiled by Kotlin. Maybe, as you said, when my getPlugin method is null, the check is skipped.

#

I tried to look at the compiled content, it seems to directly judge LuckPerms instead of null. I don't know if it's a problem with my compiler. You can copy my code and try it. I use the Gradle compilation tool. The current solution is not to directly judge the class, but to judge the name of the plugin.

#

Thank you for your guidance@fast delta

frank driftBOT
#

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

fast delta
#

glad you got it sorted out

marsh falcon
#

Thank you for your patience. I will continue to study the API of LuckPerms.

edgy wigeon
#

Hey I was debugging Listener to update players team prefix when group prefix changes, i came up with terrible code (in my opinion) and it seems like when i add this prefix the event is in some kind of infinite loop?

Pls tell me what's wroong here or what i can improve, i don't really undesrand those Node idea...

    private void onNodeAdd(NodeAddEvent e) {
        // Check if the event was acting on a Group
        if (!e.isGroup()) {
            return;
        }
        Bukkit.getLogger().severe("NodeAddEvent");

        // Check if the node was a prefix node
        Node node = e.getNode();
        if (node.getType() != NodeType.PREFIX) {
            return;
        }

        // Cast the node to PrefixNode, and the target to Group.
        PrefixNode prefixNode = ((PrefixNode) node);
        String newPrefix = prefixNode.getMetaValue();
        Group group = (Group) e.getTarget();


        LuckPermsProvider.get().getGroupManager().modifyGroup(group.getName(), g -> {
            Bukkit.getLogger().severe("Entered");
            Collection<Node> nodes = group.getNodes()
                    .stream()
                    .filter(NodeType.PREFIX::matches)
                    .collect(Collectors.toSet());
            Map<Integer,String> prefixes = group.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
            int priority = prefixes.keySet().stream().mapToInt(i -> i + 10).max().orElse(10);
            Node newPrefixNode = PrefixNode.builder(newPrefix, priority).build();
            Bukkit.getLogger().severe("Adding prefix " + newPrefix + " to " + group.getName());
            group.data().add(newPrefixNode);
            updatePlayers();
            

        });
    }
#

    private void updatePlayers() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (!player.hasPermission("smcore.vanish")) continue;
            prefixSuffixManager.updatePlayerPrefixSuffix(player, vanishManager.isVanished(player));
        }
    }
#

here is some logs from debugging

edgy wigeon
#

already figured everyting out

opaque atlas
#

does User#getPrimaryGroup just return the group of theirs with the highest weight?

ocean geyser
#

How to use the rest api?

fast delta
#

wherever you are hosting your lp rest api

ocean geyser
#

Oh, how to host it then?

#

I saw i can run it with docker

fast delta
#

check out the readme, you can use it as an extension in an existing luckperms installation or run the docker image

ocean geyser
#

what do you mean by existing luckperms installation?

fast delta
#

luckperms as a mod/plugin has an extensions system, like, plugins for luckperms

ocean geyser
#

oh, I have the plugin running on a server, so thats enough?

fast delta
#

so you can drop the extension jar in an existing LP's extensions folder and it'll use that

#

you can configure the port and configured auth keys you want etc via the env variables in the readme

ocean geyser
#

I have my rest apu set up, but when i open the server on port 8080 it says "Client sent an HTTP request to an HTTPS server." How can i fix this?

glass whale
#

hello, i just watch in /plugins/LuckPerms/libs folder come .jar file, is it plugin suggestion or luckperm's files ?

upbeat tusk
glass whale
#

oups my head has a bug sorry

languid furnace
#

is there any stored data how player count inside the group? Or do I have to manually loop all players and check

upbeat tusk
# languid furnace is there any stored data how player count inside the group? Or do I have to manu...

You can use UserManager#searchAll, which takes a NodeMatcher. In your case, you need to provide an InheritanceNode NodeMatcher. This will return a CompletableFuture containing a Map of UUIDs and a Collection of InheritanceNodes. This map contains the UUIDs of all players inside the specified InheritanceNode (the group defined in the NodeMatcher's Node builder). You can then use the keySet of this map to get the Set of UUIDs and call .size on it, just like with any other Collection.

languid furnace
upbeat tusk
languid furnace
#

hmm okay. But is there any problems with unloading the user from internal storage? Because I think that is what I want, something like unloading players when they exit server.

upbeat tusk
#

You can try it out ig

languid furnace
#

it does not work :(

upbeat tusk
#

Yeah as I thought, you have no choice other than filtering out offline players.

visual wadi
#
Collection<Node> nodes = getHelper().getPlayer(offlinePlayer.getUniqueId()).getNodes();
  for (Node node : nodes)
    getHelper().getUserManager().modifyUser(player.getUniqueId(), user -> user.data().add(node));

Is this a good way to clone a player using API?

fast delta
#

you should do a single modifyUser call and add all the nodes in there

#

but this screams "use a group" instead :d

loud harness
#

Hey, I'm using the GetGroup statement in my plugin, but the current problem is that the result is always null. So I get NullPointer.

The funny thing is that the group is loaded because I do a rankmanage GUI and in the first part all groups are loaded and displayed and it works, but when I try to use one of these groups it returns null.

humble bison
#

if i save a user with the userManager, should the update be pushed systemwide in case you have proxy + subserver setup?

#

I have an own plugin on my subservers, that adds and remove nodes to players. Not on the proxy. If i add the node and save the player, the update is only on the one subserver, not on the proxy or the other subservers. I need to use the /lpv user <username> permission check <permission> command on the proxy in order to fetch the newest perms of the player. Or i need to use the /lp user <username> permission add <permission> command directly on the subserver, to get it to the proxy too.

Is this the expected behaviour and is there a way to push it manually to the proxy?

fast delta
#

you need to push the update, see pinned message

wicked narwhal
#

what am I doing wrong ?

[15:15:59] [Server thread/INFO]: [Grosu] Enabling Grosu v1.0*
[15:16:00] [Server thread/INFO]: [net.dv8tion.jda.api.JDA] Login Successful!
[15:16:00] [Server thread/ERROR]: [Grosu] Failed to load LuckPerms API: The LuckPerms API isn't loaded yet!
This could be because:
  a) the LuckPerms plugin is not installed or it failed to enable
  b) your plugin does not declare a dependency on LuckPerms
  c) you are attempting to use the API before plugins reach the 'enable' phase
     (call the #get method in onEnable, not in your plugin constructor!)
#
@Override
    public void onEnable() {
        
        try {
            jda = JDABuilder.createDefault(discordToken).addEventListeners(new DiscordListener()).build();
        } catch (LoginException e) {
            getLogger().severe("Failed to login to Discord: " + e.getMessage());
            this.setEnabled(false); 
            return;
        }

        if (!getServer().getPluginManager().isPluginEnabled("LuckPerms")) {
            getLogger().severe("LuckPerms plugin is not enabled! Disabling Grosu Matei.");
            this.setEnabled(false); 
            return;
        }

        try {
            luckPerms = LuckPermsProvider.get();
        } catch (IllegalStateException e) {
            getLogger().severe("Failed to load LuckPerms API: " + e.getMessage());
            this.setEnabled(false); 
            return;
        }

        PluginCommand command = getCommand("grosu");
        if (command != null) {
            command.setExecutor(this);
        }

        getServer().getPluginManager().registerEvents(this, this);

        getLogger().info("Grosu Matei has been activated!");

        File logFile = new File(getDataFolder(), "command_logs.txt");
        if (!logFile.exists()) {
            try {
                logFile.createNewFile();
            } catch (IOException e) {
                getLogger().severe("Failed to create command log file: " + e.getMessage());
            }
        }
    }
main dagger
wicked narwhal
#

and sorry for ping

main dagger
#

rename your plugin jar to end in .zip, then open it, and see if and luckperms classes are inside it

main dagger
#

net/luckperms

wicked narwhal
#

they are

main dagger
#

yeah, thats what you dont want

wicked narwhal
#

ah, ok

main dagger
#

^

wicked narwhal
#

i have implementation

#

)))))))))))))))))

#

thank you

#

))))))))))))))

humble bison
fringe cosmos
#

can i connect to luck perms velocity on a fabric server?

main dagger
#

wrong channel

alpine blade
#

Hey, I'm not sure if this is the right channel but how could I retrieve a download link for the latest build? Just trying to make an autoupdater for my plugins.

wild whale
alpine blade
jaunty pecan
#

e.g. for bukkit

#

curl -s https://metadata.luckperms.net/data/downloads | jq -r '.downloads.bukkit' will give you the url for the latest Bukkit jar

simple helm
#

hi api people 🙂

#

trying to get luckperms working on my plugin

#

it loops with "waiting for luckperms to be ready" and "luckperms provider not found"

main dagger
#

why are you putting this in a repeating bukkit task?

#

lp will be fully ready before your plugin since you depend on it in your plugin.yml, which means you can get the provider directly in onenable

simple helm
#

ya just for debug

#

normally i would load it like essentialsx, etc

upbeat tusk
#

Did you actually verify that LuckPerms is starting up before your plugin? I've come across cases where even though you're depending on LuckPerms, it still starts after your plugin. Additionally <version>5.4</version> > <version>5.3</version>

simple helm
#

it might be a verion issue

#

ya lol just saw that - been banging my head on the java

#

yes its in the log

#

i think its the 5.3

upbeat tusk
#

Yeah consider updating it

simple helm
#

ya trying now

#

weird

#

same thing

main dagger
#

are you using /reload?

simple helm
#

no

#

is 5.4 enough?

#

e.g. do i have to specify the exact version in my pm?

#

pom

upbeat tusk
#

Set it to 5.4 in your pom

simple helm
#

ya did

#

still wont load - weird

upbeat tusk
#

Oh I read that wrong, yes 5.4 is enough since it's the latest API version

simple helm
#

my plugin isnt starting until after LP loads, so the dependency is working

#

i'll removing the debug polling stuff and try again, clearly 5.3 was wrong

upbeat tusk
#

yeah remove the repeating task

simple helm
#

does the api work with spigot / bukkit?

main dagger
#

it should

simple helm
#

im going to try the static singleton instead

#

my code is the same as whats on the docs

main dagger
#

did you try without the task?

simple helm
#

but its always null

#

ya

upbeat tusk
#

tbh you should upgrade to paper

simple helm
#

ya

#

but im too far in 🙂

#

next server

upbeat tusk
#

Just replace the jar

main dagger
#

bukkit plugins run just fine on paper

simple helm
#

calling the singleton resulted in some interesting info, but none of it is true lol

upbeat tusk
#

If it weren't for a stupid little mistake, I bet that it'll magically work fine if you switch to paper ngl

simple helm
#

haha

#

im asking the guy who built the server about it

#

when i use the singleton it says the plugin isnt fully loaded (it is), or im not calling it in onenable (i am) or something else lol

#

oh

#

so

#

i had to tell maven that luckperms was provided

#

go figure

#

i guess this build is different somehow - the other plugins like essentialsx, etc didnt need to be told that

#

oh well, problem solved 🙂

main dagger
#

shading luckperms into your plugin does cause problems

#

the shaded luckperms will never be loaded as a plugin, so its api will never be ready

vague prairie
#

Hi! I use user.getInheritedGroups() to get all user groups. Is there a way to get the expiry of the group if its set temporary?

upbeat tusk
tall hull
#

Is there an even which I can use to check if player meta has changed?

fast delta
#

UserDataRecalculateEvent

unique stag
#

Does someone know the best and safest way to check if the api is loaded when developing a architectury mod ?

#

I currently do it on init() but this causes some problems sometimes

unique stag
#

Nvm I’m gonna use a lifecycle event to register the commands

nocturne elbow
#

Hi, how do I check in NodeMutateEvent whether a user have been added to a group? Because afaik node can be a permission as well, isn't that right?

#

I guess I have to filter all new nodes with node type INHERITANCE predicate?

upbeat tusk
#

Why not use NodeAddEvent, since you want to listen for when they're added to a group?

fast delta
#

^ and check that the node being added is an inheritance node, you can get the node from the event

sterile venture
#

How can update a player when I set the rank with my command they use the API isn’t live updating

deep robin
#

is there any better than using the doc method to get player group?

public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
        for (String group : possibleGroups) {
            if (player.hasPermission("group." + group)) {
                return group;
            }
        }
        return null;
    }```
(documentation method)

**RESOLVED**
nocturne elbow
main dagger
sterile venture
# main dagger it should update inside luckperms right away. what *exactly* are you *seeing* th...
User targetUser = luckPerms.getUserManager().loadUser(targetPlayer.getUniqueId()).join();

        if (targetUser == null) {
            player.sendMessage(PREFIX + ChatColor.translateAlternateColorCodes('&', messagesConfig.getString("messages.targetPlayerNotFound")));
            return;
        }

        targetUser.data().clear(node -> node.getKey().equals("group"));

        if (duration == Long.MIN_VALUE) {
            targetUser.data().add(Node.builder("group." + targetGroupName).build());
        } else {
            targetUser.data().add(Node.builder("group." + targetGroupName)
                    .expiry(duration, TimeUnit.SECONDS)
                    .build());
        }

        luckPerms.getUserManager().saveUser(targetUser);```
main dagger
sterile venture
molten shore
#

this is working, but the NodeAddEvent event is not called if I add the rank to a player in another instance. How do I get him called?

#

if the player is in the same instance it works normally

wild whale
#

API events are only called on the instance where the operation takes place

molten shore
#

uhh

molten shore
wild whale
molten shore
#

thanks!

molten shore
crude wharf
#

Thankss

dense crater
#

sup
i need help in showing the lp track in the score board

sweet crag
#

Hey I'm running into an issue with setting custom metadata (like show in the docs), where user.data().clear() doesn't remove the existing key so the method ends up adding another key with the same name but different value. Any ideas, I need a second set of eyes

Example Code

        User user = getUser(player.getUniqueId());

        MetaNode node = MetaNode.builder(key, Boolean.toString(value)).build();
        user.data().clear(NodeType.META.predicate(mn -> mn.getKey().equalsIgnoreCase(key)));
        user.data().add(node);

        provider.getUserManager().saveUser(user);
    }
sweet crag
fast delta
sweet crag
modest basin
midnight wind
#

Why doesn't %luckperms_group_expiry_time% work?

#

I've followed all the instructions

crude wharf
#

did you do /papi ecloud download Luckperms?

#

and /papi reload?

left geyser
#

Please move this discussion to one of the support channels, #support-1 / #support-2. This has nothing to do with the LuckPerms API.

steep light
#

Can anyone help me?

#

Its on the Paper 1.21

upbeat tusk
#

Use the normal jar

mossy kite
#

How do I make luckperms autocomplete modded permission nodes?

nimble pebble
#

How can i unload a user that was loaded by using UserManager class?

main dagger
vapid kelp
#

Is there a downloads API for the plugin jar itself? Specifically an endpoint to get the latest build for a certain loader.

wild whale
#

(among other things)

mossy kite
main dagger
#

all permissions are "modded"

#

also wrong channel

mossy kite
#

I thought this was the right channel since I’m trying to use the luck perks api?

#

And I mean permission nodes via a mod, not a plugin, that’s what I mean by modded

fast delta
#

LuckPerms simply suggests permissions that have been checked for before

#

once a permission goes through LP it'll cache it and show it up in the editor/commands

calm coral
#

Hey i want to add and remove Groups from a Player, my add methode works great but i cant remove a group. Can anyone Help me?

        if (player != null && groupName != null && !groupName.isEmpty()) {
            User user = luckPerms.getUserManager().getUser(player.getUniqueId());
            if (user != null) {
                InheritanceNode node = InheritanceNode.builder(groupName).value(false).build();
                user.data().remove(node);
                luckPerms.getUserManager().saveUser(user);
            }
        }
    }

    public void addGroup(Player player, String groupName) {
        if (player != null && groupName != null && !groupName.isEmpty()) {
            User user = luckPerms.getUserManager().getUser(player.getUniqueId());
            if (user != null) {
                InheritanceNode node = InheritanceNode.builder(groupName).value(true).build();
                user.data().add(node);
                luckPerms.getUserManager().saveUser(user);
            }
        }```
rose marten
#

Hey, I don't know what I'm doing wrong...

I'm trying since yesterday, to get the API to run (i already got it in a few different plugins) but it won't work!

My Main: https://pastes.dev/Aa7IFTVE8K
This is my code - I didn't change ANYTHING and checked everything more than 10 times.
I tried everything that came to my mind...

It'll always show, the NotLoadedException but it is loaded!

[15:13:30] [Server thread/INFO]: [LuckPerms] Enabling LuckPerms v5.4.137
[15:13:30] [Server thread/INFO]:         __
[15:13:30] [Server thread/INFO]:   |    |__)   LuckPerms v5.4.137
[15:13:30] [Server thread/INFO]:   |___ |      Running on Bukkit - CraftBukkit
[15:13:30] [Server thread/INFO]:
[15:13:30] [Server thread/INFO]: [LuckPerms] Loading configuration...
[15:13:30] [Server thread/INFO]: [LuckPerms] Loading storage provider... [H2]
[15:13:30] [Server thread/INFO]: [LuckPerms] Loading internal permission managers...
[15:13:30] [Server thread/INFO]: [LuckPerms] Performing initial data load...
[15:13:30] [Server thread/INFO]: [LuckPerms] Successfully enabled. (took 319ms)
...
Exception in the other paste

Exception: https://pastes.dev/VGxc1QMB4l
Full Log in: https://pastes.dev/4Xx48YIL5p

I'm using the spigot-api 1.21 (server latest build), have everything in my maven right and depend: [LuckPerms] in my plugin.yml
At first I were using paper - nothing changed

Please help, thanks!

upbeat tusk
rose marten
upbeat tusk
#

Why would you downgrade to CraftBukkit again then? Attempting to resolve it on Paper is better

rose marten
#

but fine - i'll try it again

fast delta
#

make sure you aren't shading the lp api into your jar

upbeat tusk
#

wait I totally missed that lol

rose marten
#

Nothing changed

upbeat tusk
#

Are you shading LP API by any chance?

rose marten
rose marten
rose marten
rose marten
#

Sorry for wasting your time! 🙏

upbeat tusk
#

No problem. Glad you got it fixed :>

round estuary
#

when should the fabric placeholder api be updated for 1.21

left geyser
#

No ETA. Also, wrong channel.

steep light
#

How i can Set a Player in a group but temporary and Lifetime?

clever zodiac
#

that's an oxymoron

#

how does one have a group both temporarily and forever

#
Node node = Node.builder("group.owner")
        .value(true)
        .expiry(Duration.ofHours(1))
        .build();

I think?

jolly tendon
#

hi

#

I’m trying to create a plugin for custom prefixes (like BetterPrefix) for my server where LuckPerms is set up with Velocity (in proxy) and LuckPerms (in minigame) connected with MySQL. However, when I install the plugin, it applies the prefixes in LP but not in LPV.

steep light
magic comet
#

how does luckperms know what my group is, because if i remember correct * permission bypass all permission, and then it would return true for all groups

public static boolean isPlayerInGroup(Player player, String group) {
    return player.hasPermission("group." + group);
}

lets now say i want to check for all people with donator rank, but i dont want people who have * would it include that person or should it make it so if u have a group that is higher it doesn't count or what

main dagger
magic comet
#

👍

stoic inlet
#

Hello is luckperms api hook for fabric working with 1.21?

#

since mine is crashing on start

upbeat tusk
stoic inlet
#

Thank you, only looked at the channel title sorry

placid crypt
#

oop I've been asking about this in #support-1 didn't realize 1.21 wasn't supported yet. Though this was 3 days ago so lemme check on it...

spark barn
#

hey im porting a mod from 1.18.2 to 1.20.1 (forge), and i cant for the life of me work out how to make sure the calls to the net.luckperms.api.LuckPermsProvider.get() happen after the luckperms has loaded..

#

seems like whatever i do i can stop the net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet! error. so something isnt letting luckperms load first

this is the part that calls luckperms

    private final LuckPerms luckPerms;
    private static LuckPermsProvider instance;

    public LuckPermsProvider() {
        instance = this;
        this.luckPerms = net.luckperms.api.LuckPermsProvider.get();
    }
    public static LuckPermsProvider getInstance() {
        return instance;
    }

    private CachedMetaData getMetaData(GameProfile player) {
        if (this.luckPerms == null) {
            return null;
        } else {
            User user = this.luckPerms.getUserManager().getUser(player.getId());
            return user != null ? user.getCachedData().getMetaData() : null;
        }
    }

    public String[] getPlayerPrefixAndSuffix(GameProfile player) {
        try {
            CachedMetaData metaData = this.getMetaData(player);
            return new String[]{metaData.getPrefix(), metaData.getSuffix()};
        } catch(IllegalStateException ise) {
            return null;
        }
    }
``` note the origonal author set the file and classnames as LuckPermsProvider hence the direct call to the full path net.luckperms.api.LuckPermsProvider.get()
main dagger
# spark barn seems like whatever i do i can stop the ```net.luckperms.api.LuckPermsProvider$N...

if you depend on LP in your plugin.yml (or whatever the equivalent file is for your platform), LP will always be loaded loaded before your plugin/mod. If you are sure you do this already, but are still getting this error, its likely because you have shaded LP into your plugin/mod. This means that 2 versions of the API exist at runtime, one from the LP jar actually installed on the server that is loaded like normal, and the other from your plugin/mod that never gets loaded since the server doesn't know about it. You can check by looking inside of your jar and seeing if any files from LP exist (anything in net/luckperms or me/lucko/ shouldnt be in your jar!). if it is shaded, change the scope of your dependency on LuckPerms to provided in your pom

frank driftBOT
#

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

left geyser
night pier
#

That sounds xy. What are you trying to do

main dagger
#

what setting exactly?

misty arch
#

I'm working on using a chat engine that differs from the normal MC formatting, as part of that, displaynames need to be stored both with the extended formatting and with the default MC formatting so that other plugins can use display names without formatting issues.

In order to accomodate this on a velocity network the best way was to try and store metadata in group permissions and this worked until I tried to retrieve the permission data which was converted to all lowercase despite stored data retaining caps. Is there a way to retrieve data in a manner such that the permissions are not made lowercase?

main dagger
#

when you need legacy formatting codes, you can use the converter for that

misty arch
#

The reason I'm not using minimessage is to both add additional functionality and to make chat easier to format in general. The legacy formatting codes aren't what I need and their already handled by my chat implementation by default.

main dagger
#

xy then

#

its not really clear what you are trying to do

misty arch
#

The way the plugin works is it strips chat of default formatting and readds it in a way that's easier to work with in general, such as making legacy formatting like &l a toggle that can be used both to bold and unbold a message. There were also additional changes that made the usage of colors simpler than the implementation of MiniMessage provided by default so I opted to go with that instead.

The ultimate reason I chose permission data was because it provided most of the functionality I needed while allowing me to also extend the default functionality of LP Meta. The plugin uses some general checks to grab 4 parts of a users displayname, the userprefix, usersuffix, chatprefix, and chatsuffix. At the time I had not considered using MiniMessage for user prefix and suffix but now that I think about it it's probably a viable solution.

TLDR: I over complicated this and I believe my issue should be resolved.

hardy sequoia
#

Can someone explain how I use getGroupManager#loadAllGroups correctly? It returns a CompletableFuture of Type Void but I don't know how to handle that correctly.

main dagger
#

when its done, you can get data from any group i presume

#

but you should really only load the groups you are going to use

hardy sequoia
main dagger
hardy sequoia
#

Didn't I just describe what I want to do? There is no case like in "getting the filename" I really just want to get the groups above a specific weight to return them in a command. There is no further description to do.

fast delta
#

unless you are unloading groups (or creating groups in server A without messaging server B about it), all groups are loaded on startup and when created

#

given that, getLoadedGroups sounds more like what you want rather than loadAllGroups

nocturne elbow
#

how do i fix this

#

import net.luckperms.api.LuckPerms; import net.luckperms.api.model.user.User; import net.luckperms.api.node.Node;

#

im coding a minecraft plugin with supports luckprms and LPC.

#

thiss hows a error.

#

yk how to fix.

celest acorn
#

is transient user data fully local or does luckperms broadcast it over the network when changes to the transient map are made and saveUser is called? do I even need to call saveUser if I don't need to broadcast transient nodes to other luckperms instances in the network?

fast delta
#

it's local

#

and no, you don't need to call saveUser because there is nothing to save :d

#

but also, LP won't automatically broadcast any changes when calling saveAnything, you'd need to tickle the messaging service yourself, see the pinned message about that (although that is simply not applicable in this case)

echo heart
#

Is there any event when a permission node value becomes true/false because a context changed? Like the worldguard:region=test. Because neither NodeAddEvent, NodeRemoveEvent, NodeMutateEvent, UserDataRecalculateEvent, GroupDataRecalculateEvent or ContextUpdateEvent is called.

wild whale
#

There should be an event for the context change, but the calculated value of the node itself won't fire any events - the value of the node never changes, LP just changes which nodes it cares about.
XY problem, why do you need this?

echo heart
#

We are using numbered permissions. These are multiplier permissions. Total value is calculated by summing them all up. For large servers, iterating through the players effective permissions on possibly every block break isn't ideal. So now we use NodeAddEvent and NodeRemoveEvent to create a Set of strings cached from our multiplier permissions. The problem is, that it isn't really work well with contexts.

wild whale
#

Yeah, LP (and the general permission system as a whole) isn't built for that kind of thing, and thus there's no good way to do it.
There is, however, the metadata system. It's basically a key:value store on permission holders. It's easy to query what value a player has for a given metadata key

echo heart
#

Well there is a lot of users who already setup permissions (and sadly, basically everyone is doing it this way), so I'm not sure we would want them to change everything from permissions to metadata. (Also by using permissions, we keep compat with other permission plugins, even though those servers won't benefit from the cache)

echo heart
#

But thanks anyway!

celest acorn
fast delta
#

yes, because they are never saved to storage

celest acorn
#

ok, thanks 👍
and one more question: to make all User instances always have a certain node set in the transient map, do I just need to set it on UserLoadEvent and that's it?

fast delta
#

pretty sure, yeah

granite crater
#

does LP modify the users bukkit display name, or is there an official way to get their prefix

rugged hedge
#

Api or placeholders depending on your use

boreal eagle
#

Hey,

if I call group.getNodes(NodeType.PERMISSION), do I also get the permissions from the group parents then?

main dagger
#

probably not

#

since inheriting a group doesnt mean it actually has the nodes it inherits

late slate
#

Hallo, because i only See Maven everytime, can i implement Luckperm in a Java Project Plugin and when yes where is the correct download for Java?

vague gorge
#

hey
i've read the wiki and api cookbook but i couldn't figure out how can i create a group using the api

lost oar
#

How can I give a player temporary a "VIP" rank e. g. 1 week and the Player has ONLY the "VIP" rank in this week and next week the default rank. That with the API

upbeat tusk
# lost oar How can I give a player temporary a "VIP" rank e. g. 1 week and the Player has O...

Clear the player's groups, use a builder to build an InheritanceNode, set the expiry duration to 1 week, build it and add it to the user data. As for giving them the default group back, I believe it'll automatically do that once the VIP group expires, if it doesn't, write some code that does it, I'll leave that to you to test. Here are some resources to help you apply all that:

Creating an InheritanceNode, with expiry time: https://luckperms.net/wiki/Developer-API-Usage#creating-new-node-instances

Adding the node to the user: https://luckperms.net/wiki/Developer-API-Usage#modifying-usergroup-data

Saving the user data after adding the node: https://luckperms.net/wiki/Developer-API-Usage#saving-changes

Full API Usage wiki page: https://luckperms.net/wiki/Developer-API-Usage

Example of how to clear all groups and add one: https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java

wind moth
#

Hey, how can I access to all DisplayNameNodes in the user object?

I add them with:
user.data().add(DisplayNameNode.builder(serializedComponent).build());

For prefix and suffix there exists: user.getCachedData().getMetaData().getSuffixes()

upbeat tusk
wild whale
# wind moth Hey, how can I access to all DisplayNameNodes in the user object? I add them wi...

Note that LP display names almost certainly do not do what you think they do.
They override the group's "name" aka it's effective ID, and is not intended for display. By setting a display name, you'd need to use that display name in every LP command referencing it, and any other plugins that care about group name.
You should be using either prefixes/suffixes, or a custom metadata key for handling custom display properties

wind moth
#

ah, alright thanks

#

now I'm using String display = user.getCachedData().getMetaData().getMetaValue("prefix-display");

#

how can I write something with the key prefix-display?

upbeat tusk
#

Create a MetaNode using the builder, it takes a key(prefix-display in your case) and a value, then add it to the user, the same way you were adding the DisplayNameNode

sly oxide
#
    public void onServerConnect(ServerConnectEvent event) {
        var proxiedPlayer = event.getPlayer();
        LuckPerms luckPerms = LuckPermsProvider.get();

        luckPerms.getUserManager().modifyUser(proxiedPlayer.getUniqueId(), user -> {
            user.data().clear();
            user.data().add(SuffixNode.builder().suffix("Test").build());
        });
    }```

that doesnt work
wild whale
#

Doesn't work in what way?

sly oxide
#

The suffix is not going to be set

boreal eagle
#

Hey everyone 👋
I have some Spring Boot applications and would like to use the LuckPerms API there. What is the best way to do this?

fast delta
buoyant nymph
#

how i add perm without appears on chat?
public static void addPermission(UUID userUuid, String permission) {
LuckPermsProvider.get().getUserManager().modifyUser(userUuid, user -> user.data().add(Node.builder(permission).build()));
}

wild whale
#

wdym "without appears on chat"?

buoyant nymph
#

I wish it wouldn't show up

wild whale
#

Can you show a screenshot of the message?

buoyant nymph
#

yes

buoyant nymph
#

im joining

fast delta
#

no it doesn't unless you are running the respective /lp user permission set command or pushing the entry to the action log yourself via the action log api

buoyant nymph
#

oh ok

#

thx

hardy sequoia
fast delta
#

modifyUser takes care of saving the user

pine jacinth
#

Can I change player rank with User#setPrimaryGroup()?

main dagger
#

with the default config, that function doesnt do anything

#

you need to add an inheritance node to the player

#

!coolbook has examples

frank driftBOT
nocturne elbow
#

does anyone know how I could format the &#123456 style colors that luckperms uses?

#

I want to be able to reformat a player's prefix

main dagger
#

luckperms itself doesnt use any format

nocturne elbow
#

in the end I gave up and switched all my colours to regular spigot colours

main dagger
#

if your targeting paper, you should use minimessage

#

an actually sane format that supports modern features

night pier
#

okay deleted message, didn't wanna answer it anyways

stone sand
#

nevermind, LuckPerms api = LuckPermsProvider.get(); seems to work ^^

#

my fault gang i deleted it right before i saw you type 😭

stone sand
#

How do i get the luckperms api on velocity?
Nothing on the docs seems to work properly

#

and
LuckPerms api = provider.get().getProvider();

gives me this error
[01:11:04 ERROR] [velocityonlinetime]: Failed to get LuckPerms API. The instance is not of the correct type.

fast delta
#

the LuckPerms plugin won't be an instance of the LuckPerms API class

#

where are you trying to get the API? what event/method

stone sand
fast delta
hardy cedar
#

Does this API not get the time when the player first obtained permission?

main dagger
#

the only timestamp a node may have is when it expires

molten shore
#

how I get all playercount in a group?

molten shore
#

I think

        val searchAll = luckPermsApi.userManager
            .searchAll(NodeMatcher.type(NodeType.INHERITANCE))
            .join()
broken lantern
#

On Paper, how does lp check if a username (via a command) has played since its installation (assuming use-server-uuid-cache: false and the player is not cached)? I know it stores a combination of UUID and name for each player. Afaik the API only allows for loading a user by its UUID. Is it possible to use lp to check if a user has played before if I only have the player's username? (this seemed convenient to me as the data is already being stored, instead of doing a Mojang lookup for example to get a UUID and then check OfflinePlayer.hasPlayedBefore())

fast delta
#

luckperms keeps its own username-id cache, the player must be in that cache, have joined to be there (if it's shared storage like sql, joined any server/proxy that connects to that sql server)

#

so if the player never joins and is not in that cache the command will simply fail

broken lantern
nova coral
#

I made a VIP group with the prefix "&6[VIP] &6" and i making a plugin where the players in that group can modify the prefix color/name color like "&1[VIP] &6" or "&6[VIP] &1" changing the prefix. But how can i add the prefix to the player with a group context?

#

Like when the player leave the group vip the custom prefix added to him will unset

main dagger
#

you cant. you should store the color and apply it yourself if they are in the group

nocturne elbow
#

Can I check if the player has a group set to them without a permission check like if (player.hasPermission("group." + group)) {?

broken lantern
nocturne elbow
#

appreciate it

hollow marsh
#

how can I give permission to a player with lp api?

main dagger
#

!api

frank driftBOT
main dagger
#

!cookbook

frank driftBOT
urban phoenix
#

Hey! I am getting an error when doing RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

wild whale
#

Did you add a dependency on LP in your plugin.yml?

nocturne elbow
#

How can I add or remove a Permission from a player

urban phoenix
#
name: Core-Spigot
version: '${project.version}'
main: org.nexuscraft.corespigot.Core
api-version: '1.20'
load: STARTUP
authors: [ NexusDevelopment ]

depend:
  - LuckPerms
upbeat tusk
urban phoenix
#

I don't understand a shit lol

can yu guide me into adding lp to paper-plugin?

main dagger
#

but unless you have a reason to be using paper-plugin.yml, you should stick with the normal plugin.yml

hollow marsh
#

hello I am adding a perm to player like this ``` Node node = Node.builder("cosmetics.hat1").build();

                        LuckPermsProvider.get().getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
                            DataMutateResult result = user.data().add(node);

                            if (result.wasSuccessful()) {
                                player.sendMessage("Şapkan menüye eklendi!");
                            } else {
                                player.sendMessage("Zaten şapkan var");
                            }
                        });```
#

how can I add timed perm?

#

for example 30 minute perm

wild whale
#

Add an expiry to the Node

stoic jetty
#

Hello. got a question. only copy pasted relevant ones.,

LuckPermHook.java


    @Getter
    private static final LuckPerms luckPerms = LuckPermsProvider.get();

    @Nullable
    public static User getLoadedUser(@NotNull UUID uuid) {
        return luckPerms.getUserManager().getUser(uuid);
    }


    public boolean hasPermission(@NotNull UUID uuid,
                                 @NotNull String permission) {
        User user = getLoadedUser(uuid);
        if (user == null) return false;

        return user.getCachedData()
                .getPermissionData()
                .checkPermission(permission)
                .asBoolean();
    }

hasPermission never gave me issue until I tried to check permission in bungee plugin. I think we're doing this a bit wrong, but unsure what's proper way to handle

above hook is in plugin SigLib.jar , located in individual bukkit server.
A "bungee" plugin SigBungeeCore is located in bungeecord, trying to check permission with LuckPermHook#hasPermission.

In other words,

bukkit server has SigLib enabled. It has LuckPerm-Bukkit. It does NOT have SigBungeeCore
bungee server has SigBungeeCore enabled. It has LuckPerm-Bungee. It does NOT have SigLib.
Bukkit and Bungee are sharing same mysql database.

Interestingly, trying to check permission with LuckPermHook#hasPermission sometimes work, and sometimes does not work.
what would be proper way to check permission from luckperm?

main dagger
#

for basic permission checks, you shouldnt use the LuckPerms API

#

instead, you should use the permission check your platform provides

#

eg Player#hasPermission on bukkit

stoic jetty
#

huh. never knew that. thanks

ornate forum
#

hello i want to ask, how to i get expiry temp permission using api? day, hours, minutes, seconds thanks

main dagger
#

the expiry of the node is a timestamp

#

so youll have to convert it into the format you want

ornate forum
#

its work thanks