#luckperms-api

1 messages ยท Page 42 of 1

uncut panther
#

well currently yes

craggy ember
#

because it might be better using PlayerAdapter for online players and modifyUser for offline players

uncut panther
#

I mean. I wouldn't mind if it was for online only

craggy ember
#

or getUser should work

#

one of the two, either from PlayerAdapter or UserManager

#
fun Player.setGroup(groupName: String) {
    val group = BandiCore.luckPermsAPI.groupManager.getGroup(groupName) ?: throw GroupNotFoundException()

    if (isOnline) {
        BandiCore.luckPermsAPI.userManager.getUser(uniqueId).apply {
            this?.data()?.clear()
            val node = InheritanceNode.builder(group).build()
            this?.data()?.add(node)
        }
        throw GroupChangedException()
    }

    BandiCore.luckPermsAPI.userManager.modifyUser(uniqueId) {
        it.data().clear(NodeType.INHERITANCE::matches)
        val node = InheritanceNode.builder(group).build()
        it.data().add(node)
    }
    throw GroupChangedException()
}
```maybe?
#

don't quote me on that, but something like that might work

uncut panther
#

hmm but here you also used modifyUser

craggy ember
#

yeah but only if they're offline

uncut panther
#

ah

#

i see

craggy ember
#

just moved the exception throwing outside the lambda to avoid weird thingys with non-inlined lambdas throwing inside of the lambda and not terminating properly

#

btw, that ?: is called an elvis operator if you didn't know, it basically says "if the value to my left is null, do the action to my right"

uncut panther
#

hmm gret to know

#

thanks ๐Ÿ™‚

#

btw

#

im getting this weird thing with data()

craggy ember
#

yeah ik what it is

uncut panther
#

like it wants me to import it

craggy ember
#

I forgot how apply works somehow

uncut panther
#

but when I do, it does not want

craggy ember
#

replace it with this

#

(I forgot this lambda doesn't have parameters somehow lol)

#

it is the default name for a single argument in a lambda btw, if you didn't know that

#

also, looks like it returns a User? because lucko's a god and used @NotNull and @Nullable properly (these help the Kotlin compiler figure out if the type should be nullable or not)

#

right, updated my code with the new thingys btw @uncut panther

uncut panther
#

I saw the canges like floop

#

for some reason i like kotlin to be much more easy to type than Java

craggy ember
#

turns out @jaunty pecan is like mid-tier god, he forgot the @Nullable annotation on ? super User in modifyUser (unless Java doesn't let you have it there)

frank driftBOT
#

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

craggy ember
uncut panther
#

because the player can be offline ๐Ÿคทโ€โ™‚๏ธ

craggy ember
#

true

#

the way that works is really weird though

#

the documentation says that Player represents a player, online or not, but it only seems to be used in a context where the player is online

uncut panther
#

I still don't know how theBukkit.getOfflInePlayer works. Is it like it fetches an API?

craggy ember
#

depends I believe

#

Bukkit has some storage of all players that have joined before somewhere I believe

#

but some methods get from the API

#

Bukkit's just one big mess that's been built on and built on so many times now

#

like you have forks of forks of forks of forks of forks now

uncut panther
#

btw update about the code:
I changed my group to crew but on /lp user Gezelligheid_ info my parent group is still owner and not crew

craggy ember
#

gotta be a reason for that

#

you're calling player.setGroup("crew") right?

#

just making sure you know how extension functions work

uncut panther
uncut panther
craggy ember
#

so it changes your group but info doesn't reflect those changes huh?

uncut panther
#

indeed

#

btw. it automatically changed me back to owner

craggy ember
#

also, please start using val where you don't need mutability ๐Ÿ™‚

#

you'll be surprised how many times that is

uncut panther
#

does it matter that much?

craggy ember
#

not really, but it's probably better to

uncut panther
#

okay

craggy ember
#

also, sure getOfflinePlayer actually returns anything btw?

#

I believe get by username was deprecated for a reason

uncut panther
#

myeah but then I'll better work with online players

craggy ember
#

it was deprecated because "persistent storage of users should be by UUID as names are no longer unique past a single session"

turbid solar
#

is OfflinePlayer#setGroup a bukkit thing?

craggy ember
#

nope, Kotlin extension function

#

scroll up

turbid solar
#

ah ok

uncut panther
#

building now @craggy ember

craggy ember
#

right ho

uncut panther
#

still..

craggy ember
#

I wonder where info gets data from

uncut panther
#

like the command sets me to crew

#

but as soon as I run info it changes me back to owner

#

okay

#

seems to work rn

#

but

#

still the permission issue that I dont have perms for /op and such.

craggy ember
#

does this crew role have the perms for that?

uncut panther
#

well no. But I am an operator

#

even when i execute deop it gives me the contact admin

craggy ember
#

definitely not disabled?

uncut panther
#

definitelty

#

when I change my group manually with /lp user i can do stuff like /deop etc again

craggy ember
#

๐Ÿค”

uncut panther
#

its like my op gets 'removed' with the custom command

craggy ember
#

weird

uncut panther
#

yeah indeed

#

is there a way to reload the data of LP?

#

like after I have set the group of the player?

#

or wouldn't that change anything

nocturne elbow
#

Depends on how you're changing the data

#

What's the code :d

uncut panther
#

lemme send

nocturne elbow
#

Uuh not too familiar with Kotlin but wouldn't you need to return in the if block if the player is online?

uncut panther
#

would be handy yeah xD

nocturne elbow
#

Oh yeah I see, you're forgetting to save the user if they're online (something modifyUser does for you)

#

UserManager#saveUser(User)

uncut panther
#

ah

#

so applying data does not save

craggy ember
#

ffs I should've noticed that

#

also can you please stop using !! everywhere lol

uncut panther
#

hehe xD

nocturne elbow
#

I have no idea what apply does but I know you have to save the user :^)

craggy ember
#

that's basically just saying "right, all bets are off, if it's null, throw a NullPointerException, idgaf"

uncut panther
#

๐Ÿ˜…

craggy ember
uncut panther
#

okay works. but yeah still the op issue

craggy ember
#

say in Java, you have something like this:java Person person = new Person(); person.setName("Hello"); person.setAge(12); in Kotlin, we can use apply there like this:```kotlin
val person = Person().apply {
setName("Hello")
setAge(12)
}

#

it basically takes an object, does some things to it, and returns the new modified object

nocturne elbow
#

Also, if the setgroup method is on the player object, they'll always be online lmao

#

And what op issue?

craggy ember
#

not strictly true

#

well, true and not

nocturne elbow
craggy ember
#

the documentation says it represents a player, online or not

uncut panther
#

well If I change my group, I cant use /op or /deop or /reload anymore

nocturne elbow
#

You should never use reload anyway lol

uncut panther
#

i know

uncut panther
#

but it was testing purpose

nocturne elbow
#

Well I mean.. that sounds a whole lot like you don't have permission... what else can I say

uncut panther
#

the thing is

#

im OP myself

nocturne elbow
#

Give the permission check command a try

#

