#luckperms-api

1 messages ยท Page 2 of 1

obsidian forum
#

How to get user highest group by weight?

wild whale
#

I don't think there's a single method to grab that (check the JDs just in case, link in prior message), so you'll have to loop over all groups the player has and find the one with the highest weight yourself

obsidian forum
#

I know... I tried, but still absolutely no idea how to ...

wild whale
#

What part about that do you not know how to do?

obsidian forum
#

get highest group from this
Collection<Group> groups = user.getInheritedGroups(luckPerms.getPlayerAdapter(Player.class).getQueryOptions(player));

#

by weight of course

wild whale
#

I mean it's not too hard, rough pseudocode would look something like ```
var highestGroup, highestGroupWeight
for group in groups
var weight = getWeight(group)
if (weight > highestGroupWeight)
highestGroup = group
highestGroupWeight = weight

#

and iirc there's a method on groups to get the weight, if not can get all nodes of type Weight and take the highest weight from the nodes

#

I don't remember any of the exact methods, but that's roughly what you need to do

hybrid panther
#

you can also sort collection by method reference to group weight

wild whale
#

ok I wasn't sure if that was something easy to do on JVM or not. If this was kt I would have done .sort { getWeight(it) }.first(), but I can't remember what all of that has JVM equivilences

obsidian forum
hybrid panther
#

what have you tried exactly

obsidian forum
#

I've try to comparing, sorting

#

for each

#

i want just get the one group, what have highest weight

turbid solar
#

sort over all the inheritance nodes

#

then stream & sort it

hybrid panther
#

.stream().sorted(Comparator.comparingInt(Group::getWeight)).findFirst()

turbid solar
#

dont think that'll work bc iirc its an OptionalInt

wild whale
#

mutters about slow streams

turbid solar
#

gr -> gr.getWeight().orElse(0) ?

hybrid panther
#

that made me want to die writing that

obsidian forum
#

thank you guys.

nocturne elbow
still patio
#

someone have luckperms for 1.12.2 pls

glass crescent
#

I have a question,
is there a way to get the players prefix with the api

hybrid panther
#

!cookbook

frank driftBOT
native tartan
#

I have a question i use the luckperms-api for my citybuild plugin to get the ranks and update it correctly. Now i use ItemsAdder and there i can make placeholder rank badges like this:

In chat works but in the tablist it wont work does anyone know how to do that?

main dagger
#

well its up to you to correctly add it to the tablist

#

if its working in chat, you are correctly getting it from luckperms, so the issue is likely with how you are setting it in the tablist

native tartan
#

Ah ok thanks and do you maybe know whats the problem in my code? ^^'

Bc never used placeholders in combination with luckperms.

main dagger
#

i dont see anything about placeholders in that snippet

native tartan
main dagger
#

you only need to use it if you want to use papi stuff

#

theres no reason you need to use it though

native tartan
#

Ok. But then how can i get placeholders in it? Bc now i only get the rank from the rank on luckperms. But the tablist cannot "convert" it to the badge.

#

Like this

main dagger
#

well papi doesnt use : for placeholders so im not sure what plugin is doing that

#

either way, its not something for luckperms to handle

native tartan
#

Its a addon from itemsadder and the use as placeholders :admin: or :mod: etc.

main dagger
#

you should talk to them then

native tartan
#

Ok but thanks i will ask on the itemsadder devs directly thanks!

upper nacelle
#

Hey-
I'm working on a plugin that requires access to offline (and potentially offline-mode) user's usernames from their UUID. It seemed rather silly to setup a database when LuckPerms already keeps that data. When getting the username from LuckPerms, I noticed that the name returned as lowercase. I understand that it's like that for standardisation in the database; however it seems wrong to not have some source for the proper name.
Is there a reason there is not a column for a capitalised name (aside from adding an extra 16 bytes to playerdata entries)? And if not, would a pull request be in order?

upper nacelle
#

Edit: I plan to use the metadata API to save a capitalised name as a temporary measure, however this seems like a relatively important feature to have built in.

open kiln
#

So I'm using the api to change user groups is there a way to get these changes to log? Right now they are not logging?

open kiln
upper nacelle
# open kiln Bukkit.getOfflinePlayer(uuid).getName()?

a) That requires the player to have joined the specific instance, and be in the instance's UUID cache (The application I have does not necessarily have that for every player, plus I'm building for a proxy anyway)
b) If the player was online-mode, we could use the Mojang API; however the latency induced by that is not acceptable in my application (and some users are offline-mode)

turbid solar
#

whenever they join set a meta called username?

#

nvm thats what you said

#

and for another column that seems a bit useless for the 2% that needs it

obsidian forum
#

Is there any method to get offline player groups?

#

@turbid solar

frank driftBOT
#

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

turbid solar
#

load the player

#

donโ€™t randomly ping people

upper nacelle
obsidian forum
upper nacelle
obsidian forum
upper nacelle
#

Keep in mind that .join() calls will return the user, however they are blocking; so only use them in async threads, or use thenAcceptAsync's callback

obsidian forum
open kiln
#

I'm having a weird issue with the LP-api. I'm using it to remove an old rank and add a new one. It seems to remove the old rank but then applies the new one but it does not take effect until I do something /lp user name parent info?

#

This was working fine in previous versions and we just updated luck perms and the server. Only other change was we changed the server name from global to carrot which has been working just fine.

obsidian forum
# upper nacelle Keep in mind that .join() calls will return the user, however they are blocking;...

Hello again, i have small question about this code:

    public static CompletableFuture<User> loadUser(UUID uuid) {
        return luckPerms.getUserManager().loadUser(uuid);
    }

    public synchronized static Optional<Group> getHighestGroup(UUID uuid) {
        return loadUser(uuid)
                .thenApplyAsync(user -> {
                    Collection<Group> groups = user.getInheritedGroups(user.getQueryOptions());
                    return groups.stream().max(Comparator.comparingInt(g -> g.getWeight().orElse(0)));
                }).join();
    }

Is this code efficient?

upper nacelle
#

You're using thenApplyAsync and join; use one or the other

obsidian forum
upper nacelle
#
    public static CompletableFuture<User> loadUser(UUID uuid) {
        return luckPerms.getUserManager().loadUser(uuid);
    }

    public synchronized static Optional<Group> getHighestGroup(UUID uuid) {
        User user = loadUser(uuid).join();
        Collection<Group> groups = user.getInheritedGroups(user.getQueryOptions());
        return groups.stream().max(Comparator.comparingInt(g -> g.getWeight().orElse(0)));
    }

I have not tested this, but assuming all the types are correct, this would be more in line with what you are looking for.
Just keep in mind that calling getHighestGroup is blocking, and should only be used on an async thread.

obsidian forum
#

Yes, the only problem is that I am calling it on a non-synchronous thread.

upper nacelle
#

Do you mean the primary bukkit thread?

wild whale
#

that's fine

#

no the main server thread is "sync", async in the MC sphere means any other thread generally

obsidian forum
wild whale
#

ok so for the reference the main thread is generally the "sync" thread, so everything else is async in relation to it

#

Is the user online?

upper nacelle
#

