#luckperms-api

1 messages · Page 49 of 1

nocturne elbow
#

!cookbook

frank driftBOT
nocturne elbow
#

but the wiki pages are definitely worth checking

oak storm
#

Ok ^^

tight plume
#

Hello, i have a question, what is the syntax for skript to find a rank of a player with luckperm ? (Or with java ?)

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
tight plume
#

I have that :

    set {_api} to LuckPermsProvider.get()
    set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
    set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getPrefix()

    return coloured {_val} ? ""```
For get a prefix. But i need name(s) of all group(s) of player. How can i do that ?
charred glade
#

т

clever zodiac
#

I dont know how to use enums or even if completablefutures work in skript reflect, so I'm not going to even bother converting that to skript

obtuse jolt
#

LP api doesn’t support skript

#

just do real coding

tight plume
#

😂 Verry « Helpful » also i didn't think there was a wrong coding… but thanks

turbid solar
#

Well.. skript...

wide crane
#

/lp search

ocean citrus
#

how can i change the prefix of someone with the api?

nocturne elbow
#

!API You can get that info from the CachedMetaData, explained in the second page linked here

frank driftBOT
ocean citrus
#

oh if it works like that i think i found it

vernal olive
#

Hello, i have a quaestion.. So yesterday i installed LuckPerms to my server, it worked fine. But i don't know how to make ranks show on tab list. And today ranks not showing in chat. have essentials to and did this: #change-playerlist: true / #add-prefix-suffix: true / #add-prefix-in-playerlist: true. But nothing changed.. Is there a way to make ranks show on chat, tab list and above player?

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
real depot
#

For the ranks to work on chat you need some extra plugins

#

You should read the docs

earnest aurora
#

Hi, I'm using the LuckPerms API to develop my plugin. Small problem: when I start my server and my plugin is activated, I get this warning:

"[Server thread/WARN]: [Ragnarok-Core] Loaded class net.luckperms.api.LuckPermsProvider from LuckPerms v5.3.53 which is not a depend, softdepend or loadbefore of this plugin."

In addition, my server can no longer continue to boot.

Can anyone tell me how to fix this error? Thank you very much for reading this request for help and feel free to mention me if you have the solution ^^

turbid solar
#

Make you sure (soft)depend on LP

earnest aurora
#

How to check that ?

turbid solar
#

plugin.yml

earnest aurora
#

What do I have to put in for me to (soft)depend on the API?

turbid solar
#

LuckPerms

#

Oh

#

Uh

#

depends: [LuckPerms] i think

earnest aurora
#

Thanks, I'll try that

#

This does not work :(

obtuse jolt
#

!paste you startup log

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!

earnest aurora
obtuse jolt
#

that means you didnt put your depend properly

#

send your plugins.yml

storm matrix
#

Does anyone know why this may be?

obtuse jolt
#

This is for code api

earnest aurora
# obtuse jolt send your plugins.yml
name: Ragnarok-Core
author: __Wii__
version: 0.0.1
api-version: 1.17
main: net.ragnarokmc.core.Main
depends: [LuckPerms]
commands:
  setspawn:
    permission: rc.setspawn
    description: Sets a new spawn.
  spawn:
    description: Teleports to spawn.
  aide:
    aliases: help
    description: Shows all available commands.
  group:
    aliases: groups
    description: Change someones group.
    permission: rc.group
  ss:
    description: Punish someone.
    permission: rc.ss
  restart:
    description: Restart server.
    permission: rc.restart```
obtuse jolt
#

I think it depend

#

Without the s

#

Check bukkit documentation lol

earnest aurora
#

Okay

#

Yes, that's it

#
depend: [LuckPerms]
#

It still does not work

nocturne elbow
#

"does not work"?

#

the very single snippet of log you shared indicates that it does work, only with that warning because it wasn't depend, it was depends

#

I don't see anything "not working"

earnest aurora
#

"depends" doesn't exist in spigot doc

nocturne elbow
#

yes? that's what ben mentioned

obtuse jolt
earnest aurora
#

But it doesn't work

obtuse jolt
#

how is it "not working"?

#

the warning still the same?

#

luckperms isnt loaded before your plugin?

earnest aurora
#

Yes, and my (Paper) server is crashing

obtuse jolt
#

crashing then send full error

earnest aurora
obtuse jolt
#

well check the logs

#

go find out

earnest aurora
#

Yes, LuckPerms is loaded before my plugin

obtuse jolt
#

how are you adding luckperms api as a dependency of your own plugin?

earnest aurora
#

I use IntelliJ IDEA, so I go into my modules and add the LuckPerms api

obtuse jolt
#

so you dont use any form of dependency management?

#

maven or gradle

earnest aurora
#

No

obtuse jolt
#

no clue how that works then, but it likely means you are compiling the lp api classes in your own plugin

#

which you shouldnt

earnest aurora
#

Well, no

obtuse jolt
#

actually, you havent even send your errors

#

why am I trying to guess lol

earnest aurora
#

I haven't any error except this one

#

Actually, I read the logs and there are no errors

obtuse jolt
#

.......

#

then what is not working

earnest aurora
#
[12:12:06] [Server thread/INFO]: [Ragnarok-Core] [STDOUT] [RAGNAROK CORE] Database connection successfully enabled.
[12:12:06] [Server thread/WARN]: Nag author(s): '[__Wii__]' of 'Ragnarok-Core' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[12:12:06] [Server thread/WARN]: [Ragnarok-Core] Loaded class net.luckperms.api.LuckPermsProvider from LuckPerms v5.3.53 which is not a depend, softdepend or loadbefore of this plugin.
obtuse jolt
#

means seems like your depend is still wrong

earnest aurora
obtuse jolt
#

if it crash

#

how is there no errors

earnest aurora
#

I think there are errors in console only, but they doesn't appear in the logs

obtuse jolt
#

if its in console

earnest aurora
#

Wait

obtuse jolt
#

then its in the logs lol

earnest aurora
#

Wait

nocturne elbow
#

There must be a crash log in crash-reports or somewhere

earnest aurora
#

Oh um

#

Sorry

#

My server doesn't crash because of my plugin

#

I'm really sorry

#

😅

#

I am very sorry to have wasted your time

nocturne elbow
# earnest aurora ```[12:12:06] [Server thread/INFO]: [Ragnarok-Core] Enabling Ragnarok-Core v0.0....

And if that warning (the bottom-most) still appears that can mean one of two things
Either a) the updated plugin.yml isn't being bundled in the new jar file or b) the jar file that is in the server is the old one
Whichever it is, you can verify by unzipping your jar file on the server and manually checking the plugin.yml and confirm it says "depend" instead of "depends"; if not you should ask in the PaperMC discord, that's kinda out of LP's reach

earnest aurora
#

Okay, thanks a lot !

night pier
nocturne elbow
#

how would I go about getting all members in a group via the api?

nocturne elbow
obtuse jolt
trail sinew
#

hello , am trying to get the group of a player
with this :

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

but since op players have all perms it will always return true if the player is op
how Can I get the group of an op player?

let's say in a server there is admin group and owner group and both of their members are op'ed
how can I check if that player is an admin or an owner ?

#

Maybe I shall get the User class from the player

#

???

turbid solar
#

isPermissionSet(String)?

#

Or use the api

trail sinew
#

OH

#

ok

#

also
would that method work ?

Group getgroup(Player p){
        User user = (User)p;
        return Main.lp.getGroupManager().getGroup(user.getPrimaryGroup());
    }
turbid solar
#

You cant cast User to Player

#

By default primary group is the group with the highest weight

trail sinew
#

so how can I get the User

#

from player

trail sinew
turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
trail sinew
ocean citrus
ember trout
#

how can i get luckperms groups names using spigot api? api.getGroupManager().getLoadedGroups() doesn't give me the names :/

nocturne elbow
#

Group#getName?

ember trout
nocturne elbow
#

make an InheritanceNode for that group and call UserManager#searchAll

#

Passing a NodeMatcher.key(Node) or smth

atomic veldt
#

How do I get the "prefix" of the group the player is in?

nocturne elbow
#

The "cookbook" example plugin has an example command for that

#

!cookbook

frank driftBOT
nocturne elbow
#

!api If you are unfamiliar with the LP API as a whole, you should definitely read over these wiki pages: the first one contains overall info about adding and using the API in your project + important info about the API's design you will most definitely want to have in mind when using it
The second page is just a whole bunch of things you will use in your journey throughout the LP API

frank driftBOT
nocturne elbow
#