(assuming you're on latest) lp user .. permission check <perm>

#

Will spit a bunch of very useful info

uncut panther
nocturne elbow
#

Yeah you're not on latest

craggy ember
#

/ver LuckPerms

nocturne elbow
#

The check command changed recently and it worked differently

uncut panther
#

5.2.35

#

updating now

nocturne elbow
#

!latest

frank driftBOT
#
Latest version

5.2.94

uncut panther
#

lel

#

on the lastest version the op issue is fixed

#

i should consider updating more ๐Ÿค”

#

thankx for all the help doh

nocturne elbow
bold plover
#

Do context calculators not work for regular perm checks? Was trying with the LP and Sponge classes, they show up just fine under user info, but when i add the context to a node it's not being satisfied by the context even though it's the same as displayed on the player info.

crystal sonnet
#

Yes they work

#

Have you checked how the resulting node looks in the editor (or any other other way to display the nodes)? @bold plover

bold plover
#

yeah i figured it out, didn't break point it too many times turned out that subject was not always the player object if they were online, but lp uses the SubjectProxy wrapper for the subject, though luckily you can get the player by grabbing the command sender so i did just that.

#

cheers

paper walrus
#

yo

#

How do I access the api MCThink i know, super noob question

#

I'm currently trying to make it where people can buy ranks via my Python Discord bot, wondering if there's a way to grab the users current rank + promote them

hybrid panther
#

!cookbook

frank driftBOT
wild whale
#

keep in mind LP only has a java api, so you'd need to make something or other to communicate between the 2

paper walrus
#

ah, alright

remote sky
uncut panther
#

idk anymore..

remote sky
#

Try that

turbid solar
#

Does LP load the data before or after PlayerChooseInitialServerEvent on velocity? Because I'm getting an error with Player#hasPermission (I'm not familiar with vc event order) https://bytebin.lucko.me/VyPTUU2sEK

royal condor
turbid solar
#

Shouldnt be

#

wait im dumb sorry

#

nvm not related to api (or LP) but still confused I'm stupid lmfao I was using return instead of break in a for loop so it didnt get the perm from config

craggy ember
#

bet that's an output from less or something, since less hates colours

royal condor
#

What?

turbid solar
#

nah went from my vps logs to my hastebin, renamed then to my website then send it to my local pc & uploaded it (was trying to use haste <file> but that didnt work

craggy ember
turbid solar
#

so does nano

craggy ember
#

nano ew

turbid solar
#

and vim

craggy ember
#

nah vim doesn't mind colours

#

actually no

turbid solar
craggy ember
#

yeah that looks about right

royal condor
craggy ember
#

the bytebin link he posted has fucked up colours in it

#

actually that's probably because it's just serving you plain text and doesn't recognise those

royal condor
#

Not fucked up. Just how they are in raw text

craggy ember
#

yeah just me being dumb I guess

royal condor
#

But the encoding is not right. There's some UTF-8 chars that aren't displayed correctly

#

Not even that as it seems. Or at least my terminal can properly interpret it. Just curling it restores it to how it's supposed to look

craggy ember
#

maybe just the browser

rocky aurora
#

um, quick question

#

how do I obtain all the groups in the server?

#

without manually making a collection

nocturne elbow
#

GroupManager#getLoadedGroups?

rocky aurora
#

cool, thanks

thin matrix
wild whale
#

is user null?

#

that's the only thing in there that seems like it could be nullable

thin matrix
#

idk how it would be null but I made a check for it and it started working

crystal sonnet
thin matrix
#

getting it from UUID

turbid solar
#

is the user offline

jaunty pecan
#

Iโ€™m guessing those little squiggly lines are telling you it could be null ๐Ÿ˜›

rocky aurora
#

is it possible to get offline player groups?

turbid solar
#

yes

#

!cookbook

frank driftBOT
rocky aurora
#
UserManager userManager = luckPerms.getUserManager();
CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);

userFuture.thenAcceptAsync(user -> {
    // Now we have a user which we can query.
    // ...
});
#

this, right?

turbid solar
#

yes

rocky aurora
#

but, if I understood correctly,

#

this will wait for player to be online?

#

or not

turbid solar
#

It'll load the user from the database

rocky aurora
#

alright

#

and then, if I want to get all his groups

#

User#getInheritedGroups?

turbid solar
#

get the nodes, filter for inheritancenode & get the group names

rocky aurora
#

can you spoon feed me a little lol

rocky aurora
#

this is a bit confusing

#

since I am not familiar w it

turbid solar
#

that github links shows exactly how to get the groups

rocky aurora
#

but will it work with offlineplayer thou

turbid solar
#

yes as long as you load the user

rocky aurora
#

oh

#
            UserManager userManager = this.plugin.getLpApi().getUserManager();
    
            PlayerAdapter<Player> playerAdapter = this.plugin.getLpApi().getPlayerAdapter(Player.class);
    
            CompletableFuture<User> userFuture = userManager.loadUser(p.getUniqueId());
    
            userFuture.thenAcceptAsync(user -> {
                
                Collection<Group> groups = user.getInheritedGroups(playerAdapter.getQueryOptions(user));
            });
#

am I doing this right?

getQueryOptions needs Player object, not User

turbid solar
#

User#getQueryOptions?

#

think thats a thing

rocky aurora
#
            UserManager userManager = this.plugin.getLpApi().getUserManager();
            
            CompletableFuture<User> userFuture = userManager.loadUser(p.getUniqueId());
    
            userFuture.thenAcceptAsync(user -> {
                Collection<Group> gr = user.getInheritedGroups(user.getQueryOptions());
            });
#

this seems about right

crystal sonnet
#

Just donโ€™t pass any parameters to that function. No need to worry about it @rocky aurora

crimson ferry
#

How can I get a Players color?

#

(Also the Color of the Players role)

#

Or how can I get the Meta Keys of the Players group?

turbid solar
#

resolveInheritedNodes then filter for meta nodes?

crimson ferry
#

ok

#

How can I get these resolveInheritedNodes?

nocturne elbow
#

you want to get a value for a meta key?

crimson ferry
#

I want to get color meta data from the Players group.

turbid solar
#

i could send the code for it but... spoonfeeding bad

crimson ferry
#

Uh

turbid solar
#

User#resoliveInheritedNodes(NodeType, QueryOptions)

crimson ferry
#

Ok

nocturne elbow
#

uuh..

turbid solar
#

then filter for key, find first & get the value

#

i think

#

thats how I done it atleast

nocturne elbow
#

there's an easier way lol

crimson ferry
#

How @nocturne elbow

frank driftBOT
#

Hey Basti ๐Ÿ”ฎ๐Ÿ›ก! Please don't tag helpful/staff members directly.

crimson ferry
#

Uh ok sry bot

nocturne elbow
#

luckperms -> getgroupmanager -> getgroup -> getcacheddata -> getmetadata -> getmetavalue

crimson ferry
#

Okay

#

Ah

#

And at getgroup I just can get the Player Primary group

turbid solar
#

ye

turbid solar
nocturne elbow
#

Do you want to get the meta for the group or the one that the player ends up with?

crimson ferry
#

Thx

#

I wanna get the meta of the group the player has

nocturne elbow
#

so the meta the player ends up with

craggy ember
#

what are the default non contextual query options?

nocturne elbow
craggy ember
#

is Flag.RESOLVE_INHERITANCE set?

nocturne elbow
#

uh

craggy ember
#

I mean, I guess I could just use EnumSet.noneOf(Flag.class) to make sure no flags are set

nocturne elbow
#

Set.of() fingerguns

craggy ember
#

EnumSet.noneOf superior xD

nocturne elbow
#

not really lol

#

that's mutable

craggy ember
#

actually I really shouldn't be using noneOf here

#

you know Set.of isn't even a thing btw right?

nocturne elbow
#

Don't you tell me you're using Java 8 CH_facewhy

craggy ember
#

yeah I'm using Java 8 KEKW

#

forgot it's what's set as default

nocturne elbow
craggy ember
#

it's the JDK I have set as default lol

#

lemme set AdoptOpenJDK 11 as default

#

OpenJDK best JDK

#

anyone who thinks otherwise is dum dum

#

change my mind

nocturne elbow
#

*performs a lobotomy*

craggy ember
#

oi

#

I had to look that up btw KEKW

signal valley
#

what is the API to show someone's group?