Assuming the user is offline to start with and you actually need to load data; a few options:

  1. Make your own CompletableFuture that you complete when LP's is done
  2. Call in your command executor: Bukkit.getScheduler().runTaskAsynchronously(()=>{ // the lookup and all execution after })
    (Spawning threads is a little costly, so not ideal)
#

@obsidian forum

obsidian forum
#
  1. Make your own CompletableFuture that you complete when LP's is done

And I have to do it synchronously? I have no idea how to do it.

upper nacelle
#

That would be not be blocking to the thread; let me draft it up

obsidian forum
wild whale
#

CompleteableFutures are by definition async unless you .join() it or similar

#

Well that's not quite accurate but for this case it is

#

XY, what's your end goal?

obsidian forum
# wild whale XY, what's your end goal?

I just want to get the highest user group. The command is made to open the player's head gui, where it shows what the highest group is and how much it expires.

wild whale
#

Ok yeah sometimes you can get away with just vault but that'll require the LP api

upper nacelle
#

Vault has a getPrimaryGroup method iirc

#

but for expiry that's different

wild whale
#

yeah you can't get expiry

#

you can get group name / prefix but that's gotta be async since it still needs to do a data load

obsidian forum
#

To get the expiry time I am using this code:

    public static synchronized List<InheritanceNode> getTemponaryGroups(UUID uuid) {
        return loadUser(uuid)
                .thenApplyAsync(user -> user.getNodes(NodeType.INHERITANCE)
                        .stream()
                        .filter(Node::hasExpiry)
                        .filter(node -> !node.hasExpired())
                        .collect(Collectors.toList()))
                .exceptionallyAsync(throwable -> Collections.emptyList())
                .join();
    }
wild whale
#

that being said Vault is much easier to work with

#

that shouldn't be synchronized, that doesn't do what you think it does

#

And that will lag the server sincce you're doing a sync load

upper nacelle
#
    public static CompletableFuture<Optional<Group>> getHighestGroup(UUID uuid) {
        CompletableFuture<Optional<Group>> futureGroup = new CompletableFuture<>();

        loadUser(uuid).thenApplyAsync(user -> {
            // do whatever with the user

            futureGroup.complete(<whatever data you want to pass down>)
        });
        return futureGroup;
    }
#

have your command logic be like getHighestGroup(uuid).thenApplyAsync(group - > {//do whatever});

#

once again, not tested; but shouuuld work

wild whale
#

again though, shouldn't be synchronized. That will cause issues

upper nacelle
#

yea if you call .join() anywhere from the primary thread you will sync everything up and halt the primary thread until it's done

obsidian forum
wild whale
#

Honestly don't screw with futures though, just run it all on an async task and .join it, much easier

obsidian forum
#

The one above

wild whale
#

no it shouldn't be synchronized

upper nacelle
#

i copied his code ๐Ÿคฆโ€โ™‚๏ธ

#

lmao

wild whale
#

The times you need that keyword is extremely rare

obsidian forum
#

Okay guys. Thank you very much i will try to do this...

upper nacelle
#

good luck lol; I know you're getting a lot of info dumped on you xd

obsidian forum
#

?

wild whale
#

basically roughly what you should do is make an async task, inside you can load a user with .join, grab the group off of that like normal, then call another sync task to update the info wherever

#

Quadratic's method with chaining futures would work too, but it's a bit more complex

#

either way this ends with .joining on a async task and updating info on a sync task

upper nacelle
# obsidian forum ?

Modify your group checker to just call .join() the loadUser method you made, do your checking, and return the straight data (Optional<Group> or whatever you want to pass down)
In your command handler: Bukkit.getScheduler().runTaskAsynchronously(()=>{ just call your getgroup method })

#

The other method I gave you was the optimal way to do it, as it prevents spawning new threads, (which is a little costly to the main thread); but since you're only doing it every time a command is run, it's not anything to worry about

obsidian forum
#

No, I just don't know what to do next. Are you kidding me for what it is wtf

wild whale
#

Where are you stuck

upper nacelle
#

I think we dumped too much info on him lol

wild whale
#

also think it needs mentioning, if you're trying to use the LP API with limited java experience, this will be a difficult process, the LP API assumes you have knowledge of futures and such

obsidian forum
obsidian forum
wild whale
#

Yeah all good, you're not the first person in this situation, and you won't be the last.

nocturne elbow
#

hello, why don't you find the dependency of lp?

#

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

#

i have an error on groupID, artifactId and versions

upper nacelle
#

I've had a bunch of issues with jitpack.io today, are you attempting to use that repo?

#

Luckperms should be avalible through central, however you can also try paper's public repo:
Put this at the top of the <repositories> section:

<repository>
    <id>papermc</id>
    <url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
nocturne elbow
#

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

turbid solar
#

no

nocturne elbow
#

immaginavo

#

I supposed

turbid solar
#

that needs to stay dependency

nocturne elbow
#

i do that

turbid solar
#

try refreshing maven

nocturne elbow
#

thanks bro

nocturne elbow
#

Error occurred while enabling ParadiseMC v1.0-SNAPSHOT (Is it up to date?)
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms

turbid solar
#

ae you (soft) depending on luckperms?

#

and make sure you're not shading it in

nocturne elbow
#

wait

#

i found the problem

#

i doesn't have installer luckperms on server XD

nocturne elbow
#

Player subber = Bukkit.getPlayer(args[0]);

                User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(subber);

                user.setPrimaryGroup("sub");
#

why is the error?

turbid solar
#

!cookbook

frank driftBOT
nocturne elbow
#

thanks

nocturne elbow
#

anyone know is Vault able to attach permissions to user through LuckPerms?

errant smelt
#

anyone know why it says the dependency isnt found in my pom.xml. other dependencies for plugins are working fine

turbid solar
#

refresh maven

hybrid panther
nocturne elbow
tired kiln
#

hi

#

if (inheritedGroups.equals("helper")) {
globalFormat = Util.translateHexColorCodes(Config.CHAT_FORMAT_HELPER);
}
will this method work?

or so?

if (inheritedGroups.stream().anyMatch(g -> g.getName().equals("helper"))) {

turbid solar
#

2nd

tired kiln
#

if (inheritedGroups.stream().anyMatch(g -> g.getName().equals("owner"))) {

#

?

deft girder
#

does anyone know how to grant a player permissions within code (idea) in luckperms version 5.4

deft girder
#

ty

deft girder
#

how is .getGroup() defined? if i just put ,getGroup("name") then it returns null

unreal mantle
#

Show the code you're using

deft girder
#

public static void addPermission(UUID uuid) {
// Add the permission

    // Load, modify & save the user in LuckPerms.
    LuckPermsProvider.get().getUserManager().modifyUser(uuid, (User user) -> {

        Group group = LuckPermsProvider.get().getGroupManager().getGroup("spawntag");
        // Try to add the node to the user.
        user.data().clear(NodeType.INHERITANCE::matches);

        // Create a node to add to the player.
        Node node = InheritanceNode.builder(group).build();

        // Add the node to the user.
        user.data().add(node);

        // Tell the sender.
        Bukkit.getPlayer(uuid).sendMessage(ChatColor.RED + user.getUsername() + " is now in group " + group.getDisplayName());
    });
}
#

its copy pasted from github

#

and spawntag is my group for people who are tagged in spawn, obviously lol

#

oh and dont mind the add permission i forgot to change that lol

unreal mantle
#

Don't copy paste code unless you know what it does

deft girder
#

oh yeah ik what it does i just fucked uip lol it literally works

#

mb brah

unreal mantle
#

Group group = LuckPermsProvider.get().getGroupManager().getGroup("spawntag") It just simply getting the Group spawntag from the group manager and storing it in group

deft girder
#

i get the node to add it to the player so hes in no?

#

it adds me to the group, what doesnt work tho is the nametagedit prefix somehow

#

i had to reload nametagedit to make it work somehow

#

i think nametagedit is the problem

#

i just removed me out of the group and my name still has the prefix

lean mirage
#

Hello, guys. How can i sort my list of players? Example: i have a list: ADMIN TEST, DEFAULT LOL, EMERALD MEGA, DEFAULT ROFL
I want: ADMIN: test
DEFAULT: lol, rofl
EMERALD: mega

turbid solar
#

dont cross post

proper hearth
#

๐Ÿ‘‹ Hello, does anybody know how to add LuckPerms in a Forge development environment using gradle? The wiki says to use compileOnly but Forge does not load the mod. If I use CurseMaven to get the file directly, I get a NoSuchMethodError
Log:
https://paste.gg/p/anonymous/6f3d7d96c19b4205a4907aac7b05a54b

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)
#

It looks like some part of the mod is using SRG names even though I use implementation fg.deobf

#

(please ping me if you have any ideas)

turbid solar
#

you shouldn't depend on the internals, use the api?

proper hearth
#

If I use the API, Forge does not detect the mod and fails to load it

#

which results in API NotLoadedException

#

also, I'm not calling internal methods anywhere, the error above happens during mod construction

main dagger
#

did you add luckperms as a dependancy?

proper hearth
nocturne elbow
#

Hi, I am making a plugin to ban other players. I would like the admin to not be able to ban other people with a given permissions. I have a problem with getting the permissions of an offline player using LP, how to do it? Thanks in advance for your help!

#

is my code so far: User user = LuckPermsProvider.get().getUserManager().getUser(args[0]); -> args[0]: player name

#

java.lang.NullPointerException: Cannot invoke "net.luckperms.api.model.user.User.getCachedData()" because "user" is null

turbid solar
#

load the player

#

!api

frank driftBOT
nocturne elbow
#

idk how to do it

turbid solar
#

!cookbook

frank driftBOT
latent dagger
#

i need help pls

#

i gaved my group rank

#

work perfectly

#

work perfectly in chat

#

but it dont work in tab

#

and i also have /gts command

#

and i tried everything to make it work

#

but still the rank still cant do /gts

#

only work for op

turbid solar
latent dagger
#

oh ok

nocturne elbow
#

Why it is alwyays false?

#

public static boolean hasPermission(OfflinePlayer p, String permission) {
final boolean[] bool = {Boolean.FALSE};
CompletableFuture<User> userLoadTask = LuckPermsProvider.get().getUserManager().loadUser(p.getUniqueId());
userLoadTask.thenAccept((User user) -> {
CachedPermissionData permissionData = user.getCachedData().getPermissionData();
if (permissionData.checkPermission(permission).asBoolean()) {
new BukkitRunnable() {
@Override
public void run() {
bool[0] = true;
}
}.runTask(ServerPlugin.getInstance());
return;
}
});
return bool[0];
}

turbid solar
#

return a CompletableFuture

wheat lake
#

Also, why would you create a temp bool array of 1?

nocturne elbow
#

something like that?

#

public static CompletableFuture<User> hasPermission(OfflinePlayer p, String permission) {
final boolean[] bool = {Boolean.FALSE};
CompletableFuture<User> userLoadTask = LuckPermsProvider.get().getUserManager().loadUser(p.getUniqueId());
userLoadTask.thenAccept((User user) -> {
CachedPermissionData permissionData = user.getCachedData().getPermissionData();
if (permissionData.checkPermission(permission).asBoolean()) {
new BukkitRunnable() {
@Override
public void run() {
bool[0] = true;
}
}.runTask(ServerPlugin.getInstance());
return;
}
});
return userLoadTask;
}

#

omitting the boolean in the middle

turbid solar
#

no

#

Boolean competeanlefutire

nocturne elbow
sleek prairie
#

do anyone know how to remove perms from a player

upper nacelle
proper hearth
#

Will this return true if the user is in any of the groups passed to the method by name?

/**
 * Queries the LuckPerms group (including inherited groups) of the given player.
 * @param player the player ID
 * @param groups one or more groups
 * @return true if the player is in any of the given groups
 */
public static boolean hasAnyGroup(final UUID player, final String... groups) {
    // query API
    LuckPerms api = LuckPermsProvider.get();
    // query user
    User user = api.getUserManager().getUser(player);
    // validate user
    if(null == user) {
        LOGGER.error("[LuckPermsHandler#hasAnyGroup] Failed to load API for unknown user '" + player + "' ");
        return false;
    }
    // query primary group
    final String primaryGroup = user.getPrimaryGroup();
    // query inherited groups
    final List<String> inheritedGroups = user.getInheritedGroups(QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build())
            .stream().map(Group::getName).toList();
    // check each group to see if the user belongs to that group
    for(String g : groups) {
        // check primary group
        if(g.equals(primaryGroup)) {
            return true;
        }
        // check inherited groups
        if(inheritedGroups.contains(g)) {
            return true;
        }
    }
    // no checks passed
    return false;
}

I can't test in my IDE bc I'm using the Forge version and it won't import correctly (see my earlier post) so I need somebody to sanity check for me please ๐Ÿ™‚

turbid solar
#

it should

proper hearth
#

alright, fingers crossed ๐Ÿ˜‚

#

thanks

unique perch
#

hello, can you help me how to show prefix in chat. I have set the prefix, I don't see the rank

rain saffron
#

Hi! I use LuckPerms Api in my backend and have a question about players UUIDs.

My case: user registers in my backend, then i wanna create player within luckperms-api to support group changing and etc. But i don't know user's uuid before they connected to the minecraft-server and it retreives in luckperms' player table in db. How i can fix this?

If i create user with generated UUID, add some perms to it, but after connect to minecraft server - they UUID will rewrite to mojang UUID

jaunty pecan
#

you can use the mojang api to get the uuid for a given username

rain saffron
#

@jaunty pecan so, sounds cool, but if i set online-mode to false - uuid will generates once only on my minecraft server?

frank driftBOT
#

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

jaunty pecan
#

don't set online-mode false then :]

rain saffron
#

Thank you so much, will dive deep, i plan to use custom minecraft-server auth, will ask their devs how retreive UUID, good day!

proper hearth
main vine
#

Chances are I'm being a dumbass and missing it on the wiki, but how do I get my plugins permission nodes to show up as suggestions for the commands and in the web gui?

unreal mantle
#

The suggestions will only show if the permissions are registered correctly and they have been checked since last restart

night pier
#

A permission check needs to be made for LP to recognize it

main vine
unreal mantle
#

In your plugins plugin.yml

main vine
#

I'll need to Google how then, ty for telling me what file atleast, and then for the check, would it work if I did it on an empty player object?

unreal mantle
#

Honestly, it doesn't matter if it shows in the suggestion list or not. you can still manually type the permission in and it will work

main vine
#

Ik, im trying to make it populate to make it eaiser to know it exists and its exact spelling and everything

#

Regardless ty

main dagger
gray glen
#

Hello. I have this warning, how can i remove him?

EventSubscription<NodeAddEvent>' used without 'try'-with-resources statement```

eventBus.subscribe(this.corePlugin, NodeAddEvent.class, this::onNodeAdd);

turbid solar
#

should be to just ignore it

topaz forge
#

Hi there, is there an API version of this?

#

Setting temporary permissions with API for a time, and setting it to prolong, so if the player purchase the VIP twice, it will just get prolonged

novel lagoon
#

how to use LuckPerms api in Nukkit?

#

i have idea

nocturne elbow
novel lagoon
#

how to get the prefix of the group in which the player is located?

novel lagoon
#

this is corectly?

#

(sorry for my eng)

turbid solar
#

no

#

canโ€™t cast a User to a player

novel lagoon
#

how to corectly use ?

novel lagoon
turbid solar
#

should be yes

novel lagoon
#

luckperms must equals?

turbid solar
#

or LuckPermsProvider.get

novel lagoon
#

thx

#

working

crude wraith
#

Im tring to check if a user has a permission but it gives me a error

here is the code

        User user = luckPerms.getUserManager().getUser(playerUUID);
        return user.getCachedData().getPermissionData().checkPermission(permission).asBoolean();
    }```

```if (CompanyCore.getInstance().hasPermission(player.getUniqueId(), "group." + args[0] + "-vicedirettore")) {```

Here is the error
frank driftBOT
turbid solar
#

is the player online

crude wraith
#

Yes it is

main dagger
#

why not just use hasPermission() on the player directly?

crude wraith
#

I need it be working eaven if the player is offline

#

But i don't know how to do it

turbid solar
#

load the user

plush narwhal
#

Hi, can I change player's display name (which showing above their head) using Luckperms API?

wild whale
#

Nope. LP isn't responsible for anything relating to display, that's entirely the responsibility of other plugins. All LP does is provide the prefix/suffix for users

plush narwhal
#

Okay, thanks for information

upper nacelle
plush narwhal
upper nacelle
# plush narwhal I tried ``HaoNick``, ``NickNamer``, ``NickAPI``, ``NameTagEdit`` plugins but any...

You would need to modify the source of which ever one you chose to use. I used to use NameTagEdit back in the 1.8 days, however I ended up designing a custom nametag system for 1.16+

NameTagEdit requires using the config file for configuring each potential prefix and suffix, and does not support changing the player's name. You would not be able to do what you are trying to do.

HaoNick has worked in the past for me if the goal is to /nick a player; maybe play a bit more with that.

wild whale
#

I use TAB as a plug and play formatter for tab and nametags, configs powerful enough and with papi support you can do just about anything within the vanilla limitations

plush narwhal
#

I wanna give a fake name and a rank to the player for a limited time. So I need eternal API. NametagEdit API is (I guess) shut downed and I guess TAB don't have an API.

wild whale
#

I don't think it has an API but it has PlaceholderAPI support which can easily do those

#

(don't even need anything custom for display for a temporary group, LP supports temp groups so can easily just do that with the LP api)

plush narwhal
#

What does do DisplayNameNode

wild whale
#

sets the display name for a group (allows users to override a group name in commands and what other plugins see through vault etc while keeping the group name the same internally)

plush narwhal
upper nacelle
#

LuckPerms API is not going to help you unless your nametag plugin pulls from Vault or Luckperms' API to load prefixes & suffixes already.

LuckPerms is a permissions plugin that supports STORING player "meta", which includes prefixes, suffixes, and custom data; not displaying nametags.

Whatever plugin you use that handles displaying nametags has a source for data, some plugins have config files, some of those support PlaceholderAPI (PAPI has placeholders for prefix and suffix); some plugins have APIs that you could access from your own plugin.

Potential ways to use LuckPerms as a data source for prefixes:
A) Find a nametag plugin that already supports pulling from LuckPerms
B) Find a nametag plugin that supports Vault prefixes
C) Modify a nametag plugin that already exists, redesign the data loading portion to use LP's metadata API to load prefixes and suffixes.

In my experience, I have not found a working plugin that already has LP integration. I ended up designing my own nametag system that supports loading from LuckPerms.

TL;DR: Your best route would be to find some nametag plugin that already works without LP integration, and then modify it to integrate.

#

@plush narwhal

plush narwhal
upper nacelle
#

Not necessarily, as I outlined, it should not be too complex to modify an existing plugin

opaque pivot
#

How does LuckPerms handle SQL on Velocity without shading the MySQL driver?

main dagger
#

i think luckperms remaps all of its dependancies to prevent conflicts

lean mirage
#

hey, guys. I have mongoDb in lp. If i get prefix of offline user i get him?

lean mirage
#

How can I get offline player prefix via luckperms api. I have a database.

odd vapor
#

how I can get weight player?

upper nacelle
#

!api

frank driftBOT
main dagger
#

what does that have to do with the luckperms api?

#

but its probably something to do with doing it from a different thread

loud siren
main dagger
#

just because someone is using the luckperms api does not mean every issue they have is caused by luckperms

#

wherever you would ask questions about the bukkit api

upper nacelle
main dagger
#

i was responding to someone who has deleted their messages for whatever reason

upper nacelle
#

ah

steady sable
#

Hey, I use following code but it returns "null"

UserManager userManager = luckPerms.getUserManager();
            nameColor = userManager.loadUser(uuid).join().getCachedData().getMetaData().getMetaValue("nameColor");```
What have I to change that it is working?
glacial oriole
#

Hello everyone, can anyone tell me which event should i listen for to know when a user gets / lose a permission group?
(if there is one)

gray glen
gray glen
odd vapor
#

Hi I can use Common as API?

wild whale
#

You're not supposed to, why do you want to?

#

(like by definition common isn't api)

odd vapor
wild whale
#

that doesn't answer what common does that you can't do with API though

odd vapor
#

I want check how working field "weight" from class MetaCache

wild whale
#

You can get weight from the API

odd vapor
#

hmm how?

turbid solar
#

!api

frank driftBOT
odd vapor
turbid solar
#

a user doesnt have a weight

#

a user's prefix/suffix/parent does

odd vapor
# turbid solar a user doesnt have a weight

it is 50% true 50% false
I know that this is not what this system is for, but I think to base the rank hierarchy on it
better than typing all the group names by hand in my opinion

wild whale
#

No, users never have weights.

odd vapor
#

I tested it java for (Node node : user.getNodes()) { if (node instanceof WeightNode weightNode) { if (weightNode.getValue()) { weight = Math.max(weight, weightNode.getWeight()); } } return Math.max(weight, luckPerms.getGroupManager().getGroup(user.getPrimaryGroup()).getWeight().orElse(-1)); } but I thinking better use one method for it

nocturne elbow
#

A User can have a WeightNode (it's just another Node in a PermissionHolder), but it does not do or affect anything in regards to permission calculation

wild whale
#

If you want just a number for a user and you're hard depending on LP api anyways, use meta. It's basically a key:value store in nodes, so inheritance etc is respected

odd vapor
wild whale
#

It's stored as normal nodes, (meta.KEY.VALUE)

odd vapor
next orchid
#

Where does LuckPerms get these permissions from?

#

And is it possible to add my own?

unreal mantle
#

Luckperms gets them from the plugin that creates those permissions

next orchid
#

The reason I'm asking is because I want to know if I can add my own there

unreal mantle
#

That is also just the suggestion list, which is filled in when permission checks are made.

next orchid
#

It looks like it shows up there once a permission is accessed

#

Yeah ^

#

Is it cached?

#

Or would it clear every restart

unreal mantle
#

Every restart

#

But if permissions don't show in that list you can still manually type them in.

next orchid
#

True, but it's easier when they are in that list. Especially if I'm going to be making a bunch of stuff and then adding permissions later on

#

So the only way to programmatically add a suggestion to that list is to call hasPermission?

unreal mantle
#

Yes, permissions will only go into the suggestions list when a permission check is made.
I don't think you can manually add them to the suggestions list with the API. That would be a question for @proud crypt . But I'm pretty sure you cant.

night pier
#

just do a permission check onEnable

turbid solar
#

!nw

frank driftBOT
#
Please tell us what's going on!

We really would absolutely love to help you out! However, telling us that it isn't working wastes everyone's time. Please, just describe the issue you're having clearly and with as much detail as possible, and send any relevant screenshots of whatever problems you're having.

For Console Errors:
steady sable
# turbid solar !nw

If I use the following code it returns "null"

User user = luckPerms.getUserManager().getUser(uuid);
        if (user != null) {
            nameColor = user.getCachedData().getMetaData().getMetaValue("nameColor");
        } else {
            User user1 = luckPerms.getUserManager().loadUser(uuid).join();
            nameColor = user1.getCachedData().getMetaData().getMetaValue("nameColor");
        }```
turbid solar
#

is nameColor set?

#

screenshot /lp user <user> meta info

steady sable
turbid solar
#

you're checking for "nameColor" and "namecolor" is set

steady sable
#

Lower/Upper case is a problem?

#

nah

#

thats not the problem

#

For only players it is working

turbid solar
#

now screenshot /lp user Lion_King287 meta info

steady sable
turbid solar
#

start debugging, print stuff to console etc

odd vapor
#

Hi how I can get all online users from Group
I want read all users what permission change in NodeMutateEvent

odd vapor
#

I need do it ```java
luckPerms.getUserManager().getLoadedUsers().stream().filter(user -> {
Collection<Group> groups = user.getInheritedGroups(QueryOptions.builder(QueryMode.CONTEXTUAL).build());

        });``` or exists method for it?
turbid solar
#

what?

#

depends on the platform

frank driftBOT
#

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

turbid solar
#

no need to ping when i'm already talking to you

#

you should check what works the best w/ minestom and not just copy it

#

ยฏ_(ใƒ„)_/ยฏ

#

should probably look into it more before your pr lol

simple gorge
#

Can you tell me why issuing groups does not work?

main dagger
#

theres an pr for minestom already i think

wraith flicker
#

hey guys, if i add a group my plugin cant recognize it... how can i force update the group list?

wild whale
#

How is your group trying to find it?

#

*plugin

wraith flicker
#
LuckPerms luckPerms = LuckPermsProvider.get();
luckPerms.getGroupManager().getLoadedGroups()
#

nevermind

#

its my bad

elfin crescent
#

Anyone know how I could get user specific permissions? Like I found how to access the CachedPermissionData. But I don't want it to return every permission node from every group they have. I'm only trying to get user specific permissions

nocturne elbow
elfin crescent
#

Got it, thx

lost sonnet
#

ร‘

steady glade
#

ร‘

main dagger
tiny onyx
#

hi

empty axle
#

I am trying to give perms and kits in prison ranks x... although the groups have the items allowed, and the ladders are built, and all seems to function correctly, I still cant access the kits that lp allows per group. What am I doing wrong, been stuck on this for days

gleaming lance
#

Use #support-1 or #support-2 for this in the future, this channel is for questions about the API. From what I can see from the screenshots you have given a wrong permission to the group

#

Change essentials.kits.agate to essentials.kits.jade (which is the kit you are trying to give)

night pier
#

ร‘

nocturne elbow
#

Evident I will kick your ass

#

(in minecraft)

night pier
main dagger
#

ร‘?

nocturne elbow
#

?

#

@night pier

frank driftBOT
#

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

heavy field
#

how to get the settemp by the api

south hull
#

intellij is giving me a warning here, but it doesnt say how to fix it.. what do i do to fix it?

south hull
#

ok

gray grotto
#

Is there any sort of guides for how to use the LuckPerms API in node.js?

main dagger
#

you cannot use the LuckPerms API with node as it is literally part of the plugin/mod jar file. the REST api that you could interact with from node works just like any other REST api and should be documented somewhere

gray grotto
main dagger
#

there should be a page on the wiki for it

#

!wiki

frank driftBOT
gray grotto
#

I already looked there and couldn't find any node.js info but I guess -

#

sometimes i feel stupid lol

main dagger
#

like i said, it works like any other rest api

gray grotto
#

im not familar with rest apis yet so i'll go check that out, thanks :))

main dagger
#

there is almost certainly plenty of info out there about using rest apis with nodejs

gray grotto
#

yep

#

it wasn't that what i was looking for was undocumented, i was looking for the wrong information

main dagger
gray grotto
#

there's probably something im missing that i didnt realize

gray grotto
#

what url do I use?

gray grotto
#

yes i just love that package, it's very well documented /s

#

either that or im too stupid to understand

nocturne elbow
#

The url is wherever you have the web server with the REST API hosted in

#

The API key is whatever you set in LUCKPERMS_REST_AUTH_KEYS for the REST API to accept

nocturne elbow
#

Hey Guys, How Can I change the parent groups with luckperm api?
Ex:) Rank UP Just only default without guide

nocturne elbow
#

I need help, so I made the settings and then I hit apply, after that I reloaded the plugins and then I tested to see if it works (whitout op) and it worked, after I exited and entered, it didn't work any more the command I set

nocturne elbow
#

all need op permissions

#

back , sethome

#

etc

#

enderchest

queen mason
#

Can't find vault online can someone please send vault\

south kayak
nocturne elbow
#

in default

south kayak
nocturne elbow
#

and?

south kayak
#

And check if the commands you are trying to use are set to true if it is not there or set to false, it won't be working.

#

If it's not there just select the permission in and set it to true

south kayak
nocturne elbow
south kayak
nocturne elbow
#

@south kayak what its Bungeecord?

south kayak
nocturne elbow
#

ohh

main dagger
#

in the future, please use #support-1 or #support-2 for normal problems. adding permissions in the editor has nothing to do with using the api

solar cloak
#

how do i get the expiry time of a userโ€™s rank

lavish pivot
#

so im trying to add a prefix node to a player however, if i open the web editor instantly after it doesnt appear to save and it removes it from them

#

it doesnt clear for everyone just some users

turbid solar
#

push updates

#

pins

lavish pivot
#

sorry me confused

#

what goes in the ....

#

wait but that says to other servers... this is one server

#

and furthermore its only for some players.

#

so tried this... and same result

#

ah. so is there a limit to a prefix?

#

so there never was an issue with saving, it was saving with a long permission node

turbid solar
#

h2 has a limit iirc?

wild whale
#

The database schema definitely has a max node length, yeah

#

200 characters comes to mind, but not sure

crude wraith
#

How can i get a player groups?

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
lime granite
#

Can somebody tell me how to fix this.

#
org.bukkit.plugin.InvalidPluginException: java.lang.ExceptionInInitializerError
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:409) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:467) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        ... 7 more
Caused by: net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
This could be because:
  a) the LuckPerms plugin is not installed or it failed to enable
  b) the plugin in the stacktrace does not declare a dependency on LuckPerms
  c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
     (call the #get method in onEnable, not the constructor!)

        at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:53) ~[?:?]
        at com.foxdev.ranks.Ranks.<clinit>(Ranks.java:10) ~[?:?]
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:467) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[server.jar:3284a-Spigot-3892929-0ab8487]
        ... 7 more```
turbid solar
#

did you read it

lime granite
#

Yes

#

And i dont understand

turbid solar
#

!paste Ranks.java

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!

lime granite
#

Okay give me 2 minutes ๐Ÿ˜‡

turbid solar
#

the whole class

#

also don't use setPrimaryGroup

#

!cookbook

frank driftBOT
turbid solar
#

User user = (User) api.getUserManager();
dont do that

lime granite
#

How should i do it?

turbid solar
#

also paste the whole class

turbid solar
#

?

fresh flame
#

Hello,

How can I retrieve the highest group on a specifique track for a player ?

Thank you very much ๐Ÿ™‚

fresh flame
#

For the moment this is my code:

        LuckPerms luckPerms = LuckPermsProvider.get();

        Set<String> groups = Collections.singleton(luckPerms.getPlayerAdapter(Player.class).getUser(player).getNodes(NodeType.INHERITANCE).stream()
                .map(InheritanceNode::getGroupName)
                .map(n -> luckPerms.getGroupManager().getGroup(n))
                .filter(Objects::nonNull)
                .max(Comparator.comparingInt(g -> g.getWeight().orElse(0)))
                .map(Group::getName)
                .orElse(""));

I only get the highest rank

But I want the highest rank of a specific track, thank you very much ๐Ÿ™‚

wild whale
#

filter it being on that track?

hardy dust
#

i'm the dude earlier making the forge chat mod, pretty much done but can't get the luckyperms API to work, clientside has no problems but the server crashes with the following stack trace: 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) at MC-BOOTSTRAP/eventbus@5.0.7/net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) at MC-BOOTSTRAP/eventbus@5.0.7/net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) at MC-BOOTSTRAP/eventbus@5.0.7/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) at MC-BOOTSTRAP/eventbus@5.0.7/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ...

frank driftBOT
#

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

hardy dust
#

sorry for tagging, any idea what mightr be causing this though?

#

my code just uses the singleton API below: ```java
private void loadComplete(final FMLLoadCompleteEvent e) {
// Register server chat event
//MinecraftForge.EVENT_BUS.register(chatEvent);
LOGGER.info("LuckPermsChat - Mod is loaded (c) Name 2022 - 2023!");
// Load luckperms
LOGGER.info("LuckPermsChat - Attempting to load LuckPerms API!");
boolean failed = true;
try {
LuckPerms perms = null;
perms = LuckPermsProvider.get();
if(perms != null) {
//chatEvent.setLuckyPerms(perms);
failed = false;
}
} catch(Exception e2) { }
//
LOGGER.info("LuckPermsChat - " + (failed ? "LuckPerms API not found, is LuckPerms installed?" : "LuckPerms API found!"));
if(failed) LOGGER.warn("LuckPermsChat warning - LuckPerms API wasn't found, mod won't use it!");
}

main dagger
#

"LuckPermsChat" tharpyWah

hardy dust
#

probably need to rename it to ForgeLuckPermsChat

#

thats a future problem

main dagger
#

if you use luckperms in the name, please make it very clear that its not officially affiliated with luckperms

hardy dust
#

will do

#

any ideas what may be causing my issue? here are some thing's i've tried: ```

  • Using gradle dependencies for version 5.4
  • Manually including API JAR file "api-5.4.jar" into build path
  • Manually including entire mod (version 5.4.26) into build path
  • Including mod in both mods folder and build path
  • Including mod in mods folder, with gradle dependencies
  • Including mod in mods folder, with API in build path
    ...
hardy dust
#

the name doesn't matter its for a server I'm hosting for some friends, if I put it on curseforge or anything it will be under a completely different name probably like "ForgeColoredChatUtils" and it will say that is is "LuckPerms" compatiable in the description

#

the chat formatting and everything works perfectly but the goal is to the the prefix and suffixes from user metadata and include them in the chat formatting - this will be the only way to do this on modded 1.18.2 packs since there are no luckperms compatible mods for 1.18.2 (and SpongeForge doesn't exist for MC 1.18.2 either)

lime granite
#

Can somebody tell me whats wrong?

night pier
#

the API isn't loaded yet.

solid sable
#

Make sure the provider is actually set, you're reaching before its loaded

lime granite
lime granite
solid sable
#
        // Set up LuckPerms
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) luckPerms = provider.getProvider();
night pier
#

send your full main class

#

!paste

frank driftBOT
#
Please use pastebin!

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

For console errors:

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

Other errors:

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

lime granite
#

First time i touch the luckperms api ๐Ÿ˜„

solid sable
lime granite
#

Does not works ๐Ÿ˜ข

#

@solid sable

#

?

solid sable
#

Maybe you have to actually initialize it in the onEnable?

lime granite
#

Wait should you use it under onEnable?

#

Thanks bro โค๏ธ

solid sable
#

No problem!

lime granite
#

How to set someone in a group?

#

@solid sable Do you mind if i tag you everytime or dont you want that?

solid sable
solid sable
lime granite
#

Ey if you need something (Dont ask for money) I fix it ๐Ÿ˜„

solid sable
lime granite
#

What am i doing wrong?

#

@solid sable

solid sable
lime granite
#

Its says this

#

Could not pass event PlayerInteractEvent to Ranks v1.0-
org.bukkit.event.EventException: null

#

Caused by: java.lang.NullPointerException: Cannot invoke "net.luckperms.api.LuckPerms.getUserManager()" because "this.luckPerms" is null

solid sable
#

Try something like this

lime granite
#

๐Ÿ˜„

solid sable
#

It might be because you pass through the LuckPerms instance within your onEnable

lime granite
#

@solid sable Wanna join a call

#

You can explain me if you want tho ๐Ÿ˜„

solid sable
#

No sorry I can't rn, however try reaching LuckPerms like I did in the Something class

lime granite
#

Yeah but it doesnt succeed to set the player on that group.

solid sable
#

does it give any output/errors?

lime granite
#

Uhm

#

Do you have minecraft 1.19?

solid sable
#

Yes I do

lime granite
#

I send you something in dm.

crude wraith
#

How can i get all the permissions & groups of a player

#

?

solid sable
nocturne elbow
#

Does anyone know how to download PlaceholderAPI from luckperms on mohist? /papi dont works.

fallow imp
#

Are luckperms load methods built-in async? Talking about the Spigot one, just wanna make sure everything related to the database runs async.

upper nacelle
#

API calls are not, but internal luckperms handling is

#

Most API calls that would be blocking will return a CompleteableFuture, .join() is blocking

fallow imp
#

Also, sorry for the mention, didn't mean to bother you

upper nacelle
#

If you use #thenAcceptAsync callbacks then you will be fine

#

examples from the docs

#

!api

frank driftBOT
fallow imp
#

what I'm asking is do LuckPerms's API lookups use async loading process as it is in the commands? For example, I'm using UserManager#lookupUuid, does it work async?

upper nacelle
fallow imp
# upper nacelle

I'm not looking for this, I know what CompletableFuture#join does, I just want to make sure the API's functions run async, and if not, why are they using CompletableFuture at all? doesn't make sense

upper nacelle
#

when you make the API call, nothing has been done

nocturne elbow
#

Are you familiar with futures and promises?

upper nacelle
#

nothing will happen unless you either
A) Join onto the thread you are on
B) Request a callback

fallow imp
upper nacelle
#

Then it will be non blocking

fallow imp
#

and will it be async? (THE LOADING PROCESS)

nocturne elbow
#

yes

fallow imp
#

alright thanks

nocturne elbow
#

Things that return a CompletableFuture run on another thread

fallow imp
#

sure, if not, then why do they use CompletableFuture at all xD!

#

alright thanks

nocturne elbow
#

Because.. it runs on another thread?

upper nacelle
#

(Sorry for the mention)

fallow imp
nocturne elbow
upper nacelle
fallow imp
#

My sense of humor is broken ngl

#

thanks guys

scarlet jacinth
#

๐Ÿคฏ

jaunty pecan
#

incorrect unfortunately ๐Ÿ˜›

night pier
#

old classpath Nopers

night pier
#

!api

frank driftBOT
clever zodiac
scenic shore
scenic shore
young umbra
#

If I am trying to retrieve the prefixes but I want prefixes from two different tracks (main and staff) how do I get both?

main dagger
#

this is something that should be configured in luckperms

#

!stacking

frank driftBOT
covert pasture
#

even so happens on the discord

#

(i had the same result with getPrimaryGroup)

main dagger
#

mmmm i love toolbar that cant be hidden and covers content (hastebin sucks on mobile)

main dagger
covert pasture
#

i refuse to do it over lp

main dagger
#

why...?

#

luckperms has prefixes and suffixes for a reason. you should consider using it

covert pasture
#

Well yeah, but the main issue is still that getting the primary group is wrong

main dagger
#

you probably shouldnt rely on the primary group as it doesnt really mean anything

covert pasture
#

so you mean top inherited group?

main dagger
#

the "primary" group is pretty arbitrary. it has no impact on permission or meta calculation. you should just set your prefixes in luckperms and use the luckperms api to get them, and luckperms will handle all of that for you

#

no need to reinvent the wheel here

covert pasture
#

okay, thank you

rigid galleon
#

o/ I'm having problems obtaining an instance of the luckperms api, not really sure what I'm doing wrong. Following the instructions on the wiki to a T but it still doesn't work. Any idea what I'm doing wrong?

RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            this.luckPerms = provider.getProvider();
        } else {
            this.plugin.getLogger().severe(() -> "Could not obtain LuckPerms instance. Plugin will not work properly.");
        }

