#luckperms-api

1 messages · Page 36 of 1

primal spire
#

If I dispatched a command to remove a perm, I'd be running like 500+ commands in quick succession. I know there is a way around this if I did a playerLoginEvent to remove the perms one-by-one as the players just log in again, however I'm looking for other even more efficient ways of doing it

rustic laurel
#

Luckperms does not dispatch that operation in a way that lags the server

#

It will spin up a thread and use that, asynchronously, to remove the perms from the users

#

It's also not similar to running 500 commands at the same time, as it will just do what you ask

#

!bulk is a great example of this method being applied to its full extent

frank driftBOT
rustic laurel
#

I have read your message more, and indeed believe that bulk or just running a loop to remove the perm using the LPAPI would be your best bet

#

!api

frank driftBOT
primal spire
#

alright. On a note unrelated to LuckPerms... is there a way I can code something like this easily and efficiently without using luckperms? My hope is that eventually I may be able to release my plugin to the public and if I can reduce the number of dependencies, that would help.

rustic laurel
#

You can use Vault, which is a sane dependency

#

Then you'll have to arrange the async bit on your own, afaik

primal spire
#

alright. I'll check it out. Thank you!

sweet warren
#

Hi, I'm reading everywhere the docs about Bukkit/Spigot API, but is that the same for BungeeCord?

#

I can't find anything about hooking into LP Bungee, I'd need it to get some prefixes

#

Oh - I've found them. Apologize.

last merlin
#

how do you clear someones groups and add a new one

neat jackal
scarlet roost
#

How do i make it so a prefix for one of my groups doesn't get interupted by a prefix from another group which is a parent of it

rustic laurel
#

!weight

frank driftBOT
prisma trout
#

so my knowledge of completablefutures is surface level at best; and i'd like to know if this is the proper way of doing things

#

i have a DatabaseManager which returns a CompletableFuture<User> (this user is from my plugin, not LuckPerm's User, which might be a bit confusing but w/e)

#
        return databaseManager.getUser(uuid, playerName)
                .thenCombine(luckPerms.getUserManager().loadUser(uuid), (cryptoUser, user) -> {
                    cryptoUser.setLuckUser(user);
                    return cryptoUser;
                });
#

is this proper?

#

basically i want to get the cryptolib User, load the LuckPerms User into it, and return the CryptolibUser in the cf

nocturne elbow
#

what does thenCombine do lmao

#

nvm I remember now

prisma trout
#

wait

#

if luckperms loads the user on join

#

why do i need to loadUser

#

if the user is already loaded, does this still re-query the database

#

oh wait

#

nvm

#

ignore me this is fine

nocturne elbow
#

lol okay

prisma trout
#

that code is only called when the user is offline anyways (playerdata needs to be prepared before the player joins)

nocturne elbow
#

wut

prisma trout
#

the proxy tells the server that a player is joining, the server loads the user data, tells the proxy it's ready, then the player connects

nocturne elbow
#

the proxy tells the server that a player is joining
I mean, you do know AsyncPlayerPreLoginEvent is a thing, right? 👀

#

remember

#

APPLE

prisma trout
#

i wrote this before i knew it was a thing :c

#

it might be better to switch over

#

aghh fuck it

#

you're right

nocturne elbow
#

lol

prisma trout
#

you and your apples

nocturne elbow
#

I suggest you set the event priority to MONITOR and ignoreCancelled true

prisma trout
#

already was on monitor, forgot about ignoreCancelled though

#

thanks

#

i assume APPLE#getName returns the username the player is trying to connect with?

nocturne elbow
#

(for any reason) if the event is cancelled, you don't want to load your user data so it won't be called, but if it isn't cancelled, LP will have the data loaded already by the MONITOR stage

#

so I think you could safely do getUser instead

#

lemme confirm

#

unless some stupid plugin would de-cancel the event (purest evil I have yet to see), yeah you're safe to use getUser

prisma trout
#

literally just pogged irl

#

thanks

nocturne elbow
#

lol

prisma trout
#

and if i recall correctly from the documentations, LP is threadsafe?

nocturne elbow
#

uhm

#

!api

frank driftBOT
nocturne elbow
#

yes

#

lmao

prisma trout
#

perfection

#

will User.getCachedData().getMetaData().getMetaValue("something that isn't set") return null?

#

or like an empty string

#

it's nullable

#

i assume null

nocturne elbow
#

it's nullable
then yes

prisma trout
#

yeah :p

#

wtf apple is based

#

i feel like such an idiot

nocturne elbow
#

but beware tho, things annotated as nonnull, if the passed value is invalid or there is no data, the method may throw an exception instead of returning something

prisma trout
#

yep

#

that's all cool

#

thanks

nocturne elbow
#

no problem!

prisma trout
#

jesus lord

#

that was so painless

#

ignore my braindead messages

nocturne elbow
#

:^)

prisma trout
#

so, API-wise, the way to set meta would just be to get the meta map and put, yeah?

#

wait why is it a string list

#

ohh

#

wait

#

yeah

#

there's other stuff for that

#

user.data()

nocturne elbow
#

mhm

#

check the "api cookbook" repo for examples :d

prisma trout
#

i might be a little slow but i get there in the end

#

yeah that's what i just found haha

#

modifyUser yes yes yes

nocturne elbow
#

not very familiar with this part but from what I know, the cached data is like a "mirror image" of the actual data, it's immutable from the api's pov and it's already "processed" (not the Node objects, but the string values)

prisma trout
#

yeah hence the whole cached thing

#

makes a lot of sense

#

this is a well structured API

nocturne elbow
#

LP as a whole is really nice to read and to work with :)

prisma trout
#

yeah honestly tho

#

this is great

#

so in Node.builder(String), is the string <key>.<value>

#

OHHH

#

i see

nocturne elbow
#

lol

prisma trout
#

i would do meta.chat\.chat_title.OG

#

right?

nocturne elbow
#

no

prisma trout
#

that's what i see in the web editor, anyways

#

oh

#

nvm

nocturne elbow
#

you would use MetaNode.Builder

#

specify a key normally

#

and specify a value normally

prisma trout
#

OHHHH

nocturne elbow
#

LP will take care of escaping and formatting

prisma trout
#

i was just hittin the good ol Node.builder

#

thanks pog

nocturne elbow
#

lmao

#

you're having a blast

prisma trout
#

i really am

#

i'm just excited to make this whole system here prepared for the future

#

is there a specific way to get a set of permissions with a certain "prefix"

#

i.e. all permissions that start with "cryptolib.chat_title"

#

oh wait

#

i can just iterate through the permission set

#

i'm an idiot lol

#

oh actually i could do this way better

#

i assume a Tristate.asBoolean() will return false if it's either false or unset, true if true?

nocturne elbow
#

great question

#

false for undefined, yes

prisma trout
#

thanks

nocturne elbow
#

wow

#

I have always joked about using Boolean as tristates

#

Because it can be true, false or null

prisma trout
#

lol pog

#

i wonder why Boolean instead of boolean

#

also, to "update" a meta, i need to remove the MetaNode and then add the new one right?

nocturne elbow
#

yeah, since the node as a whole is a different one

#

you can should do something like user.data().clear(NodeMatcher.metaKey("whatever"))

prisma trout
#

perfect

#

same with permissions?

prisma trout
#

shit pog

