#luckperms-api

1 messages · Page 44 of 1

carmine nova
#

i have this

#

the name of player is "null"

nocturne elbow
#

That is out of the scope of what LuckPerms can do

#

I don't know why the player name is null

carmine nova
#

i try String prefix = user.getPrimaryGroup();

nocturne elbow
#

Right... the primary group is not the prefix

carmine nova
#

HA

#

String prefix = user.getCachedData().getMetaData().getPrefix();

#

it's this ?

nocturne elbow
#

Yes

carmine nova
#

it say "null"

#

it's very weird

#
@EventHandler
    public void onChat(ChatEvent event) {
        ProxiedPlayer player = (ProxiedPlayer) event.getSender();

        LuckPerms api = LuckPermsProvider.get();
        User user = api.getPlayerAdapter(ProxiedPlayer.class).getUser(player);

        String prefix = user.getCachedData().getMetaData().getPrefix();

        if (!event.getMessage().startsWith("/")) {
            ProxyServer.getInstance().broadcast("§b[" + player.getServer().getInfo().getName() +"§b] " + prefix + player.getName() + " §8» §f" + event.getMessage());
        }
    }```
nocturne elbow
#

Well getPrefix can return null if there is no prefix.. did you sync the LPs together so they share the same data?

carmine nova
#

no :/

#

i use for the moment luckperms on server test1

#

not bungeecord

nocturne elbow
#

Well, Bungee LP has no idea about the data in Spigot LP

#

Either give yourself a prefix in the proxy LP or sync them together

carmine nova
#

i see

#

I will synchronize all the grades on each server

#

on each server there can be different permission?

nocturne elbow
#

With server contexts, yes

#

!contexts explains it very well

frank driftBOT
carmine nova
#

i see contexte server: server1

#

it's very cool but how to migrate now all permissions and players to bungee

nocturne elbow
#

First you need a database

#

!network

frank driftBOT
nocturne elbow
#

And then to actually perform the migration you follow this guide:

#

!switch

frank driftBOT
carmine nova
#

1: create a database

tribal wave
#

if i'm setting a transient node for a user, do i have to #saveUser() afterwards

#

or is there no point because it's transient either way

nocturne elbow
#

:::::::::::::::)

tribal wave
#

oki, thank you fefo

nocturne elbow
#

after checking source like 5 times

tribal wave
#

xd

#

thank you for the effort

nocturne elbow
#

np

clever ferry
#

Any news on when the API version is going to be updated to 1.15 minimum?

Our Developer has set a minimum plugin API version.

"Could not load 'plugins\LuckPerms-Bukkit-5.3.5.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Plugin API version 1.13 is lower than the minimum allowed version"

nocturne elbow
#

Uuh.. LuckPerms works fine in the very latest version of Paper.. what kind of server are you running?

clever ferry
rustic laurel
#

why, purpur, why

clever ferry
rustic laurel
#

i mean, why does purpur have to do this to us

nocturne elbow
#

There is no real reason for that to be changed, LuckPerms doesn't make use of any version specific API and bumping that means entirely dropping support for 1.13-1.14 servers.

clever ferry
#

It's not purpur that caused this

nocturne elbow
#

Uhm yes it is

rustic laurel
#

does using paper stop that error

nocturne elbow
#

It does cause I used it today lol

clever ferry
#

Our developer set in bukkit.yml minimum API version, I have put in a pull request to remove it

nocturne elbow
#

Oh yeah that would break it

#

blame md5 for adding that setting

rustic laurel
#

but why change it lmao

nocturne elbow
#

^^

clever ferry
#

That's aname I havnt heard in a long time. he still maintainer of Spigot?

rustic laurel
#

yes

nocturne elbow
#

Sadly

#

Lmao

#

the maintainer

clever ferry
#

Developer wanted to try and "reduce amount of non maintained plugins"

rustic laurel
#

hmmmmmmmmm

nocturne elbow
#

Ever since 1.13 plugins couldn't be more stable tbh

#

Between versions*

clever ferry
#

in turn our build script threw a tonne of errors haha

#

what happened in 1.13?

nocturne elbow
#

Mojang made the game consistent lmao

clever ferry
#

after the M$ acquisition?

nocturne elbow
nocturne elbow
#

And the entire game is more consistent and robust internally

clever ferry
#

I'll update the pull request with a 1.13 change with as you mentioned.

#

Did they manage to move all the plugins off the main thread?

nocturne elbow
#

Lmao no

#

In our dreams

clever ferry
#

well..... I seen in the laters MC build they added more support for shaders, so "maybe" they have been working on MT?
Speculation at best

nocturne elbow
#

Not sure, but there are signs that they may be moving the game to a newer version of Java instead of old unsupported Java 8 👀

#

That's gonna be interesting

carmine nova
#

Hello for luckperms bungee I have to create a database?

turbid solar
carmine nova
#

sorry

carmine nova
#

Hello i have a problem with the api for bungeecord server, i set a new rank for a player and if player speak in chat it say the wrong prefix if i reconnect it's done :/

#

in chat

#

in tab

#

i'm the Character

#

code:

 @EventHandler
    public void onChat(ChatEvent event) {
        ProxiedPlayer player = (ProxiedPlayer) event.getSender();

        LuckPerms api = LuckPermsProvider.get();
        User user = api.getPlayerAdapter(ProxiedPlayer.class).getUser(player);

        String prefix = user.getCachedData().getMetaData().getPrefix();

        String msg = event.getMessage();
        msg.replaceAll("&","§");


        if (!event.getMessage().startsWith("/")) {
            ProxyServer.getInstance().broadcast("§b[" + player.getServer().getInfo().getName() +"§b] " + prefix + player.getName() + " §8» §f" + msg);
        }
    }
#

we would say that it does not update the prefix

obtuse jolt
#

I suggest logging the prefix variable to check if its correct first

carmine nova
#

heu okay x)

#

    public static String isPrefix() {

        return prefix;
    }

    public static void setPrefix(String prefix) {
        OnChat.prefix = prefix;
    }```
#

like this ?

turbid solar
#

No lol

carmine nova
#

x)

#

ha

#

I don't understand why it doesn't display its correct prefix it only records the prefix at the connection?

carmine nova
#

no idea my mistake: /

carmine nova
#

help me pls 😦

subtle pilot
#

hiya! I've searched the channel for some examples and gotten as far as retrieving all users in a group. Where I'm stuck is actually iterating through each of the users to do something (ie remove them from the group)

#

What I've got so far is CompletableFuture<Map<UUID, Collection<Node>>> hunters = lpapi.getUserManager().searchAll(NodeMatcher.key("group.luckyloothunters"));

nocturne elbow
#

Yep, that's the way; then you can do something like

hunters
    .thenApplyAsync(Map::entrySet)
    .thenAcceptAsync(hunterEntries -> {
      for (final Map.Entry<UUID, Collection<Node>> hunter : hunterEntries) {
        // modifyUser(uuid, user -> {
        //   for node : hunter.value
        //     user.data.remove(node)
        // }
      }
    });
subtle pilot
#

Thanks!
would uuid be hunter.getKey()?

#