My plugin.yml includes a depend:

depend:
  - LuckPerms
unreal mantle
rigid galleon
#

Yeah

unreal mantle
#

Show

rigid galleon
#
dependencies {
    compileOnly 'io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT'
    api 'net.luckperms:api:5.4'
    api 'org.spongepowered:configurate-core:4.1.2'
    api 'org.spongepowered:configurate-yaml:4.1.2'
    implementation 'com.github.sarhatabaot:KrakenCore:1.6.3'
    implementation 'co.aikar:acf-paper:0.5.1-SNAPSHOT'
}
#

Should I have it set to compileOnly instead of api?

rigid galleon
#

oh yeah

#

thats it for sure

unreal mantle
#

Yes, Luckperms needs to be compileOnly

rigid galleon
#

whoops. thanks!

fickle relic
#

hi guys, does anybody know if its possible to get the Permissions of an Offline Player?

turbid solar
#

yes

#

load the user

#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
fickle relic
#

Ah nvm i got it

stray elbow
#

im trying to use the searchAll method in the UserManager to search for all the players with a permission. Can someone assist me? I can't figure out how to get the node matcher to work and the documentation is confusing

#

*confusing to me

#

this is what I have right now

#

or maybe the code is working actually but I'm trying to get all the players who have this permission even if the permission comes from a group and is not directly attached to their player