how ro xhange a users group

clever zodiac
#

!cookbook

frank driftBOT
nocturne elbow
#

still dont work

#

ghelp

turbid solar
#

!nw

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

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

For Console Errors:
nocturne elbow
#

how to set duration when u give a rank?

#

r u dumb

#

tghis is api channel

#

xD

#

?

#

me trying to pull a joke

result: someone asking me if im dumb

#

lol

#

:P

sharp geyser
#

Hi there, I've written a piece of code to add suffix to a player

#

The code does run but the suffix is not changed at all ...

#

(I've debugged the code and each line of code inside the modifyUser() does actually run)

#

Can someone help pls ? 😳

#

Also I think the console would show the LuckPerms Logging Info as I've used the ActionLogger to submit a log. However the log info doesn't appear on the console ..

sharp geyser
#

OMG I figured it out! I just removed the code of the whole logging part from the callback

#

And it worked!

#

I'm not sure if it's a bug as it's not said in the javadoc or wiki (or did I miss something?) but it worked ...

nocturne elbow
#

hi

primal silo
#

Hello
I have a small question regarding the usermanager API.
Is there an easy way to retrieve all users having a specific permission?
I tried using the searchAll method but am not sure how I should use the nodes to achieve this.

nocturne elbow
#

That's.. what searchAll is for lol

#

What have you tried?

primal silo
#

Well that's what I assumed

#

I just don't know how to use that method.
Is there anywhere like a code example I could look at?

nocturne elbow
#

searchAll takes a NodeMatcher, check out the static factory methods in the NodeMatcher interface, there are a few ones that take a Node or a String as node key

#

!cookbook I'm fairly certain there is also an example in the cookbook plugin

frank driftBOT
primal silo
#

Thanks, didn't know that existed

nocturne elbow
#

"that"?

#

The cookbook plugin or the NodeMatcher?

primal silo
#

The cookbook

#

One more question about that API.
So I create a matcher using a PermissionNode and that will result in a Map<UUID, PermissionNode>. Is there a way to retrieve the playername as well directly from the searchAll method?

turbid solar
#

I assume the UUID is the player uuid right?

primal silo
#

Yes

turbid solar
#

If so, you can use your platform or the api to get the username

primal silo
#

Yeah but I am looking to retrieve every user in the network even if the player has never joined the specific server I am running the search on

turbid solar
#

d;lp UserManager#lookup

slate deltaBOT
#
@NonNull
CompletableFuture<String> lookupUsername(@NonNull UUID uniqueId)
throws IllegalArgumentException, NullPointerException```
Description:

Uses the LuckPerms cache to find a username for the given uuid.

Returns:

a username, could be null

Throws:

IllegalArgumentException - if the username is invalid
NullPointerException - if either parameters are null

Parameters:

uniqueId - the uuid

primal silo
#

Ah nice, I'll try that

nocturne elbow
#

Why does it say the LuckPermsApi is not enabled but the plugin depends on LuckPerms?

clever zodiac
#

is there like a posted format for action log descriptions xd

nocturne elbow
nocturne elbow
#

Though short

willow heart
#

If I directly update the MariaDB, would changes be reflected immediately or would the player have to rejoin the server?

#

Trying to figure out how to do 3rd party integration (not a plugin)

nocturne elbow
#

Neither (unless you wait like 5+ minutes before logging in again)

#

Why would you update the db yourself?

willow heart
#

@nocturne elbow, we're currently creating a shop, and I'm in charge of the backend. Since ranks can be bought, I need to figure out how to give it to the user. I was hoping updating the Database would reflect the changes, since I'm not seeing any other way to integrate with Luckperms

frank driftBOT
#

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

willow heart
#

Erm, sorry for pinging. When I was mentioning you. it showed your username (@ emily) instead of your nickname (@ Emily (do not ping))

#

No Discord! I didn't want to ping again in the edit!

nocturne elbow
#

Well you have two options

#

Well, 3 but I would reduce it to two

#
  1. After updating the db, dispatch a /lp networksync command.. but if you're gonna run commands anyway I would suggest instead you do:
  2. Dispatch a command directly instead of updating the db, that will do a number of things too
#
  1. Would be to make your own bridge plugin that bridges your system with LP API to apply the changes
#

Easiest by far is #2 lol

willow heart
#

#3 would be a bit more practical for me, but yea, #2 is easiest

#

Alright, I think I have a vague idea of where to start

#

Thank you Emily! I appreciate your patience and your support

nocturne elbow
#

#3 is by far the most flexible option

#

You have your own plugin in between, you can process your own instructions and do w/e you want, not constrained to specific command syntaxes

willow heart
#

Indeed

#

We'll have to have a plugin anyways which loads in cosmetics and perks, so it'll just be another thing that's integrated

trail oar
#

If I want to do something if a player loses/gains a permission using bungeecord api how which event should I use?

#

(Also, what if i wanna do it in spigot?)

nocturne elbow
#

NodeMutateEvent

#

Or if you want to do things for them separately, NodeAddEvent and NodeRemoveEvent

trail oar
#

Thanks, the event bus thing is required for this right?

nocturne elbow
#

"thing"?

trail oar
#

idk the name xD

#

i guess it would be subscribe

nocturne elbow
#

Yeah, LP uses its own event bus for all this

trail sinew
#

I have the luckperms plugin in my serv but am always having :
The RegistredServiceProvider.getProvder() null

#

How can I solve this

nocturne elbow
#

Did you add LuckPerms as a depend?

trail sinew
#

soft depend

#

shall I change it to depend

nocturne elbow
#

Hm shouldn't be needed

#

Well, either depend or soft-depend

#

Can you send the whole server log?

trail sinew
#

sure

#
[15:55:04] [Server thread/INFO]: [TabList] Enabling TabList v1.0
[15:55:04] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[15:55:04] [Server thread/INFO]: Done (63.817s)! For help, type "help"
[15:55:23] [User Authenticator #1/INFO]: UUID of player validdanixo is c1ee717c-f000-3c9f-9658-bc1030af442e
[15:55:26] [Server thread/INFO]: validdanixo[/127.0.0.1:64629] logged in with entity id 210 at ([world]-150.19303922415043, 84.0, -231.6021123194474)
[15:55:28] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5035ms or 100 ticks behind
[15:55:39] [Server thread/INFO]: Sending the packets !
[15:55:39] [Server thread/WARN]: java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because the return value of "org.bukkit.plugin.ServicesManager.getRegistration(java.lang.Class)" is null
[15:55:39] [Server thread/WARN]:        at tablist.valid.me.Main.ordor(Main.java:55)
[15:55:39] [Server thread/WARN]:        at tablist.valid.me.UpdateList.update(UpdateList.java:21)
[15:55:39] [Server thread/WARN]:        at tablist.valid.me.UpdateEvents$1.run(UpdateEvents.java:21)
[15:55:39] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:82)
[15:55:39] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415)
[15:55:39] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1254)
[15:55:39] [Server thread/WARN]:        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:438)
[15:55:39] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1202)
[15:55:39] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1035)
[15:55:39] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303)
[15:55:39] [Server thread/WARN]:        at java.base/java.lang.Thread.run(Thread.java:831)
[15:55:39] [Server thread/INFO]: packet sent !
[15:56:13] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 15241ms or 304 ticks behind
>java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.RegisteredServiceProvider.getProvider()" because the return value of "org.bukkit.plugin.ServicesManager.getRegistration(java.lang.Class)" is null
[16:00:42] [Server thread/INFO]: Unknown command. Type "/help" for help.
#

we'll get the error at player join and quit events

#

cuz I used the Luckperm class there

nocturne elbow
#

the whole log please

#

logs/latest.log

#

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

trail sinew
#

ok

#

here u go

nocturne elbow
#

hm how are you building your plugin? maven, gradle, ...?

trail sinew
#

I just use the luckperms jar as an external archive

nocturne elbow
#

Make sure you aren't bundling the API inside your jar, that can cause this issue to happen

#

You can just unzip your jar file to double check if the net.luckperms packages are in there or not

trail sinew
#

ok

#

ty for help :))

nocturne elbow
#

yw

nocturne elbow
#

how do i check the permission of an offline player with the API?
pls help, ty

#

okay nvm if the api is bullshit i cant do anything

#

Lmao

late charm
turbid solar
#

No

#

!chat

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
late charm
#

Essentials provides the {DISPLAYNAME} placeholder to its chat formats which will combine the prefix, nickname and suffix into one
{DISPLAYNAME} = %1$s = Player#getDisplayName()

Then I'm confused, what does it mean by it will combine the prefix, suffix etc?

#

Oh so I can use getDisplayName only if I have Essentials installed?

#

I'll try that. thanks

trail sinew
#

I still get the Bukkit.getServicesManager().getRegistration(LuckPerms.class)
null
I even changed to maven and it still happens

#

I use this to check :

@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
            if(label.equalsIgnoreCase("test")){

                if(Bukkit.getServicesManager().getRegistration(LuckPerms.class)==null){sender.sendMessage("lp null");}else{sender.sendMessage("lp not null");}
            }   
        return true;}
obtuse jolt
#

check that luckperms start before your plugin

trail sinew
#

ok

#

It starts before my plugin , and my plugin have it as a depend

obtuse jolt
#

How are you adding luckperms as a dependency to your project?

trail sinew
#

I just added the lp api dependency to my project's pom.xml

#
<project xmlns = "http://maven.apache.org/POM/4.0.0"
         xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0
   http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.companyname.project-group</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
    <dependency>
        <groupId>net.luckperms</groupId>
        <artifactId>api</artifactId>
        <version>5.3</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
</project>
#

help cri

fading vector
#
[18:37:41 INFO]: [LP] > Group Info: s-admin
[18:37:41 INFO]: [LP] - Display Name: s-admin
[18:37:41 INFO]: [LP] - Weight: 70
[18:37:41 INFO]: [LP] - Parent Groups:
[18:37:41 INFO]: [LP]     > manager 
[18:37:41 INFO]: [LP] - Contextual Data: (mode: server)
[18:37:41 INFO]: [LP]     Prefix: "[S-ADMIN] "
[18:37:41 INFO]: [LP]     Suffix: None
[18:37:41 INFO]: [LP]     Meta: (weight=70) (auctions=10)
#

As you can see the group only has a single prefix

nocturne elbow
#

The getPrefixes/Suffixes method returns all of the inherited and owned prefixes/suffixes as shown in lp (user|group) <user|group> meta info

fading vector
#

Ah ok

#

Got it thanks

nocturne elbow
nocturne elbow
nocturne elbow
#

hu

trail sinew
#

Idk if tjere is somethin am doing wrong

#

Is there a other way to get luckperms class ? Or any alternative solutions

nocturne elbow
#

Yeah you can use LuckPermsProvider.get()

#

I don't see why that would happen though besides you bundling the API in your plugin which, apparently you aren't

#

Plus this is weeeeeeell beyond enabling

trail sinew
#

Allright i'll try it once i get home ,. Ty for your time

#

And help

nocturne elbow
#

np

thin turret
#

Hey guys just wondering... how do I add a ImmutableContextSet to a SuffixNode? Can't seem to manage to do it. Here's what I got with the Context so far. ```java
ImmutableContextSet set = ImmutableContextSet.builder()
.add("server", servername)
.build();

nocturne elbow
#

there are a few methods in NodeBuilder, contexts or withContexts

thin turret
#

So would this work? ```java
ImmutableContextSet context = ImmutableContextSet.builder()
.add("server", servername)
.build();
SuffixNode node = SuffixNode.builder(format, 1).withContext(context).build();

nocturne elbow
#

The config.yml?

#

LuckPerms' config.yml?

thin turret
#

Nope from my Plugin config.yml. Here... ```java
server-name: ""

#

Like that as an example

nocturne elbow
#

ah okay sweet lol

thin turret
#

LOL

nocturne elbow
#

yeah that should work fine then

fading vector
#
Collection<Group> inherits = user.getInheritedGroups(QueryOptions.contextual());

If I want to retrieve all inherited groups that have a context of server=survival

#

how would that be possible ?

nocturne elbow
#

Check out the QueryOptions.Builder

#

You can pass your own ContextSet for it

trail sinew
#

Emily , the LuckPermsProvider.get() also didn't work cri

#

It's really depressing bruh

nocturne elbow
#

mood

#

can you send the jar file over?

trail sinew
#

the plugin's jar ?

nocturne elbow
#

ya

trail sinew
#

here or privet ?

nocturne elbow
#

here is fine but if you don't want to my dms are open

trail sinew
#

uploading

nocturne elbow
#

uhm

#

is it supposed to be that large?

#

like, you're almost definitely doing something wrong lmao let me see

#

you're shading the entirety of Minecraft lmao

#

I'mma go ahead and delete that 'cause it's against MC EULA and Discord ToS lmao

#

But yeah, you are bundling every single thing you depend on, you most definitely do not want to do that lol

trail sinew
#

nope it's just my internet

#

and it got cancelled for no reason

#

sorry for keeping u waiting

#

imma reupload

nocturne elbow
#

???

#

nono

#

you did send it, it was over 40 MB in size

trail sinew
#

Oh

nocturne elbow
#

And you are bundling in your plugin the entirety of a modified MC server (spigot) + the LP API + whatever else you are depending on

#

I don't know what you're doing to build your plugin jar but you should probably do some research into how to not do that

trail sinew
#

weird

#

I never created a plugin that was over 10mb

#

and this one have like 2 classes

#

lemme fix everything and i'll tell u when it's done

nocturne elbow
#

sure

clever zodiac
#

is there a way to get every UUID of every user who has data through the api

#

if not I need to use bukkit's offline player's thing but I'd rather do something with less overhead

#

nvm that also wouldnt work aha

#

hm I was just doing an autocomplete search, getUniqueUsers() possibly?

fading vector
#

Is there anyway to retrieve the config's

#
server: survival
#

context set in the plugin itself from the api ?

#

For example i want to retrieve all the inherited groups of a user depending on the server LuckPerms is in which is specified in the context server: anyserver

jaunty pecan
#

luckPerms.getServerName()

fading vector
#

thank you

jaunty pecan
#

alternatively, you may find luckPerms.getContextManager().getStaticQueryOptions() more useful

fading vector
#
   String serverName = api.getServerName();
       ImmutableContextSet contextSet = ImmutableContextSet.builder()
                .add("server", serverName)
                .build();
        Collection<Group> inherits = user.getInheritedGroups(QueryOptions.contextual(contextSet));
        for (Group g : inherits) {
            Bukkit.broadcastMessage(g.getName());
        }
[01:07:44 INFO]: [LP] - Parent Groups:
[01:07:44 INFO]: [LP]     > master (server=survival)
[01:07:44 INFO]: [LP]     > owner 
#

I think this is supposed to print all the groups that I inherit having context server=survival
It's printing all my inherited groups.

nocturne elbow
#

It's printing all the inherited groups that satisfy the context

#

global context satisfies all contexts (unless turned off in settings, effectively disabling global nodes (I've never seen anyone want this lol))

fading vector
#

oh

nocturne elbow
#

I think there's a flag for the query options

fading vector
#

yea i aint gonna do that lmao

nocturne elbow
#

That's probably what you want

fading vector
#

yup that worked

#
      ImmutableContextSet contextSet = ImmutableContextSet.builder()
                .add("server", serverName)
                .build();
        QueryOptions options = QueryOptions.builder(QueryMode.CONTEXTUAL).flag(Flag.APPLY_INHERITANCE_NODES_WITHOUT_SERVER_CONTEXT, false)
                .context(contextSet)
                .build();
        Collection<Group> inherits = user.getInheritedGroups(options);
        for (Group g : inherits) {
            Bukkit.broadcastMessage(g.getName());
        }
nocturne elbow
#

god I hate these flags

#

they're so obnoxiously long lmao

obtuse jolt
#

But we’ll but for understanding what it does

fading vector
#

and surprisingly idk why it only printed the highest rank which was my end goal.
Apart from displaying the primary group prefix in chat, the goal is to display the highest group you inherit from on that specific server beside the primary group prefix.

obtuse jolt
#

It’s make it clear

nocturne elbow
#

BufferedReader bufferedReader = new BufferedReader

obtuse jolt
#

Haha

nocturne elbow
#

so they aren't taken into consideration

#

like, technically you only inherit master in server=survival

#

that "enables" the transitively inherited ones to exist in global context as well

#

I think

#

lol

fading vector
#

it was because i only inherited master in context server=survival

#

once i added another group with the same context, it displayed both

#

just need to sort them by highest weight and display the one with the highest weight

trail sinew
#

Emily it's done , I just had to remove the spigot decompiled from the output file
😄

#

and Now I don't get null errors

remote root
#

How do you connect certain assets from this plugin to other plugins?

#

If anyone can teach me about it please Dm me

#

I mean In general*

#

Connecting plugins to other plugins

last merlin
#

How do I add a temp rank?

nocturne elbow
#

that's an extremely vague question

remote root
nocturne elbow
remote root
#

Like luckperms say I want to display a Rank with a description of the rank that is a Lore

nocturne elbow
#

that... was not for you?

#

But sure lol

remote root
nocturne elbow
#

'?'?

#

Have you heard of this feature discord has called "replies"?

remote root
#

Oh sorry

#

I didn't see that lol

nocturne elbow
#

it's okay

nocturne elbow
#

You store them in LP, but it's other plugins' responsibility to actually take them and display them

rapid hearth
#

Hey, how do I reference the LuckPerms API as a library in a Velocity-Plugin project?

nocturne elbow
#

hi i never done bungee stuf b4

#

how to

#

register luckperms instance\in bungee

#

this.luckPerms = getServer().getServicesManager().load(LuckPerms.class);

#

spigot

#

but

#

hjow

#

bubnegee

silver sleet
#

You can just retrieve an instance using the LuckPermsProvider

rapid hearth
#

On that note, is there a way to get just the prefix for a user using the LuckPermsProvider in velocity?

rapid hearth
# remote root Yea yea
getLuckPermsAPI().getUserManager().getUser(player.getUniqueId()).getCachedData().getMetaData().getPrefix()```
#

the getLuckPermsAPI() method returns a instance of LuckPerms which you get using

        {
            luckPermsApi = LuckPermsProvider.get();
        }```
In your plugin's constructor
nocturne elbow
#

that is so wrong on so many levels

obtuse jolt
rapid hearth
#

Constructive advice is better than laughing and pointing

obtuse jolt
#

plugin load at onenable

rapid hearth
#

for velocity?

#

I was just told earlier today that onEnable is depricated

#

I mean you are right, I meant to say its suppose to go into the method thats listening for ProxyInitializeEvent.

obtuse jolt
#

ah yea, I always just called that method name onEnable to be consistent with bukkit api lol

high turtle
#

Does anyone know how I can check the permissions of an offline player?

white dove
#

./lp user [name] info?

#

maybe that works

high turtle
#

with the api

proud wren
#

What would be the alternative to cached data to retrieve a meta value for someone who isn't online/in the cache?

#

The code I have now checks the cached data and if that is null retrieves it using user.getNodes(NodeType.META).find { node -> node.metaKey == "color"} which seems to be returning null as well

#

i think i've got it, i need to load the user

#

how does luckperms handle unloading users?

#

like, if i load users will they stick about for ever or is it cached? if so, what sort of cache?

turbid solar
#

I think it unloads the user after 2 minutes?

proud wren
#

with no reset on touch?

nocturne elbow
#

you can cancel the UserUnloadEvent

proud wren
#

Blimey okay - looks like it's wrapper api time then 😬

#

Does this include online players as well then?

obtuse jolt
#

Online should remain loaded

#

Honestly I’d rather you just let lp handle when to load or unload

proud wren
#

Would cancelling the unload event reset the timer or would I then be in charge of unloading users myself?

obtuse jolt
#

Then if you specific need a user that is not loaded, call the load user method as required

proud wren
#

Yeah I'd rather that to! But a timer that doesn't reset on touch is pretty useless if I'm touching specific users very frequently

obtuse jolt
#

Yea if you can code a decent logic in which determines frequent users yourself, then sure lol

#

Else you may run into your server using too much memory.

proud wren
#

And the resetting is done on L204 it seems

obtuse jolt
#

Generally yea caching does that, but lp internal caching isn’t documented

#

So test and see lol

nocturne elbow
#

I think "CachedData" doesn't exactly reflect the general idea of what people think of a "cache"

#

It's more of "precalculated"

#

Considering contexts, settings, etc

#

Like, as soon as the user is loaded, it gets calculated for applicable contexts, and cached

obtuse jolt
#

Well yea cache is to save calculated info in memory so we don’t have to keep calculating again

nocturne elbow
#

Yeah but it's directly attached/binded/coupled to the User, it is saved when the user is loaded, it vanishes when it's unloaded, it's invalidated when the user is, when they change contexts etc

#

After all the PermissionHolder is the data entity

proud wren
#

Right, so the user still gets unloaded after two minutes regardless?

nocturne elbow
#

Tbh Luck would probably be best suited for these questions lol

#

"Probably" tsk

#

I know there's the UserHousekeeper which is what drives the unloading, uh I'm not exactly sure what happens when that happens
I also don't store Users long term, but fetch them on demand and use as a local variable, but that's me tho

proud wren
#

Yeah, it seems that when it does the unloading it checks against two caches, one for if it's been recently used by the API. This cache expires after 5 minutes.

nocturne elbow
#

Like yeah there is eventually a point in time (e.g. after unloading and relogging, re-loading etc) in which the instance you're holding is no longer valid, and LP is handling a completely different instance

#

In short: mutability bad

proud wren
#

Yes definitely, although I'd assume the cache would be invalidated at that point?

#

Like, there are methods to invalidate the cached data and permission calculations so I'd assume that these were used somewhere

#

I need to just boot this up in an IDE and have a poke about, github search only gets you so far :')

nocturne elbow
#

Yeah those are called on things like the ContextManager, when players change worlds, or just entirely too when a permission is changed it's also recalculated

nocturne elbow
proud wren
#

It seems like the registerApiUsage method is only called when you load a user, not when you get it or do anything with it

#

The other method is only called on attempted log ins, so it's a straight timeout cache with no reset on touches

proud wren
fallow plume
#

whats the api to get the groups prefix?

vagrant dragon
#

how to give player offline permission?

mighty echo
#

Someone can help me using the LP API? I really need to get a player group name and im not fidding out how to do that

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook has examples

frank driftBOT
mighty echo
#

tks

turbid solar
#

What?

nocturne elbow
#

Well you need to fetch the new user name from Mojang yourself, LP does none of that stuff

#

But you can save it in LP with UserManager#savePlayerData or something

nocturne elbow
#

d;LP usermanager#saveplayerdata

slate deltaBOT
#
@NonNull
CompletableFuture<PlayerSaveResult> savePlayerData(@NonNull UUID uniqueId, @NonNull String username)
throws IllegalArgumentException, NullPointerException```
Description:

Saves data about a player to the uuid caching system.

Returns:

the result of the operation.

Throws:

IllegalArgumentException - if the username is invalid
NullPointerException - if either parameters are null

Parameters:

uniqueId - the users mojang unique id
username - the users username

nocturne elbow
#

Oh wow I nailed it

#

I was so very unconfident on myself on that one lol

night pier
#

Be confident ThumbsUpCatHappy

nocturne elbow
#

Nah

night pier
#

Oh

turbid solar
#

Softdepend on LP

#

Also dont do it on proxy init iirc

wispy harness
#

Is there a way to get the case sensitive IGN of a member?

wild whale
#

lp does't store case sensitve IGN iirc

wispy harness
#

Is there a way to enable that/is it allowed to make a PR for it?

#

Or is it done w/ a specific reason?

nocturne elbow
wispy harness
#

Sure, understandable though. Saved it to my own playerdata instead then 😂 It was for the same reason as that guy, just nice to have it since it already stores it

dull rover
#

So if a plugin hooks into LP via the context calculator, does it just automatically get ran when a permission check is ran for a plugin / player on the hasPermission() check or whatever?

nocturne elbow
#

I don't think so, from what I know, it happens whenever permissions are pre (re?) calculated and cached, for example during login, changing worlds, changing gamemodes ...., essentially whenever any of the bizillion invalidate/invalidateCache/signalContextUpdate etc are called

dull rover
#

Interesting. I have someone who has a project that they check players permissions via the hasPermission() check and in the Spark it's taking up 0.13% and after taking a closer look, they also have Towny on their server which has a context calculator hook for LP, it's actually calling Towny's calculator hook each time and running a ton of extra logic that shouldn't be necessary for this other plugin.

nocturne elbow
#

You can get into a really deep rabbit hole regarding how all of this is cached and stored in the backend 😛

#

Can you send the spark report btw?

trim siren
#

the blacksmith class does not do anything regardig towny. however, the plugin does use towny api in some other classes

#

we're not really worried about performance, its just something odd we noticed lol

nocturne elbow
#

dude idk this plugin is beyond me lmao

#

apparently the context the player is in expires roughly every tick?

#

but the permission queries themselves are backed by a map

#

idk this plugin is insane

icy scroll
#

привет

dull rover
#

Time to ping Luck to have him check it out at some point?

nocturne elbow
#

I guess lol

dull rover
#

I pinged him last time so it's your turn.

icy scroll
#

hello

nocturne elbow
#

the amount of misinformation I myself have created for my own understanding is outstanding 🙃

icy scroll
#

i need help

nocturne elbow
icy scroll
#

what to do I write / pl editor, but the link does not come to me

dull rover
icy scroll
#

How is that?

night pier
#

This is the channel for the LuckPerms API. (development)
if you need plugin support, use the channels listed above.

subtle lagoon
#

Using the Bukkit service manager, it's returning a null service provider. what would cause this?

#

im seeing LuckPerms loaded before my plugin too, as should be as I depend on it in the plugin.yml

#

obviously a me issue but im not sure what would cause it

#

my simple test plugin worked without issue

#

ah, forgot to set the maven dependency as provided so it included and relocated the class, so the classpath changed :^)

#

thanks for the help me

subtle lagoon
#

NodeRemoveEvent isn't called for lmao when i do the following:

/lp user TheUsername parent set lmao -- Properly calls NodeAddEvent
/lp user TheUsername parent set default -- Does NOT call NodeRemoveEvent, even though it was
#

is this an oversight?

nocturne elbow
subtle lagoon
#

very nice specialization for a common action

nocturne elbow
#

Myes, it's essentially for NodeMap#clear and overloaded variants

thorn kettle
#

Hello. I need to add multiple groups to the user (as you can do with "/lp user blablubb parent add anothergroup") through the API. How do I do that? The User interface only has .setPrimaryGroup() and it takes only one group. 😦

nocturne elbow
#

Setting the primary group is not necessarily related to adding parent groups

#

They are two different concepts

#

You need to build an InheritanceNode and add it to the user's NodeMap data

#

!api the second link has some examples for that and many other things as well

frank driftBOT
nocturne elbow
#

I think

#

!cookbook if not the cookbook plugin is a good example to use as guide

frank driftBOT
thorn kettle
#

ok thank you. I will try.

thorn kettle
#

Thank you. It works 🙂

prisma lantern
#
    public static void addPermission(ProxiedPlayer p, String name) {
        LuckPerms lp = LuckPermsProvider.get();
        PermissionNode n = PermissionNode.builder(name).build();
        
        User user = lp.getUserManager().getUser(p.getUniqueId());
        Objects.requireNonNull(user).getNodes().add(n);
        lp.getUserManager().saveUser(user);
    }```
#

why doesn't that add a permission

#

if i run that method

#

adding permission

#

tab.group.default

#

when i do /lp user Quared permission info

#

it isnt there

nocturne elbow
#

that looks like bungee, and you're using /lp, are you sure the proxy and the server are synced?

prisma lantern
#

yea

#

even if i do /lpb

#

it still says nothing

nocturne elbow
#

so it doesn't show in /lpb user <user> permission info either?

prisma lantern
#

nope

nocturne elbow
#

well that just sounds none of this is running tbh, put various print statements in there, e.g. at the beginning of the method, then print the node, and put a print in saveUser(user).thenRun(<print here>)
Also any errors in the proxy console?

prisma lantern
#

no errors

#

but ill try

nocturne elbow
#

also screenshot /lpb info

prisma lantern
#
    public static void addPermission(ProxiedPlayer p, String name) {
        System.out.println("Hello from adding");
        LuckPerms lp = LuckPermsProvider.get();
        PermissionNode n = PermissionNode.builder(name).build();
        
        User user = lp.getUserManager().getUser(p.getUniqueId());
        Objects.requireNonNull(user).getNodes().add(n);
        lp.getUserManager().saveUser(user).thenRun(() -> System.out.println("Hello from saving"));
    }```
nocturne elbow
#

just to be entirely sure, in game run /lp user <user> info and same for /lpb

#

because that just looks like it's working

#

there is no reason for it to not lol

prisma lantern
#

first is lpb

#

2nd is lp

nocturne elbow
#

getNodes returns an unmodifiable view of the holder's own nodes

prisma lantern
#

oh

#

then

nocturne elbow
#

to modify this you use the data() which returns the NodeMap

prisma lantern
nocturne elbow
#

yeah that should do it

prisma lantern
#

alright

#

lets see

#

lets go

#

it works

prisma lantern
nocturne elbow
#

sweet

viral lotus
#

Eclipse is giving me this when I try to register events. Is this common?

nocturne elbow
#

EventBus#subscribe returns an EventSubscription which extends AutoCloseable if you wish to "close" the subscription anytime and not use it
AutoCloseables are usually but not exclusively used for resources, e.g. file IO, database connections, network streams, which require to be closed to safely handle them
In this particular case you can ignore that warning

viral lotus
dull rover
jaunty pecan
#

the lookup is cached

#

so it doesn't run on every call

dull rover
#

But the question is, why is Towny even invoked here at all? Is it simply because it registers a calculator hook?

jaunty pecan
#

Yes

dull rover
#

Hmm, okay. I guess it's something they'll just have to live with then. Thanks for getting back to me on that.

quasi igloo
#

Track.promote() is asking for a user, how do I get a user, when I try to import user eclipse can only find the essx User because I'm using essx for something else

#

also how to I promote/demote a user until they get a specified group?

nocturne elbow
frank driftBOT
quasi igloo
#

ah yes giveMeADamnUser()

nocturne elbow
quasi igloo
#

ok, I will try to find out how to do that, thanks

nocturne elbow
#

That's what the .. parent settrack .. command does essentially

#

/blob/ LOL

#

Keep in mind the way the command does it is not a one-to-one copy to how you'd do it with the API, it uses internal classes and stuff, rather than the API itself

quasi igloo
#

where is getPlayerGroup()

nocturne elbow
#

?

#

oh

quasi igloo
#

the 2nd function is a public static String getPlayerGroup()

nocturne elbow
#

ugh I really dislike that example

quasi igloo
#

but I can't find which class it's in

nocturne elbow
#

it isn't in any class, that's something you would make to get the player's "primary" group (assuming the collection is ordered)

quasi igloo
#

o

#

I don't get collections, arrays are better

#

thanks

nocturne elbow
#

Eh you should definitely become familiar with Java itself and the Java API before diving into something like the LP API

#

That's my suggestion, it takes a lot of things you should know beforehand for granted

obtuse jolt
#

collections are just abstractions of arrays

#

But never heard someone say they like arrays lol

quasi igloo
#

it's giving me a java.lang.ExceptionInInitializerError for public static LuckPerms lp = (LuckPerms) Bukkit.getServicesManager().getRegistration(LuckPerms.class).getProvider();, why?

obtuse jolt
#

static 💀

quasi igloo
#

well I want to call it from my other classes

obtuse jolt
#

That is the worse way of doing that btw

#

But anyways you need to get the lp instance at the onEnable method

#

Also ensure you set lp to load before your plugin, by configurating depend in plugins.yml

quasi igloo
#

ah

#

ok it works now thanks

remote root
#

Can someone help me in Dms with the luckperms api

#

Please do ping me or dm me

nocturne elbow
#

Just ask here

nocturne elbow
stray elbow
#

I'm routinely checking whether a certain condition is being met and assigning a permission group that lasts grreater than the interval of the check time. I need to be able to overwrite the remaining time on the temppermission. How would I be able to do that?

#
                    Node node = Node.builder("group.test")
                            .value(true)
                            .expiry(Duration.ofSeconds(50))
                            .build();

                    DiscordPlugin.LUCKPERMS.getUserManager().modifyUser(playerUUID, user -> user.data().add(node));
                }
            }
        }.runTaskTimer(DiscordPlugin.INSTANCE, 0L, 200L);```
#

i set the durations to be low for testing

#

and it appears that the new node doesn't overwrite the old one

#

and thus every 50ish seconds there will be up to a 10 second gap where the player would not have the permission

#

(the real time interval would only be once an hour or so)

#

i put in a fix by checking to see if the user has the node and just removing it and re-adding it, let me know if there is a better way

nocturne elbow
#

d;LP TemporaryMergeStrategy

slate deltaBOT
#
public enum TemporaryNodeMergeStrategy
extends Enum<TemporaryNodeMergeStrategy>```
TemporaryNodeMergeStrategy has 1 extensions, 2 methods, 3 all implementations, and  3 fields.
Description:

Controls how the implementation should behave when new temporary nodes are set that would otherwise conflict with existing entries.

The default behaviour of NodeMap.add(Node) is to return a result of DataMutateResult.FAIL_ALREADY_HAS when an equivalent node is found. This can be replicated using NONE.

However, the NodeMap.add(Node, TemporaryNodeMergeStrategy) method allows this behaviour to be customized for temporary permissions.

nocturne elbow
#

Well, almost lol

rose gale
#

i added luckperms to my pom.xml but the project is marked red

turbid solar
#

!paste pom.xml

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!

rose gale
#

help

#

where should I enter the code to add luckperms to my project

obtuse jolt
#

!api

frank driftBOT
stray elbow
remote root
#

In my plugin I need to make it display A certain rank from luckperms can anyone help me out in dms or we can call or I can send snips so I can show you where I want it so we can do it

#

Dm me In the next 24 hours please

nocturne elbow
#

what about the group you need to display?

#

the name? the display name? the prefix?
how you get the group?

remote root
#

Like for say:

#

Name : Bob

Last on: 6 days

Rank: Member

#

Like I need it to display like that

#

Or for owner

#

Name : Iamtheowner

Last on: Now

Rank: Owner

nocturne elbow
#

so you need to get the player's primary group and show the group name?

remote root
#

Finally someone understands me

nocturne elbow
#

you got anything until now?

remote root
#

Just 2 things left and I'll be done with my GUI

nocturne elbow
#

I meant if you got anything about getting the User and/or the player's group

remote root
#

Oh no not at all I am So confused

nocturne elbow
#

with?

remote root
#

I don't know how to display it

#

If you could send me a code to copy paste so I can read it or teach me that would be great

nocturne elbow
#

I suggest you start off by reading this page (more particularly this section linked), it goes about getting an LP user from a player; if the player is offline, you'll need to load it, read the section carefully: https://luckperms.net/wiki/Developer-API-Usage#loading-data-for-players, once you get the User, there's a method for it uh, getPrimaryGroup or something which is more than likely what you want.
You might also want to check out the API "cookbook" example plugin, it's a good "real world" example of how to use several elements of the API that are commonly used https://github.com/LuckPerms/api-cookbook

#

If you have a specific question about something in particular ask about it, but I can't really help "about everything", I don't really feel like repeating everything that's been written in the wiki already, so if you don't get something about it in particular, do ask about it and we can start with that instead

valid sigil
#

hey, I have an issue. My server was backdoored so we needed to delete and reinstall all plugins. And we didnt have time to save the luckperms roles. Is there any way to take the roles from the old luckperms files. Because we have the old files.

devout plume
#

ello

#

how can i use luckperms api on a bungee plugin

obtuse jolt
#

!api

frank driftBOT
obtuse jolt
#

basically only different is like the player class, the rest shouldnt have a difference between platforms

devout plume
#

the Player.class throws an error

#

sry for mentioning

obtuse jolt
devout plume
#

oh

obtuse jolt
#

Player.class is for bukkit, use the correct one for the platform you dev

devout plume
#

gotcha

#

ty

dry berry
#

Guys

#

How can i modify the tab name

#

For a rnkl

#

rank

obtuse jolt
#

!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
mild musk
#

does anyone have a code :)

#

i can use

stark locust
#

How can I rename a group over the API?

nocturne elbow
#

manually

#

Create a new group with the new name, copy all of the nodes from the old one to the new one and then delete the old group

stark locust
#

okay!

nocturne elbow
#

Then you'll want to use UserManager# and GroupManager#searchAll to find all instances of the InheritanceNode representing the old group, and replace them with one pointing to the new one

#

If you want to also update the name in the inheritances that is

#

Not the best yet, I'm planning-ish to expand the API a bit to ease those two processes, as it is far from ideal at first (copying node collections and running bulk operations)

feral badge
nocturne elbow
#

!cookbook The API cookbook plugin has a command example for that

frank driftBOT
nocturne elbow
#

GetMembersCommand or something like that

feral badge
#

thanks!

silver sleet
#

Can the API be used standalone?

turbid solar
#

Dont think so

ornate arrow
#

How to load LuckPermsAPI in Velocity?

nocturne elbow
#

The same way you can use in any other platform

#

!api Check these two wiki pages, they go over that

frank driftBOT
wheat veldt
#

oi

#

I couldn't seem to find anything to get a players group highest in a track

#

anybody know?

nocturne elbow
#

a what?

#

ideally the player will be in either none or 1 group on a track, not more

#

ideally

#

what are you trying to do?

wheat veldt
#

Essentially what the placeholder does

#

wait i could prob just look its open source

#

lmao

nocturne elbow
#

yep, it is

wheat veldt
#

oml i cant even find the class that has them lmao

nocturne elbow
#

I believe all placeholders are in a single class, it would be a matter of Ctrl + F'ing the placeholder name

#

with "highest_on_track" as element

wheat veldt
#

tyvm

#

One thing I can't understand, is where these variables are initialized .. (player, user, userData, queryOptions, element)

nocturne elbow
#

those come from the placeholder expansion/plugin itself, it is adapted beforehand for the placeholder function

wheat veldt
#

how inefficient is this? lmao ```java
public String getDonorTag(Player p) {
Track donorTrack = Achievements.luckperms.getTrackManager().getTrack("donorranks");
PlayerAdapter<Player> playerAdapter = Achievements.luckperms.getPlayerAdapter(Player.class);
User user = playerAdapter.getUser(p);
QueryOptions queryOptions = playerAdapter.getQueryOptions(p).toBuilder().flag(Flag.RESOLVE_INHERITANCE, false).build();
Collection<Group> groups = user.getInheritedGroups(queryOptions);
List<Group> inTrack = getUserGroupsInTrack(donorTrack, groups);
if (!inTrack.isEmpty()) {
Group highestweightedGroup = null;
for (Group group : inTrack) {
if (highestweightedGroup == null) {
highestweightedGroup = group;
} else if (group.getWeight().getAsInt() > highestweightedGroup.getWeight().getAsInt()) {
highestweightedGroup = group;
}
}
return highestweightedGroup.getCachedData().getMetaData().getPrefix();
}
return "null";
}

public List<Group> getUserGroupsInTrack(Track track, Collection<Group> groups) {
    List<Group> inTrack = new ArrayList<>();
    for (Group group : groups) {
        if (track.containsGroup(group)) {
            inTrack.add(group);
        }
    }
    return inTrack;
}
visual zenith
#

Hi ! I search to get the number of player in specific group with the API. It's possible ?

visual zenith
#

thx

obtuse jolt
#

then adapt it for your own use

visual zenith
#

Yeah i try but i don't understand something here

#

because it's for the same usage but i just need to return to use on other place in my code

obtuse jolt
#

ah yea you need to learn async coding

#

meaning learning java's completable future api

#

There is a short section here https://luckperms.net/wiki/Developer-API, but you probably want to do your own research on it first.

tight plume
#

Hello, it's possible to get all of parent (group) of a player ?

night pier
#

/lp user <username> parent info

#

oh, nvm. this is....

tight plume
#

No no with the api 😂

night pier
#

yep, i realized that. mb

tight plume
#

🙂

nocturne elbow
tight plume
nocturne elbow
#

I would assume so. I used the search function in the top right btw

tight plume
#

It's my first time to use java objects.
I try this but i have an error do you know the good syntaxe ?

    set {_api} to LuckPermsProvider.get()
    set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
    #set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getSuffix()
    set {_val} to {_user}.resolveInheritedGroups({_user}.queryOptions().toBuilder().flag(Flag.INHERITANCE, false))

    return coloured {_val} ? ""```
#

I need to have a list of all prefix of all parent of a player

#

Do you have a list of all class ?

nocturne elbow
#

What error do you get?

#

I don't know what that is but it kind of looks correct

tight plume
#

set {_val} to {_user}.resolveInheritedGroups({_user}.queryOptions().toBuilder().flag(Flag.INHERITANCE, false))
This return what ? String ?

#

A list of strings ?

nocturne elbow
#

resolveInheritedGroups? I think it returns a Set of Groups

tight plume
#

Builder seem doesn't work on skript i suppose

nocturne elbow
#

You aren't rebuilding the QueryOptions Builder

tight plume
#

Ho

nocturne elbow
#

Like in here

#

It calls build at the end of the query options builder

tight plume
#

So i have to do that ?
set {_val} to {_user}.resolveInheritedGroups({_user}.queryOptions().toBuilder().flag(Flag.INHERITANCE, false).build() one ) missing

#

Where i have to write it 😮

#

At the end ?

tight plume
nocturne elbow
#

That's not really a helpful error message

tight plume
#

I only have that :'s

#

When i remove that : .toBuilder().flag(Flag.INHERITANCE).build()
Skript work how can i get all of the prefix of all groups for a user ?

nocturne elbow
#

Ah, apparently it's getQueryOptions, not queryOptions

tight plume
#

I don't need builder ?

nocturne elbow
#

Yes you do, but the function isn't called queryOptions, it's getQueryOptions

tight plume
#

i can't do something like that ? {_user}.resolveInheritedGroups().getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getPrefix()

nocturne elbow
#

In there you should be able to just call getMetaData(), no arguments passed to it

tight plume
#

{_user}.resolveInheritedGroups().getCachedData().getMetaData().getSuffix() like that ?

nocturne elbow
#

Yeah

#

Unless you're using a 2 years old LP version Lol

tight plume
#

Ho 😮

#
    set {_api} to LuckPermsProvider.get()
    set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
    #set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getSuffix()
    set {_val} to {_user}.resolveInheritedGroups().getCachedData().getMetaData().getSuffix()

    send "%{_val}%" to {_p}```

It's send me `<none>`
How can i fix that ?
zinc shuttle
#

Is the inheritedGroups suffix null?

tight plume
#

Omg i'm dumb 😂

#

But yes i changed for prefix but still none (I have prefix)

zinc shuttle
#

But you are trying to get the suffix....

#

Not the prefix

#

The prefix is before the name
The suffix is after the name

tight plume
#

Yes i know, i change it to the prefix but it's the same : s

#

again <none>

zinc shuttle
#

You tried asking in the skript discord?

nocturne elbow
#

Uh is this skript?

tight plume
#

I can only have 1 prefix on the chat. I want to have all of other prefix (from other groups of a player)

nocturne elbow
#

Look, not to hate on skript, I barely know it, but if you're at the point of using the LP API, I strongly suggest you use Java (you definitely are capable if you're using the LP API already!); the tools at your disposal will be vastly superior and possibilities will expand to a whole different perspective

nocturne elbow
#

Well it's not "a setting", flip a switch, it's done, but there is a section in the config for that, yes

tight plume
nocturne elbow
#

I see

tight plume
#

Beacause if i don't do that it's to many text in my chat area

tight plume
#

I just want to get all of others prefix in string for a player, it's possible with java ?

nocturne elbow
#

Absolutely

#

I don't know the capabilities of Skript, but the LP API is designed in Java, I would be surprised if you couldn't do it lol

#

You can probably do it with Skript too, but I can only help so much

tight plume
#

I can write java inside skript

#

Just idk what i need to write beacause i'm too beegeener in java : s

#

I enderstand it's a class language with objects

#

Can you help me to write the line please ? : s

nocturne elbow
#

Well, I don't know how you would do it in skript (or again, what its capabilities are), but if I were to do that in Java I would do something like this

user.getCachedData().getMetaData(
    user.getQueryOptions().toBuilder().flag(Flag.INHERITANCE, false).build()
).getPrefixes()
    .values().stream()
    .collect(Collectors.joining(" "));

that would join all prefixes into a string, separated by a single whitespace each

#

that's kinda better

tight plume
#

Ok and the prefix of the higer group too ? Because i don't need it it's by default in the chat

zinc shuttle
#

Would HIGHLY recommend learning java instead

nocturne elbow
zinc shuttle
#

Is there not a skript addon for luckperms?

tight plume
#

I trying your idea

nocturne elbow
#

This server in particular isn't "Java help", but there are tons of others that are dedicated to that

tight plume
#

I need to set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId()) for replace user ?

#

User is an object ?

nocturne elbow
#

correct

#

Well in Java there are some general conventions (how to name things, capitalization, etc): User is a class, user would be an object of type User

zinc shuttle
#

Honestly skript is a great place for java help

#

(there java help channel of course)

nocturne elbow
#

These conventions really help identify what each thing is

nocturne elbow
tight plume
#

Ho ok

tight plume
nocturne elbow
#

ah

#

I'm stupid lol
It returns a string

that would join all prefixes into a string, separated by a single whitespace each

tight plume
#

Ok hum :/ I try to match it with my skript : s

nocturne elbow
#

if you want them as a list it can be done as well, just collect(Collectors.toList()) instead

#

but yeah again idk what the capabilities are lol

tight plume
#

It's verry stange it's return me <none>

#
    set {_api} to LuckPermsProvider.get()
    set {_user} to {_api}.getUserManager().getUser({_p}.getUniqueId())
    #set {_val} to {_user}.getCachedData().getMetaData({_api}.getContextManager().getQueryOptions(({_p}))).getSuffix()
    set {_val} to {_user}.getCachedData().getMetaData({_user}.getQueryOptions().toBuilder().flag(Flag.INHERITANCE, false).build()).getPrefixes().values().stream().collect(Collectors.joining(" "));

    send "%{_val}%" to {_p}```

And `getAllParrent(Gleush)` (Gleush as player)

Do you see something strange (In Java code ?)
#

I have to import something ?

nocturne elbow
#

import like, import a class or something?

tight plume
#

Wait wait wait i miss something

nocturne elbow
#

idk how skript works lmao

nocturne elbow
tight plume
#

I already import : net.luckperms.api.LuckPermsProvider

#

I have to import something new ?

nocturne elbow
#

Well, Flag in net.luckperms.api.query.Flag and Collectors in java.util.stream.Collectors

tight plume
#

It's maybe that my error

#

i trying

#

Flag is an alias ?

nocturne elbow
#

huh?

tight plume
#

No no sorry

nocturne elbow
#

ah, it's Flag.RESOLVE_INHERITANCE, not Flag.INHERITANCE

#

This is something proper tooling would help at 😂 instead of pulling everything off the top of my head

tight plume
#

It's verry helpfull for me 😮 thanks again !

#

Nothing to import for the build ?

#

or toBuilder ?

#

Bruh 😂

nocturne elbow
#

well, I wouldn't need to import anything else if I were to be doing this in Java

#

At this point you should really be asking skript support

zinc shuttle
#

Found a skript addon for luckperms btw

#

I don't know if I am allowed to post links so if you want it, its called skUniversal

tight plume
#

I already have it

zinc shuttle
#

Well.. it will take care of all the dirty work for you...

tight plume
#

But i don't found doc online : s

zinc shuttle
#

Go to skripthub, and search for SkUniversal in the documenation

tight plume
#

I can have an actual prefix of the player but not all of the prefix of all group of a player : s this addon can't help me : s

ancient sable
#

?Get ranks api

zinc shuttle
#

You can have multiple prefixes of multiple group on 1 player using the lp config..

ornate arrow
#

How to load LuckPermsAPI in Velocity?

this.luckPerms = LuckPermsProvider.get();

It throws LuckPermsNotLoadedException. Btw, I had set dependencies in plugin.yml.

nocturne elbow
#

<.<

ornate arrow
#

Yes, but it didn't show me smth

#

Its just doc

#

Can u show me, how to load LuckPermsAPI using Velocity? Singleton doesn't work

obtuse jolt
#

how does it "not work"?

ornate arrow
#
Caused by: net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!

But I set in plugin.yml:
depends: ["LuckPerms"]

nocturne elbow
#

Uhm... Velocity doesn't have a plugin.yml? It's annotations based

ornate arrow
#

Ohhhh, its correct. Sorry, i forgot about that.

clever lichen
#

could i get all the players history of groups

#

like even if they expired

nocturne elbow
#

there is no thing for that (e.g. temp group removal on expiry isn't logged);

#

I suggest you do that on your own by listening to NodeRemoveEvent, and check that the target is a User and the event's Node is an InheritanceNode, and keep track of that yourself

clever lichen
#

ok

#

thx

prisma trout
#

Hey guys, just a quick question about luckperms' user meta

#

how heavy is updating a meta value for an online player? I'd like to update a user's meta every second but I'm wondering if using the LP meta is the best solution or not for that scenario

#

if hitting the meta a lot is an issue, caching would solve that (for my use-case, it would be fine to load/save a player's LP information on join/leave, and just manipulate values in memory for the period that they are online)

jaunty pecan
#

yeah - don't update it every second

#

the side-effect of that is that a lot of downstream caches get invalidated, which would make permission checks considerably slower

#

a separate system for online players, then just persist the update on quit sounds like a a good solution

prisma trout
#

yeah i figured

#

sounds good, thanks for the input

swift sage
#

(Google translation)
Hello.
I have a question while developing a plugin using 'LuckPerms'.
How can I get all players in a group?

swift sage
#

Thank you so much! 😃

noble holly
#

Hello.
I have a question while developing a plugin using 'LuckPerms'.

#

i already give perm to default group

#

but its still not working

#

how i fix it

hasty haven
#

u reload your server right now

noble holly
#

already

#

i already restart the server 3 times its still not working

turbid solar
#

Does this have to do with the api?

#

Or 2

noble holly
#

kkk

floral panther
#

Hello guys waveAnimated
I'm currently looking into adding custom contexts from my quest plugin. These would base on conditions which are user-defined checks that can be evaluated at any given time.

However, after reading the API docs it seems like LP wants me to evaluate the state of my context in general without giving me information about what value was specified in the context that is currently checked.
From my POV it looks like LP is building a list of all contexts that are currently deemed active instead of checking just the ones that are relevant when a permission is checked. Is that correct?

If it is, it means that I would have to evaluate ALL conditions whenever my calculater is invoked because I don't know which condition i'm supposed to check for. As this happens quite frequently and condition checks are expensive, server performance would be killed.
Can someone confirm this?

nocturne elbow
#

I think you are misunderstanding what a context is: a context is a state, a status the player exists in at any given point in time, not "event based". For example the world context represents the state in which world the player is in at any given point in time, or from ExtraContexts the whitelisted context, if the given player is currently whitelisted or not. None of these are event driven, it is data that just "exists in the player", you can think of it as a custom field in the User object

#

That's why a context calculator, the only thing it takes for you to do the job is the player object itself (if you need to fetch state from elsewhere you will need to DI it when creating the calculator)

floral panther
#

Ok, that is what i was suspecting otterSad
Thank you for the reply! 👍

open osprey
#

Hi!

#

It's my understanding that checking user.getCachedData().getPermissionData().checkPermission(String permission) will always return true when the player is opped.

#

Is it possible to check if they also have a specific permission?

#

like

#

idk

nocturne elbow
#

See if it's present in the permission map, in the cached perm data

#

Although checkPermission will return UNSET if it isn't set ¯_(ツ)_/¯

nocturne elbow
#

It's just that on bukkit, if it is unset then it will (likely) fallback to op status, but that is using Permissible::hasPermission(String), not the LP API

loud prism
#

hi, is there an event to know when a player loses a temporary group?

nocturne elbow
#

NodeRemoveEvent

loud prism
#

Thanks you

nocturne elbow
#

Check that the target is a User, the node is an InheritanceNode and that it had an expiry

hybrid panther
prisma trout
#

that's right

limber reef
#

Hi, how can i get a list of permissions on a user with luckperms api?

nocturne elbow
#

There are many ways, but depending on what you want to do, you might be better using one way or another

#

@limber reef do you mean the user's own permissions or inherited ones as well?

limber reef
#

The user's permissions but i already solved.. if i need support i will make other questions. Thanks

nocturne elbow
#

coolio

clever lichen
#

how can i get all the group names

#

?

clever lichen
#

like in my server

nocturne elbow
#

GroupManager::getLoadedGroups()

#

It returns a collection of groups so you can get the names from that

clever lichen
#

where should i put that?

#

because im currently trying to make a gui that is dynamic, first it would get all the groups, and then add them to the gui

nocturne elbow
#

You get the GroupManager instance with LuckPerms::getGroupManager()

#

If you aren't familiar with using the API in general or need to revise classes and packages in general I suggest you check out the javadoc and the general API usage pages

#

!api

frank driftBOT
open sky
#

Hey, is it a desired behavior that the NodeMutateEvent is not called on bungeecord when mutating a user on a sub server?

#

Or is this a bug?

nocturne elbow
#

the node mutation happens on one server, the other servers simply reload from storage

open sky
#

oh i see, thank you

prisma trout
#

hey, how can I check how many players are in a luckperms group. I'd like to be able to get the number of players whos highest priority/inheritence group (im not sure what the correct word is there) is equal the group I'm checking to

#

I can track rank changes myself, but checking to see if there's an easy way to use LP's API for this before I go off and do my own thing

nocturne elbow
#

Take a look into UserManager#searchAll, and the static factory methods in NodeMatcher

prisma trout
#

I see, yea this looks like the right track

#

So say I have group A and group B. B inherits from A. If I search for A, will players in B also show up?

nocturne elbow
#

No

#

This looks for players that own a particular node

#

It just looks for it in storage, it doesn't do any tree traversal or anything and it does not discriminate between different node types

prisma trout
#

Good stuff, thanks emily

wooden fable
#

is there a way, using the API, to reset a player inside a track? (i.e. moving them to the first group in the track)

  • a way without demoting them till they're out of the track and then re-adding them
nocturne elbow
#

Remove all of the user's InheritanceNodes of groups that are on said track, and then put them in the first group (either promote them on the track or simply add the InheritanceNode of the first group)

wooden fable
#

how would I do that? I know how to get the current inherited groups:
user.resolveInheritedNodes(user.getQueryOptions().toBuilder().flag(Flag.RESOLVE_INHERITANCE,false).build())but it's unmodifiable, so how do I remove them?

nocturne elbow
#

None of that
user.data().clear(NodeType.INHERITANCE.predicate(node -> track.containsGroup(node.getGroupName())))
Something like this should do it

#

Idk if that's exactly right but similar method names surely

wooden fable
#

I'll try that, thx!

uncut temple
#

Hello, is there a way to get the rank of an offline player?

nocturne elbow
#

<copied from a moderators response to another person, found when using the discord search function>

nocturne elbow
#

Ok

woven wedge
#

Hi,
is it normal that :

User user = Main.getLuckPermsApi().getUserManager().getUser(player.getUniqueId());
Track track = Main.getLuckPermsApi().getTrackManager().getTrack("default");
if(track != null && user != null) {
    track.promote(user, ImmutableContextSet.empty());
}

Even when /lp user mypseudo promote default works

woven wedge
#

I needed to save the user : api.getUserManager().saveUser(user);

azure fern
#

How i Loop all RankNames

nocturne elbow
azure fern
#

Thank you so much! emilyy#3958

nocturne elbow
#

you're welcome

azure fern
#
if(net.luckperms.api.LuckPermsProvider.get().getGroupManager().getGroup(role) != null) {
        
        Bukkit.broadcastMessage("Yes " + role);
            
}

i check for a existing group

minor venture
#

Hi

#

How i can delete a users node with a string match?

#

Im using this: but idk how to make a node with a string match
user.data().remove();

#

to put inside remove() method

#

nvm

#

i use a collection of nodes but is there a best way?

  User user = api.getPlayerAdapter(Player.class).getUser(target);
  Collection<Node> nodes = user.getNodes();
    for (Node node: nodes){
      if (node.getKey().equals("group.admin")) user.data().remove(node);
    }
nocturne elbow
#

user.data().clear(NodeMatcher.key("node.key"))

minor venture
#

Thank u :3

sinful ibex
#

hi is there any way to hide player command who don't have permission in LuckPerms

nocturne elbow
#

LP is not directly responsible for that

#

Consider it a "side effect" of denying the command permission, which is done by the server itself

#

So register your commands properly and/or deny the correct permissions; everything else is up to the server platform really

sinful ibex
#

i need this because player can see other command who don't have permissions , any plugin hider don't have the feature

nocturne elbow
#

Again, LP is not responsible for that.
If the command is registered properly, denying the permission will suffice, but it is not something LP controls, it's up to the server platform to check at login if the player has the permission for the command, and based on the result, send the command to the client or not

#

If you're on Bukkit I guess you can listen to the PlayerCommandSendEvent, check for the commands you're wanting to check and remove them from the set

sinful ibex
#

thank you so much

#

i have idea but coding 0 knowledge

#

but thank you so much now i get some clue how can i do this

nocturne elbow
#

yw

sinful ibex
#
    public void preCommand(PlayerCommandPreprocessEvent event) {
        Player player = event.getPlayer();
        User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
        if (event.getMessage() != null) {
            event.setCancelled(true);
            player.sendMessage("Unknown Command. Type \"/helps\" for helps");

        }```
#

help me i want to use LuckPerms api player permissions check but line number 4 luckPerms is red after importing LuckPerms it not solve and says package net.luckperms.api not available

floral panther
#

Did you add the API as a Maven / gradle dependency?

wild whale
#

Also do you actually get the LP instance ever?

#

Looks like a "that isn't a variable" error, not a dependency error