turbid solar
#

!cookbook has example for that

frank driftBOT
signal valley
#

it says it moved to another link

odd vapor
#

How to check if a player is in a group and add him to the group?

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
jaunty pecan
#

d;luckperms Node

slate deltaBOT
#
public interface Node```
Node has 15 methods, and  10 sub interfaces.
Description:

Represents a LuckPerms "node".

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

Combining these various states into one object (a "node") means that a holder only has to have one type of data set (a set of nodes) in order to take on various properties.

It is recommended that users of the API make use of Streams to manipulate data and obtain the required information.

This interface provides a number of methods to read the attributes of the node, as well as methods to query and extract additional state and properties from these settings.

Nodes have the following 4 key attributes:

<br />

*...

This description has been shortened as it was too long.

jaunty pecan
#

\o/

craggy ember
#

๐Ÿ‘‹

#

hello there DocDex

versed flint
#

o

#

๐Ÿ˜„

turbid solar
#

d;luckperms User

slate deltaBOT
#
public interface User
extends PermissionHolder```
User has 1 super interfaces, 4 methods, and  1 extensions.
Description:

A player which holds permission data.

craggy ember
#

d;luckperms User#getInheritedNodes

slate deltaBOT
#
@NonNull Collection<Group> getInheritedGroups(@NonNull QueryOptionsย queryOptions)```
Description:

Gets a collection of the Groups this holder inherits nodes from.

If Flag.RESOLVE_INHERITANCE is set, this will include holders inherited from both directly and indirectly (through directly inherited groups). It will effectively resolve the whole "inheritance tree".

If Flag.RESOLVE_INHERITANCE is not set, then the traversal will only go one level up the inheritance tree, and return only directly inherited groups.

The collection will be ordered according to the platforms inheritance rules. The groups which are inherited from first will appear earlier in the list.

The list will not contain the holder.

Returns:

a collection of the groups the holder inherits from

Parameters:

queryOptions - the query options

craggy ember
#

wait... it doesn't just perform an exact search, it performs a LIKE search as well?

#

this bot's awesome!

#

thanks @versed flint!

#

great bot!

versed flint
#

thanks

craggy ember
#

I might PR over some gateway intent changes if you'd be alright with that

versed flint
#

pls do

craggy ember
#

me likes to contribute to others' projects ๐Ÿ™‚

versed flint
#

a star would be awesome too

craggy ember
#

your wish is my command

versed flint
#

btw there's loads of docs, type d;docs

craggy ember
#

d;docs

slate deltaBOT
#
Javadocs:
โ€ข plotsquared-bukkit        โ€ข fawe
โ€ข commons-compress          โ€ข sponge
โ€ข commons-crypto            โ€ข waterfall-chat
โ€ข commons-configuration2    
โ€ข commons-collections4      
โ€ข commons-codec             
โ€ข plotsquared               
โ€ข velocity                  
โ€ข jda                       
โ€ข waterfall                 
versed flint
#

(telling you to run it because only the command runner can interact with the pagination)

craggy ember
#

jesus christ that's a lot

#

and I'm assuming they aren't hard coded either?

versed flint
#

nah

#

probably 50% of them automatically update

#

well, update daily

#

the other 50% is things like old spigot versions which obviously don't need to be updated

craggy ember
#

nice reference to the host container from Docker there

#

guessing this has a published Docker image?

versed flint
#

nah

#

i need to make one tho

craggy ember
#

I can make that as well whilst I'm at it if you like

versed flint
#

I'd prefer to do it myself so I can actually learnt how to

#

I really need to learn docker properly

craggy ember
#

lemme link you to my Dockerfile as an example

#

basically, you create one of those, then run docker build -t image-name:version directory

#

or in your case, docker build -t docdex:1.0.0-beta .

#

I think

versed flint
#

okie

#

i'll come back to it when I get around to looking into docker

craggy ember
#

yeah you build the image and then push it

versed flint
#

currently just using ptero

craggy ember
#

if you also look in bardybot, I have docker-push.sh, which used to be used by Travis to automatically push builds to Docker

#

it just logs into Docker Hub with docker login and then pushes with docker push

#

also, #piggypigletformod

versed flint
#

lol wot

#

i haven't been active in this server since like 2017

craggy ember
#

I'm kidding lol

#

you should get something though, to recognise that thee is the creator of DocDex

versed flint
#

d;info

slate deltaBOT
#
DocDex | Info

Website | Github | Invite

DocDex (Documentation Index) is a bot developed using JDA and Java 11, which can display information on javadoc objects, from a fuzzy query.

Servers

16 (31,892 Users)

Javadocs

93 (Default: jdk)

craggy ember
#

one of the most useful bots I've ever seen

versed flint
#

my name is there

craggy ember
#

true

#

oh also, Gradle thing here, but you know I managed to use dependencies in allprojects the other day

#

I think you can do it now

versed flint
#

I didn't know you couldn't do so before

#

sorry double negative

craggy ember
#

maybe was just me being dum dum in the past lol

#

where's the class that starts JDA btw?

versed flint
#

JDARegisterable under the discord subproject

craggy ember
#

also, my guy be using ORM

versed flint
#

my own orm

craggy ember
#

what's it like?

versed flint
#

too verbose

craggy ember
#

not Kotlin friendly then

craggy ember
#

right, what are all the things the bot does btw?

#

or all the things the bot listens to

#

need to know this for gateway intents

versed flint
#

erm

#

well it needs a member count for the info command

#

and server count

#

it deletes and adds emojis to messages (not always its own)

#

it makes messages

#

reads message history

#

deletes other peoples messages sometimes

#

edits messages

craggy ember
#

yeah let's move there

mighty folio
#

Hello

turbid solar
#

hi

mighty folio
#

How do i get the Api? is it possible to:
private Plugin LuckPerms = Bukkit.getPluginManager().getPlugin("???");

#

or what do i have to type in the " "

turbid solar
#

!api

frank driftBOT
turbid solar
#

explains how to get it

#

either use the singleton or the service provider

nocturne elbow
#

Quick question

#

When I'm calling Permission#getPrimaryGroup in Vault

#

Does that return all of the player's parent groups

hybrid panther
#

Gets the name of their primary group

turbid solar
#

group = 1, groups > 1

versed flint
#

who ghost pinged me

nocturne elbow
#

@tired loom :p

tired loom
#

mistake

versed flint
#

why

#

ah

tired loom
#

like

#

mistake

#

ok

#

sorry

craggy ember
languid walrus
#

How can I remove a specific amount of items from an inventory? With /rankup

odd vapor
#

!api

frank driftBOT
hollow grotto
#

This is less an API question and more a general development question. Luck may be the only one who has the proper answer to this but speculation is welcome.

What was the reasoning behind going with weights over a different system, such as explicit deny wins like what you find in Active Directory?

jaunty pecan
#

No particular reason

#

Iโ€™m not familiar with active directory so canโ€™t really compare

hollow grotto
#

Understandable.

Essentially the difference there is in LP if you have multiple roles and you have a mix of allow and deny, the winner is determined by the weight. In AD, if you have multiple roles, it's calculated like this:

  1. If there are any denies, the result is deny.
  2. If there are no denies but there are allows, the result is allow.
  3. If there are neither, the result is no permission (behaves like a deny in that they don't have permission, but can be overridden by an allow).
nocturne elbow
#

That seems to be how WorldGuard does it if all applicable regions have the same priority

#

But you can still prioritize ALLOW over DENY if one of the applicable regions has a higher priority

#

For the StateFlags that is, kinda exclusive

hollow plank
#

I am writing the grief protection plugin for my server. I need to get data from luckperm to find out which group a player is in I guess how can I do that

#

how can i use this

nocturne elbow
#

Well that would include inherited groups as well

hollow plank
#

I just need to understand if a player is in the group I chose.

nocturne elbow
#

Do you know what inheritance is?

hollow plank
#

i guess no

nocturne elbow
#

!inheritance

frank driftBOT
hollow plank
#

I may not understand because my English is not good

#

okey i understand this

#

but i will use only group.owner

nocturne elbow
#

okay

hollow plank
#

how can i use

nocturne elbow
#

You write that method somewhere and then you call it...? isPlayerInGroup(player, "owner")?

hollow plank
#

I thought about it too but it's strange how easy it is ๐Ÿ˜„

#

thank you for help

hybrid panther
#

the font aPES_Eyes

hollow plank
#

if(player.isOp() || isPlayerInGroup(player, "owner")) does this work

nocturne elbow
#

I don't see why it wouldn't

hollow plank
#

I'm a little inexperienced, sometimes I make small mistakes ๐Ÿ˜„

hollow plank
nocturne elbow
#

Well the method takes a Player

#

Not a String (player name)

surreal matrix
#

anybody able to help

nocturne elbow
#

with the api?

surreal matrix
nocturne elbow
#
  1. #support-1 or #support-2 for general LP help
  2. If you are a server admin, please check the console for any errors.

hollow plank
#

i dont use api

nocturne elbow
#

it was a question for ShanePike

hollow plank
#

but my code is not working

hollow plank
#

sorry my mistake i find my problem

nocturne elbow
#

how do I get the instance of luckperms on bungee

#

LuckPermsProvider.get()?

#

d;methods lp luckpermsprovider

slate deltaBOT
nocturne elbow
#

Amazing

#

thx

left badger
#

ooh luckperms got docdex

crystal sonnet
#

That's new btw

cosmic radish
turbid solar
cosmic radish
turbid solar
#

yes

blazing portal
#

is it possible to get a prefix of an offline player?

nocturne elbow
#

!cookbook

frank driftBOT
blazing portal
#

thank you ๐Ÿ˜„

pearl ether
#

I've set the weights of each group

#

like is there an util or should I just implement it myself

nocturne elbow
#

.stream.sort?

#

I mean it's a set you're looking at right there, there is no guarantees it will be sorted (unless it's a SortedSet but there are no guarantees it's one either mmlul)

pearl ether
#

;D

#

thanks

rustic laurel
#

That's an ad and ads are bad @severe zenith - not here thanks

severe zenith
#

k

marble shore
#

Is there a way/is it safe to use LuckPerm's Redis library (Jedis) instead of shading Jedis myself?

harsh radish
#

How can I get when a players rank expires?

nocturne elbow
#

!cookbook has a few listener examples

frank driftBOT
nocturne elbow
#

And for that you'll want to listen to NodeRemoveEvent, check that the target is a User and that the node is of NodeType.INHERITANCE and that it had an expiry

harsh radish
#

I need the time until the player's rank has expired

#

is there a method for this?

nocturne elbow
#

Not directly, there isn't a User#getParentGroupsExpiryTime method

#

You can use PermissionHolder#getNodes(NodeType) for NodeType.INHERITANCE and filter by those that have an expiry date and have not expired

#

Then get the expiry for each. Keep in mind that you can have multiple parent groups and multiple temporary parent groups so you may end up with 0, 1 or many resulting nodes ccatrainbowshrug

harsh radish
#

okay thanks

severe zenith
#

anyone able to help me in with luckperms?

nocturne elbow
#

with the API...?

nocturne elbow
#

means you're passing null

#

lol

unkempt depot
#

lol

#

forgot to deploy to repo w/ newest version ๐Ÿ˜ข

zinc shuttle
#
        user.data().clear(user.getQueryOptions().context(), NodeMatcher.key(InheritanceNode.builder().group(group).build()));
        api.getUserManager().saveUser(user);
    }```