hunters
        .thenApplyAsync(Map::entrySet)
        .thenAcceptAsync(hunterEntries -> {
            for (final Map.Entry<UUID, Collection<Node>> hunter : hunterEntries) {
                luckperms.getUserManager().modifyUser(hunter.getKey(), user -> {
                   for node : hunter.value
                     user.data.remove(node)
                 }
            }
        });```
nocturne elbow
subtle pilot
#

almost there.... I can feel it haha

#

could I just remove the internal for node section? Like this:


hunters
        .thenApplyAsync(Map::entrySet)
        .thenAcceptAsync(hunterEntries -> {
            for (final Map.Entry<UUID, Collection<Node>> hunter : hunterEntries) {
                Node node = Node.builder("group.luckyloothunters").value(true).build();
                luckperms.getUserManager().modifyUser(hunter.getKey(), user -> {
                     user.data().remove(node);
                 });
            }
        });```
nocturne elbow
#

btw you can do Node node = InheritanceNode.builder("luckyloothunters").build()

#

can = should 👀

subtle pilot
#

haha will do, thanks

#

otherwise that looks good as is?

nocturne elbow
#

and yeah that looks about right then, keep in mind that data().remove(node) does take into account the node's expiry time and contexts, so that will work only if they have luckyloothunters as a "regular" parent group (no contexts and not a temp parent group)

subtle pilot
#

gotcha; is there a different method to use to remove if it was temp?

#

No plans to have it as temp atm but that could change

nocturne elbow
subtle pilot
#

the 'node' and 'value' were giving me errors and I wasnt sure what was wrong there, which is why I removed them haha

nocturne elbow
#

'cause you have node built above, but you're gonna take the node from looping the Collection<Node>

#

(also hunter.value() cuz it's a method)

subtle pilot
#

hunter.getValue()?

nocturne elbow
#

yeah possibly

subtle pilot
#

aaahhhh I dont know what it wants

nocturne elbow
#

well it doesn't know what type node is right away

#

Node node : ...

subtle pilot
#

aha!

subtle pilot
#

Thanks a lot for the help

#

just trying to figure out how to build correctly now
using gradle but keep getting a NoClassDefFound error for net/luckperms/api/node/Node

nocturne elbow
#

while building or when running?

subtle pilot
#

running

nocturne elbow
#

what LP version?

subtle pilot
#

5.2.67

#

using api 5.2

#

its listed under my External Libraries in IntelliJ

nocturne elbow
#

how does your build.gradle look like?

subtle pilot
nocturne elbow
#

hm make sure you have luckperms as a dependency in your plugin

#

not entirely sure how sponge works...

obtuse jolt
subtle pilot
#

I dont see it loading before it crashes

obtuse jolt
#

yea means you need to somehow tell sponge to load luckperms before your plugin

#

or listen to luckperms enabling before doing your luckperms stuff with your plugin

subtle pilot
#

Got it!

#

Haha it works as expected! Thanks for the help :)

carmine nova
#

Hello I still have my problem that when a player changes his role he does not update in the chat: /

#
@EventHandler
    public void onChat(ChatEvent event) {
        ProxiedPlayer player = (ProxiedPlayer) event.getSender();

        LuckPerms api = LuckPermsProvider.get();
        User user = api.getPlayerAdapter(ProxiedPlayer.class).getUser(player);

        String prefix = user.getCachedData().getMetaData().getPrefix();

        String msg = event.getMessage();
        msg.replaceAll("&", "§");


       
       ProxyServer.getInstance().broadcast("§b[" + player.getServer().getInfo().getName() + "§b] " + prefix + player.getName() + " §8» §f" + msg);

      }
bold plinth
#

looked thru the api but couldnt seem to find it, is it possible through the api to return all players in a certain group? this would contain offline players to so returning player#getName is fine but need to do it in a way that isnt via permission, any help would be appreciated!

nocturne elbow
bold plinth
#

@nocturne elbow sorry didnt see that aha thanks very much

frank driftBOT
#

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

nocturne elbow
carmine nova
#

common database it's a command /lp user <player> permission set group.crew

nocturne elbow
#

Don't do that Jesus

#

lp user <user> parent set <group>

carmine nova
#

:/

obtuse jolt
#

or parent add if you want to keep the current groups inherited

carmine nova
#

/lp user shark_zekrom parent remove crew

#

/lp user shark_zekrom parent add character

#

the same error :/

obtuse jolt
#

is the correct prefix shown in /lp user USER info

carmine nova
#

it's character but in chat bungee it's crew

obtuse jolt
#

screenshot lpb user USER meta info

carmine nova
#

[16:20:50 INFO]: [LP] shark_zekrom's Prefixes
[16:20:50 INFO]: [LP] -> 6 - 'Character | ' (inherited from character)
[16:20:50 INFO]: [LP] shark_zekrom has no suffixes.
[16:20:50 INFO]: [LP] shark_zekrom has no meta.

obtuse jolt
#

yea I suggest you do logging of variable in your plugin, part of basic debugging

carmine nova
#

how because I check the player's prefix in the ChatEvent event

obtuse jolt
#

so like any info on that output that you can show

carmine nova
#

String prefix = user.getCachedData().getMetaData().getPrefix();

#

i use this for get the prefix

obtuse jolt
#

i know

#

log that value in console

#

something like Bukkit.getLogger().info(prefix)

carmine nova
#

I display the value of prefix because it is when I speak in the chat

#
ProxyServer.getInstance().broadcast("§b[" + player.getServer().getInfo().getName() + "§b] " + prefix + player.getName() + " §8» §f" + msg);```
obtuse jolt
#

idk then, your code snippet look ok, works the last time I tried similar way of getting prefix on my own plugin (tho its a spigot plugin)

carmine nova
#

it is not in the config that I did something?

#

sync-minutes: -1

#

it's this no?

obtuse jolt
#

thats ok

#

I dont think its data syncing

#

output for luckperms command is correct

carmine nova
#

it's weird

#

I modify the line?
sync-minutes: -1

obtuse jolt
#

no thats fine

#

possible issue is with caching, again I suggest actually doing some debug logging

carmine nova
#

so i have to make a loop?

obtuse jolt
#

up to you, its just a basic debug info logging

carmine nova
#

okay

#

String prefix2 = user.getPrimaryGroup();

#

this ?

obtuse jolt
#

CachedDataManager#getMetaData()

carmine nova
#

String prefix = user.getCachedData().getMetaData().getPrefix();

#

this ?

obtuse jolt
#

uhh

#

not really what i said

#

Have you uh debugged code before?

carmine nova
#

no :/

safe oyster
#

How do I add a player to a group?

nocturne elbow
#

with the API?

safe oyster
#

Preferably, yes.

nocturne elbow
#

ah okay

#

Asking because some people love asking general LP questions in the api channel lol

safe oyster
#

Ah, InheritanceNode, aight thanks.

nocturne elbow
#

eyup

safe oyster
#

Didn't think of looking at the command yet tbh.

nocturne elbow
#

That's an example plugin, not the actual command lul

#

You can check the whole repo see more usage examples

safe oyster
#

Hmm, suppose I might, thanks.

ripe mesa
obtuse jolt
#

Make sure you have latest version of luckperms installed on your server

ripe mesa
#

this is my pom

<repositories>
        <repository>
            <id>papermc</id>
            <url>https://papermc.io/repo/repository/maven-public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.destroystokyo.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.3</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
#

omg im so dumb

#

sry

#

i was on my testserver without luckperms

limpid shuttle
safe oyster
#

Is there an event fired when a user gets added to a group?

turbid solar
#

NodeAddEvent/NodeRemoveEvent

safe oyster
#

Oh right, InheritanceNode.

long shale
#

Hello,
I don't understand the luckperms api who can explain to me?

nocturne elbow
#

I mean it's not something you "just understand" or something you "explain"

#

It has many parts and depending on what you are wanting to do you may need this and that part of it

#

You can always start by asking a specific question or even explain what you're trying to do with it

viral bone
#

/lp applyedits HblHn44FyU

#

woops

#

how can i give a rank out over a period of time

nocturne elbow
#

@viral bone don't crosspost

#

And keep the question in the appropriate channel: this being support-1 or -2

plain badge
#

Not sure where the best place would be for this but how would I depend on the Fabric version of Luck Perms in Gradle?

plain badge
#

It doesn't seem to be working for me.

#

Not sure why

nocturne elbow
#

me neither ngl

plain badge
nocturne elbow
#

what about it "doesn't work"

plain badge
#

Well, I would expect it to add the commands and such in game, unless I'm mistaken for what it's actually supposed to do

nocturne elbow
#

what..?

plain badge
#

I guess I am mistaken then

nocturne elbow
#

what has the API to do with the plugin commands?

plain badge
#

Right, my question was on how I would include the LuckPerms mod itself. Not the api, wasn't sure where to ask the question so I went here. I'm assuming that exists lol.

nocturne elbow
#

may I ask why?

plain badge
#

Because I want to test with it in my IDE? Don't there's another reason to have.

#

Unless that isn't possible

nocturne elbow
#

The built jar is not up in any repo, you can download it and somehow add it to the IDE's classpath, idk how loom does dependencies like that tbh

plain badge
#

Hm okay

alpine blade
# ripe mesa

looks like somebody got their server security pwned

keen valve
#

hey

#

i want to set and unset permission for a player thru api

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
keen valve
keen valve
#

i want to disable luckPerms messages in console

#

so that lp logs dont appear when the server is using my plugin

turbid solar
#

Cant

keen valve
#

huh

#

there must be some way

keen valve
#

can i change the plugin prefix?

frail coral
#

unless you edit the src no

#

same thing with the logs

nocturne elbow
#

what

#

The only messaging service that requires players to be online is plugin messaging

#

Redis, rabbitmq and sql don't need them

#

And I don't know why you'd call that an "exploit"? The whole purpose of the messaging service is to notify changes in storage

obtuse jolt
#

what type of "other stuff"?

nocturne elbow
#

You can't just send arbitrary data through LP's messaging system, you can push updates in general about LP storage changes or specific user updates, it doesn't allow for anything else. After all it's API, not a whole library

obtuse jolt
#

that is not something LP should be responsible of

#

lol

#

you can try, but its not a good solution at all, if it even works

#

depends

#

if you want like a proper expandable solution, redis server or similar will be better

#

what

#

thats is used to get UUID of users that has data in luckperms

#

and then used to get user and check permissions

#

which is what luckperm is for

nocturne elbow
#

!help

frank driftBOT
#
Available commands:

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

!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translations
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki

nocturne elbow
#

There are neither pros nor cons really, I guess the first one allows for other plugins to register their own LuckPerms service but it's like extremely unlikely to happen lol

frank driftBOT
nocturne elbow
#

Yes

#

Not many, only log/publish/network events

#

You're probably looking for LogReceiveEvent

raven pelican
#

hey, how can I get all players in a group?

jaunty pecan
#

UserManager#searchAll

#

then use NodeMatcher.key() using an inheritance node

raven pelican
#

well I have the Group object as a reference is it possible to use that somehow?

jaunty pecan
#

Yes

raven pelican
#

Yea I just found that too, Thanks!

dreamy parcel
#

Maybe I am an idiot but how can I set a Node to an OfflinePlayer? Have I to use the CachedPermissionData or is it just like the player where online?

turbid solar
#

Load the player

#

!cookbook has examples

frank driftBOT
dreamy parcel
#

thank you so much 😄

nocturne elbow
#

how do i transfer all my permissionsex groups to luckperms

#

i really dont wanna do everything again

obtuse jolt
#

!migration

frank driftBOT
obtuse jolt
#

also

surreal tusk
#

Hi, i cant find in documentation how to use this group.getCachedData().getMetaData().getMetaValue(""), can me somebody send a example of key, please ?

obtuse jolt
#

!api

frank driftBOT
obtuse jolt
frank driftBOT
surreal tusk
#

Ok, for example this "prefix.100" is the key ?

nocturne elbow
#

no

#

There is a method specifically named getPrefix in the CachedMetaData

#

non-prefix/suffix meta is just a key/value pair

surreal tusk
#

Yes, but it is not work, its always null

#

But i want to get prefix on specific priority

#

or suffix

obtuse jolt
#
  1. what exact code are you using to get the prefix
  2. check that the user has a prefix in /lp user USER info
surreal tusk
#

To get prefix Prefix = group.getCachedData().getMetaData().getPrefix();

obtuse jolt
surreal tusk
#

and all code

public void refreshPrefixSuffix() {
        new Tasker() {
            @Override
            public void run() {
                for (Player p: TheAPI.getOnlinePlayers()) {
                    User user = Loader.lp.getPlayerAdapter(Player.class).getUser(p);
                    Group group = Loader.lp.getGroupManager().getGroup(user.getPrimaryGroup());
                    Tag = group.getCachedData().getMetaData().getSuffix();
                    Prefix = group.getCachedData().getMetaData().getPrefix();
                }
            }
        }.runRepeating(0, 20);
    }```
#

ok

#

Ok, and its possible to get prefix or suffix on specific priority

obtuse jolt
#

get the priority value you want from the map returned ^^

surreal tusk
#

Ok, and can you send me some key examples

obtuse jolt
surreal tusk
#

What

obtuse jolt
surreal tusk
#

Ok, but I cant found how this key looks like

nocturne elbow
#

There are no predefined keys

#

You store your own values for your own keys

surreal tusk
#

Ok, and if i want to get prefix on priority 50, how i cant get it

surreal tusk
#

Ok, and what i cant find here

obtuse jolt
#

what can you not find?

surreal tusk
#

How i can use metod getMetaValue

#

like this group.getCachedData().getMetaData().getMetaValue("prefix.50") or ?

obtuse jolt
#

nope

#

thats for meta

#

prefix uses a DIFFERENT method

#

as I linked

#
  1. get a map of all prefix, key=priority, value=prefix
#
  1. get prefix value based of priority what you want by doing how all map works, getting a value based on a key.
surreal tusk
#

Ok, can you send me an example

obtuse jolt
#

!cookbook

frank driftBOT
obtuse jolt
#

(please take some time to actually read the javadocs and code)

ashen nexus
#

so i found the MetaStackDefinition class which seems to be what is needed to calculate the full prefix / suffix of players including spacers and i'm wondering if there is a proper way to use it within the api or if i should just build a string using it manually

nocturne elbow
#

CachedMetaData#getPrefix/Suffix provides the full calculated prefix based on meta-formatting and contexts already

#

Sounds like you're trying to reinvent the wheel lol

ashen nexus
#

oh does that include like the "end-spacer" configuration settings too?

nocturne elbow
#

Yep

ashen nexus
#

oh cool i'll try that then, did the v4 api do that or am i just misremembering

nocturne elbow
#

I don't know lol

#

I didn't get to use v4

ashen nexus
#

alright

potent portal
#

Hello, I have an error using the api

nocturne elbow
#

ChatFormat.java:22
Line 22 in that file

#

What is it?

potent portal
#

@nocturne elbow what?

frank driftBOT
#

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

potent portal
#

sorry

turbid solar
#

Which line is 22

potent portal
#

you tell me this?

turbid solar
#

Show the report command class

nocturne elbow
#

Did you add the report command to your plugin.yml

potent portal
potent portal
nocturne elbow
#

then getCommand is returning null

potent portal
#

ty

turbid solar
#

String.join(args, " ") is a thing btw

manic dawn
#

hi everyone. I am trying to start using luckperms. And find it very unclear on when im doing my permissions through the ingame chat.. Isn't there any txt document or something like that that i can use?? I cant find anything in the plugin folder

obtuse jolt
edgy marlin
#

Hey! Previously, I used PEX and now I decided to switch to LuckPerms. Help please, I do not understand anything in the API, how can I get the prefix in the same way as in the PEX

#

if you can help me please mention me. I can not always notice

jaunty pecan
#

have you tried reading the documentation?

#

there's lots of info there, including how to get a prefix :)

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!apo

frank driftBOT
#

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

turbid solar
#

!api

frank driftBOT
frank driftBOT
#

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

#
Latest version

5.3.16

main dagger
#

!download @nocturne elbow

frank driftBOT
nocturne elbow
royal compass
nocturne elbow
#

Good question

#

Very good question indeed

#

Dare I say great question

#

Excellent choice of a question

royal compass
#

heh

nocturne elbow
#

Jason I have absolutely no fucking idea

royal compass
#

figured :p

nocturne elbow
#

Give me 5

royal compass
#

i have a skript that runs the /lp group default permission set command but i figured if imma make it in my own plugin i should see if i can use the api lol

nocturne elbow
#

Awesome

royal compass
#

but yeah no rush i've not started on the plugin yet anyways :p

#

just trying to figure out the best way to do things first

nocturne elbow
#

Thanks Luck for commenting your code 🙏

royal compass
#

lol

nocturne elbow
#

So yeah, it will remove the "other" one

royal compass
#

sweet thanks!

nocturne elbow
#

yw

royal compass
#

also i don't have much experience with running code async, what would be the best way to do it?

#

is that with the CompletableFutures stuff

#

actually ig i could use the bukkitscheduler and runTaskAsynchronously

nocturne elbow
#

You could do that, yeah

royal compass
#

alright, thanks fefe ❤️

nocturne elbow
#

:i

royal compass
#

lol

royal compass
#

the heck
am i doing something wrong or why is this not appearing cuz it's definitely what the docs say heh

nocturne elbow
#

git gud

royal compass
#

oh ok

nocturne elbow
#

git: 'gud' is not a git command. See 'git --help'.

royal compass
#

lol

nocturne elbow
royal compass
#

nope was i supposed to make one

nocturne elbow
#

!api yes

frank driftBOT
royal compass
#

oh yeah i did do that

nocturne elbow
#

But...?

royal compass
#

unless i wasn't supposed to put this in my onEnable?

nocturne elbow
#

I want to add a permission to a player.
Is there any example of how to use the API?

#

!cookbook both of you check this :p

frank driftBOT
royal compass
#

ah i got it now thx

#

i did it before with vault just completely forgot to do that here too lol

nocturne elbow
#

I don't get it

#

How can I add a permission to a player?

royal compass
nocturne elbow
#

I'm here

#

Which line adds the permission?

#

Sorry if I'm dumb

#

How familiar are you with Java as a programming language?

#

It's even commented...

#

I've been coding Spigot plugins for like a year

nocturne elbow
#

Basically line 44 to line 58?

royal compass
#

if thats what u wanna do then sure

nocturne elbow
#

Basically, yeah

#

Thanks

#

a year is.. a lot of time :d especially for something like Spigot, correct me if I'm wrong but I think one should be able to identify something like that?

#

Maybe I'm just slow.

#

I did code in my free time, I don't have your enthusiasm for learning. I'm weak.

royal compass
#

work out and u can become strong! 💪

nocturne elbow
#

I can't add the permissions in loop

#
                    for (int i = 0; i < property.getVaults(); i++) {
                        log.info("test");
                        int cont = i + 1;
                        Node node = Node.builder("mytheriavaults.access." + property.getRegion() + String.valueOf(cont))
                                .build();
                        PPPlugin.luckPerms.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
                            DataMutateResult result = user.data().add(node);
                            if (!result.wasSuccessful()) {
                                log.info(player.getName() + " cometió una excepción al comprar " + property.getRegion()
                                        + " (ya tenía los permisos del contenedor [" + String.valueOf(cont) + "])");
                            }
                        });
                    }```
property.getVaults() is equal to 3
#

"test" is printed three times but look what I found

royal compass
#

fefo why is this crashing my server pls help```java
while(true) {
for(Player player : Bukkit.getOnlinePlayers()) {
Node node = Node.builder("perm").build();
}
}