#

ty

prisma trout
#

everything is working 😄

#

thank you so much fefo :p

feral moon
#

Hey, I'm trying to use the API on Waterfall/BungeeCord, and even with depend: ["LuckPerms"] in my plugin, for some reason 1) my plugin loads before LP, and 2) another plugin (gChat, also from lucko) which loads after LP also says the API isn't loaded

nocturne elbow
#

IIRC on bungee it isn't "depend" but "depends"

#

But that's weird lol

feral moon
#

ah, lemme try it

#

I even switched back to normal bungee from waterfall to see if that'd fix it, and no luck, but i'll try again lol

nocturne elbow
#

Yep, it's "depends"

feral moon
#

yep, now i'm loading after

#

but, "The LuckPerms API is not loaded" still

#

lol

#

using LuckPermsProvider.get()

nocturne elbow
#

Are you trying to get the API on onLoad or onEnable?

feral moon
#

onLoad

#

should it be onEnable?

nocturne elbow
#

Eeh not sure how bungee does it but the dependency tree dictates the enabling order, not load order

feral moon
#

just tried w/ onEnable, still no luck (pun not intended)

nocturne elbow
#

(on Bukkit at least, I would assume it's the same on bungee)

#

lol

feral moon
#

although, now gChat gets the API

#

right after i do

nocturne elbow
#

Then you're most probably shading the API jar into your plugin, how are you building your jar?

feral moon
#

w/ gradle, lemme check my build.gradle

nocturne elbow
#

Make sure it's compileOnly

feral moon
#

yep, that'd do it

nocturne elbow
#

Yeah no

#

Lol

#

Also, I suggest you update to 5.1 or 5.2 :d (ideally it would be the same version that the platform is running)

feral moon
#

ayy, got LP api now

nocturne elbow
#

Neato

feral moon
#

ah, yeah, lemme update it to 5.2

#

and now to hope my db code works lmfao

#

just out of curiosity, does LP use an ORM at all to handle it's DB stuff?

nocturne elbow
#

An what

feral moon
#

p much it uh, handles stuff like fetching objects from a DB for you by generating SQL and mapping objects in the DB to fields in an object

#

(pretty much asking how LP handles database stuff, bc i want to try and have something as a fallback if my current thing doesn't work lol)

nocturne elbow
#

If I understood correctly, no, it makes all sql queries directly, fetching the data as it is stored basically (classic selects, inserts and updates :d) and builds the objects based on the query

#

Lemme

#

Sec lol

feral moon
#

fair

#

so, pretty much what my fallback plan was already :p

#

i'm just using an orm rn bc im lazy, and it makes it easy to support multiple db backends

nocturne elbow
#

there is that HUGE list of pre-made query statements, so it's basically all clean when using them

feral moon
#

fair

nocturne elbow
#

but yeah it's nothing more than classic connections, prepared statements and iterating through the result set

feral moon
#

got it

#

fair enough :)

tribal wave
#

hello humans

#

if I wanted to get an integer value of a permission, like myplugin.numbers.10 should I use the stream API to find that value, or is there a better way?

wild whale
#

Uh I feel like this might be a good use of meta

#

Perms are good and all, but meta is essentially a key: value map that respects inheritance

#

which sounds like exactly what you want

#

fucking hell fefo lol

tribal wave
#

ah that's right i totally forgot about metas

#

thanks XD

wild whale
#

fefo be add_reaction crazy

nocturne elbow
#

aye

dull egret
#

how do I add Luckperms api on Bungee?

turbid solar
#

Same way you do it on bukkit

#

!api

frank driftBOT
dull egret
#

@turbid solar so this is fine??

<dependency>
    <groupId>net.luckperms</groupId>
    <artifactId>api</artifactId>
    <version>5.1</version>
    <scope>provided</scope>
</dependency>
turbid solar
#

Latest api is 5.2 pretty sure

#

Wiki not updated yet

dull egret
#

ah ok thanks buddy

coarse light
#

Good evening, could someone tell me what event I should use when a player loses permission?

nocturne elbow
#

NodeRemoveEvent is what you're looking for

coarse light
#

thx

nocturne elbow
#

wow, maxlego08 left

#

I'm sad ;(

turbid solar
nocturne elbow
#

huh?

turbid solar
#

Message got deleted

nocturne elbow
#

!cookbook

frank driftBOT
nocturne elbow
#

@nocturne elbow you can check api usage examples there 👆

#

thanks 🙂

#

among them, getting the prefix :d

#

i will save this repo in my browser favorites!

steel edge
#

How can I get all user permissions? (only user permissions, no rank permissions)

turbid solar
#

!api

frank driftBOT
nocturne elbow
#

And if it's an online player the one we are talking about and you want the player object, just get the uuid and Bukkit.getPlayer(uuid) lol

wispy yew
#

how do code html

nocturne elbow
#

?

wild whale
wispy yew
#

how do i include lp api in my html project

obtuse jolt
#

wtf

wispy yew
#

??

wild whale
#

I hope you're trolling

obtuse jolt
#

yea...

#
  1. html is not a programming language
wispy yew
#

yes it is

obtuse jolt
#
  1. minecraft plugin have nothing to do with html
#

unless you are interfacing it with a website, but still

wispy yew
#

Im making my own lp editor

#

jokes im just kidding

obtuse jolt
#

....................

wild whale
#

No, really?

rustic laurel
wispy yew
#

point taken, sorry

wild whale
#

If you have legitimate questions about the LP java api, then here is fine.

rustic blade
#

im not having

luckAPI.getNodeFactory().makeGroupNode(group).build();

What am i doing wrong ?

nocturne elbow
#

Where did you even get that

#

That's not a thing in v5 lmao

rustic blade
#

Okay 😄

#

Is this correct ?

PermissionNode build = PermissionNode.builder().permission(groupName).build();
#

Correct ?

nocturne elbow
rustic blade
#
User user = this.luckPerms.getUserManager().getUser(player.getUniqueId());

is this the correct way to get a user ? and how can i apply the PermissionNode to the user ?

nocturne elbow
#

!cookbook You can check the "api-cookbook" repository for some "real world" examples on how to use the API

frank driftBOT
nocturne elbow
#

Including but not limited to: loading user data and adding perms, groups, and other things

rustic blade
#

i did this like that but it wont work ...

#

So i got the groupnode and now i want to set it to the user

nocturne elbow
#

There is an example of exactly that in the cookbook repo..

rustic blade
#

can i do user.data().add()

nocturne elbow
#

And I don't quite get what you mean by "it wont work" either, how does it not work? Does it throw an error? What does it do/not do?

rustic blade
#
this.luckPerms.getUserManager().modifyUser(player.getUniqueId(), lpUser -> {
            lpUser.data().clear(NodeType.INHERITANCE::matches);
            PermissionNode build = PermissionNode.builder().permission(groupName).build();
            lpUser.data().add(build);
        });

did it like this ... checked with
lp user playername info nothing changed no rank ...

nocturne elbow
#

You use InheritanceNode.Builder to add parent groups to a user/group, not PermissionNode.Builder

rustic blade
#

okay i will try

rustic blade
#

Worked ^^ Thanks

fleet cosmos
wild whale
#

!errors

frank driftBOT
fleet cosmos
#

I've already seen this, and I did everything according to the instructions, but the problem remained, so I came here

nocturne elbow
#

Also, send the entire log, not only a snippet

fleet cosmos
#

the entire server log?

nocturne elbow
#

mhm

#

!paste

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!

nocturne elbow
fleet cosmos
#

okey going to general 1

hushed oxide
#

Hello, i made a plugin which requires vault, and i didnt find any events, does luckperms has a parent group set event?

nocturne elbow
#

NodeAddEvent is what you're looking for

hushed oxide
#

Good

#

Thanks

nocturne elbow
#

np

novel locust
#

Is this the help channel

wild whale
#

If you're looking for hekp with the LP api, yes. For general LP support, #support-1

nocturne elbow
#

This is where the cool devs hang out 😎

novel locust
#

Oh I c

#

So I’m trying to make it so that an arena of my server is a kitpvp area and only in that area can you access certain kits. I have the region setup with worldgaurd and I installed extracontexts and set world guard to true

nocturne elbow
novel locust
#

Ok

dusk pebble
#

hi, I have such a problem, I don't know how to make every player lose the rank player

turbid solar
#

Dont post in 4 different channels

feral moon
#

so, not exactly luckperms related but it's another one of lucko's plugins so i may as well ask here ig, is there a maven package for lucko's gchat plugin? found the source for it here but i'm wanting to use it's api for listening to chat events https://github.com/lucko/gChat

nocturne elbow
#

I mean you could... just... listen to Bungee's chat event?

#

And as far as I know it isn't up in any maven repo

#

Wouldn't be hard to clone, compile and install to maven local tho

feral moon
#

fair

#

and i think the event from gchat gave you the formatted message too, not sure

misty hinge
#

why do u have an invisible name !+ avatar,

wild whale
#

Yeah please nick yourself lol

remote sky
#

It’s visible on mobile :)