That should remove a user from ``group`` correct?
#

for some reason.. it is refusing to remove me from the group

#

but i can add a group with public void addGroup(String group) { user.data().add(InheritanceNode.builder().group(group).build()); api.getUserManager().saveUser(user); }
just fine..

nocturne elbow
#

Yeah that should work I think?

#

What happens if you don't pass the context to the clear method, only the NodeMatcher?

zinc shuttle
#

The thing is that that's what I used for a 1.15 plugin..

#

And it worked flawlessly

#

And add still works but that one doesnt

#

And I don't think I can't not pass the query context to the clear method

#

Since it requires it and won't compile if I dont

nocturne elbow
#

I'm sure you can

#

d;lp NodeMap#clear(Predicate)

slate deltaBOT
#
void clear(@NonNull Predicateย test)```
Description:

Clears any nodes which pass the predicate.

Parameters:

test - the predicate to test for nodes which should be removed

nocturne elbow
#

yeah you absolutely can lmao

#

unless you're compiling against an old af version

#

Which LP version are you using and which one are you compiling against?

zinc shuttle
#

Whatever version was on the api page

#

Like 5 months ago

nocturne elbow
zinc shuttle
#

I'm not currently at my computer nor really allowed on it as of now

#

Should be a 1.15 build of the lp api and the latest version of lp (or 4 days old)

nocturne elbow
#

Okay, whenever you can check and send those 2 infos over cuz they do be important tbh
I'mma test that now but afaik it should work fine

#

cool cool

nocturne elbow
#

clear(ContextSet, Predicate) will clear those that satisfy both the predicate and the context set

#

so the permission for that key (if you're doing NodeMatcher.key(...) that is) would need to satisfy all contexts passed in the set

zinc shuttle
#

So either will work?

nocturne elbow
#

literally no lmao

#

reread what I just said

zinc shuttle
#

I'll update the api and luckperms to make sure they are both latest stable and see what happens

#

Oh

nocturne elbow
#

when passing the contextset you are basically filtering all nodes that satisfy the contextset

#

so if you pass a contextset only for server=survival, you would get all nodes for server=survival, and if the node you're trying to clear does not exist there it won't clear them

zinc shuttle
#

It's a non-bungee server

#

Have I pulled a small brain?

nocturne elbow
#

'twas an example

zinc shuttle
#

That's the greatest usage of 'twas I've ever seen other than 'twas the night before Christmas

nocturne elbow
#

lmao

zinc shuttle
#

So I'm trying to look for an object in which it does not exist in the context specified?

nocturne elbow
# slate delta

I'm 100% sure that method has always existed (always = since v5.0)

zinc shuttle
#

So if I remove the context it should work as that method used to?

nocturne elbow
#

Otherwise it would specify since: X

#

yea

#

Make sure you're using an update api version lol v5.2 preferable (latest as of today)

zinc shuttle
#

I'm using a 5 month old version

#

But latest luckperms

#

So yeah I'll update and remove that context

#

Thank you for your help :)

nocturne elbow
#

For example, in here (in UserManager) savePlayerData has always existed (since v5.0, unspecified but it's the "new" api) existed, but modifyUser was introduced in v5.1 as it says there, and deletePlayerData since v5.2

zinc shuttle
#

There's a usermanager?

zinc shuttle
#

I made my own class to interact with players...

#

For nothing??

#

And my own group management class

nocturne elbow
#

LMAO

#

d;methods lp luckperms

slate deltaBOT
#
Methods:
net.luckperms.api.LuckPerms#getPlatform
net.luckperms.api.LuckPerms#getEventBus
net.luckperms.api.LuckPerms#getPlayerAdapter
net.luckperms.api.LuckPerms#getPluginMetadata
net.luckperms.api.LuckPerms#getTrackManager
net.luckperms.api.LuckPerms#getNodeBuilderRegistry
net.luckperms.api.LuckPerms#getMessagingService
net.luckperms.api.LuckPerms#getGroupManager
net.luckperms.api.LuckPerms#runUpdateTask
net.luckperms.api.LuckPerms#getUserManager
net.luckperms.api.LuckPerms#getNodeMatcherFactory
net.luckperms.api.LuckPerms#getServerName
net.luckperms.api.LuckPerms#getQueryOptionsRegistry
net.luckperms.api.LuckPerms#getActionLogger
net.luckperms.api.LuckPerms#registerMessengerProvider```
nocturne elbow
#