nocturne elbow
#

lol

obtuse jolt
#

😆

nocturne elbow
royal compass
#

is this gud

#

maybe i should have it shut down the server too 🤔

#

ok but fr question is there a way to remove/unset a perm cuz i'm not seeing anything on the site but i could be searching for the wrong thing

turbid solar
#

.remove instead of .add

royal compass
#

gotcha thanks

#

hm wonder why thats not in the docs

#

anyways so if i'm understanding this correct i can do multiple group.data().adds and then at the end save it and it'll save it all, correct?

nocturne elbow
#

that's ideal

royal compass
#

sweet thanks

#

so is this all i'd need really?

                luckPerms.getGroupManager().modifyGroup("default", group -> {
                    group.data().add(Node.builder("essentials.back.into." + plugin.getConfig().getString("end-world")).value(true).build());
                    group.data().add(Node.builder("essentials.tpa").value(true).build());
                });```
nocturne elbow
#

You can omit setting the value, it's true by default

royal compass
#

ah kk

#

didn't know if it mattered or not since i planned on overwriting the perm tho

#

and when i want to remove a certain node it has to match exactly what the node is with all its contexts and everything right

nocturne elbow
#

correct

#

even value

royal compass
#

:o my plugin works thats surprising

keen valve
#

how do i get a list of all existing groups

turbid solar
#

Bruh

obtuse jolt
#

haha

turbid solar
#

d;help

slate deltaBOT
#
Help:

Command(s): d;info
Example: d;info
Description: Display info about the bot.

Command(s): d;docs, d;javadocs
Example: d;javadocs
Description: Get a list of javadocs.

Command(s): d;prefix
Example: d;prefix <prefix>
Description: Set the server's command prefix.

Command(s): d;algorithm
Example: d;algorithm <algorithm>
Description: Set the server's algorithm.

obtuse jolt
frank driftBOT
obtuse jolt
#

yea that ^^ lol

#

and if you not sure how to get luckperm API instance and the group manager, read the api usage guide

keen valve
#

this is sad

turbid solar
#

What does getApi do

keen valve
obtuse jolt
# keen valve

that doesnt really look like an errors produce by luckperms

#

it says something to do with org.jetbrains.annotations.Unmodifiable?

keen valve
#

i m on eclipse

#

it automatically puts these 2 annotations

obtuse jolt
#

probably why it doesnt resolve jetbrains annotations lol

keen valve
#

cant import the other 1 for some reason

keen valve
#

i alr hav it manually added

obtuse jolt
#

idk then, I dont use eclipse

turbid solar
#

Dont import the plugin

#

Import the api

#

!api

obtuse jolt
#

that as well

frank driftBOT
obtuse jolt
#

I also suggest you use maven/gradle and not static classpath jars

turbid solar
keen valve
keen valve
obtuse jolt
#

luckperms jar is probably not the issue tho

#

since the error is with jetbrains classpath

turbid solar
#

Did you click apply after?

#

Also you indeed Probably want to try maven/gradle

keen valve
edgy marlin
#

Hey, i copied the line from the API and got an error, what have I done wrong?

         public void run() {
            Collection<String> groups = LuckPerms.getGroupManager().getGroup(groupName);
frank driftBOT
obtuse jolt
#

you did not even get the api instance

edgy marlin
#

ok thanks, i am get the api instance and i get a error

obtuse jolt
# edgy marlin

you probably managing your variable wrongly... where are you defining the groupName variable

feral whale
#

Hello, I'm looking to check permissions of a player, during the LoginEvent (Bungeecord event), when user is "trying to log", I have only the UUID of a player, I want cancel the connection if the uuid havn't the permission

#

For now I have try this :

#
LuckPermsProvider.get().getUserManager().loadUser(event.getConnection().getUniqueId()).thenAccept(user -> {
    if (!user.getCachedData().getPermissionData().checkPermission("bypass").asBoolean()) {
        event.setCancelled(true);
    }
});```
#