shut ingot
#

Hey I was wondering if there was an event for when a node expires?

nocturne elbow
#

NodeRemoveEvent @shut ingot

#

Check that it had an expiry and that that instant is already in the past

shut ingot
#

Sweet I appreciate you a lot!

nocturne elbow
#

Lovely

shut ingot
#

hey @nocturne elbow the event doesn't fire at all? Is there something special i need to do to get the api event to fire or something haha

frank driftBOT
#

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

ancient sable
#

Hi i have a good questions

nocturne elbow
#

How are you subscribing the Listener to the event?

ancient sable
#

Anyone know how is call the methood that download the dependency? or where is the link?

nocturne elbow
#

Anyone know who is call the methood that download the dependency? or where is the link?

#

You mean the dependencies repo?

ancient sable
#

I want to based on Luckperms dependency system

#

to download my custom dependency

#

Do i explained?

nocturne elbow
#

Well you can check LPs source for that, there are a couple of files dedicated to dependency downloading and checking

ancient sable
#

OK

#

Where bro?

#

i want to found that information

#

but i couldnt found

jaunty pecan
#

it's in a package called dependencies inside the common module of the project

ancient sable
#

I have just started with dependency magnamente

#

Oh, a owner of luckperms answer to me 😄

#

thanks

#

!clipy

frank driftBOT
#

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

ancient sable
#

!Download luckperms sourcecode

frank driftBOT
sudden pelican
shut ingot
#

Thanks fefo I forgot to subscribe it

ancient sable
#

Sorry for the questions, but Luckperms, when enable it download dependency and when is down (when the plugin is off) it delete?

#

Because i wanna base on that system to make a plugin loader

nocturne elbow
#

Thanks fefo I forgot to subscribe it
hit that bell button

ancient sable
#

and Thank you Jordan

#

Thanks fefo I forgot to subscribe it

nocturne elbow
#

Sorry for the questions, but Luckperms, when enable it download dependency and when is down (when the plugin is off) it delete?
No, the downloaded dependencies are already downloaded into files, so unless someone manually deletes them (or the code manually deletes them), they will stay there

ancient sable
#

oh ok

#

thank

#

i wanna take ideas to make a plugin loader but i cant found anything

shut ingot
#

is there a way to unsubscribe on disable?

#

i use plugman and something strange happens xD

#

it starts to multiply the events

ancient sable
#

its happen something related to me

#

when i use Luckperms i cant use Plugman, its crash my network

nocturne elbow
#

is there a way to unsubscribe on disable?
When you subscribe to an event, you get an EventSubscription

#

Which you can close

#

Check out the javadocs for the methods and classes

#

!javadocs

frank driftBOT
nocturne elbow
#

Bottom link

shut ingot
#

ahh thanks

#

Sweet it works, thank you

#

I tried to do it through the eventbus lmao

ancient sable
#

Hi is thecode from github outdated?

#

(Talking about luckperms Legacy)

nocturne elbow
#

no?

#

LP bukkit legacy is the exact same as LP bukkit

#

it just includes gson with it

#

because 1.7.10 didn't have gson

remote sky
#

GSON 🤮

#

org.json ❤️

lime rune
#

...

#

take that back lol

nocturne elbow
#

lol

#

@lime rune hi

lime rune
#

@nocturne elbow why is your name so long but hi

frank driftBOT
#

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

lime rune
#

oops

nocturne elbow
#

KEK

lime rune
#

okay so how do I use the luckperms api

nocturne elbow
#

!api :fingerguns:

frank driftBOT
nocturne elbow
#

it cool

#

does stuff

lime rune
#

we have to load manually?

#

or is that a safe thing?

nocturne elbow
#

huh?

#

load what "manually"?

lime rune
#

UserManager#loadUser

nocturne elbow
#

oh it's safe

lime rune
#

and getUser is when the user is loaded right?

nocturne elbow
#

yessir

#

although loadUser returns a CompletableFuture<User>

#

so you can thenAccept/whenComplete

lime rune
#

get() >:]

nocturne elbow
#

oh no

lime rune
#

okay so how do we get a user?

#

getUser() then I guess

obtuse jolt
#

you should probably just take a look at the javadocs (instead of asking for every method)

nocturne elbow
#

okay so how do we get a user?
I mean that one is literally explained in the api usage page xD

#

oh also

obtuse jolt
#

and that as well ^

lime rune
#

oh im blind, sry benUwU

nocturne elbow
#

!cookbook Check here for some real world api usage examples

frank driftBOT
nocturne elbow
#

a nice repo

obtuse jolt
#

also Eclipse IDE lol

nocturne elbow
#

I mean lol

lime rune
#

yeah I mean Eclipse is good but it has ruined many projects

agile trail
#

hwy how do I commands like /plugins and /info?

wild whale
#

?

agile trail
#

*disable

wild whale
#

#luckperms-api is for support for those using the Luckperms API in their own plugins. I think you want to be in #support-1

agile trail
#

my b

copper dove
#

Lets say you need to get a specific server context and check if the player has a permission in that context. i.e. Hub server needs to check if a player has a permission in the 'factions' context How would you go about it?

mighty path
#

This is probably a really dumb idea, but could I use the LuckPerms API without actual LuckPerms if I shaded the JAR in?

obtuse jolt
#

no

mighty path
#

I basically want to have LuckPerms compatibility on a platform that doesn't have LuckPerms support yet

obtuse jolt
#

like what platform?

mighty path
#

Minestom. It's a multithreaded server implementation designed to be used at scale.

#

No permissions system so I'm writing one.

obtuse jolt
#