juicy stuff

zinc shuttle
#

I am using a user

#

But I think I'm getting that from something along the lines of getUser

nocturne elbow
#

Well yeah you eventually work with a User instance

#

but you get users with either the UserManager or the PlatformAdapter

zinc shuttle
#

And for groups I am using the group manager

nocturne elbow
#

UserManager lets you load/modify data from offline players (and many, many more things)

zinc shuttle
#

But the group manager was so long that I created my own class

#

For getting prefixes and weight

#

Then I am definitely using the userManaher already

nocturne elbow
zinc shuttle
#

Yeah but I made it easier lol

nocturne elbow
#

weight there's no mystery, you can just get the group and get the weight

#

prefix/suffix needs an extra step but still

zinc shuttle
#

new LuckPermsGroup("owner").getPrefix();

nocturne elbow
#

I wonder what that does BTS

zinc shuttle
#

Bts?

nocturne elbow
#

behind the scenes

zinc shuttle
#

Ah

#

There's alittle more than just getting the prefix for getPrefix.. it will return the group name of the group if it doesn't have the prefix and if the group is null it returns the "name + (null)"

nocturne elbow
#

Does it respect the prefix stacking settings though? ;p

zinc shuttle
#

Ah what now?

#

It gets players prefix, if that's null it gets group prefix..

#

The primary groups prefix

nocturne elbow
#

yeah but you can specify how prefixes will actually show

#

like

zinc shuttle
#

It shows the prefix just like essentials does

nocturne elbow
#

imagine I have a prison track, a staff track and a donors track, you can make it so it shows the final prefix as (for instance)
[Mod] โญ [Donor] โญ [G] -

zinc shuttle
#

Wait what

#

Are you serious

nocturne elbow
#

totally

#

!stacking

frank driftBOT
zinc shuttle
#

I spent Like 8 hours making my own chat thing aswell

#

Just so I could do that

#

And your telling me

#

That this plugin does it for me??

nocturne elbow
#

And you can get the final prefix with a single line lol

#

and it can get pretty wild.

zinc shuttle
#

My poor brain

#

Imma go to bed

nocturne elbow
#

lol

zinc shuttle
#

My brain is fried

nocturne elbow
#

Of course if there's no evaluated prefix it will return null but that's something you can easily solve lol

#

Anyway, gnight :ablobwave:

zinc shuttle
#

Gn

nocturne elbow
#

:o

#

my

#

my blob :(

#

:ablobwave:

#

๐Ÿ˜ญ

zinc shuttle
#

Oof

rocky isle
#

hi i need help:
i'm using tebex "buycraft"
and i want to create packages like: vip, mvp
but i dont know how to give someone an luckperms rank??

what is the command

isnt it:
/lp user @p ?

rocky isle
#

sorry
i know how it works

#

but
i need an
@p command

nocturne elbow
#

do yourself a favor and read the page I linked

#

it has what you need

rocky isle
#

should i do this?
{name}

nocturne elbow
#

mhm

#

that's what the docs say

rocky isle
#

ok

#

thanks

nocturne elbow
#

because it 100% isn't specific to luckperms

rough nova
#

Hi everyone!

@jaunty pecan , I want to create a website where players can enter their names to see how much time they have until a secondary degree expires (for example VIP).
My time database doesn't look like chat (i mean i can't understand this: 1613695413) and I don't know how to calculate, can you tell me please?

frank driftBOT
#

Hey Brosky (Vlad)! Please don't tag helpful/staff members directly.

turbid solar
rough nova
#

Thanks!

turbid solar
#

And you can find soms api or do it yourself probably

zinc shuttle
#

You can use new Date(Long) I believe

#

If you use new Date(0) it's Jan 1, 1970

zinc shuttle
#

I was using LP Api version 5.1 fefo..

nocturne elbow
#

Yeah well the method was doing what you were telling it to tbh lmao

#

You should be able to not pass any ContextSet at all in that case

zinc shuttle
#

yeah it works now, without the context

zinc shuttle
#

is there any way to re-arange the roles in the lp editor?

jaunty pecan
#

they're ordered by weight

unkempt rampart
#

Hi Guys, Is it possible To Make a Nick System Where It Nicks And Changes to a Prefix, Then when you unick it comes back the the orginal prefix, I am Using Luckperms for the prefixes

zinc shuttle
#
  prefix:
    format:
      - "highest_not_on_track_levels"
      - "highest_on_track_levels"
    duplicates: first-only
    start-spacer: ""
    middle-spacer: " &8| "
    end-spacer: " &8| "
  suffix:
    format:
      - "highest"
    duplicates: first-only
    start-spacer: ""
    middle-spacer: " "
    end-spacer: ""```
So i currently have that but is there a way to say for example: if the owner doesn't want to show highest_on_track_levels is it possible to not show it for only the group owner?
nocturne elbow
#

No, those settings apply globally on the server

zinc shuttle
#

so i would have to make my own custom chat handler wouldn't i (which i conveniently already have)

proud crypt
zinc shuttle
#

heres an example of what i was trying to do:

Owner: it would only display owner, not the level
Manager: it would only display manager, not the level
...
Moderator: it would display moderator and the level
...
Member: it would only display the level

And for the re-arranging i just had to reload the page (it was sorting by creation not weight)

misty dove
#

hey I have a little problem maybe its because of my ignorance of not knowing how lp works internally and probably there are easier ways to do this but
I have created a webapp that asks for nickname and password for a server and I have 2 groups on my minecraft server 1 that cannot do antything and second that allows for normal play eg interacting with other blocks and basic commands
app assumes that player has already been on server so the uuid is in the database. When webserver authenticates player it sets group to that player directly in the database
I mean it sets primary_group of that player in the luckperms_players table to that group.
I think it should work, entry in the database changes and stuff but in the game player still cannot do anything.
Or should I just update player directly in the user_permissions table

nocturne elbow
#

The primary group is not quite what it seems; the primary group isn't grabbed from storage, but by default the primary group is calculated at runtime and it's the direct parent group that weights the most (and tbh that is the behavior people expect so it shouldn't really be changed), so changing the db entry will most likely have no effect (just like the parent switchprimarygroup command, it even tells you it won't change based on the config setting)

#

A common misconception is that the primary group is the parent group, and that's not necessarily true, you can have many parent groups (but one primary group only);

IMO you shouldn't modify storage directly :p as it isn't reflected in real time on the loaded on-memory data (although that's nothing an /lp sync cannot fix), you should make some sort of bridge plugin that interfaced with the LP API that changes their parent groups as you need

misty dove
#

oh okay
I've never wrote a plugin before so I assume it would be overkill for that
are there any other ways to automate that? I got really desperate and wrote that app today because few times my server got destroyed by some dudes that somehow got ip and destroyed my and my friend's works and stuff

obtuse jolt
#

(is it an offline mode server)

misty dove
#

yes

#

it is sadly

nocturne elbow
#

Well, there's nothing stopping you from changing what's in the db, but you would need to run /lp sync//lp networksync after modifying it, and yes you would need to add an entry in the user_permissions table for the node group.<group>

misty dove
#

okay got it
thanks a lot

near orbit
#

Hey can someone help me? This is my first time working with the luckperms API. Why doesn't it work with the maven?

nocturne elbow
#

and maven too?

near orbit
#

yes

nocturne elbow
#

All your <dependency>...</dependency> tags go inside one single <dependencies>...</dependencies>

near orbit
#

okay thx

lapis oyster
#

how can i get the groups of the players that i can let it show in the tab and in the chat?

torpid marten
#

hi, so i got a problem, im doing a loop of group names and i created them using
if(getLuckPerms().getGroupManager().getGroup(groups) == null) getLuckPerms().getGroupManager().createAndLoadGroup(groups);
but if i want to get the group right after that with
getLuckPerms().getGroupManager().getGroup(groups)
its null

nocturne elbow
#

createAndLoadGroup takes some time to create (and.. load) the group

#

it returns a CompletableFuture so getGroup will return null until the future is done

nocturne elbow
frank driftBOT
torpid marten
#

oh makes sense

#

thanks for the info

native dawn
#

I can't see anything about this in the wiki or cookbook - what would be the best way to get the users' next rank in a track?

turbid solar
#

If I load a user then later call getUser(UUID) would that work or would I need to call loadUser(UUID) again?

nocturne elbow
#

I think it's loaded for a minute but you should load it if the user is offline

#

if it's an online player you can just LuckPerms#getPlayerAdapter(Class) -> getUser(Player)

nocturne elbow
native dawn
severe zenith
#

anyone know why on my server everyone has the same ip?

turbid solar
nocturne elbow
silent plume
#

Hello! I have a question. I have the problem that whenever i give 1 person a role everybody else gets that role assigned too. How do I fix that problem?

nocturne elbow
#

with the API?

silent plume
#

probably whenever i promote someone everyone else gets promoted with it and idk where my mistake is

nocturne elbow
#

uuh... what is this to do with the LP API exactly?

silent plume
#

i followed a tutorial i created 5 roles and set prefix and also i did the track it works anc i can promote people but the prefix doesnt really work if i promote someone to mod it sometimes looks like [Member]mod and when i once get the prefix to be mod everyone becomes mod

nocturne elbow
#

Do you know what an API is?

silent plume
#

im sorry i looked it up and ig its not what i thought it was

nocturne elbow
nocturne elbow
#

oh btw for your previous question

#

you can get the next group on a track with this method

#

d;lp Track#getNext(Group)

slate deltaBOT
#
@Nullable String getNext(@NonNull Groupย current)
throws NullPointerException, IllegalStateException```
Description:

Gets the next group on the track, after the one provided

null is returned if the group is not on the track.

Parameters:

current - the group before the group being requested

Throws:

NullPointerException - if the group is null
IllegalStateException - if the group instance was not obtained from LuckPerms.

Returns:

the group name, or null if the end of the track has been reached

native dawn
#

yeah that doesn't help really

#

because for example, if I pull the users groups and filter to the two in the track, I will end up with default at a minimum and also another, example rank1

#

I don't want it to select default to then get the next group as rank1 if rank1 is the highest in the track

nocturne elbow
#

what?

#

you literally asked for "the next group on a track"

#

that's literally it

native dawn
#

I asked How would I find the "top" rank in the track which the user has?, or the lastmost which they have

nocturne elbow
native dawn
#

I then went into further detail below?

#

sorry for the misunderstanding

nocturne elbow
#

so the player will have default and another group, and both of them are on the same track?

#

I'm not getting the situation

native dawn
#

let me send an example

#

pretend Basilisk is default, this is part of a larger network so the user will always have default rank, but then they may also have phoenix rank

nocturne elbow
#

oh I see what you're trying to do

native dawn
#

I don't want to fetch their ranks and filter by the track to be left with default, and then selecting basilisk and it saying the next rank is centaur

nocturne elbow
#

you're trying to manually promote them yourself because they are on two groups on the same track and you can't simply /lp user .. promote them, right?

native dawn
#

I need to know which rank they're currently on so that I can perform operations before they are promoted based on some config sided stuff

nocturne elbow
#

oh hm okay

#

well you still can't /lp user .. promote them hhhhhhhhhhhhhhh

#

uuh let me think

nocturne elbow
#

I hate spoon-feeding

#

but

#

I had to figure it out myself xD

#