But, it's this code is Async 🤔

nocturne elbow
#

On an instantaneous event such as login, you can call join() to get the User on loadUser

#

But the bungee login event has this "intents" thing... not sure how it works so yeah lol you can do that

#

Make sure to set the event priority to something higher than LP's (which is LOW)

maiden monolith
#

How to i get what group a player is in?

#

Nvm

feral whale
nocturne elbow
#

Yes

crystal sonnet
#

I have registered a custom context calculator

#

Can I trigger the user recalculate event when that context changes?

nocturne elbow
#

ContextManager#signalContextUpdate

crystal sonnet
#

Thanks

mighty parrot
#

Hello, I'm trying to use the LuckPerms Bungeecord api, but i don't know how can I load the Luckperms api:

obtuse jolt
#

not sure if bungee works the same as a spigot plugin, but usually in plugin.yml you can specify depend or soft-depend plugins to ensure luckperms load before yours

mighty parrot
#

Yes i've mark my plugin.yml as depend, but it's a command, if I can execute /lpb in the console, logically LuckPerms is load no ?

obtuse jolt
obtuse jolt
#

or is it a field variable

mighty parrot
#

No, not at all, I call the method directly when the command is executed

#

LuckPermsProvider.get()

obtuse jolt
#

from that one line of code it looks ok