well you need to do a lot more work than just shading luckperm's jar

#

probably beyond my scope of knowledge as well

mighty path
#

I know that. But what I want with LuckPerms is for it to be able to write permissions to a LP database.

#

I thought maybe the API could help with that.

obtuse jolt
#

i mean how luckperm works is there is a common abstract api that does the main system, and the separately implement it to different platforms like nukki, bukkit, bungee etc

misty hinge
#

Ohno

#

I read shade

obtuse jolt
#

lmao

misty hinge
#

runs away

mighty path
#

I hate Gradle as well.

misty hinge
#

Gradle hates you too

mighty path
#

I'm sure it does.

#

So basically what you're telling me is I can't use the API without the actual LP plugin installed?

turbid solar
#

Yes

mighty path
#

:(

#

Back to reading LuckPerms database queries.

turbid solar
#

You could make an issue on GH for support for that but its unlikely that it'll get added unless alot of people want it

remote sky
#

Gradle > Maven

mighty path
#

Well is Maven malevolent?

copper dove
#

Lets say you need to get a specific server context and check if the player has a permission in that context. i.e. Hub server needs to check if a player has a permission in the 'factions' context How would you go about it?

remote sky
#

!api

frank driftBOT
mighty path
#

I understand your point. I'm just a bit annoyed because all I want to do is database queries.

remote sky
#

Make them yourself I guess?

mighty path
#

Yeah I will but it's annoying because everything is buried in like a dozen layers of functions.

copper dove
obtuse jolt
#

I understand your point. I'm just a bit annoyed because all I want to do is database queries.
@mighty path well you must first get luckperms to actually work on the server platform first right...?

mighty path
#

I suppose.

#

But since the databases are server-independent it seemed like something you could do without the server part.

obtuse jolt
#

yea so what if you have a database of permission? If luckperm is not working on your server means no permission checking will occur

#

suppporting a new server implementation with different api needs a lot more work than what you saying.

crisp aspen
#

does the spigot API allow for using the ChatColor enum in a suffix/prefix

#

such as return this.getColor() + "[" + this.getName() + "]";

nocturne elbow
#

Yes

crisp aspen
#

thanks

subtle kelp
#

Hi, is there a way to integrate the BungeeCord version of LP with my spigot plugin ?

nocturne elbow
#

as far as I know it's the exact same api

#

!api

frank driftBOT
subtle kelp
#

yes but my plugin can't the .jar file because it's running on different server

nocturne elbow
#

what?

#

if your plugin has LuckPerms as a dependency, then you need luckperms on the server that the plugin is on

obtuse jolt
#

@subtle kelp you need luckperms on all server

subtle kelp
#

so i can't use the bungee version ?

obtuse jolt
#

@subtle kelp you use lp-bungee for bungeecord server, lp-bukkit for bukkit based backend server

#

if you plugin is installed on your backend server, it should interact with LP-bukkit

subtle kelp
#

then i need to install lp-bukkit on all servers that run my plugin and remove lp-bungee right ?

obtuse jolt
#

@subtle kelp you still need lp bungee for plugin on bungee and bungee perms like /server

subtle kelp
#

ok i'll try that, thanks

obtuse jolt
#

!sync oh yea that this

frank driftBOT
subtle kelp
#

All working now, thank you

shy hill
#

When coding a plugin for bungeecord, do you have to add support for luckperms for it to utilize it's permissions?

nocturne elbow
#

Nope, unless you will be working with LP directly through the API, there is no need to add exclusive support

shy hill
#

Okay, let me grab my plugin code that I need help with.

#
if(args[0].equals("reload") && sender.hasPermission("discord.reload"))

Would this work with luckperms?

#

I have LP installed on bungee and spigot, the plugin code I showed is for a bungeecord plugin.

#

I do have both LP on bungee and spigot connected via a MySQL database.

nocturne elbow
#

Yes, that would work with LP

shy hill
#

Wait, wtf... It works all the sudden.

#

🤦‍♂️ Thanks for the help.

nocturne elbow
#

lol np

shy hill
#

I literally added the LP api to add LP support but all-in-all I didn't follow the network installation instructions

//            LuckPerms api = LuckPermsProvider.get();
            ProxiedPlayer p = (ProxiedPlayer) sender;
            if(args.length == 0) {
                p.sendMessage(new ComponentBuilder(Discord.configuration.getString("text").replace("&","§")).create());
            } else if(args[0].equals("reload") && sender.hasPermission("discord.reload")) {//|| api.getGroupManager().getGroup(api.getPlayerAdapter(ProxiedPlayer.class).getUser(p).getPrimaryGroup()).getNodes().toString().contains("key=discord.reload, value=true")) {
                try {```
#

ROFL

shy hill
#

I need some help with my code...

#

oh god... let me just pastebin it...

#

actually nvm forget it.

nocturne elbow
#

hm?

shy hill
#
                try {
                    Discord.reload();
                    p.sendMessage(new ComponentBuilder(Discord.configuration.getString("messages.pluginReloadSuccessful").replace("&","§")).create());

                } catch (IOException e) {
                    p.sendMessage(new ComponentBuilder(Discord.configuration.getString("messages.pluginReloadUnsuccessful").replace("&","§")).create());
                    e.printStackTrace();
                }
            }```
#

I have this bit of code. when it errors for reloading the config. It doesn't drop a IO exception. but rather something completely different and i'm having a hard time seeing what that exception is, so I can catch it.

#

Let me grab the log.

#

The config is INTENTIONALLY messed up so I can test the fail message.

wild whale
#

btw instead of the .replace, ChatColor.translateAlternateCodes

shy hill
#

OHH, thank you =D

#

I hate that stupid fucking $ symbol

nocturne elbow
#

What does Discord.reload() do? Share the code

wild whale
#

do I spy static aboose

nocturne elbow
shy hill
#

oh okay

misty hinge
#
                try {
                    Discord.reload();
                    p.sendMessage(new ComponentBuilder(Discord.configuration.getString("messages.pluginReloadSuccessful").replace("&","§")).create());

                } catch (IOException e) {
                    p.sendMessage(new ComponentBuilder(Discord.configuration.getString("messages.pluginReloadUnsuccessful").replace("&","§")).create());
                    e.printStackTrace();
                }
            }```

@shy hill MY EYES

#

WHY YA HURTING MY EYES

shy hill
#

with the .replace?

misty hinge
#

ur going towards DSRV with that long ass string

#

looks at _11

shy hill
#

DSRV?

wild whale
#

DiscordSRV, another plugin I'm support for

#

it's got a few legacy issues such as ReallyFreakingLongConfigOptions

shy hill
#

Oh... wait, you haven't seen long yet.

#

I had setup networked LP wrong and didn't realize it so I instead did this to my plugin to check if a player has a permission...

api.getGroupManager().getGroup(api.getPlayerAdapter(ProxiedPlayer.class).getUser(p).getPrimaryGroup()).getNodes().toString().contains("key=discord.reload, value=true")) {```
#

🤣

wild whale
#

burn it.

nocturne elbow
#

Yeah and that's not the way you check nodes btw lmao so brittle

shy hill
#

🤣 It was my first time messing with bungeecord.

wild whale
#

I assume md must have a platform-based way of checking if a player has a permission like bukkit's Player#hasPermission(String)

shy hill
#

Yea, I fortunately didn't have to add "exclusive support" to my plugin to check if a player has a permission.

misty hinge
#

DSRV has the top 1 longest config stuff

#

dont change my mind

shy hill
#

DiscordSRV really does have a really long config.

proud crypt
#

those key names are something though

#

MinecraftDiscordAccountLinkedAllowRelinkBySendingANewCode: false lol

#

the config itself really isn't that long, LP's is longer :)

shy hill
#

I'm having a hard time reading that, let alone in a config file LMAO

steel edge
#

Hello, I want get all USER permission (no group inherit permission), but I dont found how i can do it

#

With this code I get all permission, included permissions of groups

nocturne elbow
#

Objects.requireNonNull will throw a NullPointerException on purpose if the object is null

steel edge
#

No no, this work, but not the way I want

#

But my unique permission is *

nocturne elbow
#

That's just a suggestion tho

#

so you'll probably want to have something like if (user == null) return;

#

but you do you on that part

#

lemme

#

!javadocs

frank driftBOT
steel edge
#

"but I dont found how I can do it"

nocturne elbow
#

PermissionHolder#getNodes() will give you the holder's own nodes

#

in a collection

steel edge
#

Are you saying that this should give me back the permission list from user?

#

#isWildCard = if permission is true or false, no?

nocturne elbow
#

looks good

steel edge
#

this work fine, but is "isNegated()" the boolean for check if true or false, ty ^^

nocturne elbow
#

wut

steel edge
#

yep, now Im trying to get Context server xD (getKey() and getPermission () return the same xd)

nocturne elbow
#

They return the same for PermissionNode, but getPermission does not exist for other type of nodes ;)

