#luckperms-api

1 messages ยท Page 50 of 1

sinful ibex
#

yes

wild whale
#

.

sinful ibex
floral panther
wild whale
#

^

sinful ibex
wild whale
#

We're now entering the territory of "If you don't know java before trying to use the LP api, you're going to have a bad time"

#

What's your end goal here?

#

@sinful ibex ^

sinful ibex
#

i want to block player command ( Tab complete ) who dont have luckperms permissions

wild whale
#
  • You can do perm checks on Bukkit without depending on LP: Player#hasPermission
  • Blocking tab complete for commands w/out perms is already built into bukkit
sinful ibex
floral panther
#

Hey ๐Ÿ‘‹
I have a question regarding contexts. @sonic wolf and me just wrote an integration so BetonQuest provides it's tags as LP contexts. However, after doing these changes it does not work anymore:
https://github.com/BetonQuest/BetonQuest/pull/1633/files
We made sure the lambda code get's executed, it looks correct in the debugger. But the contexts are not showing up on the player when using a lp permission check command.

wild whale
#

contexts don't show up on lp p check iirc. Have you checked lp user <> info?

nocturne elbow
#

Bukkit.getScheduler().runTaskAsynchronously
why

#

context calculators are to calculate contexts on the spot

floral panther
nocturne elbow
floral panther
#

It's async because there are database queries involved when no PlayerData is loaded which may happen in edge cases.

nocturne elbow
#

check the description for the ContextCalculator interface

floral panther
#

lmao that is actually the issue

#

Thank you!

nocturne elbow
#

mhm mhm

#

yw

nocturne elbow
#

hi

#

Hey, I plan to do in the listener so that the player can use the item if he has a VIP range but I don't know how I use this plugin for the first time

#