stray elbow
#

after more testing/searching I have this which does return all the palyers with a permission but not the players that indirectly have the permission from being a part of a group

jaunty pecan
#

that's the expected behaviour

#

you can do getGroupManager().searchAll(..) and handle the inheritance yourself

scenic shore
#

can i create a group with this method?

hybrid panther
#

that represents a permission node

#

you cannot convert node -> group

#

you could make a group separately, and then apply that existing node

scenic shore
#

i still don't understand the documentation

wicked swan
#

the documentation makes no sense to me... does anyone have an example just to check if player has a certain permission?

wild whale
#

If you just need a true/false, your platform most likely has an easier way than hooking into the LP api

scenic shore
#

how do i create a group with LuckPerms API? i can't find it in the documentation

#

okay, i'll never finish my plugin

hybrid panther
#

ok

night pier
#

a whole 9 minutes, and thatโ€™s the conclusion you came to.

nocturne elbow
#

that's a mood

green hamlet
#

How can I add a permission to a user with the API?

wild whale
#

!cookbook

frank driftBOT
rotund pecan
#

Hey everyone - struggling a little with getting Contexts:

Our server provides rank vouchers which allows people who can't donate to obtain ranks for the server. We've recently opened up a closed beta to a new server that we want all Donators to take part in, including those people who've used vouchers. We've set up the context server=survival on the group.vip permission node for these players.