#

!paste I suggest you send your full startup log

frank driftBOT
#
Please use pastebin!

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

mighty parrot
#

Yeah np

obtuse jolt
#

startup log?

mighty parrot
#

Oh sorry x)

obtuse jolt
#

hmm it should in theory work

mighty parrot
#

that was the problem x)

obtuse jolt
#

how are you adding luckperms to your project dependency

mighty parrot
obtuse jolt
#

uhm is that gradle or

#

also the latest api version is 5.3

mighty parrot
mighty parrot
nocturne elbow
#

Make it compileOnly/compileOnlyApi

#

You are shading the API into your plugin

obtuse jolt
#

yea was about to point that out

mighty parrot
#

I'm trying this right now

#

Thank you, it works 🤠

gilded sky
nocturne elbow
#

getCachedData.getMetaData.getPrefixes will return a SortedMap<Integer, String>, the keys being the weight of the corresponding prefix, ordered by weight in descending order

gilded sky
nocturne elbow
#

Iterator<Map.Entry<Integer, String>> it = map.entrySet().iterator();

gilded sky
#

stream.findfirst?

#

Okay

nocturne elbow
#

Uh yeah that can work too

gilded sky
nocturne elbow
#

RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

Put that inside setupInstances

#

You are calling that as soon as your plugin class is constructed, way before LuckPerms registers the service

gilded sky
nocturne elbow
#

That doesn't change what I said

#

That is still way before LuckPerms registers the service in the services manager

#

That happens in the onEnable stage

gilded sky
#

Yes

nocturne elbow
#

So you have to call that at least in onEnable

gilded sky
#

but if i add it as a dependency

#

its laods after it got loaded

#

so all fine

nocturne elbow
#

No

gilded sky
#

Yes

#

i added it to enable to

nocturne elbow
#

It doesn't work like that

gilded sky
#

onEnable

gilded sky
#

👀

nocturne elbow
#

Bukkit will first instantiate all the plugin classes, way before calling onEnable, your "provider" object is created as soon as your plugin class is constructed, again way before onEnable, and LuckPerms registers the service in onEnable, way after you are calling that

gilded sky
#

Ohh okay

#

btw what should i use? QueryOptions.defaultContextualOptions()

#

or smth else?

nocturne elbow
#

you can pass nothing

#

just getMetaData()

gilded sky
#

Noe

nocturne elbow
#

getCachedMeta?

gilded sky
#

Or how can i get the priority of the group/ the prefix and suffix

nocturne elbow
#

what version of the API are you including as a dependency?

gilded sky
#

The wait

gilded sky
#

¯_(ツ)_/¯

nocturne elbow
#

5.3 is the latest

#

CachedDataManager#getMetaData() (no parameters) was introduced in 5.1

gilded sky
#

So how can i get it now? 👀

nocturne elbow
#

..... replace 5.0 with 5.3?

gilded sky
#

The group name of the player/prefix of group suffix, and the priority

gilded sky
nocturne elbow
#

keep in mind that the prefix that is shown in /lp user .. info may not necessarily be the prefix with highest weight

#

it all depends on the meta-formatting settings (a.k.a. "prefix/suffix stacking")

#

wow thanks a lot discord

#

what are you wanting to do exactly...?

#

what are you trying to achieve, your end goal?

gilded sky
#

I wanna get the prefix/suffix and the weight of the prefix, for sorting

nocturne elbow
#

Okay then, prefixes/suffixes you can get with user.getCachedData().getMetaData().getPrefixes/Suffixes()

will return a SortedMap<Integer, String>, the keys being the weight of the corresponding prefix/suffix, ordered by weight in descending order

nocturne elbow
#

Could you disable pinging when replying please?

strange cairn
#

Hello. I'm trying to register an event listener for whenever a players permissions update. Is this not the correct approach? LuckPermsListeners.java`

public class LuckPermsListeners {
    private final Main plugin;
    private final LuckPerms luckPerms;