modern thistle
#

:C

nocturne elbow
#

I too can send screenshots with an incredibly lacking amount of context

modern thistle
#

okey

obtuse jolt
#

I get this error
@modern thistle amazing error!!

modern thistle
#

i not speak english xd

#

i speak spanish

#

:v

nocturne elbow
#

Is this even related to the developer api?

white mauve
#

Hey how do I connect my luckperm ranks with tebex store

#

please reply as soon as possible

obtuse jolt
limpid escarp
#

Hallo, what jar is the api of luckperms?

turbid solar
#

!api

frank driftBOT
upbeat kelp
#

how do I set a players primary group?

#

User#setPrimaryGroup doesn't seem to be working for me, no error at all

modern spire
#

i got luckperms to work with commands already in the game but couldnt figure out how to do it with commands outside like warps and stuff which i got from plugins

upbeat kelp
#

Thanks

modern spire
#

realized i used the wrong channel, apologies

limpid escarp
#

shut i use the normal latest luckperms-bukkit.jar as api?

nocturne elbow
#

yeah....... no

#

in the main api usage page it tells you you should download the api jar instead (if you are not using a build system like maven or gradle)

nocturne elbow
#

use maven

remote sky
#

Use Gradle

#

Gradle is more compact

#

Plus Daemon

#

Maven: ```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>target/dependencies
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

#

Gradle: ```gradle

apply plugin: 'java'

repositories {
mavenCentral()
}

jar {
baseName = 'gradleExample'
version = '0.0.1-SNAPSHOT'
}

dependencies {
testImplementation 'junit:junit:4.12'
}

#

Plus it’s easier for dependencies

nocturne elbow
#

Not to mention faster 👀

#

fair

steel edge
#

Why permissions with server context appear duplicated

nocturne elbow
#

where and how are you calling addPermission?

steel edge
nocturne elbow
#

assuming permissions is basically getStringList?

steel edge
#

yep

#

first addPermission (below String[] split) is bad xD

nocturne elbow
#

exactly

steel edge
#

I just realized, sorry xDDD

nocturne elbow
#

also, you can remove this part: if it's empty, there is nothing to iterate through in the for loop below :) i.e. the loop would be skipped

shell hedge
#

Hey, im noob at the api. This code works inconsistent. What is the correct way to add a list of permissions to player?

public void exec(Player player) {

        ArrayList<String> permissions = new ArrayList<>();

        permissions.add("hub.break");
        permissions.add("hub.place");
        permissions.add("hub.jump");
        permissions.add("hub.run");

        for (String string : permissions) {
            addPerm(player, string);
        }

    }

    public static void addPerm(Player player, String permission) {
        Node node = Node.builder(permission).withContext(DefaultContextKeys.SERVER_KEY, "hub").build();

        Main.luckPerms.getUserManager().modifyUser(player.getUniqueId(), (User user) -> user.data().add(node));
    }
turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

Make sure to save the user

shell hedge
turbid solar
#

Does the code just not work?

shell hedge
#

Its inconsistent, sometimes it saves all 4, some times 3, sometimes none

turbid solar
#

Tried debugging it? By logging every thing u do

shell hedge
#

Yeah, sometimes my loop execute before the user.data().add has returned succesful...

#

I have no idea if that is a correct way to add a list of permissions

shell hedge
#
public static void giveMultiple(Player player, List<String> permissions) {
        User user = Main.luckPerms.getUserManager().getUser(player.getUniqueId());
        for (String permission : permissions) {
            Node node = Node.builder(permission).build();
            user.data().add(node);
        }
        Main.luckPerms.getUserManager().saveUser(user);
    }

Found this if this helps someone with same problem!

remote sky
#

Not to mention faster 👀
Yea owo

terse granite
#

How can I add a permission to a player via api?

nocturne elbow
#

!cookbook you can read some "real world" api usage examples in this repo, among them how to add perms

frank driftBOT
terse granite
#

ok

novel mica
#

my plugin stopped working😫

nocturne elbow
#

ok?

orchid cape
#

Hey so I made a scoreboard using
Set<String> groups = main.loadUser(player).getNodes().stream()
.filter(NodeType.INHERITANCE::matches)
.map(NodeType.INHERITANCE::cast)
.map(InheritanceNode::getGroupName)
.collect(Collectors.toSet());

and with each group I displayed it on the scoreboard. Now how can I set up the default group so i can name it to say Member on 5.0+ Ive looked around a bit and found a solution for <5.0 but I couldnt figure it out. Can you guys help me out w this

nocturne elbow
#

You can just getNodes(NodeType.INHERITANCE) and it'll return a collection of InheritanceNodes btw

#

And I'm not sure what you mean by the rest tbh

orchid cape
#

I used this from the api website which is why like that

#

so basically u have a default group on startup and i dont know how to change the name post version 5.0

nocturne elbow
#

/lp group default setdisplayname Member?

#

Then you can Group#getFriendlyName() iirc

orchid cape
#

ok yep it worked

#

thank you for that

nocturne elbow
#

Coolio

orchid cape
#

wait so what u were saying b4 about getNodes(NodeType.INHERITANCE)

#

how would i use that in my situation

#

where i want the groups

nocturne elbow
#

Instead of getNodes().stream().filter(...).map(...) you can just getNodes(NodeType...).stream()

barren parrot
orchid cape
#

so earlier we talked ab how u can change the displayname of the default group and that is good but my issue now is that the method I was using was grabbing the groups by name and not displayname so how would I be able to display the displayname of a group on the scoreboard? I can see there is a place for displaynames in the api online but it is pretty confusing

nocturne elbow
#

@barren parrot Node#getExpiry() iirc

barren parrot
#

Ok thank's I will look