in permissionex I did it like this if (pu.inGroup ("owner") &&! player.hasPermission ("core.plugins")) {

nocturne elbow
#

tbf you can just check if player.hasPermission("group.vip")

#

though that will account for wildcards and, if you're on bukkit, probably op status (depends on config but it will by default)

#

I want to do this for the group

#
    public void onPlayerCommandPreprocesss(final PlayerCommandPreprocessEvent event) {
        final Player player = event.getPlayer();
        final User u = UserManager.getUser(player);
        LuckPermsApi api = LuckPerms.getApi();
  
        Group group = api.getGroup("owner");
            
            final String message = event.getMessage();
            final String[] splittedMessage = message.split(" ");
            final String[] pluginCommands = { "/op" };
            if (containsIgnoreCase(pluginCommands, splittedMessage[0])) {
                event.setCancelled(true);
                ChatUtil.sendMessage((CommandSender)player, "&cno permission");
            }
        }
#

I did it, but it doesn't work, I can do it in another way without using maven?

#

err, what "other way" and.. what are you depending on exactly?

#

is this v4 API?

#

without using the maven

#

why would you not use maven?

nocturne elbow
#

the latest api matches

#

what?

#

can you share your pom file?

#

!pasteit

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ 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!

nocturne elbow
#
  <modelVersion>4.0.0</modelVersion>
  <groupId>UHC-testowe</groupId>
  <artifactId>UHC-testowe</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>

      <dependency>
          <groupId>me.lucko.luckperms</groupId>
          <artifactId>luckperms-api</artifactId>
          <version>4.4</version>
          <scope>provided</scope>
      </dependency>
  </dependencies>
</project>
#

christ, use a paste site

#

and yes that's v4 API, don't know how you got there

#

ok

nocturne elbow
#

that's like, the easiest and least convoluted way tbf

#

?

#

without the <>

#

usually <something> means "fill in the blank"

#

other than that, yep, that's how I'd do it

#
            Bukkit.broadcastMessage(ChatUtil.fixColor("&7[&AI&7] &7(&6&lVIP&7) &c" + pu.getName() + " &7join 
&cMutant!"));
        }```
nocturne elbow
#

are you reading any of what I'm saying?

#

it does not work

#

what does not work?

#

this is for permissions i want on the group

#

what?

nocturne elbow
nocturne elbow
#

holy

#

okay

#

I'm out

nocturne elbow
# nocturne elbow holy

i updated my Server to the 1.13.2 and had to see that PermEx didn't get an Update, so i had search a liitle bit and found LuckPerms.
Now i have to Update all of my Plugins to work with LuckPerms, but how can i get the User group?

In Pex i used this:

PermissionsEx.getUser(p).inGroup("owner")

But how does it work in LuckPerms? I implementet the Plugin.jar in my Project and tried to find it, but it doesn't.

Thanks for the Help!
Sullaysur

#

Are you deliberately not reading my messages?

#

I read, I checked as you said, but it does not work, I gave myself a group and it does not work

#

how does it not work?

#

did you debug in any way?

#

yes

#

how?

#

what was your debugging process?

#

I did if (! player.has Permission ("group. <owner>"));
I gave the owner to myself and nothing

#

spigot debuger

sudden pelican
nocturne elbow
#

no I fired these <> and it still does not work

#

but this is still for permissions

nocturne elbow
#

and what is a "spigot debugger"?

#

plugin

#

my mistake I am a bit tired and in general I talk in a different language on a daily basis I just don't want to go for permissions only for a given group in luckyperm

#

for permissions, I know how to do

#

for example if (! player.hasPermission ("core.plugins")) {but that's not what I mean

#

yes, and you can also use that same function to check for group membership

#

in api documentation there is no way to check a specific group, it is just how to check if a player has a group

#

a parent group is literally just a group.<group> permission node

#

player.hasPermission("group.vip") or player.hasPermission("group.owner") or player.hasPermission("group.default")

#

and this is like the very first thing shown in the API Usage documentation

last merlin
#

Whats the best way to get the top inherit group for a player

#

i dont wanna loop through 30 groups

#

@nocturne elbow

frank driftBOT
#

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

nocturne elbow
last merlin
#

sorry

nocturne elbow
#

reading too hard?

last merlin
#

i cant read english that well

nocturne elbow
#

but you understand the exact same thing after pinging

last merlin
#

Yes

#

I don't read stuff that is difficult for no reason

last merlin
#

thx]

#

My api wont load

#

its in my depend

nocturne elbow
#

what makes you think it doesn't?

#

any errors?

last merlin
#

Caused by: java.lang.IllegalStateException: API is not loaded.

#

LuckPerms.getApi()

#

Using this

nocturne elbow
#

how are you building your plugin

#

maven gradle ..?

last merlin
#

maven

#

im not shading

#

wtf

#

its shading

#

ok fixed

#

Nvm

#

still says it

nocturne elbow
#

share the whole error

last merlin
#

well i put <scope>provided

#

and it stil shades

nocturne elbow
#

might need to clean before rebuilding
maven does weird things sometimes that need cleaning

last merlin
#

ok i clean now trying

#

nah still there

nocturne elbow
#

share your pom ig

last merlin
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.8.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>me.lucko.luckperms</groupId>
            <artifactId>luckperms-api</artifactId>
            <version>4.0</version>
            <scope>provided</scope>
        </dependency>
nocturne elbow
#

the whole pom

last merlin
#
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

nocturne elbow
#

the whole pom

#

the file

#

the entire thing

last merlin
frank driftBOT
nocturne elbow
#

thank you

last merlin
#

np sorry

#

wait waht

#

the shaded jar doesnt shade it

#

but the other one does

#

??? lol

nocturne elbow
#

"other one"?

last merlin
#

The shadeed

#

but it still dont load

#
 @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player player = e.getPlayer();
        player.setScoreboard(board);

        String group = LuckPerms.getApi().getUser(e.getPlayer().getUniqueId()).getPrimaryGroup();

        for(String rank : plugin.getConfig().getConfigurationSection("tab.ranks").getKeys(false)) {
            if(group.equals(rank)) {
                for(String nameRank : teams.keySet()) {
                    if(nameRank.equals(rank)) {
                        teams.get(nameRank).addEntry(player.getName());
                        System.out.println("Set " + player.getName() + " rank to " + nameRank);
                        return;
                    }
                }
            }
        }
  }
nocturne elbow
#

you should be using 5.3 API, not v4 lol

last merlin
#

wtf

#

maven central

nocturne elbow
#

v5 api is not compatible with v4

#

what does central have to do with any of this

last merlin
#

i got the pom from there

#

the depency

last merlin
#

got it

nocturne elbow
last merlin
#

yea

#

LuckPerms api = LuckPermsProvider.get();
String group = api.getPlayerAdapter(Player.class).getUser(player).getPrimaryGroup();

#

should be sorted now

nocturne elbow
#

looks good

pseudo eagle
#

Is there a luckperms event that is called only when the player's parent set changes?

nocturne elbow
#

No

#

@pseudo eagle ^ and the event target is a User

celest bridge
#

how can i get rank prefix from api?

nocturne elbow
#

I think this will point you into the right direction. (Found via discord search function)

obtuse jolt
#

you need to actually save it.

#

!api

frank driftBOT
torn shale
#

what is the api to show how long i will lose my temp rank?

#

gรบy

#

guys

bright tapir
#

probably User#getTransientNodes, Node#getExpiryDate?

torn shale
#

which one?

obtuse jolt
obtuse jolt
torn shale
#

Can you write me the api idk what u mean

night pier
#

the API is already there. all you have to do is add it to your plugin, and use it.

soft field
#

is there something that returns every user in a group?

obtuse jolt
torn shale
#

but what api say the expiry day of rank?

balmy cliff
#

Hey. So I was wondering which event allows me to listen to users being put into groups?

lime rune
#

Out of curiosity why is LuckPerms using 32 as parallelism for its FJP?

nocturne elbow
nocturne elbow
wooden fable
#

is there a way to demote in a Track but not allowing to leave the Track? i.e. demote unless it kicks out of the Track

wild whale
#

check if the demotion would take them off the track, and if it would, don't demote?
should be a simple if

wooden fable
#

get the current group and check if it's the first group on the Track?

nocturne elbow
#

yes

#

ah nice kekw

zinc shuttle
#

Oh

#

Discord compressed that lol

#

That's better

silver sleet
#

Not really API, but it probably fits here best, so:
What would be the best way to listen to LuckPerms data changes from a standalone program?

silver sleet
#

Monitoring microservice

#

Also maybe a discord bot, not sure about that one though

obtuse jolt
#

its either read directing from database or write a mc plugin that interace with a web api service like discord bot

jaunty pecan
silver sleet
#

Also, couldn't I just write a standalone module?

jaunty pecan
#

you could, but it's probably easier to just run a velocity instance

#

it has basically no overhead when players aren't connected

#

at least, not enough overhead to worry about

tardy topaz
#

Okay, I don't know who wrote the documentation, but this is what I live for

obtuse jolt
tardy topaz
#

ofc

#

I would personally use a callback/consumer

#

but I just like the method name kekw

#

Hmm, if a user doesn't belong to a specific group, does User#getPrimaryGroup just return "default"?

nocturne elbow
#

eehh that method..; by default, yes, but you can change some settings and run some commands here and there and then it may be different

#

but like in 99.99% of the cases it will be the parent group with highest weight (default if they have no other)

tardy topaz
#

okay, good

#

I need whichever one has the highest weight

#

ty

silver sleet
#

I'm listening to the UserDataRecalculateEvent and it doesn't get called when I change the prefix of a group the player is in. Is that intended behaviour? And if so, which event should I listen to to catch that kind of stuff?

nocturne elbow
#

Yeah well, for groups there's GroupDataRecalculateEvent

#

Hmm

silver sleet
#

Is there a method to get the InheritanceNode of a group?

nocturne elbow
#

InheritanceNode.builder ?

silver sleet
#

Ah, looks about right, Thanks

static jasper
#

poor question but anyway :( How invasively can i intercept user meta through the api/whatever? let's say i have a meta stacking setup with multiple format entries, one of them being a highest_on_track_ranks sorta thing, and I want to give certain players a completely custom rank that would go in the same prefix slot. Ideally I'd want to have that prefix info directly on the user, otherwise I'd need a track with a billion entries for each user. Is that feasible through the API or should this be done on like, the chat-plugin level or something? or thinking about it now the best solution would probably be to dynamically construct that track and just accept that it's really long but i guess asking for ideas since i dont know the API

nocturne elbow
#

Well hello there

#

What do you mean by "a completely custom rank"? What's different in it that other groups and what is it to do with the track?

#

Do you want to "replace" the meta stacking entry with that group's prefix?

static jasper
#

a completely custom rank meaning per-player, so i'd like to avoid groups and attach it to the user directly, which ofc means i lose all sorts of group and track context

#

also hi

nocturne elbow
#

So you just want to add a prefix?

#

Like, actually "add" to the stacked ones? You could use highest_own for that and put the prefix node in the user data

static jasper
#

right, and the duplicate resolver would make sure that all of the other stuff would stay as is if an user doesn't have such a special rank?

nocturne elbow
#

what

static jasper
#

oh highest_own oops

nocturne elbow
#

Yeah, that entry will ignore inherited prefixes/suffixes

static jasper
#

๐Ÿ‘ i think i can make this work, thanks emi

nocturne elbow
#

โ˜บ๏ธ

torn shale
#

!tab

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

LuckPerms only acts as the source for prefixes / suffixes, it doesn't actually apply them. You need an appropriately configured chat/tablist formatting plugin for them to be displayed. If the values appear correctly when you run /lp user <user> info, LuckPerms is doing its job!

List of chat/tablist formatting plugins that work with LuckPerms
leaden iron
#

Why is this happening?
18:55:25 [SEVERE] Caused by: java.lang.NoSuchMethodError: net.luckperms.api.cacheddata.CachedDataManager.getPermissionData()Lnet/luckperms/api/cacheddata/CachedPermissionData;

wild whale
#

Either you've got a corrupted LP jar downloaded, or your LP version and the version of LP you're depending on for the API differ

leaden iron
#

Thank you for explaining it to me

#

The api version differ from the LP version on server lol

torn shale
#

What is the placeholder api that show the expiry day of rank? I set temp rank in my server

nocturne elbow
#

!placeholders

frank driftBOT
nocturne elbow
torn shale
ocean citrus
#

is there something wrong here?

List<String> groups = new ArrayList<>();
plugin.getApi().getGroupManager().getLoadedGroups().forEach(group -> {
            if (player.hasPermission("group." + group))
                groups.add(group.getName());
        });
#

or is it "group." + group.getName()?

nocturne elbow
#

You would use the name, yes

quiet hornet
#

para la 1.18.8 si esta no ?

#

for 1.18.8 if not?

nocturne elbow
#

what?

#

that is not even a version that exists

#

But all in all, the API is completely independent from the Minecraft version and modding platform

leaden finch
#

what do i put in repository in my plugin to import luckperms api?

#

i only found dependency

obtuse jolt
#

its on Maven Central

leaden finch
#

on the page

obtuse jolt
unreal mantle
#

Only the dependency

leaden finch
#

oh okay

leaden finch
#

how to know if player is already in "vip" group or not?

night pier
#

/lp user <user> parent info will show all of their groups

leaden finch
#

no in api

night pier
#

Facepalm mb

obtuse jolt
#

tbh you dont need lp api for that. Its just a simple hasPermission check of group.<groupname> permission node.

obtuse jolt
#

๐Ÿ˜ณ

unreal mantle
leaden finch
#

if(player.hasPermission("vip")){

#

will this work?

#

i am trying to get group of player

#

if its vip

obtuse jolt
#

did you read what I just said lol

#

group.<groupname> permission node.

leaden finch
#

if(player.hasPermission("group." + vip)){

#

lol pls dont laugh

unreal mantle
#

Close but not... lol

leaden finch
#

whats wrong again

#

now

#

lol

unreal mantle
#

group.<groupname> is the full permission, so doing group. + vip is redundant unless that vip changes

#

Unless you are wanting to change for different groups, just do "group.vip"

leaden finch
#

ok

#

if(player.hasPermission("group.vip")){

unreal mantle
#

Looks good.

leaden finch
#

now how do i assign group to user?

obtuse jolt
leaden finch
#

for temporary

#

like say 3 days

obtuse jolt
unreal mantle
ocean citrus
#

this doesnt seems to work

public static List<String> getPlayerGroups(Player player) {
        List<String> groups = new ArrayList<>();
        groupManager.loadAllGroups().whenComplete((v, th) ->
                groupManager.getLoadedGroups().forEach(group -> {
            if (player.hasPermission("group." + group))
                groups.add(group.getName());
        }));
        return groups;
    }
#

maybe i'm doing something wrong

nocturne elbow
ocean citrus
#

i know but that didnt work either

nocturne elbow
#

What is "that"?

ocean citrus
#

trying to put the groupname and the prefix into a map

#

this gets the playergroups

#

and after that i get all the prefixes

nocturne elbow
ocean citrus
#

hmmm

nocturne elbow
#

Using the loaded groups will suffice unless you are unloading groups

ocean citrus
#

i tried that but for some reason i got a npr at the group so i thought they werent loaded or something

#

my bad

nocturne elbow
#

Hm

bright tapir
#

hi there, I'm having a somewhat unique issue

nocturne elbow
#

okay

bright tapir
#

wow I was not expecting someone to respond that fast, 100% should've typed it out before I said anything lol

night pier
#

you should always do that ๐Ÿ˜‰

bright tapir
#

I'm promoting players to higher levels on a track using this very basic method

public void promote(final Player player, final String trackName) {
    final User user = Objects.requireNonNull(this.luckPerms.getUserManager().getUser(player.getUniqueId()));
    final Track track = Objects.requireNonNull(this.luckPerms.getTrackManager().getTrack(trackName));
    track.promote(user, ImmutableContextSet.empty());
    this.luckPerms.getUserManager().saveUser(user);
}```
the issue is that when promoting the player multiple times, they seem to keep the old rank which they were promoted from. this issue disappears if I do `/lp user <user> info` between each promote
nocturne elbow
#

Objects.requireNonNull ๐Ÿ˜ท

bright tapir
#

shh it's dev

night pier
nocturne elbow
#

the way it's being used

#

btw you can use the PlayerAdapter if you have a Player object

#

ideally you would

bright tapir
#

will do. any idea about the issue, though?

nocturne elbow
#

LuckPerms::getPlayerAdapter or smth

#

"multiple times" as in one after the other or after long periods?

bright tapir
#

one after the other

#

same as running /lp user promote <user> track <track> multiple times in rapid succession

#

if it'd help, I could send a video of what I'm talking about

nocturne elbow
#

sure ig

#

my guess is that they're being promoted before the data is stored so it goes silly or something

bright tapir
nocturne elbow
#

hmm

bright tapir
#

if you'd like, I can throw some more code snippets on paste

nocturne elbow
#

I'm assuming you just call the promote function in the command and that's about it? Or is there more to it?

bright tapir
#

it does also check if the player has another group on the track, do you want me to share the handler code?

#

let me just try the promote method on its own

nocturne elbow
#

Well, LP will check that too, the Track::promote method returns a PromotionResult (I think that's what it's called?), I'm sure it'll be useful

bright tapir
#

issue is still happening with this command handler code ```java
final var sender = (Player) c.getSender();
this.luckPermsService.promote(sender, "player");

nocturne elbow
nocturne elbow
#

oh yeah this

#

i forgor ๐Ÿ’€

nocturne elbow
#

yeah idk it works fine for me Shrug

#

@bright tapir can you add a debug line on saveUser(user).whenComplete to see if and when the user data is saved?

bright tapir
#

ye

bright tapir
#

forgot to log the promotion result, here's a video showcasing that as well. (handler code was changed only by wrapping #promote with Player#sendMessage)

#

I'm heading to sleep for the night, but do feel free to ping me if you have any ideas on why this is happening

nocturne elbow
#

what LP version are you running?

#

How is it even promoting ..

limber marsh
#

Hey, it might be a silly question, but that would be the equivalent of /lp user <player> parent add <group> from the API?

wild whale
# limber marsh Hey, it might be a silly question, but that would be the equivalent of `/lp user...

See this example from the cookbook, just ommit L59 (which removes all other groups like /lp user <who> parent set <g> does)
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java

GitHub

Tasty recipes (sample usage) for the LuckPerms API. - api-cookbook/SetGroupCommand.java at master ยท LuckPerms/api-cookbook

chrome geyser
#

hi

#

how can add a few days of a group to all players?

#

i was looking for something like this

#

idk

#

ah?

nocturne elbow
chrome geyser
#

note that i do not intend to use this often

#

just like once

#

i guess that the new node will overwrite the old one

#

luckperms works that way i think

nocturne elbow
#

Node#getExpiry will return null if it isn't a temp node

snow ember
#

When do I need to call LuckPermsProvider.get() in Fabric?

nocturne elbow
#

I believe after SERVER_STARTING is fine

snow ember
#

alright ill try that

nocturne elbow
#

Definitely safe on SERVER_STARTED once everything's been initialized

snow ember
#

would prefer to be before then so everything is good to go before its all loaded

#

looks like SERVER_STARTED does it

nocturne elbow
#

Sweet

bright tapir
nocturne elbow
#

Yeah man I don't know. That's really weird

#

How is it able to promote in the first place

#

There was an issue with promotion/demotion actually not removing the previous group node, but that was like a single version and way before v5.3 I believe, but it also did fail when you tried to promote again

#

What happens if you try to promote consecutively by running the LP promote command instead?

thick knoll
#

How do I get the net/luckperms/api/LuckPerms class if I have BungeeCord version of LuckPerms installed? I'm newbie to plugin development and I don't know anything about a bunch of spigot> bungee

#

Or do a plugin special for bungee?

nocturne elbow
#

I would assume that if you have something to do for bungee, then do it for bungee. Backend servers don't know that a bungee exists nor do they check that to begin with. It would be news to me if they did

thick knoll
obtuse jolt
bright tapir
weary wyvern
#

luckPerms.getUserManager().searchAll(PermissionNode.builder("my.permission").build());

I need the right equivalent of this.

#

I want to get all users with a certain permission offline also

obtuse jolt
#

that means you need to load all the users, which is possible but very bad for performance

weary wyvern
bright tapir
#

youโ€™re probably looking for User#getPrimaryGroup

night pier
#

!cookbook

frank driftBOT
nocturne elbow
#

my frentch

#

hello

#

je suis francais

frank driftBOT
#

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

nocturne elbow
#

svp

neat jackal
#

!ask

frank driftBOT
#
Please ask your question!

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

Or, try here first:
Why shouldn't I ask to ask?
nocturne elbow
#

merci

nocturne elbow
#

@iron matrix how are you building your plugin? maven, gradle, or what ..?

iron matrix
#

maven

nocturne elbow
#

Share your pom.xml please

iron matrix
nocturne elbow
#

uh

#

you aren't even.. depending on LP? as in, you're not adding it as a dependency in your pom

iron matrix
#

Ive done what Ive always done for adding luckperms into my plugin?

#

What exactly do I need to add / do?

nocturne elbow
#

What are you doing exactly, step by step to build your plugin?

iron matrix
night pier
#

why aren't you adding it to your pom.xml? you're already using maven, why add them to the project like that?

torn shale
#

any tab plugin for luckperm?

tranquil tangle
#

TAB is a good one

pallid bison
#

https://haste.nycode.de/qawamodaje.coffee
Hi there,
I am currently trying to write the auto update method for my plugin. Problem is just how do I do this for bungee cord. In the link I made it for Spigot but I don't know how to do it for Bungee cord who can help?

obtuse jolt
pallid bison
#

Hey @obtuse jolt

frank driftBOT
#

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

pallid bison
#

I just can't get on what's red right now

obtuse jolt
#

I am not familar with bungee api, looks like you are just trying to use methods that doesnt exist on bungeecord api. Tbh you can just use the singleton method LuckPerms api = LuckPermsProvider.get(); it works for all platforms.

undone sedge
#

Hey, I'm having a little bit of a problem, setting the primary group of a user doesn't seem to be saving

#

I also tried it with the UserManager#loadUser then UserManager#saveUser but that also didn't work

#

I have put a System.out.print(user.getPrimaryGroup) imediatly after the setPrimaryGroup and the code definetly reaches the setPrimaryGroup method

#

Don't know if I'm doing something wrong

nocturne elbow
#

That method does not do what you likely think it does

#

If you want to add a parent group, build an InheritanceNode for that group and add it to the user's data

#

If you want to additionally remove all other parent groups, use the NodeMap::clear method that takes a Predicate (or a NodeType?) to only remove InheritanceNodes, then add the one you want

undone sedge
#

Oh okay, that's more complicated than i thought

#

I'll look into it, thankls

wild whale
#

it sounds more complicated than it is

#

!cookbook I think there's an example of setting a user's group in the cookbook somewhere

frank driftBOT
nocturne elbow
tranquil tangle
#

FAKE LINK MODERATOR REMOVE THE MESSAGE

nocturne elbow
#

Hey how can i get metaData in the LP BungeeCord version?

pallid bison
nocturne elbow
#

NodeAddEvent/NodeRemoveEvent; check that the event target is a User and that the node is an InheritanceNode

tranquil tangle
#

t

desert egret
#

download

hollow locust
#

Hello, is there a way to set a suffix with the api?

obtuse jolt
#

SuffixNode

hollow locust
#

Would it wokr with a single player?

#

I'm trying to set a suffix for a single player @obtuse jolt

frank driftBOT
#

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

hollow locust
#

Alright sorry Ben

obtuse jolt
#

You can see the section on modifying user data on that.

hollow locust
#
                SuffixNode node = SuffixNode.builder(suffix, 1).build();
                user.data().add(node);
                Suffix.getMain().getLuckPermsApi().getUserManager().saveUser(user);
#

have I done anything wrong?

#

It does not add the suffix to the player

nocturne elbow
#

Does it show in lp user <user> meta info?

hollow locust
#

no

nocturne elbow
#

Any errors or anything.. ? That should work fine

hollow locust
#

no errors, when i do /lp editor i dont see it

nocturne elbow
nocturne elbow
#

scam

nocturne elbow
#

not what your saying but the message above what i said

leaden finch
#

i am making a command /wizard, when executed i want to give player certain permission

#

how do i do it using api?

leaden finch
#

anyonee??

nocturne elbow
leaden finch
wooden fable
#

Hi! When building with a jar file with Maven it doesn't manage to find LP: cannot access net.luckperms.api.model.user.User
Anyone knows how to solve this issue?
(yes, I've included LP in the POM file...)

leaden finch
obtuse jolt
#

usually ppl wont want to use luckperms api for just giving a single permission node, bcu it will limit users, but ig there isnt any good permission plugin other than lp lol

#

!api in this case, there is quite a good guide

frank driftBOT
obtuse jolt
#

!cookbook for examples

frank driftBOT
obtuse jolt
wooden fable
#

when trying to compile using Maven

obtuse jolt
#

!paste your pom

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ 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!

wooden fable
#

oh, nvm... apparently the error was in a project that is dependent on a different one and it didn't have LP in the dependencies

nocturne elbow
#

How to get the Suffix of a User using the API without using Cached Information?

obtuse jolt
nocturne elbow
#

well basically how to find suffix of offline user

obtuse jolt
#

you need to load the user first

nocturne elbow
#
public static @NonNull CompletableFuture<User> getPlayerSuffix(String playerName) throws SQLException {
        if(PlayerStats.isPlayerRegistered(playerName)) {
            String suffix;
            UUID uuid = UUID.fromString(PlayerStats.getPlayerUUID(playerName));
            UserManager userManager = MainCore.getLPAPI().getUserManager();
            return MainCore.getLPAPI().getUserManager().loadUser(uuid);
               .thenApplyAsync(user -> {
                user.getCachedData().getMetaData().getSuffix();
            });
        }
        else {
            return null;
        }
    }
#

here is my code

#

the thing is , that this doesnt work

#

I want it so that, if the player is online or offline, it should display stats

#

suffix*

obtuse jolt
#

also you are doing user.getCachedData().getMetaData().getSuffix(); but not storing it or using in any way.

nocturne elbow
#

basically I want to return the suffix from the function

#
public static CompletableFuture<Object> getPlayerSuffix(String playerName) throws SQLException {
        if(PlayerStats.isPlayerRegistered(playerName)) {
            UUID uuid = UUID.fromString(PlayerStats.getPlayerUUID(playerName));
            UserManager userManager = MainCore.getLPAPI().getUserManager();
            return MainCore.getLPAPI().getUserManager().loadUser(uuid)
               .thenApplyAsync(user -> {
                String suffix = user.getCachedData().getMetaData().getSuffix();
                return suffix;
            });
        }
        else {
            return null;
        }
    }
#

what about this?

#

this doesn't have any compilation error.

#

but would it work?

obtuse jolt
nocturne elbow
#

ridiculous

obtuse jolt
#

im not a java runtime environment ยฏ_(ใƒ„)_/ยฏ

nocturne elbow
#

doesn't work

#

I want to return the string

#

not the CompleteableFuture<Object>

obtuse jolt
#

you will need to code in an asynchronous manner

nocturne elbow
#

how?

obtuse jolt
#
<someclass>.getPlayerSuffix(name).thenAccept(String suffix -> {
    // Do stuff with the suffix
});
#

when you want to call that getPlayerSuffix method

nocturne elbow
#

for that to work, can you please check if my getPlayerSuffix Method is compatible with the above code?

#
public static CompletableFuture<Object> getPlayerSuffix(String playerName) throws SQLException {
        if(PlayerStats.isPlayerRegistered(playerName)) {
            UUID uuid = UUID.fromString(PlayerStats.getPlayerUUID(playerName));
            UserManager userManager = MainCore.getLPAPI().getUserManager();
            return MainCore.getLPAPI().getUserManager().loadUser(uuid)
               .thenApplyAsync(user -> {
                String suffix = user.getCachedData().getMetaData().getSuffix();
                return suffix;
            });
        }
        else {
            return null;
        }
    }```
#

This is the one I have written, It's giving me error when I'm calling the method in another class like this:

LPPlayerGroup.getPlayerSuffix(name).thenAccept(String suffix -> {
                            });
obtuse jolt
#

and your use of static methods... not a very good code design

nocturne elbow
#

and there are two returns in my code.

obtuse jolt
#

I suggest reading up on CompletableFuture api, its considered an advanced java topic and required before trying to use lp

nocturne elbow
#
public static CompletableFuture<String> getPlayerSuffix(String playerName) throws SQLException {
        if(PlayerStats.isPlayerRegistered(playerName)) {
            UUID uuid = UUID.fromString(PlayerStats.getPlayerUUID(playerName));
            return MainCore.getLPAPI().getUserManager().loadUser(uuid)
               .thenApplyAsync(user -> {
                String suffix = user.getCachedData().getMetaData().getSuffix();
                return suffix;
            });
        }
        else {
            return null;
        }
    }```
#

what further changes should be made here?

#

^ This is the error on function call

obtuse jolt
#

i think you dont need to specific datatype for lambda functions

nocturne elbow
#

then?

#

Okay, removed String in front of suffix in function call

fringe torrent
#

Good day all, I am hunting for a event that fires when /lp applyedits is ran

#

Ideally I'd like to pass this through to DiscordSRV's alert system, detailing who ran the command and what changed

rustic laurel
fringe torrent
#

Thanks boss

nocturne elbow
#

:patLarry:

rustic laurel
#

np!

#

love u 2 @nocturne elbow

nocturne elbow
#

:3

fringe torrent
#

We've got this format for manually logging things atm

woeful gale
#

Hi! How can I remove all groups and just leaving the default group for a player? Thank you!

rustic laurel
#

for ALL players or just one?

frank driftBOT
rustic laurel
#

for ALL players, you run lp bulkupdate users delete - that'll clear everyone

#

for just one, lp user <name> clear

abstract flicker
#

I want to give a Bukkit Player player a permission
But i can not cast Player to User!?

obtuse jolt
#

!api

frank driftBOT
obtuse jolt
abstract flicker
#

Thanks

abstract flicker
#

sorry but i did not find it in the wiki: How can i get the time to the expiry? or how can i geht the expiry date / time?

abstract flicker
#

sorry I am a beginner, whats the usage of this? the add Permission works but i dont understand how I can get the expiryduration?

#

so my code for add Permission is

#

public static void addPermission1h (Player p, String perm) {

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

    user.data().add(Node.builder(perm).expiry(Duration.ofHours(1)).build());

    LuckPermsProvider.get().getUserManager().saveUser(user);
}
woeful gale
rustic laurel
#

Ah, API wise you'd have to get their nodes and remove the group ones that aren't default - that will generally require a lot of API shenanigans so I'll link you the wiki page. On it, you can find the javadocs which will have the precise things to use.

#

!api

frank driftBOT
abstract flicker
#

sorry I am a beginner, whats the usage of this? i dont understand how I can get the expiryduration?

astral forge
#

So i have a question, if i add Luckperms API to my plugin, now can i make my plugin into a permissions plugin like luckperms? Or no

nocturne elbow
#

By "add" you mean implement it or use it?

abstract flicker
#

?

nocturne elbow
#

that screenshot you sent is the method you use to get the remaining time

abstract flicker
#

yes but how must i use it in a plugin

nocturne elbow
#

get the node, get the expiry duration?

#

what do you want to do?

abstract flicker
#

expiry duration for a permission

nocturne elbow
#

that tells me nothing

abstract flicker
#

i want to show the player when his permissions expiry

nocturne elbow
#

okay, now that's something; get the user's nodes (getNodes() I believe), filter in those that do have an expiry, and get the one(s) whose key matches the permission you need

#

then from it/those, get the remaining time

astral forge
nocturne elbow
#

No

#

If you are using it is because there is an existing permission system implementation in play

#

Which is like, 100% of the time will be LP lmao

abstract flicker
#

till now i have this: and now?

#

@Nullable
Duration getExpiryDuration(Player p, String perm) {
User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(p);
user.getNodes().
}
}

nocturne elbow
#

filter in those that do have an expiry

abstract flicker
#

How can I do that?

nocturne elbow
abstract flicker
#

Okay. I was hoping for help with my problem. I don't quite understand why something like this is being sent to me. I have already programmed a complete lobby system, etc., but I am just not very familiar with the LuckPermsAPI. That's why I asked here. Thanks anyway.

nocturne elbow
#

Iterating through a Collection to get elements that match a certain criteria is not specific to the LP API

#

I'm not sure where the confusion is coming from

abstract flicker
#

Okey then I'm sorry, but I haven't used something like that before.

nocturne elbow
#

A for loop?

abstract flicker
#

I only used for loops with Bukkit Player and it seemed somehow different to me than here.

nocturne elbow
#

Okay let me ask, what part makes iteration different and/or confusing?

#

If you can point that out I can help a bit more, but other than that it's iterating nodes instead of iterating players

abstract flicker
#

so i have a for loop but how can I check if there is an expiry

#

for (Node node : user.getNodes()) {

    }
#

that is what I mean, sorry when you didnt get it

nocturne elbow
#

Right, okay

#

Node.hasExpiry

abstract flicker
#

oh thanks and how can i get the time until it expiry

nocturne elbow
#

You sent a screenshot of the method you have to use for that earlier

astral forge
#

Also sorry to ping you i didnโ€™t see your name

nocturne elbow
#

???

#

What are you trying to do? Use the API as an end user, or implement the API to create your own permissions system implementation for others to use?

#

I'm not sure I'm following

astral forge
#

I wanted to create my own permissions system implementation

#

Sorry i didnโ€™t know how to explain it

nocturne elbow
#

Sure you can do that, it would be incompatible with the LP plugin but you can make your own implementation out of the API

#

After all it's platform agnostic and, well, it's an API, it has very little implementation details in it already; you'd just need to make sure to follow the relevant specifications in each interface's javadoc

astral forge
#

ok! thanks for helping me!

red pumice
#

hi, the api isnt making much sense, and from what I found online, I have this setup: ```java
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

LuckPerms lp = provider.getProvider();

Player p = (Player) sender;

User user = lp.getUserManager().getUser(p.getUniqueId());

System.out.println(user.getPrimaryGroup());

#

I dont know what I am doing wrong, if someone could explain the issue that would be amazing

nocturne elbow
#

Run and screenshot both lp info and lp user <yourself> info while online

last merlin
#

luckperms api wont work for me

#

with maven

#

SO it works in maven but it wont show up as a import

#

Tried to invalidate caches, clean maven

nocturne elbow
#

have you manually added any jar files to the project "libraries" tab in intellij?

uncut panther
#

How can I get the prefix of a group with the name of the group as a string?
I managed to get the group with

val group = luckpermsApi.groupManager.getGroup(groupname)
nocturne elbow
#

!api Check the second page linked, the section that talks about cached data

frank driftBOT
nocturne elbow
#

hm? what was the issue?

formal scarab
#

Is it required to implement the estimatePotentialContexts() method from ContextCalculator?

I can't extimate the contexts without access to a player object so the method is useless to me

#

or is there a way to get the player object in that method? Every player will have a few contexts and no player's contexts will be the same

nocturne elbow
#

if it was required then it wouldn't have a default implementation

formal scarab
#

That's what I figured

nocturne elbow
#

Gets a ContextSet, containing some/all of the contexts this calculator could potentially submit.

The result of this call is primarily intended on providing suggestions to end users when defining permissions.

e.g. the world context would submit a context set with the worlds for entries, the gamemode context for each gamemode, etc

formal scarab
#

oh alright, so its just a helpful thing for the end-user, yeah?

dreamy fiber
#

Any help please?

#

I added LP in maven as dependency

#

But still

#

Got it, imported wrong library

woven tendon
#

Hi I want to update a plugin from Sponge 7.3 to Sponge 8.0 and I use the newest LuckPerms version for this LuckPerms 5.3.8.3 or something, the problem is that I cant register the LuckPerms service (the permissions variable is always null)

unreal mantle
#

!usage

frank driftBOT
nocturne elbow
#

You will need to go into detail

pine dust
#

Hi. Is it possible to use the API without running any platform? (Bukkit/Sponge/etc) I wanted to create a script that would create some groups, assign some users and permissions. Maybe there's a way to do that without starting the real server?

nocturne elbow
#

not without actually running a server

#

you can make an extension if you don't want to tie it to any specific platform, but you still require for LP to be running on a server to use the API lol

pine dust
#

I see. So I'll probably make a dummy server for that. Thank You for lightning fast response! ๐Ÿ™‚

turbid solar
#

LP for Sponge 8 isnt released yet

woven tendon
#

Yeah I know but u can already test with it if you add it as local dependency

#

And I dont know if this is a bug because its always null or if I messed something up

turbid solar
#

Try testing with that jar

woven tendon
#

Ok

#

But I think I got the exact same jar

#

Its throwing the exact same error

turbid solar
#

Send your rankupsponge clsss here

#

!paste

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ 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!

woven tendon
turbid solar
#

Did you make sure to check that you're using the jar i send?

woven tendon
#

Yes

ebon zealot
#

when using this code

        LuckPerms api = LuckPermsProvider.get();
        Group group = api.getGroupManager().getGroup(groupName);
        if (group == null) throw new IllegalArgumentException("Group " + groupName + " not found");
        UserManager userManager = api.getUserManager();
        List<User> users = new ArrayList<>();
        for (UUID uuid : userManager.searchAll(NodeMatcher.key(InheritanceNode.builder(group).build())).join().keySet()) {
            User user = userManager.isLoaded(uuid) ? userManager.getUser(uuid) : userManager.loadUser(uuid).join();
            if (user == null) throw new IllegalStateException("Could not load data of " + uuid);
            users.add(user);
        }
        return users;
    }```

i get all red errors and such. but have luckperms in the dependancies. please help
trim cliff
#

Using Luckperms api in Bungeecord, everything works unless variable luckPerms might not have been initialized

wild whale
#

that's a basic java intelij error

trim cliff
#

Ye I know what it means, but I can't initialize it either. Cuz then I get '(' or '[' expected

wild whale
#

This is seeming like you're trying to use the LP api without knowing java

trim cliff
#

Ye I'm still learning

#

forget it, fixed it already LuckPerms api = LuckPermsProvider.get();

teal quest
#

Hey, I have made a function that returns the prefix of a user.. Now I have changed the permissions of the groups so that they inherit each other, but the function is now returning the prefix of the lowest group... How can I change this so that I get the prefix of the highest group where the player is currently in?

glacial grove
#

guys how to do ultimate homes permisions

pulsar viper
#

does luckperms require an SQL database or is it optional?

snow bison
#

if u want it to link to more then one server u need a database yes

#

else if one server then no database needed

pulsar viper
#

k

#

thanks

snow bison
pulsar viper
#

as for some reason I gave perms to players to use /warps and /spawn (this is from a spigot plugin called warpsystem) but its not letting them use these commands

snow bison
#

ok

#

want me to come try? [dm the ip]

pulsar viper
#

idk as Im not the owner of this server so im not allowed to invite FYI the server is still in early dev

snow bison
#

its in dms

#

and i asked u to

#

so yes u can

pulsar viper
#

my bad pls do not ping me though

neon sparrow
#

Check the instructions sent there to help

pulsar viper
#

yes yes ik

timid apex
#

my dependency is not working <dependency> <groupId>me.lucko.luckperms</groupId> <artifactId>luckperms-api</artifactId> <version>5.3</version> </dependency> version is red

turbid solar
#

!Api

frank driftBOT
timid apex
#

guess maven is not working for luckperms for me, I add the jar to the library and it clears up all the errors, so no updates needed for that class, just need to fix the maven info

neon sparrow
#

what does your lp dependency look like now?

timid apex
#
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.3</version>
            <scope>provided</scope>
        </dependency>```
night pier
#

did you load maven changes after you updated it?

timid apex
#

yes, thats auto, and invalidate caches and restart

night pier
#

no idea, ive got the same thing in my pom.xml, and it works fine. thonk

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

taken straight from mine.

timid apex
#

well, if it wasn't a maven issue for me to make a plugin then it wouldn't be me

#

I removed most of my dependencies and now it work, guess one of them is messing with me, I will add them back a few at a time

woeful gale
#

Hi, it is possible to get the first node that has certain prefix on a player?

quartz geyser
#

yes

woeful gale
#

How can I do it?

quartz geyser
#

just copy the prefix phrase on groups and put it to users

woeful gale
#

What?

quartz geyser
#

u know the prefix.0.

woeful gale
#

No no

#

Lets say I give this perm to a player: plugin.homes.5
So I want to find the node (permission) of a player that have the plugin.homes prefix, is it possible?

quartz geyser
#

idk

#

havent learned much either

#

im

nocturne elbow
#

@woeful gale are these permissions from your own plugin?

woeful gale
#

Yes

nocturne elbow
#

If so, you should really use MetaNodes instead and check the data from the CachedMetaData (PermissionHolder#getCachedData ...)

#

It's essentially a Map.Entry (key->value pair) and LP caches differently them so you can just query them by key

woeful gale
#

Thank you!

nocturne elbow
woeful gale
nocturne elbow
#

great question

nocturne elbow
#

How do I edit the permissions for people using a plugin for example the spawn tp plugin if I only want 1 player to be able to tp to spawn?

paper burrow
#

How can i get List Members of group (API)

turbid solar
#

!cookbook

frank driftBOT
paper burrow
#

thanks

uncut temple
#

Hello, how can I get the weight of an InheritanceNode (or of another node) ? My goal is to get the weight of a rank

nocturne elbow
#

the Group itself holds its weight (since it's yet another node, a weight node), not the node representing the group

#

you'll want to get the group from the group manager and get its weight from it instead

uncut temple
#

Thanks a lot

#

I'll give it a try

nocturne elbow
#

how i get code for crate so players can get rank from crate?

pine current
#

Maybe let your crate-plugin execute the command "/lp user {placeholder-for-user} parent add {rank}" if that's possible

lime scaffold
#

how can i get the prefix of a player? i already have Objects.requireNonNull(lp.getUserManager().getUser(p.getUniqueId())).getPrimaryGroup(); which gets the primary group but i want to get the "primary" prefix of the player

turbid solar
#

!cookbook

frank driftBOT
patent tendon
#

why this error?

this is the first time i try to use luckperms api

#

ping in case, thx

turbid solar
#

Are you soft depending on lp?

#

Do you have Lp installed?

#

@patent tendon

patent tendon
patent tendon
#

and do the thing

turbid solar
#

soft depend on LP

#

Also make sure scope in Pom is set to provided

patent tendon
#

now i try to compile, in case of errors I'll tell you

patent tendon
patent tendon
#

anyone?

turbid solar
#

Send main class

patent tendon
frank driftBOT
patent tendon
turbid solar
#

Remove the public Noswear(LuckPerms

patent tendon
turbid solar
#

Yes

#

@patent tendon

patent tendon
#

thx

vivid plover
#

To interact with a user's groups (adding or removing), is it just the node group.group_name? (just making sure)

wild whale
#

Correct

patent tendon
#

this is right in the docs , but if i cast it to (User) when the method is called throws an ClassCastException

#

always ping in case, thx

jaunty pecan
#

The docs explain why that code snippit is not possible

#

And then go on to explain what to do instead

#

In other words.. keep reading

patent tendon
#

right! thanks you!

urban rivet
#

How do I add a permission with the API?

frail quest
#

org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/luckperms/api/node/Node

#

๐Ÿฅฒ

#

Hi guys, i'm having problem with the api of LuckPerms. Here the problem in console

frank driftBOT
wild whale
#

Make sure LP is installed, and you've added it to your dependencies in your plugin.yml - if you don't LP might load after your plugin and thus your plugin won't find the classes

frail quest
#

How can i set in plugin.yml luckperms as a depency

#

@wild whale

frank driftBOT
#

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

frail quest
#

._. sorry

wild whale
#

just add dependencies: ["LuckPerms"]

night pier
frail quest
#

Nothing. Same error

night pier
#

you have LP installed?

frail quest
#

Yes

night pier
#

what version

frail quest
#

5.3.74

night pier
#

!latest

frank driftBOT
#
Latest version

5.3.75

night pier
#

should be fine. thonk

wild whale
#

In logs, does LP load before or after your plugin?

frail quest
#

after, but i added it as a depency in my plugin yml

wild whale
#

You sure you properly rebuilt etc? If it's a dependency it should load before

frail quest
#

yes

night pier
#

!paste can you send your plugin.yml

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ 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!

frail quest
#

Resolved, using depend instead of dependencies

wild whale
#

oh derp my bad

delicate zodiac
#

Hi guys im trying to obtain the instance of the api but i have this problem

turbid solar
delicate zodiac
turbid solar
#

Show full code

delicate zodiac
turbid solar
#

Do it in onEnable

delicate zodiac
#

aight

#

ah works

hard wharf
#

Set<String> permissions = prev.getNodes().stream() .filter(NodeType.PERMISSION::matches) .map(NodeType.PERMISSION::cast) .map(PermissionNode::getPermission) .collect(Collectors.toSet());
This way will I get all the permissions that the right player has? eg (my.special.permission)

delicate zodiac
#

try it out to see if it works

hard wharf
#

seems working

delicate zodiac
#

pog

tame vine
#

ะฒะฒะฒะฒะฒะฒ

tame vine
#

ะฟั€

tired pond
#

@rustic laurel ^ scam link

frank driftBOT
#

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

tired pond
#

Itโ€™s in a few channels

teal storm
#

New to luckyperms,
How do I use luckyperm API?

How would I set and get permission from luckyperm?
Do I just store everything locally?
Is there a good example?

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
teal storm
#

Thank you

chrome geyser
#

what it does mean?

#

i'm using LuckPermsProvider.get()

#

it happened hours after the server started

turbid solar
#

Is lp loaded

chrome geyser
#

it is

inner stratus
#

how do i get a user's prefix? im new to this lel

ocean citrus
#

i think you need to get it by a group

#
String prefix = plugin.getApi().getGroupManager.getGroup("owner").getCachedData().getMetaData().getPrefix();```
#

correct me if i'm wrong

snow ember
#

What's the benefit of using tristate over a nullable boolean?

clever zodiac
#

same reason why some developers use Optionals over a nullable value, it indicates that a value can and will be "not present" when some conditions are met, or when some aren't

#

null is usually interpreted as an error in the program, Optionals and TriState tells the end-developer that it's proper to not be present in some cases

inner stratus
night pier
#

!cookbook id suggest having a look at this. it may help you out.

frank driftBOT
night pier
#

!api (this might exist?) if so, it'd also be useful

frank driftBOT
inner stratus
#

sorry if i am being stupid i started java yesterday ;-;

karmic shadow
ocean citrus
#

You need to get the LuckPerms object

#

I get it from my main class

inner stratus
#

I have tried using String prefix = LuckPerms.getPlayerAdapter(Player.class).getMetaData(player).getPrefix(); but it says 'Cannot make a static reference to the non-static method getPlayerAdapter(Player.class) from the type LuckPerms'

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
ocean citrus
#

it's just LuckPerms#getGroupManager(). etc

#

if you take a look at the api

knotty portal
#

!meta

frank driftBOT
rustic laurel
#

@nocturne elbow and @dense steeple say hi! Vic ask away!!!

#

Just gonna legitimize this interaction with the Larry referral stamp of referral

dense steeple
#

false alarm

nocturne elbow
#

hii

dense steeple
#

I didn't pull the changes I needed to

#

๐Ÿ‘€

nocturne elbow
#

๐Ÿ’€

flint anvil
#

How should i parse colors in prefixes/suffices, i'd assume the ampersand legacycompoenentserialiser?

jaunty pecan
#

that's what most people use

#

or minimessage

#

but to LuckPerms it's just a string.. so there's no right answer in that sense

noble fog
#

How can I get temp permission's duration (epoch time) by using LP's API?

#

n

lime condor
#

Not sure if this is the correct channel, but how do you check for meta?
Is metaData.getMetaValue the only way, or is there a more standardised way that would work with all perm plugins?

I am referring to things like this, which was listed on the wiki.

max-homes = 5
username-color: blue
nocturne elbow
#

If you're working on a Bukkit plugin you can use the Vault API https://github.com/MilkBowl/VaultAPI, if you're working on a Sponge plugin I believe its API has some methods for that as well

lime condor
#

Thanks! I was mostly wondering if there was some way to do it without vault

nocturne elbow
#

You could make an interface of your own and an implementation for each permission plugin

#

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

#

LP API is LP API, not "generic perm plugin API"

#

That would be where Vault fits in

red pumice
#

does the luckperms API support bungeecord?

#

it seems like this part required Bukkit: RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

jaunty pecan
#

keep reading

red pumice
#

I know luckperms does support bungeecord as a plugin, but how do I use the API for bungeecord?

turbid solar
#

!api

frank driftBOT
red pumice
turbid solar
#

Keep reading the page, then youโ€™ll know how to use it on bungee

red pumice
turbid solar
#

Keep reading

daring jungle
#

@turbid solar

frank driftBOT
#

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

karmic shadow
#

Why?

steady jay
#

How am i able to get all the users loaded in the database?

vivid plover
#

How come java userManager.modifyUser(user.getUniqueId(), modifier -> modifier.setPrimaryGroup("admin")); is returning FAIL? lp user dkim19375 parent set admin works fine - is there a way to do the same thing as the command without using setPrimaryGroup? (I could dispatch the command into console but i assume theres a better way ๐Ÿค”)

turbid solar
#

!cookbook

frank driftBOT
obtuse jolt
vivid plover
#

oh-

#

whats primary group?

vivid plover
#

and how do I get the parent? I assume it's something with the nodes (since I know that the group node is group.nameofgroup) but isn't anything that I could find in the docs talking about how to get (or set) the parent group

nocturne elbow
#

by default, the primary group is the direct parent group with highest weight

#

If all you want to do is emulate parent set, clear all of the user's inheritance nodes and add the one you want

#

that's what parent set does; keep in mind that using parent set does also not guarantee changing the primary group, again that behavior is configurable

#

in the end, the primary group is somewhat irrelevant from what I know. I didn't dig enough to actually know what it's for but from what I understand it's just a Vault construct, so it's to satisfy Vault's needs and does not affect permission calculation.

#

also

and how do I get the parent?
users (and groups as well) can have more than just one group as parent group, sooooo there is no right answer to that

nocturne elbow
#

hey how can i get the metaData of a group? every time i get the metadata he is getting metadata from inherited groups.

tardy quail
#

What do we think is the best way to get PlaceHolders for an OfflinePlayer?

#

Just trying to think if its possible to get a users LuckPerms prefix if they're offline and messaging from discord...

nocturne elbow
tardy quail
steady jay
nocturne elbow
#

the palceholder expansion uses UserManager::getUser, so it has to be loaded beforehand

nocturne elbow
#

Gets a set all "unique" user UUIDs.

"Unique" meaning the user isn't just a member of the "default" group.

#

I don't see how "that could mean a lot"

tardy quail
nocturne elbow
#

that should work, yes

#

if i'm not mistaken Users loaded from API are discarded after 5 minutes, but I think you can unload them yourself too

#

Yep, UserManager::cleanupUser(User)

tardy quail
#

If they are reused in the 5 minutes I'm guessing the timer resets? Ideally looking to get ChatControlRed to support LuckPerms prefix if the user is typing from discord

nocturne elbow
#

uh I think so, not entirely sure; you can also cancel the UserUnloadEvent though personally I'd advise against doing that, or if you do it be in a controlled manner and not just cancel EVERY user unload

#

it shouldn't be an issue but uh I personally wouldn't want to have potentially hundreds of unused user objects in memory

steady glade
#

Any reason why I keep getting an NPE from this?

night pier
#

does it have anything to do with you missing the t in getMultiSuffix ?

steady glade
#

Im trying to switch over from PEX and recreate my chat plugin with luckperms. This method is suppose to get all the prefixes and suffixes from all the groups a user has but I seem to keep getting an NPE.

steady glade
nocturne elbow
#

Seeing the actual error would probably give a hint btw - also you can use getPrefixes/getSuffixes to get the inherited prefixes/suffixes, already in the cached metadata of the user, instead of going through each group manually

steady glade
#

That makes sense lol dont know why I didn't think of that

#

Yeah still didn't work

#

This is what is at chat event 43

nocturne elbow
#

The NPE is being thrown in ConfigMessageUtils::getCReplaceMessage @ line 118, which is called from ChatEvent::onPlayerChat @ line 43

what's in ConfigMessageUtils @ 118?

steady glade
#

That cant be right though ive used this method before and it works fine

nocturne elbow
#

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

#

Something's wrong in that function, I can tell that much - either getMessage is returning null, args is null (though that would be a bit odd) or args[i] is null

steady glade
#

๐Ÿ˜ตโ€๐Ÿ’ซ im positive that's not the issue, I feel like im using the lp api wrong in someway. That method works fine, maybe its one of this methods

nocturne elbow
#

I don't know what you want me to tell you, the stack trace doesn't lie

#

The only "issue" I see there is that UserManager::getUser(UUID) may return null, but that's only if the player is offline and the user is not loaded -- but even if, the error is clearly coming from getCReplaceMessage, not one of those prefix/suffix functions

steady glade
#

Hmm alright lemme make some changes real quick

#

It works when I remove the lp methods

nocturne elbow
#

Right, so it's likely then that for one of the args, args[i] is null then, CachedMetaData::getPrefix/getSuffix returns null if there is no evaluated prefix/suffix

steady glade
#

Ah alright

nocturne elbow
#

it's annotated as @Nullable if I'm not mistaken

#

yep

steady glade
#

Yeah it seems that getting prefixes/suffixes from the player through CachedMetaData::getPrefix/getSuffix just returns null

#

Is there a way I can just loop through all there teams for the prefix and suffix of that team

red pumice
#

I want to check if a user has a rank or higher

#

and I cant find a simple way to do it with the API

#

is there something built in?

nocturne elbow
#

getPrefix/getSuffix return whatever you see in /lp user <user> info

#

Or rather the other way around but that's a good visual confirmation that what you're getting corresponds to what you're expecting

nocturne elbow
red pumice
#

I got it working

hybrid panther
#

@lyric gyro did you make a variable called luckPerms?

lyric gyro
#

no I did not create a variable named luckPerms

hybrid panther
#

then you should read the guide more throughly ๐Ÿ˜„

lyric gyro
#

just add this in my main class ?

#

Because I really didn't understand your wiki

turbid solar
#

somewhere put LuckPerms luckPerms;

#

Then luckPerms = providerโ€ฆ in onEnable with that

lyric gyro
nocturne elbow
#

It's not a static method, you need to call it on a LuckPerms instance

lyric gyro
#

I have to create a class?

hybrid panther
lyric gyro
hybrid panther
#

you have it named api and then in your other screenshot youre trying to use luckPerms...

#

plus, you probably dont have the getUserAdapter code in the same onEnable block as that screenshot

#

youre gonna have to show us more code context to get sufficient help

proud crypt
#

sounds like someone needs to learn a bit about java lol

hybrid panther
#

that too

lyric gyro
hybrid panther
#

is that the same class as your onEnable main class?

lyric gyro
hybrid panther
#

ok

#

please learn java and come back

#

thanks!

steady glade
#

Hey I keep getting an npe on this, ive tried multiple ways of getting the prefixes and suffixes of every group a user is in but I cant find one that works, any suggestions on how to do it?
and yeah I tried getting all the prefixes and suffixes from a user through their MetaData didnt work

turbid solar
#

What line do you get the npe on

#

Use a debugger or whatever or use Java 15+(?) cus that has better exception things

steady glade
#

alright give me a sec

steady glade
#

The methods that im calling are the ones above that

turbid solar
#

Show the exception

#

!paste

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://paste.lucko.me/ 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!

steady glade
hybrid panther
steady glade
#

I know how to check for npe

#

the issue is it returns an npe when there shouldnt be one

nocturne elbow
#

Why shouldn't? We stated that getPrefix/getSuffix may return null if there is no prefix/suffix in the user's cached metadata

#

And I said that you should check that to be the case with the user info command

#

You should handle null cases of you know it's a possible outcome

hybrid panther
#

If what you say is true then all of the Jvm is broken and millions of peoples programs would be broke right now

#

What em said

steady glade
#

That's why I said it shouldn't return an npe

#

Idk if I did something wrong ill just have to check later

nocturne elbow
#

Can you share a screenshot of lp user <user> info and println getPrefix?

safe lance
#

What is the difference betweenjava public static boolean isPlayerInGroup(Player player, String group) { return player.hasPermission("group." + group); }Andjava public CompletableFuture<Boolean> isAdmin(UUID who) { return luckPerms.getUserManager().loadUser(who) .thenApplyAsync(user -> { Collection<Group> inheritedGroups = user.getInheritedGroups(user.getQueryOptions()); return inheritedGroups.stream().anyMatch(g -> g.getName().equals("admin")); }); }Don't they technecly do the same thing? I just want to check if a player is an admin

nocturne elbow
#

The latter works for offline players and works on every platform as-is, the first one works for online players only and will need to be adapter for each platform

#

no u

safe lance
nocturne elbow
#

I mean you can use whichever you want ยฏ_(ใƒ„)_/ยฏ