    public LuckPermsListeners(Main plugin, LuckPerms luckPerms) {
        this.plugin = plugin;
        this.luckPerms = luckPerms;
    }

    public void register() {
        this.plugin.getLogger().info("LuckPerms listeners enabled");
        EventBus eventBus = this.luckPerms.getEventBus();
        eventBus.subscribe(this.plugin, UserDataRecalculateEvent.class, this::onUserDataRecalculate);
    }

    private void onUserDataRecalculate(UserDataRecalculateEvent e) {
        // do stuff
    }
}
#

The "LuckPerms listeners enabled" log never fires

nocturne elbow
#

Are you.. calling.. the register method?

strange cairn
#

I- uhm.. I guess I should do that huh? 😅

nocturne elbow
strange cairn
#

Sounds good

#

I'll give that a shot when I get home - had to go to work

spark mauve
#

do I have to do something special to make luckperms trigger the update propogation code? I'm making a gross hack of a mod to allow me to get the player's dimension on the proxy server and it works, but for the proxy to notice the change I have to do /lpv sync

nocturne elbow
#

Why yes with MessagingService#pushUpdate()

#

You can get the (optional) messaging service with LuckPerms#getMessagingService()

spark mauve
#

so just add a lp.getMessagingService().ifPresent(MessagingService::pushUpdate);?

nocturne elbow
#

Well it depends on when and where you call it

#

For example

luckPerms.getUserManager().modifyUser(uuid, user -> {
  // stuff
});
luckPerms.getMessagingService().ifPresent(MessagingService::pushUpdate);

This will most likely not work as you would expect, because the modifyUser method runs on another thread and it will probably be invoked way after code that follows below (including the messaging service update)

spark mauve
#

I'm handling the loading and saving manually

nocturne elbow
#

Still, UserManager#saveUser(User) runs async

#

If you were to adapt it to something like this then

luckPerms.getUserManager().modifyUser(uuid, user -> {
  // stuff
}).thenRunAsync(() -> {
  luckPerms.getMessagingService().ifPresent(MessagingService::pushUpdate);
});

then that will work, yes

#

Because it will call the lambda when the CompletableFuture returned by modifyUser is, well, completed

nocturne elbow
#

@nocturne elbow this is not the place for advertising 🙂 read the #rules

strange cairn
#

is it possible to get the permission removed in a NodeRemoveEvent when the node type is InheritanceNode ?

vagrant spruce
#

how do you get the player's prefix in the bungeecord using metadata?

nocturne elbow
#

The same way you'd do on Bukkit but on Bungee

#

luckPerms.getPlayerAdapter(ProxiedPlayer.class).getMetaData(player).getPrefix()

vagrant spruce
#

is there a link that shows the entire luckperms API on the bungeecord?

nocturne elbow
#

It's the same API everywhere, it has no platform

#

!api 🙂

frank driftBOT
vagrant spruce
#

ok, thanks!

plush quartz
#

!api

frank driftBOT
undone plover
#

How is the Event called, that is called if a user gets a new parent?

turbid solar
#

NodeAddEvent

crystal sonnet
#

What's the easiest way to verifiy if an event has been fired?

#

Like I'm currently not listening to LP events at all but do need to make sure that a certain event gets fired at the right time

nocturne elbow
#

Just.. listen.. to it?

#

Or subscribe when you need to and unsubscribe afterwards

trim pike
#

Hey

#

I'm trying to get temp ranks from a player sorted by their weight, I'm a bit lost at this point:

#

Could anyone give tips 😛

turbid solar
#

group.getWeight()?

trim pike
#

If that would have been possible there I would have never wrote anything in this chat xd

turbid solar
#

d;lp Group#getWeight

slate deltaBOT
turbid solar
#

.getAsInt() or something

#

(that will throw an NPE or some error if itś not set tho)

trim pike
#

I appreciate the attempt to help but when streaming through nodes it doesn't return an object of type Group

obtuse jolt
# trim pike

you need to end the stream with like .collect(Collectors.toList()) or smt to get the resulting groups

trim pike
#

..

obtuse jolt
#

what?

trim pike
#

Did you read my question

obtuse jolt
#

you said the stream doesnt return a Group object

trim pike
#

Yes and it's not magically going to turn in to Group object by collecting the stream

obtuse jolt
#

well, you said temp ranks sorted by weights, means you want a resulting list/collection of groups since players can have more than 1 of those groups, so it shouldnt be a single Group object

trim pike
#

Okay maybe my phrase wasn't extremely correct but I think most people will understand what I meant

#

When streaming through nodes with type INHERITANCE, and mapping and casting them to their respective Class, you are streaming through an object of type InheritanceNode and not Group

#

And .getWeight() is not possible on an object of type InheritanceNode

turbid solar
#

you can get the group with the GroupManager? InheritanceNode should return the Group name as a string

trim pike
#

I can pretty easily do like ..LuckPermsAPI#getGroup(InheritanceNode#getGroupName) but I'm trying to do it somewhat cleaner

obtuse jolt
trim pike
#

Thanks for the great advice...

obtuse jolt
#

I mean its how the api is designed so...

#

open a gh issue if you think the design or structure can be improved

#

maybe suggest a getGroup method in InheritanceNode class to the dev if you feel its needed

alpine dagger
#

uhm is there a way to get the prefix in an bungeecord plugin with the api?

turbid solar
#

Yes

#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
alpine dagger
nocturne elbow
#

Like the error says, that is not a static method

#

You need a LuckPerms object to use the API

#

!api the first link shows how to get it

frank driftBOT
undone plover
#

How can I add someone to a parent?

nocturne elbow
#

Add a parent group to someone?

undone plover
#

and how do I do this in the api?

nocturne elbow
undone plover
#

thanks

nocturne elbow
#

You're welcome

obtuse jolt
#

How is it not working? What are you trying to achieve?

#

few things wrong just by looking at the code:

  1. primary group is based on weights, not to be manually set https://luckperms.net/wiki/Weight
  2. Why are you running saveUser inside of modifyUser? The point of modifyUser is so it automatically saved
barren otter
#

Are there any placeholders for display name in LPC config? I tried like {username} but it didnt work since its neither in LPC config or a Placeholder.

#

Basically how do I get the display name placeholder

turbid solar
#

Not Lp related

barren otter
#

oh okay sry

signal lagoon
#

how would i check if someone has a permission node from luckperms (with luckperms bungeecord)

obtuse jolt
#

you are coding a bungeecord plugin?

signal lagoon
#

ye with the luckperms api

signal lagoon
#

thank you so much

#

its says in my ide that it can not instintate the type luckperms

#

should i just create a construtor?

nocturne elbow
#

I suggest you read the 2 API usage pages on the wiki

#

!api

frank driftBOT
nocturne elbow
#

the first one explains, among other things, how to get an instance of the LuckPerms interface

signal lagoon
#

im sorry, but how do i use the searchAll method? for the paramaters do i need a player, or what?

nocturne elbow
#

No?

#

Did you read the javadoc I linked above?

signal lagoon
#

I did, but not thuroughly my bad!

#

i found it

#

so another question what is a node?

#

like is it a string

#

ik its an object, but like what does it store?

nocturne elbow
#