This is what I would do (in theory this works, keep in mind I haven't tested any of this lol)

final Track track = this.luckPerms.getTrackManager().getTrack("track");
Validate.notNull(track, "yeet");
final User user = this.luckPerms.getPlayerAdapter(Player.class).getUser(player);
final QueryOptions queryOptions = user.getQueryOptions();
final List<String> playerGroups =
    user.getInheritedGroups(queryOptions.toBuilder().flag(Flag.RESOLVE_INHERITANCE, false).build())
        .stream()
        .map(Group::getName)
        .collect(Collectors.toList());
final String highestGroupOnTrack = track.getGroups()
                                        .stream()
                                        .sorted(Collections.reverseOrder())
                                        .filter(playerGroups::contains)
                                        .findFirst().orElse("default");
lapis oyster
#

Can i get the group of a player with the API? but I need to get the group of the player for a spigot plugin and the Luckperms is only on the Bungee server.

nocturne elbow
#

That's stupid, LuckPerms needs to be installed on every server to work on them

#

It doesn't check permissions across the network

gloomy flare
#

Hi. How can I get an users secondary group?

crystal sonnet
humble echo
#

someone know why i have this error?

turbid solar
#

Depend on LuckPerms and make sure tou load the api after luckperms

humble echo
#

yup

turbid solar
#

Show where you're getting the api instance

#

Line 32

humble echo
#

onEnable

turbid solar
#

Is LP on the server? And make sure you're not shading the api in

humble echo
#

yes is in the server

#

the plugin loads before luckpers

turbid solar
#

might be depends

humble echo
#

idk

turbid solar
#

Try it

#

Are you using maven or gradle?

humble echo
#

maven

turbid solar
#

!paste your pom

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!

humble echo
#

i try with maven dep and same file as in the server

turbid solar
#

Dont use the platform jars

#

!api

frank driftBOT
turbid solar
obtuse jolt
#

yea shouldnt use systemPath, luckperms as a proper maven repo

#

probably the same case for bungeecord-lib you are using

humble echo
#

i change systempPath and the same error xd

turbid solar
#

Did you try making it depends instead of depend?

humble echo
#

in plugin.yml?

turbid solar
#

Yes

#

Its different between bukkit & bungee

humble echo
#

k

nocturne elbow
#

Lombok ๐Ÿฅฒ

humble echo
#

tried depend, softdepend and depends

nocturne elbow
#

On bungee it's depends and share your new pom please

humble echo
#

k

nocturne elbow
#

That looks good, you sure it's in depends?

humble echo
#

yup

nocturne elbow
#

Hum thonk

#

Does it still try to load before LP?

#

Because that sounds like a fucked up proxy plugin manager lmao

humble echo
#

xdd

#

nvm

#

idk why

#

but

#

know its working

nocturne elbow
#

which method do I have to use if I want to check the group of a offline player?

turbid solar
#

!cookbook

frank driftBOT
opal eagle
#

Yo! Is there an easy way to get expiration time of the group/permission? I know how to check if someone is in specific group with player.haspermission("group.name"), but how to get expiration time?

rustic laurel
#

!api basically you just need to use the LPAPI instead of Bukkit

frank driftBOT
opal eagle
#

Okay! Thanks I'll look into this

opal eagle
nocturne elbow
#

d;lp node#getexpiry()

slate deltaBOT
#
@Nullable Instant getExpiry()```
Description:

Gets the time when this node will expire.

Returns:

the Instant when this node will expire, or null if it doesn't have an expiry time

nocturne elbow
#

The mere fact you asked "how to access expireAt from this structure" scares me just thinking how you are doing things monkas

opal eagle
#

Yeah, thanks a lot!

nocturne elbow
#

lol sounds hacky; the LP API is made so you don't have to write some hacky janky workarounds to make things work :d usually there are proper methods to achieve your goal

opal eagle
#

That's cool! I have to spend more time learning mincraft plugin coding and everything will be easier

#

Thank you one more time

stray current
#

nvm i found it

cursive juniper
#

Hello! I'm working with the LuckPerms API for the first time, and I'm a bit lost on the topic of managing a user's groups. The docs on the website seem to skim over this.
My goal is simple: I want to add a user to a group using the group name. I was able to get the group object using getGroupManager().getGroup(<name>). However, it appears that to assign the user to it, I need it in the form of a Node... but there is no GroupNode or something like that. What should I use, then?

Can anybody please point me in the right direction? Many thanks ๐Ÿ‘Œ

turbid solar
#

!cookbook

frank driftBOT
cursive juniper
#

Ah, useful. Thank you!

opal eagle
#

Hello!
What does it mean? I can't use api inside of the asynchronous task? In my Main class I have "public static LuckPerms api;" and when plugin enables "api = LuckPermsProvider.get();". So Can I use "Main.api.getPlayerAdapter(Player.class).getUser(player)" in async task?

turbid solar
#

What?

opal eagle
#

I'm trying to make code below execute async way and in method Time.getTimeReminder I use LP api and I don't know if it is correct as on previous screenshot it states that "Asynchronous task should never access any API in Bukkit"

nocturne elbow
#

And you can use PlayerAdapter methods both synchronously and asynchronously

#

By "don't use bukkit api async" they mean more like world and entities modification, spawning, etc

hybrid panther
nocturne elbow
#

eeh there are a lot of things that are just okay but there is no "standard" on what should and shouldn't be done async

opal eagle
nocturne elbow
#

Yeah that's fine

opal eagle
#

Nice! Thank you a lot guys

nocturne elbow
#

I mean that is part of the Bukkit API, "Bukkit API" doesn't refer to things that are strictly under the Bukkit class, but the server API as a whole

#

But again

eeh there are a lot of things that are just okay but there is no "standard" on what should and shouldn't be done async
and things like sending messages is fine lol

opal eagle
#

Okay, I get it now

#

Thanks!

opal eagle
#

One last question xD If I run part of my code asynchronously and in that part I call a method from another class (in that class I don't use async) will this method run asynchronously?

#

Or I have to do it in all my classes?

nocturne elbow
#

It'll run async

#

Basically, it runs on the same thread the caller is running on, if that makes any sense

opal eagle
#

Thank you very very much โค๏ธ

weary pond
turbid solar
#

?

nocturne elbow
#

Fabric equivalent of Vault? :o

turbid solar
#

Till fabric gets a perm api i think?

weary pond
#

Ok, thank)

nocturne elbow
#

That looks very lacking though..
For what you just asked it sounds a whole lot like you might want to use meta nodes instead of custom perms & parsing (you would need to depend directly on LP and use the actual LPAPI to get the value for the meta key), but if you really want to do it like that you would need to iterate through all inherited permissions, in Bukkit that's easy with the bukkit api itself, just a few method calls and some looping; I wouldn't know if you can get all perms a player has in fabric

weary pond
#

Hopefully something like this will appear in the official fabric permissions api

nocturne elbow
#

For now I would suggest you depend directly upon LP ;););)
And tbh meta nodes (basically a key/value pair) and meta lookups are optimized for performance and fast querying, so you don't have to slowly iterate through all the nodes n stuff

#

But if you want to be more open to other perms platforms without depending directly on them (like the WIP pex2) you wouldn't depend on the LP API and wait until fabric implements their own api

rustic laurel
weary pond
#

Thanks for answers, I'll try it.

long shale
#

Hello

#

So how can I set the prefix with luckperms in programming

#

My english not so good

turbid solar
#

!cookbook

frank driftBOT
marble shore
#

Hey, I apply negated permissions to a player for cooldown purposes. Is it possible to, through the API, check for the following scenario:

  • Check if the player has a negated timed permission node
  • If the player has a negated node, if the player would have access to the permission without this node
  • If so, the cooldown of the node

I thought using something like:

            user.resolveInheritedNodes(NodeType.PERMISSION, QueryOptions.nonContextual())
                    .stream()
                    .filter(p -> p.getKey().equalsIgnoreCase(node))
                    .forEach(p -> System.out.println(" - " + p.getKey() + ": " + p.getValue() + ", " + p.getExpiry()));

However, this doesn't work for certain scenarios (eg when checking for: node.with.subnodes, node.with would be filtered out even though it changes the value of node.with.subnodes)

nocturne elbow
#

I feel like what you actually need is something strangely similar to the new permission check command

supple moth
#

Hmm ok.

#

Is the above message the api?

turbid solar
#

The link? No

vagrant spruce
#

how can i use the player prefix in my plugin?

hybrid panther
urban bane
#

i need some help

#

i've added this to my server to use it with essentials x and i have no idea how to use it

nocturne elbow
#

@urban bane please don't post in multiple channels and adhere to the correct ones

marble shore
vagrant spruce
nocturne elbow
#

and that's how you get the prefix

vagrant spruce
#

then you need to create a separate file and put this code?

nocturne elbow
#

That repository is an example plugin with example commands

#

That code is sample code, you are supposed to read it, analyze it and see "oh okay, I see how this is done, I will adapt this to my needs"

torpid wind
#

is there a way to remove a certain group from a player via the api

nocturne elbow
torpid wind
nocturne elbow
#

what?

#

You mean, if a player doesn't have a group, add one?

#

Well yeah you could do that check, but I mean you can just add it anyway, if they already have that Node nothing will change

torpid wind
#

nope add a group ontop of his exiting ones

nocturne elbow
#

Oh I see

#

Just don't call clear?

#

I mean...

#

lol

torpid wind
#

I have a subserver where you will get a rank if you are the owner of it (private server system) and i want to add a group with perms to him and not to remove his original one

#
HanniSagt.getLuckPerms().getUserManager().modifyUser(uuid, (User user) -> {
            user.data().clear(NodeType.INHERITANCE::matches);
            Node node = null;
            node = InheritanceNode.builder(group).build();
            DataMutateResult result = user.data().add(node);

            // Check to see the result of adding the node.
            if (result.wasSuccessful()) {
                System.out.println("Success -> Added permission group");
            } else {
                System.out.println("Failed -> Failed to add permission group");
            }
        });
#

this is my current code

nocturne elbow
#

Just don't call clear?

torpid wind
#

oh lol

#

nvm im dump as hell

nocturne elbow
#

lol

torpid wind
#

thank you anyway PepoParty

nocturne elbow
#

with the api.?

turbid solar
#

?

nocturne elbow
#

they deleted their message smh

turbid solar
#

You sure you're not imagening things?

nocturne elbow
turbid solar
#

?

obtuse jolt
limpid escarp
#

how can I get the rank of a player in luckperms?

turbid solar
#

!cookbook

frank driftBOT
limpid escarp
#

thx

final adder
#

hi i search to change a specific prefix for a user (priority 60)

`// Find the highest priority of their other prefixes
// We need to do this because they might inherit a prefix from a parent group,
// and we want the prefix we set to override that!
Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i + 10).max().orElse(10);