User user = api.getPlayerAdapter(Player.class).getUser(player);
Set<String> permissions = user.getNodes(NodeType.PERMISSION).stream().map(PermissionNode::getPermission).collect(Collectors.toSet());```

The above code grabs all permissions assigned to a user only without any contexts. How do I include permissions on a user with context?
#

It's to check if they have the group.vip node to allow them into the closed beta server

wild whale
#

group.<name> nodes are still treated like normal nodes that you can check a Boolean value using the normal platform methods afaik, any reason you need LP api to check this? If not, just letting LP deal with all that is probably easier

rotund pecan
#

I tried that initially, but with our setup, using player#hasPermission("group.vip") for players who've used vouchers doesn't work. the VIP only gets applied to the Survival server via context=survival, so the closed beta server isn't picking up on the fact that they are VIP

wild whale
#

...ah. I see

rotund pecan
#

I output permissions to console and it only returned permissions without a given Context, which is why I'm asking how I grab permissions that included contexts, as well

wild whale
#

if memory serves by default it only returns nodes that satisfy the default empty contextset, there should be an overload that takes a contextset iirc

nocturne elbow
rotund pecan
#

Okay, thanks guys, I'll have a play around

rotund pecan
#

I figured out a way to do it, but it's pretty hacky. It works for the time being and isn't on a particularly large server, so it shouldn't be ran often, and will be removed in time for the public launch. Thanks for the pointers! (I will sit down to properly learn the API at one stage, just needed something fast)

cursive tinsel
#

Question Regarding My HubCore, We have VIP Ranks in our lobby servers. After reading the context initiative in the api documentation I'm just slightly confused. I may have also missed something.

So it there a way to justify a players group based on the server they are on?
Meaning is there a way api wise for me to get a players grounp in the context of "hub-1"

#

In lamens terms, how do I make it so if a player has {x} rank on this server they get {y} rank on this server.

main dagger
#

if you just want to know about a permission or group on the current server, you can just use your platforms normal permission check method

#

if you need to check it for a different server, read the conversation above

green hamlet
#

When I remove a user a permission and then check if he has the permission with player.hasPermission() it doesn't update, and the user still has the permission(tried reloading and rejoining)

cursive tinsel
#

Idk if this is what your going for, but here

#
    public static boolean hasSpecificPermission(String name, User user, Context context) {
        boolean foundperm = false;
        for (Node node : user.getNodes(NodeType.PERMISSION)) {
            if (!node.getContexts().contains(context)) continue;
            if (node.getKey().equalsIgnoreCase(name) && node.getValue()) {
                foundvip = true;
            }
        }
        return foundperm;
    }```