The Node class encapsulates more than just permission assignments. Nodes are used to store data about inherited groups, as well as assigned prefixes, suffixes and meta values.

signal lagoon
#

cool

signal lagoon
#

i may be an idiot, but is this how you use it? ```if (api.getUserManager().searchAll(api.getNodeMatcherFactory().key("jayden.toros.servers")) != null) {
sender.sendMessage("hi");

           }```
nocturne elbow
#

it will never return null tho

#

it's annotated as NonNull

signal lagoon
#

oh ok

#

so how should i do it?

#

it tells me its not gonna work if i remove the doesnt equal null

nocturne elbow
#

How should you do what?

junior jay
#

So LuckPerms needs to be installed on every server instance in the bungeecord network. Will a proxy plugin be able to add/remove groups using the LuckPerms API?

nocturne elbow
#

If it's also installed in the proxy and every LP instance is connected to the same messaging service, yes

#

See the MessagingService interface in the JavaDoc 📌

junior jay
#

So the Bungeecord server is receiving the changes, however, my proxy plugin isn't.

#

It prints this if it does receive the change (which it isn't doing)

#
EventBus eb = api.getEventBus();
eb.subscribe(NodeAddEvent.class, this::nodeAdded);

is the code

junior jay
#

how am I supposed to extract any useful information out of those events?
would it require String parsing?

turbid solar
#

Yes

junior jay
shadow silo
#

How to check all groups of a player/offline player in a specific server? because i'm reading the documentation but i don't understand how context/query work.

bitter gulch
#

This isn't really about the luckperms api, more about the helper api

#

can I ask about that here?

#

Not sure where else to ask about it

nocturne elbow
#

there

nocturne elbow
#

replace survival with w/e the server context value should be ofc

dreamy parcel
#

I do not know whether this is the right place for this question. When a player is in a group named abc he has the permission group.abc, hasn't he? Now my question: if I remove the permission group.abc do I remove him out of the group abc too?

golden shuttle
#

How can I add a player to a group via API?

turbid solar
#

!cookbook has examples

frank driftBOT
golden shuttle
dreamy parcel
#

thanks

raven pelican
#

Hey, is it possible to assign permission / set the parent of a user, but silent? aka not trigger a log message

broken pasture
#

I don't think there's a way to have a single permission be silent, but there's a setting in the config to make all logs silent

#

There's also a permission to see logs you can set to false.

nocturne elbow
stray meadow
#

When i do /lp editor and Edit my perms the perms that i Added even of i clicked save and wrote that in the chat it Doesnt make Any changes why?

nocturne elbow
#

is this to do with the LP API?

rocky aurora
#

sorry for a lazy question

#

how do I give/set players permission using the API?

rustic laurel
#

!api

frank driftBOT
rustic laurel
#

All is well and explained somewhere up there ^ :D

rocky aurora
#

well, used the cookbook I guess

#

got what I needed

#

what if I want to set the node to 'false'?

#

nvm

golden shuttle
#

When I add a player to a region using the API, the player still cannot leave the region that was secured with exit deny. What can I do about this?

golden shuttle
gaunt hill
#

Hi. I'm making a plugin what sets the players rank to the rank stored in out database. My problem is that, I'm getting the correct data for the change and I save it too but, it isn't changing.

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

Has examples how to add it

inland rampart
#

Does travertine support lpb?

turbid solar
#

Yes

inland rampart
#

alright

native grove
#

!help

frank driftBOT
#
Available commands

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

!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki

tight gull
#

!clolors

frank driftBOT
tribal halo
#

!weight

frank driftBOT
#

LuckPerms allows you to set weights in order to determine the priority of certain nodes, like permissions and even prefixes. A higher weight number is a higher priority.

tribal halo
#

!editor

frank driftBOT
errant jetty
#

!api

frank driftBOT
nocturne elbow
#

@tribal halo @errant jetty this isn't the bot commands channel, use #general for that purpose

tribal halo
#

o sure

nocturne elbow
#

!sync

frank driftBOT
slate orchid
#

Hi, how can i get information, when temp parent expire?

slate orchid
#

._.

nocturne elbow
#

You can do something like

user.getNodes(NodeType.INHERITANCE)
    .stream()
    .filter(Node::hasExpiry)
    .map(Node::getExpiry)
    .collect(Collectors.toList());
vestal rose
#

how do i remove the option to op people?

turbid solar
#

Config?

#

Disable ops

shy dagger
#

hey, I get errors when I try to apply the Luckperms API to maven.
I've never worked with apis so idk
and for the vault api issue ill fix on my own i guess
heres errors:
https://imgur.com/a/maGxaKX

turbid solar
#

Do you get an error?

#

Like a uhh

#

Error log

#

APi ia on maven central

shy dagger
#

nope

#

thats all errors i get

#

uh

#

i used a plugin on intellij

#

idrk how to work with apis

#

u got an error

#

lol

#

yeah

#

the red bar there

turbid solar
#

Hover over the red line

shy dagger
#

oh god lol

#

okay

#

how do u have these 100x more epic colors

turbid solar
#

Send your full code

#

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

#

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

shy dagger
#

doesnbt give an option to choose java

turbid solar
#

you need to put it in a method

#

in your onEnable

#

yes

spare steppe
#

Hello, I am creating a permission system for commands ran from a command block, is it possible to inject my own PermissibleBase to ServerCommandSender so it would not collide with LuckPerms? Or are there any other ways using the API to do this?

nocturne elbow
#

Or are there any other ways using the API to do this?
do what with the API?

#

missing details tho

spare steppe
#

Basically I want to check for permissions for command blocks and not give them unlimited priviledges, my idea was a single plugin that would have it's own list of permission, or just create a group in LuckPerms and take all the permissions from that group. In order to do that I have to replace Minecraft's PermissibleBase in ServerCommandSender, but LuckPerms already does that, so how do I make it to not collide? Or is there any way using the API to inject something in this class LuckPerms modifies?

nocturne elbow
#

LuckPerms doesn't inject a permissible into all permissibles, it only injects one into players only on join

river lance
#

Is it intentional that a user can have no groups?
not even the default group?
I'm on Waterfall and that is my test Command for testing:

final var uuid = plugin.getUUID(sender); // Get UUID from CommandSender
LuckPermsProvider.get().getUserManager().modifyUser(uuid, user -> user.data().clear(NodeType.INHERITANCE::matches)).thenAccept(v -> {
    final var groups = LuckPermsProvider.get().getUserManager().getUser(uuid).getInheritedGroups(QueryOptions.nonContextual());
    sender.sendMessage("Your Group size is: " + groups.size());
});
nocturne elbow
#

what a great question

#

curiously enough if you do the modifyUser process "manually"
(userManager.loadUser(uuid).thenApplyAsync(blah return user).thenCompose(userManager::saveUser))
it will actually give default if needed

#

I guess that's a bug lol

vestal rose
#

am pro at luckperms

obtuse jolt
#

ok?

granite zinc
#

how do i give myself a rank on ma server?

rustic laurel
#

!usage

frank driftBOT
rustic laurel
#

Or if you want to do it with the API,

frank driftBOT
granite zinc
#

ty

#

but like what is the command

#

i have the group

#

hoe do igive it to myself?

rustic laurel
#

that is documented on the usage page. also, this channel is not for LP usage, it's for writing code using LP

granite zinc
#

oh sry

shadow silo
nocturne elbow
#

Not necessarily, it delegates the save task to a new thread in the background;
It is highly advised you do it async if you are going to .join()/.get() the returned CompletableFuture, because that will wait until the async task is completed, defeating the purpose of concurrency in that case.

rustic laurel
#

Feef

#

Sleeeeeep

nocturne elbow
#

I literally just woke up

#

Double integrals time

shadow silo
shadow silo
#

to add multiple permissions (with same context, value), I have to create multiple nodes?

vestal rose
#

i need help on how to set all permissions quickly

#

someone help?

neon sparrow
#

through the api?

vestal rose
#

how do u do that

shadow silo
#

I (well) looked at the API but I can't find a method to retrieve the group in a track of a lp user.
Example: I inherit "admin" group in the staff track, is there a method to retrieve my group in the "staff" track?
Idk if I explain well but I'm not english sorry :x

neon sparrow
vestal rose
#

yes

river lance
#

I Think I found another bug..
I modify the user Groups on BungeeCord but it took some time that this changes are received on the server..
LuckPermsProvider.get().getUserManager().modifyUser to add a group need time..
/lpb user example parent add group works that instance.

#

Or did I forgot somthing to add in my code?

turbid solar
#

Push the update with the messenger

river lance
nocturne elbow
nocturne elbow
river lance
nocturne elbow
#

yeah probably

river lance
#

Works fine, thanks 😄

nocturne elbow
#

To send updates through the messaging service to other servers:

  • if it's a single user (UserManager#saveUser, UserManager#modifyUser) (preferred whenever possible over general updates):
CompletableFuture<Void> future = ...;  // action (any that writes to storage)
future.thenRunAsync(() -> {
  Optional<MessagingService> messagingService = luckPerms.getMessagingService();
  if (messagingService.isPresent()) {
    messagingService.get().pushUserUpdate(userManager.getUser(uuid));
  }
});
  • if it's other (non-user) changes / general changes (e.g. TrackManager#saveTrack, TrackManager#deleteTrack, GroupManager#saveGroup, GroupManager#modifyGroup, GroupManager#deleteGroup):
CompletableFuture<Void> future = ...;  // action (any that writes to storage)
future.thenRunAsync(() -> luckPerms.getMessagingService().ifPresent(MessagingService::pushUpdate));
#

and that's a message I'm saving to my clipboard

turbid solar
#

Pin?

nocturne elbow
#

will probably PR to the wiki or to api cookbook

#

eventually :^)