nocturne elbow
#

@orchid cape not sure what you're looking for really

orchid cape
nocturne elbow
#

Yeah the display name

orchid cape
#

so how do i get that

#

cuz the groups variable with the getnodes etc etc gives me the group name not the displayname

#

the display name is Member

#

but the group name is default

nocturne elbow
#

Then get the group from the GroupManager from the resulting nodes

#

GroupManager#getGroup(String) or something

orchid cape
#

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

#

that is the one i was using for geting the group of a player

#

now this is where i put in the groups variable that i used above and the player

nocturne elbow
#

Yeah... but that's with the groups names, not the display names

#

Get the player groups like you were doing earlier (with the stream) and get the Group from the resulting InheritanceNodes using the GroupManager

orchid cape
#

ok yea i figured it out

#

thank you vmuch for ur help

barren parrot
#

How to replace null to rank ?
https://i.imgur.com/xUkCIqJ.png

                Set<Instant> group = user.getNodes().stream()
                        .map(NodeType.INHERITANCE::cast)
                        .map(Node::getExpiry)
                        .collect(Collectors.toSet());
wild whale
#

If you just want to get the rank, Vault is usually the easiest

barren parrot
#

How to get rank and time at the same time ?

nocturne elbow
#

filter the nodes that do have an expiry

#

so you have all the InheritanceNodes that do expire (i.e. parent groups)

barren parrot
#

Ok thank's i will test

uncut ice
#

Can I use the API Outside from Spigot/BungeeCord/Nukkit etc. In an own Java Application

nocturne elbow
#

But why

uncut ice
#

To manage permissions etc?

rustic laurel
#

permissions for what though

uncut ice
#

Is it possible or Not?

rustic laurel
#

...

#

it's not that simple

#

if you're managing permissions for an entirely different java app, unrelated to minecraft, yes it's likely possible but you'd have to abstract things yourself

uncut ice
#

I want to implement LuckPerms as a module into CloudNet, i dont know If you know Englisch

rustic laurel
#

cloudnet as far as I know has its own permission system already?

uncut ice
#

Yes

rustic laurel
#

cloudnet is an infrastructure for existing servers, if I'm reading this correctly

#

cloudnet helps you run, for example, a paper server, no?

#

anyhow, anything is possible if you have the skills to do it, but I'm not sure what your actual use case is tbh

nocturne elbow
#

LOL

#

Why delete that

uncut ice
#

I want to create a module

#

For CloudNet

nocturne elbow
#

Luckperms simply isn't made for that use case

rustic laurel
#

you can modify it if you have the skills to do so, if not, it's not a cloudnet module natively

uncut ice
#

Yes i know

#

Which abstract classes i Must use to create an instance?

#

I think I have the Skills

rustic laurel
#

then, read the code, and abstract it. It's not something anyone can guide you through without doing it all for you

bold plover
#

Is there a way to get someones position on a track?

obtuse jolt
#

with API?

bold plover
#

yeah

bold plover
#

Was just trying to make some simple command that promote players below a rank under them in a track, but not to the same rank etc, and applied the correct server context, so they can only promote people for their respective context, and only to the rank below theirs.
Currently we have 2 lp dbs one on the proxy so everyone has global litebans and a second on the servers, so i am using plugin messaging channels and using the API to check tracks directly then send a response back to do the proxy database

#

was hoping i could just get their position in the track and then check if the next one is below the current position of the command sender, though if not i guess i'll have to do something a bit more tedious

bold plover
#

did some reading up in general and i think i can do this using track promote commands if i set up the perms correctly, might just use the command as an alias to fire off the same command on bungee and the server and have the plugin make sure the servers context is set correctly for the tracks thing.

carmine nova
#

hello is there an api when the player has new permissions

#

example: group.test suddenly I can execute actions afterwards

#

sorry i'm belgian ^^

obtuse jolt
#

You add the relevant perms to the group??

cinder yacht
#

Anyone there? I'm needing some help

wild whale
#

!askl

frank driftBOT
#

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

wild whale
#

-_-

#

!ask

frank driftBOT
#
Please ask your question!

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

Or, try here first:
Why shouldn't I ask to ask?
snow lotus
#

!ask

frank driftBOT
#
Please ask your question!

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

Or, try here first:
Why shouldn't I ask to ask?
remote sky
#

🤔

wind moth
#

Wie heißt das Event, welches gecalled wird wenn ein User ein Gruppenupdate erhält?

stiff jacinth
#

Versuch das GroupDataRecalculateEvent

wind moth
#

wann wird das gecalled?

nocturne elbow
#

Hello, does someone know how I give the player his permission with the LuckPerms API

#

!cookbook there is an example for that in here 👇

frank driftBOT
nocturne elbow
#

I can't find the code example, which index is it in exactly?

#

commands/AddPermissionCommand or something

#

Ok

#

I don't mean with a command but with the API

#

.. that entire repo is full of examples on how to use the api

#

take the AddPermissionCommand piece as example

#

and adapt it to your needs

wind moth
#

Is there a possibility to get the highest group of a player?

nocturne elbow
#

User#getPrimaryGroup?

#

I can't find "AddPermissionCommand" on Github

wind moth
#

User#getPrimaryGroup?
@nocturne elbow returns default. but i have admin and default

frank driftBOT
#

Hey Lvkas_ × Lukas! Please don't tag helpful/staff members directly.

wind moth
#

sorry rcsLifeMan

nocturne elbow
#

Then you have an improper weights setup

#

most likely

#

!weights

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.

nocturne elbow
wind moth
#

how can i get all groups of a player?

#

getNodes?

nocturne elbow
wind moth
#

how are these sorted?

#

weight?

nocturne elbow
#

yes

wind moth
#

first the highest?

nocturne elbow
#

Thanks

#

first the highest?
yes

nocturne elbow
#

How to remove a permission from a player?

#

through API

#

How to what

#

lol sorry

#

O

#

oh ok got it

nocturne elbow
#

hey i use this to get the prefix of the player but i get this error:

#
PlaceholderAPI.setPlaceholders(po, "%luckperms_prefix%")
#
java.lang.IllegalArgumentException: Score '§l>> §lLylixn : %luckperms_prefix%' is longer than the limit of 40 characters
    at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at org.bukkit.craftbukkit.v1_16_R2.scoreboard.CraftObjective.getScore(CraftObjective.java:121) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at io.github.kypdo.irithemccore.Main.lambda$scoreBase$0(Main.java:83) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R2.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at org.bukkit.craftbukkit.v1_16_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:400) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.b(MinecraftServer.java:1059) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.DedicatedServer.b(DedicatedServer.java:352) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.a(MinecraftServer.java:1007) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:846) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]
stiff jacinth
#

How can I check if a group has permission to something?

#

I tried

group.getNodes().contains(Node.builder("my.node.test").build());
#
java.lang.IllegalArgumentException: Score '§l>> §lLylixn : %luckperms_prefix%' is longer than the limit of 40 characters
    at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at org.bukkit.craftbukkit.v1_16_R2.scoreboard.CraftObjective.getScore(CraftObjective.java:121) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at io.github.kypdo.irithemccore.Main.lambda$scoreBase$0(Main.java:83) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R2.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at org.bukkit.craftbukkit.v1_16_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:400) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.b(MinecraftServer.java:1059) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.DedicatedServer.b(DedicatedServer.java:352) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.a(MinecraftServer.java:1007) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:846) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.3.jar:git-Spigot-3a70bd9-bf3d720]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]