#

keep in mind NodeType PERMISSION is for the players "other permissions" meaning the ones you specify for them. The ones they get from groups will NOT be ran in this method.

cursive tinsel
#

So i just checked for a perm under context server, hub

#

Nonetheless, I appreciate the quick response

main dagger
#

primary group is kinda arbitrary

#

you should avoid relying on it

cursive tinsel
#

Yea I am now

#

I didn't know that it was referencing the group of the "global" context

brazen sinew
#

is it possible to assign RGB prefixes/suffixes through the api with Components?

main dagger
#

prefixes/suffixes are raw strings

#

its up to the plugin that displays them to format them

fallow imp
#

off-topic to luckperms but will CompletableFuture's whenComplete be completed in the same async task that the CompletableFuture got completed in?

#

or will it be completed in the main thread somehow?

main dagger
#

#general for non-lp stuff, but i dont see why that would happen in the main thread

fallow imp
#

Yes me2, just want to make sure, logically I imagined it will run in the same async thread, I hope LuckPerms doesn't complete the CompletableFuture using the main thread by going back to it before using the #complete method, because I want to use the same thread as much as I can. However, thanks, I didn't type in general because I thought it's for "how to set player prefix using /lp" questions

main dagger
fallow imp
#

Alright thanks

green hamlet
turbid solar
#