// Create a node to add to the player.
Node node = PrefixNode.builder("K", priority).build();`

In this exemple found here : https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetPrefixCommand.java
It show how to add a prefix for the highest priority

So if i want to change a prefix should i do like that with priority to 60 ?
Is there any way to modify instead or create ?

foggy oriole
#

What class do i use for the playeradapter to get the prefix of a player through bungee?
rn i have this: CachedMetaData user = api.getPlayerAdapter(ProxiedPlayer.class).getMetaData(sender);

turbid solar
#

user.getPrefix

#

Should Probably rename that

foggy oriole
#

yeah i call get prefix and it returns null

#

but the class is correct?

turbid solar
#

Means you havent set a prefix then

foggy oriole
#

._. i whiffed, wasnt in the group

nocturne elbow
#

Fabric is missing kek

final adder
#

Guys user.getPrefix doesnt exist, how u get it ? 0_o

nocturne elbow
turbid solar
#

!api @final adder

frank driftBOT
nocturne elbow
final adder
#

Oh mybad sorry

gentle osprey
#

Hello, I'm trying to get which track, selected player on. Simply I got group of player and search in all tracks. But its bit complicated. Is there any simple way to get players tracks? I can post my code if need

nocturne elbow
gentle osprey
#

Triple "for loop" scares me actually

nocturne elbow
#

So you want to get the tracks the player is on?

gentle osprey
#

Yes in this way I can get value of required blocks by config

nocturne elbow
#

Yeah, that is going to require a number of loops. There isn't really a "simple" way, the simplest it can get is the way you would think of anyway:

  • Get the player parent groups
  • Get the loaded tracks
  • Check for each track if their groups contains at least one of the player parent groups (there's your for loops right here, for each track for each group)

You could simplify that by a factor of a lot by using the Java Stream API (see https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/package-summary.html and the examples using streams on this page too (you can just Ctrl F "stream" lol) https://luckperms.net/wiki/Developer-API-Usage) but if you're not too knowledgeable, it's not the easiest of topics to get into lol

gentle osprey
#

I also type with stream lib actually but thx for informations

#

Stream works as like for loops this is why I didn't want use it

#

But thx so much ^^

nocturne elbow
#

They kinda do from an outer perspective, yeah, but you can do things like #map, #filter, #peek, and many, many more things!
Streams are amazing but you pay for performance though fingerguns although it isn't really an issue unless it's something super heavy you call every tick lmao

gentle osprey
#

Aight tysm bud ^^

nocturne elbow
#

Hi, i'm new in this API and i don't know how can i get the player prefix. I tried java api.getUserManager().getUser(e.getPlayer().getUniqueId()).getCachedData().getMetaData().getPrefix(); but i don't know what does ,,contexts'' in getMetaData() mean. Can somebody help me?

vagrant spruce
nocturne elbow
#

Don't /reload

vagrant spruce
#

even when I donโ€™t give / reload, it gives this same error

nocturne elbow
#

Is this your own plugin you're making?

vagrant spruce
#

yes

nocturne elbow
#

!contexts fyi

frank driftBOT
nocturne elbow
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!

vagrant spruce
#

or is it my plugin code?

nocturne elbow
#

I asked for the log so that's actually perfect

#

Did you add LP to your plugin's depend list?

#

Also, get the LuckPerms instance inside your onEnable, that's when it becomes available

vagrant spruce
#

continues the same error

nocturne elbow
#

!paste your plugin.yml 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!

vagrant spruce
nocturne elbow
#

is it the exact same error?

#

also I'm assuming you didn't /reload and you fully restarted instead ๐Ÿ‘€

#

add a space between the - and LuckPerms

ancient sable
#

Hi

#

!api

frank driftBOT
ancient sable
#

!api downlaod

frank driftBOT
ancient sable
#

!getPrefix()

frank driftBOT
#

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

ancient sable
#

How about getting the player prefix?

#

Because in the api usage appear CachedMetaData metaData = user.getCachedData().getMetaData(); and it said that that "user" was not found so its confuse

#

So its only confuse the webpage about api

#

Please i cant found any page that talk about how getting luckperms prefix rank

sudden pelican
#

!cookbook

frank driftBOT
ancient sable
#

Oh

#

Thanks

odd jackal
#

!api

frank driftBOT
long shale
#

How can I set the prefixes with luckpermsapi? I can't find anything on the wiki page

turbid solar
#

!cookbook

frank driftBOT
long shale
#

I don't mean the group directly via command

turbid solar
#

Thered code examples there

long shale
#

I just want to do the group with group group ... and put the prefixes there

turbid solar
#

What

long shale
#

Where can I get the luckpermsapi?

#

!download

frank driftBOT
long shale
#

!api

frank driftBOT
long shale
#

!api download

frank driftBOT
turbid solar
#

First link

odd jackal
#

!api

frank driftBOT
nocturne elbow
#

!translte

frank driftBOT
#

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

nocturne elbow
#

!help

frank driftBOT
#
Available commands:
โ€Ž

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

โ€Ž

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

nocturne elbow
#

!translations

frank driftBOT
turbid solar
#

!api @odd jackal

frank driftBOT
turbid solar
nocturne slate
#

Hey there,

For a proxy plugin, we're relying on the LuckPerms API to retrieve usernames from offline players. But we've found out that some, not all, of the usernames are in lowercase. Is there any way to fix this?

turbid solar
#

Every name should be lowercase from LP

nocturne slate
turbid solar
#

Editor iirc gets it from online players, and not the db (which saves lowercase)

nocturne slate
#

all players I took An image of were online though

uncut timber
#

I'm getting a NullPointerException on the thrid line where "player" is an OfflinePlayer

        User user = api.getUserManager().getUser(player.getUniqueId());
        Collection<Node> nodes = user.data().toCollection();```
Is there some sort of incompatibility when using OfflinePlayers or am I just missing something?
nocturne elbow
#

Yes, getUser doesn't work on offline players because the there is no data loaded

#

you have to use loadUser instead

#

!api

frank driftBOT
nocturne elbow
#

hey

#

so Im having problems with the prefix

#

;-;

#

Ive been on this for a while now

#

Is this to do with the API?

uncut timber
#

Or do I have to do an isOnline check?

nocturne elbow
#

getUser will work on online players, yes

uncut timber
#

Okay. Thank you so much!

muted tangle
#

How would i change a groups alias/name using lp api?
(I already have an instance of the group)

#

Specifically i have an instance of the default group and i want to change it's alias

#

Also is this the best way of getting the default group: (It is async)
Group group = groupManager.createAndLoadGroup("default").join();

#

I couldn't find a getDefaultGroup or similar

nocturne elbow
#

you can probably just getGroup, default is always present since it can't be renamed nor deleted

nocturne elbow
muted tangle
#

Ah i thought the nodes was just for permissions, thanks.

nocturne elbow
#

Permissions are nodes, but not all nodes are permission nodes

#

d;sub_interfaces luckperms Node

slate deltaBOT
#
Sub Interfaces:
net.luckperms.api.node.types.RegexPermissionNode
net.luckperms.api.node.types.InheritanceNode
net.luckperms.api.node.types.MetaNode
net.luckperms.api.node.types.PrefixNode
net.luckperms.api.node.ScopedNode
net.luckperms.api.node.types.SuffixNode
net.luckperms.api.node.types.DisplayNameNode
net.luckperms.api.node.types.WeightNode
net.luckperms.api.node.types.PermissionNode
net.luckperms.api.node.types.ChatMetaNode```
nocturne elbow
#

all those are different types of nodes, there is PermissionNode just like there are others

craggy ember
#

ffs I've contributed to DocDex and I know less about it than you do lol

nocturne elbow
craggy ember
#

and the Fefo one-line commit streak continues

#

mine was 36 additions and 15 deletions

pliant dock
#

How do I get a players permission group?

#

Or check if they have a certain group?

rustic laurel
#

!api

frank driftBOT