#

yeah until then it's gonna be pinned lmao

slate orchid
#

But my IDE can't find object NodeType

#

a wrote this:

            User user = LuckPerms.getApi().getUser(fp.getName());
            String expire = user.getNodes(NodeType.INHERITANCE)
                    .stream()
                    .filter(Node::hasExpiry)
                    .map(Node::getExpiry)
                    .collect(Collectors.toList());```
nocturne elbow
#

collect(Collectors.toList())
what do you think this does

#

or

#

what do you believe "collect to list" means

slate orchid
nocturne elbow
#

right

#

String expire = ... collect(Collectors.toList());

#

a String is not a List

slate orchid
#

I know, but which generic type must be into List?

nocturne elbow
#

and Node#getExpiry returns an Instant so you'll end up with a List<Instant>

#

the instant in time the node will expire

slate orchid
#

But it can't found NodeType object

nocturne elbow
#

try importing it?

slate orchid
#

yes

nocturne elbow
#

slate orchid
#

it can't found any object

#

🤷‍♂️

nocturne elbow
#

what API version are you adding as dependency

slate orchid
#
        <dependency>
            <groupId>me.lucko.luckperms</groupId>
            <artifactId>luckperms-api</artifactId>
            <version>4.0</version>
        </dependency>```
nocturne elbow
#

what the

#

that's old

#

really old

slate orchid
#

oh ok

nocturne elbow
#

right

nocturne elbow
#

@nocturne elbow no

fringe skiff
#

Hello, i've been looking at the api for a while but i don't understand it fully, I have a group that has a prefix. permission for tab and chat which has text you can put in and i want to do that with a command, from what i understand i should remove the existing prefix permission and put another one with different text..
how would i do that?

nocturne elbow
#

I guess you could do something like

// "Simulate" the meta setprefix command and remove all prefixes with the same weight as the new prefix
group.data().clear(NodeType.PREFIX.predicate(node -> node.getPriority() == newPrefixNode.getPriority()));
// Add the new prefix
group.data().add(newPrefixNode);
fringe skiff
#

wait i dont have a node with metadata

nocturne elbow
#

wat

fringe skiff
#

i think so

#

this is what i was talking about

nocturne elbow
#

Yeah?

fringe skiff
#

i just need to change the text there don't i?

#

how'd i after it changes once tho

nocturne elbow
nocturne elbow
fringe skiff
#

can't i change the text written there

nocturne elbow
#

In the editor yes

#

But nodes are immutable

fringe skiff
#

pretty sure i just have no idea how to use the api thats why i sound so confusing

nocturne elbow
#

To do how the editor does it you have to remove the old one and add the new one

fringe skiff
#

yes

#

thats what i thought of doing

nocturne elbow
#

I mean whether you do it in the editor or not you still have to do it that way

fringe skiff
#

is there a way to "search" a node

#

i only would have prefix. cause all else could change

#

so if id have to delete the node idk how i'd select the correct one

nocturne elbow
#

This I wrote above would suffice, if you don't care about the weight just do .predicate() alone
#luckperms-api message

fringe skiff
nocturne elbow
#

What part of it?

fringe skiff
#

nodetype.prefix (essentially) means that its a node that on the editor would start with prefix.?

nocturne elbow
#

Yes, it's a prefix node

fringe skiff
#

and what does this do
.predicate(node -> node.getPriority() == newPrefixNode.getPriority()

nocturne elbow
#

do you know what a predicate is?

fringe skiff
#

i thought it was some lp related stuff for a second

#

oops

nocturne elbow
#

Not exclusively, no

#

I'm assuming you have a prefix node built? That's what I meant by "newPrefixNode" it'd be your, well, your new ("modified") prefix

fringe skiff
#

i don't but i think i know what you mean

#

this? .predicate(node -> node.getPriority() == newPrefixNode.getPriority()

#

oops

#

i see that there is a // build a prefix node;
would it still work if i used node.builder?

nocturne elbow
#

Well it would yes, but you should use the PrefixNode.Builder

fringe skiff
#

Node newPrefixNode = Node.builder("prefix.5.&8[&#d980ba&8]").build();
i mean this

fringe skiff
#

so would it be .builder(weight,"&8[&#d980ba&8]") ?

#

(that number there is the weight i think)

nocturne elbow
#

How a node is structured internally is, as I just suggested, internal details. Using the specific builder will prevent your code from breaking if Luck goes mad and changes the structure lol

nocturne elbow
#

(also I think the wiki is wrong lol, it's .builder("Prefix", weight))

#

Eh

fringe skiff
#

ah okay

#

well

#

is a node's weight it's group's weight?

nocturne elbow
#

Prefixes have their own weight, separate from the group weight

#

but

fringe skiff