@nocturne elbow "is longer than the limit of 40 characters" - You are exceeding the character limit

nocturne elbow
#

but the prefix is : "&7&lJoueur"

stiff jacinth
#

I tried

group.getNodes().contains(Node.builder("my.node.test").build());

So I've made a work around, but I'd like to know anyways. I searched for messages containing this, but haven't found what I was looking for

#

but the prefix is : "&7&lJoueur"
@nocturne elbow Its not - its: §l>> §lLylixn : &7&lJoueur (at least maybe even more when chatting)

#

Because it might add suffixes or clan tags, idk what else you are doing...

uncut ice
#

How can i get the meta datas; meta key and meta value?

#

For a group

#

And not in the form string, stringlist

nocturne elbow
#

someGroup.getNodes(NodeType.META)?

#

will give you a collection of MetaNodes

uncut ice
#

yes thanks

sterile coral
#

so i'm using this to set suffixes, but i'm curious how performant is it?

    public void setSuffix(Player player, String suffix) {
        LP.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
            user.data().clear(NodeType.SUFFIX::matches);

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

            Node node = SuffixNode.builder(suffix, priority).build();
            user.data().add(node);
        });
    }
#

in the end it'll be used fairly regularly on a server with 60+ players

#

and i'm pretty new to java so i have no idea how exactly completablefutures work

nocturne elbow
#

well, the loading/saving user data that modifyUser does for you are done asynchronously, so there is no performance penalty there

sterile coral
#

ah great

nocturne elbow
#

I'm not sure if the callback is done async, but it's all loaded and cached data anyway so it's gonna be fast

sterile coral
#

okay, that's good

#

so that's basically equivalent of a promise in js, i guess?

nocturne elbow
#

yeah from what I know completablefutures are basically promises in js

sterile coral
#

alright, thanks!

nocturne elbow
#

yeah the callback is done async too

#

so there will be absolutely no performance penalty whatsoever

sterile coral
#

that's great, thanks for the info

jaunty pecan
#

yeah from what I know completablefutures are basically promises in js
👍

#

Exactly the same idea

proud crypt
#

i promise to complete your future

nocturne elbow
#

Will you complete?

#

Or complete exceptionally?

proud crypt
#

yes

nocturne elbow
#

That wasn't--

sterile coral
#

i'm having this weird issue, i keep getting java.lang.NoClassDefFoundError: net/luckperms/api/node/Node BUT only sometimes

nocturne elbow
#

How are you building your plugin?

sterile coral
#

but, even if i use this and copy the jar to the plugins folder, i get the same error

nocturne elbow
#

Didn't really answer my question

sterile coral
#

uh that's really the best answer i have since i'm extremely new to this

nocturne elbow
#

by the looks of it you're using maven

sterile coral
#

yeah

nocturne elbow
#

!paste your pom.xml please

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!

sterile coral
nocturne elbow
#

looks good

#

when are you exactly getting the exception?

sterile coral
#

when i launch the server

nocturne elbow
#

even on a fresh start?

#

i.e. no reloads

sterile coral
#

yeah

#

i fix the issue by removing the imports, removing anywhere the imports are used, rebuild, relaunch, reimport and hotreload

#

then it's fine

nocturne elbow
#

uuuhh don't know what kind of fix is that lol

sterile coral
#

it's really hacky lol

nocturne elbow
#

got a server log with that error coming up on start up?

sterile coral
red pollen
#

you need to put LuckPerms as a dependency in your plugin.yml

sterile coral
#

ah

red pollen
#

the exception java.lang.NoClassDefFoundError usually shows up when either the class doesn't exists or the plugin associated with this class hasn't been initialized yet

sterile coral
#

yep, that fixes it

#

thank you

#

and thanks for the explanation

red pollen
#

you're welcome

#

is there a temporary group expire event or something like that

nocturne elbow
#

NodeRemoveEvent, check that the node was of type INHERITANCE and that it had an expiry

#

might as well want to check the target too, depends on your needs

red pollen
#

thanks i'm going to try that

uncut ice
#

BungeeCord dont found the api

#

The plugin said, that the api is not loaded

#

I have in my bungee.yml as depend LuckPerms

nocturne elbow
#

you are shading (including/compiling with) the API inside your plugin

#

most probably

uncut ice
#

Yes, this is possible

#

I try it

nocturne elbow
#

you don't want to include the LP API inside your plugin

uncut ice
#

yes

nocturne elbow
#

it is provided by LP

uncut ice
#

yes ik

nocturne elbow
#

how do I access the lp groups (not lpb) from the API that I load using a Bungeecord plugin. Do I only have access to the lpb groups?

#

or do I have to use the message channel to fetch the groups I want

#

or do people using the bungee version only use lpb groups instead of lp groups. Because then I wouldn't need to do this

wild whale
#

Assuming bungee is set up correctly, all groups and perm data should be globally accesible.

nocturne elbow
#

private static LuckPerms luckPermAPI = LuckPermsProvider.get();

#

^ this is what im using for my bungee plugin

#

and its only giving me the lpb groups. But your saying the lpb groups shoudl sync with the lp groups?

wild whale
#

COrrect

nocturne elbow
#

if they are using the same db...

wild whale
#

All of the LP instances should be connected to the same db

#

dammit fefo sniper

nocturne elbow
#

kek

#

so whats the destinction of using lpb vs lp?

wild whale
#

in theory, the commands should have no difference. Both /lpb and /lp should have the exact same effect

nocturne elbow
#

ok thats good to hear. makes my life a lot easier

#

thanks for the help. best permission plugin by far 🙂

nocturne elbow
#

!api