yes

nocturne elbow
#

hey

#

so im tryna check a users permissions on waterfall at PreLoginEvent

#

how does one check permissions off of a string of a uuid or username

#

cause what im trying to do is IF user does not have antivpn.bypass then ple.setCancelled(true)

#

the api is very confusing to me

#

(user.data().contains(PermissionNode.builder("antivpn.bypass"), player.toString())) {

#

like imo should not be this hard to check a player for a permission using the api

#

But uh I don't think that player.toString is ever going to work out

jaunty pecan
#

it is not available in the PreLoginEvent

nocturne elbow
#

omg

#

great so i gotta build my anti bot into my queue plugin bru

#

not a bad feature for 6.0 ya know what ima do it thanks

jaunty pecan
#

there is a good reason for it fyi

nocturne elbow
#

what is it lol

jaunty pecan
#

PreLoginEvent is called before authentication with mojang

#

so the players profile/uuid/etc isn't known

nocturne elbow
#

o okay

#

atleast this way i can do the best option i got which is dont allow connections at all unless they have the permission

#

my anti bot is a website where u put your username and it adds a permission

crimson ferry
#

How can I listen/subscribe to UserUpdateMessage ?
(I want to do something when a User gets updated / gets a new primary parent)
(When I use the NodeAddEvent, and I update a Users group on the Server, it won't trigger that event on the bungee. (bungee listens to that event))

turbid solar
#

!api

frank driftBOT
turbid solar
#

nvm

#

i think it'll work if you publish your changes with the messaging thing

#

check pins

still gulch
#

Is NodeAddEvent fired every time a permission is changed in luckperms be it webpage or command?

main dagger
#

the NodeAddEvent - called when a node is added to a user/group

#

i would assume that this is fired when changes in the editor are applied/saved and cause a node to be added to a player or group

vital grove
#

hello i was wandering if you can help me with this, i am making a bungeecord plugin and trying to check if a user is a group. i have done this:

    String[] ranks = {"owner", "admin", "gamemaster", "builder", "youtuber", "mvp++", "mvp+", "mvp", "vip+", "vip", "default"};
    Collection<String> ranksCollection = Arrays.asList(ranks);

public void execute(CommandSender commandSender, String[] args) {
  ProxiedPlayer p = (ProxiedPlayer) commandSender;
  if (getPlayerGroup(p, ranksCollection).equals("mvp++")) {
  }
}
    public static String getPlayerGroup(ProxiedPlayer player, Collection<String> possibleGroups) {
        for (String group : possibleGroups) {
            if (player.hasPermission("group." + group)) {
                return group;
            }
        }
        return null;
    }

but even if i am in the mvp++ group it doesn't run the code after

#

anyone?

surreal citrus
#

see if that works

main dagger
#

!cookbook this is probably more useful than an ai that doesnt actually understand code

frank driftBOT
vital grove
#

i will try using this if (user.getPrimaryGroup().equals("mvp+")) {

main dagger
#

btw you can just do a normal permission check for the group.<group name> permission

vital grove
surreal citrus
surreal citrus
main dagger
#

using your platforms built-in way to check permissions is far simpler than relying on the lp api for just that

radiant path
#

how can i get a prefix from a grup

main dagger
#

!cookbook

frank driftBOT
surreal citrus
#

I was more or less asking in terms of effectiveness, rather than simplicity, but I understand the point

silk star
#

Good morning! Could someone possibly help me find out how long a rank will remain? I would like to make a /rank command that indicates how long a rank still exists. And if it is permanent, also permanently displayed. I thought I had seen something about it here before, but I canโ€™t find it ๐Ÿค”

frank driftBOT
untold lantern
#

!arrange

frank driftBOT
#

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

untold lantern
#

!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
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!velocitycheck
!verbose
!version
!weight
!whyluckperms
!wiki

vital grove
#

does anyone know why this doesn't work?

                                user.data().add(PrefixNode.builder("&6[MVP&d++]", 1).build());```
turbid solar
#

did you save the user

vital grove
#

oh

#

no

#

and how do i save?

#

like this?

#
LuckPermsProvider.get().getUserManager().saveUser(user);```
nocturne elbow
#

yes

vital grove
#

ok thanks

vital grove
#

could you please help me make it instead of adding prefix to changing

#

because if i add it doesn't work the same (can't be seen)

main dagger
#

remove the old one first

vital grove
#

how to do so

turbid solar
#

!cookbook

frank driftBOT
vital grove
turbid solar
#

look in setprefix command

vital grove
#

user.data().clear(NodeType.PREFIX::matches);?

#

i will try and see

#

thanks though!

vital grove
#

but also do you know why

#

i have to relog for it to work?

#

(use the other prefix)

turbid solar
#

your chat plugin

vital grove
#

essentialsxchat

#

but i am making a bungeecord plugin and connecting using mysql

daring sandal
#

Is there a way to detect when a temp added parent is removed from a player?

unreal mantle
#

Listen for the NodeRemoveEvent I think it is

vital grove
#

!cookbook

frank driftBOT
vital grove
#

(Whenever i change the prefix the user has to relog for the apply to happen btw i am updating from proxy and have it connected with mysql to the backened)

fallow imp
#

Should I close the eventbus or what?

#

Found it, so it's for unregistering the listener (btw disabled mention ping)

nocturne elbow
pliant crow
#

Just would like to know if you are able to see the duration left on a settemp node with the API, if its on the docs, i will try to look for it again because i probably couldn't find it

pliant crow
#

omg my notifications are so loud, anyway thanks ill try this

pliant crow
#

sorry for ping forgot to turn that off

main dagger
#

getExpiry() returns the time that it expires, getExpiryDuration() returns the amount of time remaining. they both accomplish the same thing in different ways

empty fable
#

!colours

frank driftBOT
empty fable
#

!placeholders

frank driftBOT
daring sandal
#

how does one check if a Node represents a group?
I currently check if the key is group.<group> but idk if that's the proper way ๐Ÿ˜ฌ

        return nodes.stream()
                .filter(Node::getValue)
                .filter(it -> it.getKey().equalsIgnoreCase("group." + plugin.getGroup()))
                .findFirst()
                .orElse(null);```
#
        return nodes.stream()
                .filter(NodeType.INHERITANCE::matches)
                .map(NodeType.INHERITANCE::cast)
                .filter(Node::getValue)
                .filter(it -> it.getGroupName().equals(plugin.getGroup()))
                .findFirst()
                .orElse(null);```
Welp, I think this is better
main dagger
#

probably just if its group.something and something exists as a group

#

theres nothing special about group nodes other than how luckperms handles it

#

as in they are stored the same way

vital grove
#

Here:
CompletableFuture<Void> future = ; // action (any that writes to storage)

#

how to put this command in

#

user.data().add(PrefixNode.builder("&b[MVP&c+&b] ", 1).build());

#

i do this?

#

CompletableFuture<Void> future = LuckPermsProvider.get().runUpdateTask();

main dagger
vital grove
#

right!

#

i will try

#

it works!

daring minnow
#

Let's suppose a group has no weight set. Behaviorally, how does LuckPerms compare a group without weight to a group with a defined weight?

My best guess would be that LuckPerms treats groups with a defined weight as having a greater weight than groups without a configured weight. Is that correct?

wild whale
#

I'd imagine no weight probably defaults to weight of 0

night pier
#

!api

frank driftBOT
reef stream
#

where can i get version for 1.12.2 forge

hasty viper
#

How would I go about removing/overriding a Player's prefix set by a group? (I am trying to switch a Player's prefix, while still being able to reset to their original group prefix)
This is what Im trying, but it's not removing the group prefix and ends up giving 2 prefixes, the one I'm trying to set, and Player's primary group prefix

      LuckPermsProvider.get().getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
                  user.data().clear(NodeType.PREFIX::matches);

                  Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
                  int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i + 10).max().orElse(10);

                  Group group = luckPerms.getGroupManager().getGroup(rankPrefix);
                  String prefix = group.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefix();
                  Node node = PrefixNode.builder(prefix, priority).build();
                  user.data().add(node);
              });```
sonic marsh
#

What is the correct way to add a permission to a player or group just for the current server, and not for any other servers?

#

I'd like it to be temporary to that instance of a server, and when that instance is destroyed, the permission should be too

#

and it should not interact with other servers at all, at risk of that player getting the permission in other servers

#

And unlike using contexts, these permissions are generated at will

#

oh, and I can't use a local database for each server, because some content (eg. prefixes, etc) needs to be synced between all servers

sonic marsh
#

Tldr; of that is that I need to make a custom permission handler that can inject into luckperms somehow.
Is that possible in any way?

nocturne elbow
#

why not use contexts?

#

you can add contextual permissions with the api

sonic marsh
#

because I don't really want to end up with 1,000s of permissions in my default group

#

I'd like to keep that part simple

#

and just adding a small permission handler would be the perfect solution

#

imo

nocturne elbow
#

do you need them to be stored in storage?

sonic marsh
#

No

nocturne elbow
#

transient node map

sonic marsh
#

thanks!

#

I forgot the name, I think you told me about them before lol

nocturne elbow
sonic marsh
nocturne elbow
#

yes

sonic marsh
#

awesome

hasty viper
nocturne elbow
#

No, the meta stacking is precisely to configure how it behaves when it finds multiple prefixes/suffixes, when inherited etc

#

That doesn't clear the primary group prefix because that's the user's own node map, the prefix from the group resides in the group

#

What chat plugin are you using? Perhaps its settings are misconfigured

hasty viper
#

Hmm, I'm using TownyChat (on test server), but everything looks normal there, when I try changing my prefix to the rank that is my current primary rank, I Only get 1 prefix, however if I try to use that above code to change to another I get double, here is how it looks in for lp info

Would increasing the weight on the prefix I'm setting work?

main dagger
#

if it shows correctly in /lp user <name> info luckperms is doing its job

hasty viper
#

Alright thats super helpful to know, thank you!

fallow imp
#

Hello, does the loadUser method force reloads the user or uses the cached user in memory if available?

#

Feel free to ping me

unreal mantle
fallow imp
#

what if the player is already playing on the server and in another word is already loaded?

#

The user manager is poorly documented

wheat lake
#

From my understanding of how plugins works, playing in a different world on the same server doesn't matter since plugins are loaded per server and not per world.

upper nacelle
#

I would assume he is talking about another instance of LP running somewhere

upper nacelle
#

In that case, only one LuckPerms instance runs per server.

#

All operations are local for your case

#

#loadUser will pull from memory cache if avalible, however expect it could be blocking if it has to go to the DB

fallow imp
#

I'm making a command to change the data of the player who sent it, all of what I want is using the cached data which is stored in the memory instead of reloading the player from the database. However I want to use the UserManager#modifyUser method, and I was talking about the UserManager#loadUser because what UserManager#modifyUser does is loading the user, modifying him and unloading, but sounds it loads from the database everytime it's called so after looking in the sourcecode and making sure, I will manually write the UserManager#modifyUser code but by using the UserManager#getUser instead of UserManager#loadUser, I know the problem is not that hard and may be solved by 2 more lines of code, but I wanted the efficient way and writing less code

upper nacelle
#

#modifyUser will not go to the DB if it has it cached locally

fallow imp
#

Sure? I can't find anything related to what you're saying in the docs

upper nacelle
#

Test it

fallow imp
#

Bruh moment

#

I really hate debugging

upper nacelle
#

Then you need to find a different hobby XD

fallow imp
#

Even if I love LuckPerms, this case is important to be documented :/

upper nacelle
#

!api

frank driftBOT
upper nacelle
#

Have you read all those pages

#

!cookbook

frank driftBOT
fallow imp
# upper nacelle Then you need to find a different hobby XD

I don't really hate it, but docs already exists and the dev already knows, so it should be documented, "debug to see if it works" is not efficient and annoying, and in this case will be painful to debug. What would you do that makes you confident that it doesn't load from the database if the data already exists in the memory? Let's say I use MySQL, I will have to change the player's data from the database table and then debug the UserManager#modifyUser to see if it took the new changed data? Doesn't that look stupid and annoying? I really prefer writing the code manually instead of "test to see if it works"

fallow imp
#

but not "all"

upper nacelle
#

What's wrong with this?

#

It's safer to use this, as if the user is unloaded for some reason, it will not block your entire server.

fallow imp
#

Let me explain more, I will be using it for a already loaded player, and the loading process as it always takes data from the database for a already loaded player is not efficient nor good for performance. The player is already loaded, I don't want it to reload the player, I want it to use the already loaded user. However I'm done with this I will write it myself, 3 lines of code.

upper nacelle
#

If you've already verified that the user is loaded, just #getUser

fallow imp
#

yes I'm going to use it

#

thanks

vital grove
#

hello, i am trying to send a users prefix from the bungeecord server to the backend server using bukkit-bungee-plugin-messaging-channel. It kind of works it sends the prefix but infront of it sends a symbol for example (โ—„&c[OWNER] AA12Pro) is that supposed to be happening and if yes how to disable/bypass it

upper nacelle
#

If that symbol is not in your LP prefix, then it would sound like some decoding issue with whatever bytestream encoding you are using.

vital grove
#

it isn't in the prefix

upper nacelle
#

On the proxy log the prefix before you send it

vital grove
#

and to decode it i am using this java if (s.equalsIgnoreCase("network-essentials:nicked-chat")) { ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(bytes); try { Bukkit.getConsoleSender().sendMessage(name); name = IOUtils.toString(arrayInputStream, StandardCharsets.UTF_8); getConfig().set(player.getName(), name); saveConfig(); } catch (IOException e) { e.printStackTrace(); } }

#

i have made a nick plugin

#

and i have it made it

#

so it doesn't change the prefix

#

but only the name

vital grove
#

ok

#

its normal

#

&c[OWNER]

upper nacelle
#

Now log it right after decoding on the ds

vital grove
#

i have done that

#

and it shows tha

#

after decoding the backend server sends this

#

โ—„&c[OWNER] AA12Pro

upper nacelle
#

That means it's some decoding/encoding issue

vital grove
#

hm

#

and how do i fix that

#

this is how i encode it:

ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
                        try (DataOutputStream out = new DataOutputStream(arrayOutputStream)) {
                            out.writeUTF(prefix + BungeeMain.getData().getString("Player." + p.getUniqueId() + ".Nickname"));
                            p.getServer().sendData("network-essentials:nicked-chat", arrayOutputStream.toByteArray());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }```