frank driftBOT
cerulean finch
#
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(Permission.class);
permissionProvider.getProvider().playerAdd(Bukkit.getPlayerExact(playerName), reward.getData());```
I'm using this to hook into luckperms and add a permission to a user, everything is working well except that the added permission has a world context and idk why
nocturne elbow
#

well you're hooking onto LP through vault

#

and by default, LP does not ignore world context on operations made through vault

#

you can explicitly give a world argument to vault tho, don't know the exact methods

cerulean finch
#

ahm

nocturne elbow
#

hm?

#

you can explicitly give a world argument to vault tho, don't know the exact methods
in that case, you would pass null as world

cerulean finch
#

yeah just read the javadoc

#

readed*

#

rode?

nocturne elbow
#

read* ;)

cerulean finch
#

thanks

nocturne elbow
#

yeah it's read read read

#

lol

cerulean finch
#

well yes I need to use null as a world argument

#

without it, it takes the player current world

nocturne elbow
#

correct

cerulean finch
#

thanks for helping me Fefo

nocturne elbow
#

😁 np

fleet halo
#

im my plugin has permissions, do I need to add lp as an external library and make it a (depend in plugin.yml) or does it not matter?

nocturne elbow
#

no lol

#

Surely youd know that by now man

fleet halo
#

i figured

#

something with my permission code must be wack then ty

nocturne elbow
#

totally lol

#

send it here man

fleet halo
#

i would but ive been seeing way better progress when i actually grind out shit myself

#

its most likely a problem with my if else loops tbh lol

#

i have too many (!(sender) + (sender) loops

nocturne elbow
#

Dont be afraid to ask for help man

#

i wont judge your code

#

just help you fix it

fleet halo
#

ight wtvr

#

thats the permission node okay?

#

like that it works while im opped (hence the default op)

nocturne elbow
#

yus

fleet halo
#

now it's default FALSE so you need the permission node regardless of opped status

#
public class SpeedMain implements CommandExecutor {

    List<String> toggled = new ArrayList<String>();

    public boolean onCommand(CommandSender sender, Command cmd, String commondLabel, String[] args) {

        if (commondLabel.equalsIgnoreCase("speed")) {
            if (!(sender instanceof Player)) {
                sender.sendMessage(ChatColor.RED + "YOU MUST BE A PLAYER TO USE THIS COMMAND!");
                return false;
            }

                Player player = (Player) sender;
                if (player.hasPermission("de.speed")) {


                if (toggled.contains(player.getName())) {
                    player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1));
                    player.sendMessage(ChatColor.AQUA + "SPEED" + "" + ChatColor.GREEN + "ENABLED!");
                    toggled.remove(player.getName());
                    return true;
                }

                player.removePotionEffect(PotionEffectType.SPEED);
                player.sendMessage(ChatColor.AQUA + "SPEED" + "" + ChatColor.DARK_RED + "DISABLED!");
                toggled.add(player.getName());
                return true;
            }
        }
        return false;
    }
}

and thats the code for the permission node im trying to make

#

i think the issue is the if loops

nocturne elbow
#

what doesnt work about it?

fleet halo
#

even when you have the perm node it doesnt work

nocturne elbow
#

okay

#

okay

#

so

#

Stupid question

#

Are you absolutely sure you have the permission?

#

^

fleet halo
#

yes ill send a ss

#

just gata load up the server gimme a min

nocturne elbow
#

Sure

fleet halo
#

does the code look good though?

nocturne elbow
#

Can't read nicely rn, on the phone lol

fleet halo
#

lol all g

nocturne elbow
#

should return true

#

then you wont have to cast sender to player

#

makes it simpler

#

so like ```java
public class SpeedMain implements CommandExecutor {

List<String> toggled = new ArrayList<String>();

public boolean onCommand(CommandSender sender, Command cmd, String commondLabel, String[] args) {

    if (commondLabel.equalsIgnoreCase("speed")) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "YOU MUST BE A PLAYER TO USE THIS COMMAND!");
            return true;
        }

            if (sender.hasPermission("de.speed")) {


            if (toggled.contains(sender.getName())) {
                sender.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1));
                sender.sendMessage(ChatColor.AQUA + "SPEED" + "" + ChatColor.GREEN + "ENABLED!");
                toggled.remove(sender.getName());
                return true;
            }

            sender.removePotionEffect(PotionEffectType.SPEED);
            sender.sendMessage(ChatColor.AQUA + "SPEED" + "" + ChatColor.DARK_RED + "DISABLED!");
            toggled.add(sender.getName());
            return true;
        }
    }
    return true;
}

}```

fleet halo
#

there i have the node

nocturne elbow
#

how about printing the value of sender.hasPermission("de.speed")?

#

see what it actually gets

fleet halo
#

i tried that already it prints out fine

#

theres something wrong with the if's()

nocturne elbow
#

So the issue would be somewhere else

#

then this toggled.contains(sender.getName()) must be evaluating to false

fleet halo
#

the toggled is fine bc when im opped its working

nocturne elbow
#

that's what's left I guess?

fleet halo
#

toggled is for toggling the command

#

so you can enable and disable it

#

it works fine

nocturne elbow
#

aa

#

it works when youre opped?

fleet halo
#

yeah

nocturne elbow
#

the fuck

fleet halo
#

because the default is for op...

nocturne elbow
#

try just getting rid of the default: false all together

fleet halo
#

ok

nocturne elbow
#

what does /lp check <yourself> de.speed show when deopped (and having the node obv)?

#

I wonder if itll work lol

fleet halo
#

what does /lp check <yourself> de.speed show when deopped (and having the node obv)?
@nocturne elbow did that already

frank driftBOT
#

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

fleet halo
#

im eventually gana make a parent thing for the perms so it will be 10x easier to manage

nocturne elbow
#

make children 😉

fleet halo
#

try just getting rid of the default: false all together
@nocturne elbow tf this worked...

nocturne elbow
#

ummmmmmmmmmmm

#

I just never add defaults to my perms

#

unless theyre admin perms then i add default: op

#

thats funny tho. glad it worked man

fleet halo
#

I appreciate it lol

#

lol

nocturne elbow
#

thats stupid as wtf

fleet halo
#

On a bad note however my wifi decided to crash...

nocturne elbow
#

ah no

fleet halo
#

Time to go debug that lol

#

Have a gn u guys

nocturne elbow
#

its 2.24pm man

#

about bedtime

#

yes

fleet halo
#

10:24PM for me and I've got class tomorrow lol

nocturne elbow
#

enjoy

fleet halo
#

I'll try

nocturne elbow
#

tell ya what, life is at its peak when you get out of school

fleet halo
#

Factual

nocturne elbow
#

just finished 🙂

fleet halo
#

1/2 my classes are on zoom so it's fine

#

Nicd

nocturne elbow
#

ah still

#

US?

fleet halo
#

*nice

#

Yeah usa

nocturne elbow
#

corona is fucked there

#

oh wait this is dev api

#

i forgot

fleet halo
#

Lol

#

Cya man lol

nocturne elbow
#

ciao

midnight wharf
#

Given an InheritanceNode (group), what would be the proper method of finding the prefix granted to the player from that group?

nocturne elbow
#

metaData.getPrefix()

#

yeet

midnight wharf
#

getMetaData on the InheritanceNode requires a NodeMetadataKey which doesn't appear to be documented on the api docs

nocturne elbow
#

MetaData metaData = cachedData.getMetaData(contexts);
String prefix = metaData.getPrefix();

#

please ignore me

midnight wharf
#

contexts is undocumented as to what's expected

#

lmao

nocturne elbow
#

just listen to fefo

#

Lol

#

Fefo is the profesh

#

You want to get the prefix/es coming from that group (and parents) specifically, and not any of the other inherited groups, right?

midnight wharf
#

Correct

nocturne elbow
#

Well, you have the node, .getGroupName() will... well, give you the group name lol, from there you get the group instance from the GroupManager, getCachedData.getMetaData.getPrefix

#

Tim was sort of on the right path... but at the end of it lmao

midnight wharf
#

Perfect, got it, thanks

nocturne elbow
#

For getPrefix you'll want to pass the user's queryOptions, so it applies for their contexts

#

big ol line of code

midnight wharf
#

Users query options?

nocturne elbow
#

You have the user instance from where you got the node, right?

midnight wharf
#

Yes

nocturne elbow
#

Doesn't it have a method like "getQueryOptions" or something? 🤔

midnight wharf
nocturne elbow
#

Scroll down....?

midnight wharf
nocturne elbow
#

What API version are you compiling against?

midnight wharf
#

5.0

nocturne elbow
#

Aaaa

midnight wharf
#

I set this project up around march..?

#

I'll update the dependency

nocturne elbow
#

This method got introduced on 5.1

#

We are currently on 5.2 lol

midnight wharf
#

Perfect, I'll have it regrab the depend