upper nacelle
#

UTF

vital grove
upper nacelle
#

Decoding:

  ByteArrayDataInput in = ByteStreams.newDataInput(message);
  in.readUTF()
vital grove
#

let me try

upper nacelle
#

read/write UTF has encoding chars

#

that's what you are seeing

#

like nullterms

vital grove
#

i didn't undestand

upper nacelle
#

Did that decoder work?

vital grove
#

i don't know its building

upper nacelle
#

DataOutputStream#writeUTF has encoding chars around your string, as it's designed to load a bunch of crap into a bytestream, and you just decoded it manually without processing it

#

I thought it would only be a single nullterm at the end but I guess it's more

vital grove
#

your way worked thanks!

#

&c[OWNER] AA12

pulsar beacon
#

Is there any way to make a range can give ranks but only those that are below it?

frank driftBOT
main dagger
pulsar beacon
#

ok

snow flame
#

!paste

frank driftBOT
#
Please use pastebin!

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

For console errors:

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

Other errors:

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

snow flame
#

I need help
SO
i am making a plugin for playerjoinevent
and i want different join messages for different rank
Here is the code i got so far

#

But it is giving me a error
Here is the config i am using for it

#

And here is the error it is giving

#

@unreal mantle

frank driftBOT
#

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

snow flame
#

Sir here is the code

#

sorry for he morning

#

accidentally post the thing there ๐Ÿ˜…

main dagger
#

because "this.luckperms" is null
when do you create your reference to the lp api?

snow flame
#

Here is full class ss

main dagger
#

so you dont set its value to anything...?

snow flame
#

What's value?

main dagger
#

you need to get the instance of the api

#

!cookbook

frank driftBOT
snow flame
#

This thing ?

unreal mantle
#

That's not how you add LP to a plugin

snow flame
#

Um

#

I have never worked with API before

unreal mantle
snow flame
#

So do i have to add this

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

to this file

#

???

main dagger
#

i think that is What It Says

snow flame
#

O k ok

#

@main dagger

frank driftBOT
#

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

night pier
#

Why are you pinging for no reason

snow flame
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.4</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>```
#

that how i add it ?

unreal mantle
#

Yes

snow flame
#

Not working

#

Ok lol it is working now when i restarted IDEA

#

So sir @unreal mantle

frank driftBOT
#

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

snow flame
#

the plugin should work now ?

#

or do i have to do other things

wheat lake
night pier
#

Doesnโ€™t always work. Sometimes you have to invalidate caches.

snow flame
#

Oh ok thanks for tip

wheat lake
#

From now on you can use the LP API in your plugin. Keep in mind you still need the LuckPerms plugin in your (test)server.