#luckperms-api

1 messages ยท Page 41 of 1

frank driftBOT
#
Running a network and getting UUID mismatches?

Please double check that:
1. BungeeCord config.yml has ip_forward and online_mode set to true
2. All backend servers' spigot.yml has bungeecord set to true
3. All backend servers' server.properties have online-mode set to false

turbid solar
#

Also secure your server

tired pond
#

^

hybrid panther
#

hello

nocturne elbow
turbid solar
#

If they 'hacked' into your server it's not secure lol

obtuse jolt
misty hinge
#

do you run bungeecord?
if so try BungeeGuard

zinc shuttle
#

Yeah I had that happen and bungeeguard fixed it

umbral yacht
#

My event isn't firing when I add nodes through the editor.

LuckPermsProvider.get().getEventBus().subscribe(NodeAddEvent.class, e -> {
    System.out.println(e.getNode().getKey() + " added to " + e.getTarget());
});

The event is fired whenever I edit from within the same plugin (like in PlayerJoinEvent)

In config, I've tried using messaging service sql and redis, both with the same behaviour (no errors too)

jaunty pecan
#

where are you running the applyedits command?

#

is it on the same server as where you have your listener registered?

#

The Node add/remove/clear events are not fired across the network - only on the server where the change was executed

umbral yacht
hybrid panther
#

logs are over the messenger service i think

jaunty pecan
#

Yeah, so LogBroadcastEvent is probably what you want

#

the action logs are the only thing that gets dispatched across the network

umbral yacht
#

So I need to manually parse the description string?

#

Actually, I have an idea. I can make all my servers/proxies hook into NodeAddEvent, and relay important stuff to rabbitmq

Edit: Late but ^^^ that worked perfectly.

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
copper light
#

how would i set a prefix to a group

#

i have a Group object

copper light
#

thanks

copper light
#

and what about adding a user to a group?
u.data().add(InheritanceNode.builder("group." + formatname).build());

#

formatname is the groupname

turbid solar
#

for inheritancenode iirc you don't need the group.

copper light
#

ah i think i got it

#

my getuser returns null

turbid solar
#

is it an offline user?

copper light
#

it isnt

turbid solar
#

Can you send your code?

copper light
#

i'll look at it first

#

its prob a stupid mistake

copper light
#

got it to work!

#

thanks for your help

turbid solar
#

Does User#getNodes also return the nodes of the group(s) said user is in?

#

fairly sure it doesn't just want to be sure

nocturne elbow
#

non

#

Holder's own nodes

#

Wait

#

It includes the nodes representing parent groups but it doesn't include inherited nodes

#

Worded a bit strange but that should answer it lol

turbid solar
#

code:

                System.out.println("building le meta node");
                MetaNode mn = MetaNode.builder("whitelisted", "true").build();
                System.out.println("adding le node to da user");
                user.getNodes().add(mn);
                System.out.println("saving lE user");
                lp.getUserManager().saveUser(user);
                System.out.println("saved eL user");
main dagger
#

try using getUserManager().modifyUser()

#

it loads the user, calls the provided function with the loaded user, and then saves it

turbid solar
#

still not working

#
LuckPerms lp = Utilities.getInstance().getLuckPerms();
                String playerName = args[1];
                UUID uuid = lp.getUserManager().lookupUniqueId(playerName).join();
                System.out.println(uuid.toString());
                lp.getUserManager().modifyUser(uuid, (User user) -> {
                    MetaNode mn = MetaNode.builder("whitelisted", "true").build();
                    user.getNodes().add(mn);
                });
main dagger
#

try java LuckPerms lp = Utilities.getInstance().getLuckPerms(); String playerName = args[1]; UUID uuid = lp.getUserManager().lookupUniqueId(playerName).join(); System.out.println(uuid.toString()); lp.getUserManager().modifyUser(uuid, (User user) -> { MetaNode mn = MetaNode.builder("whitelisted", "true").build(); user.data().add(mn); });

turbid solar
#

am I blind or is that the exact same?

main dagger
#

user.data() instead of user.getNodes()

turbid solar
#

that might be it

#

no clue why I used getNodes

#

yup it was lol

main dagger
#

shorter code moment java user.data().add(MetaNode.builder("whitelisted", "true").build()); ๐Ÿ™ƒ

#

actually idk if that works in java

#

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

nocturne elbow
#

what?

turbid solar
#

I think I used getNodes() because I wanted to check if thjey already had it but I later decided not to do that and forgot to change it

patent drum
#

Hey there im currently trying to use the API in BungeeCord but im always getting an IllegalStateException: The LuckPerms API is not loaded. Im using the newest version and call ````LuckPermsProvider.get()``` in the onEnable method. What am I doing wrong ?

turbid solar
#

softdepend on luckperms

#

Or hard depend

patent drum
#

I have an hard depend

turbid solar
#

!paste your code & plugin.yml

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!

turbid solar
#

& the error

patent drum
#

My code is written in Kotlin is this ok for you ?

sudden pelican
#

are you shading the luckperms api into your plugin?

patent drum
sudden pelican
#

no

patent drum
#

Well

nocturne elbow
#

We don't discriminate ๐Ÿ™‚

turbid solar
#

kotlin still sucks tho

nocturne elbow
#

Tf

#

No

#

It has cool stuff

crystal bridge
nocturne elbow
#

Extension functions, operator overloading

patent drum
nocturne elbow
#

It's weird from a Java perspective but eh

#

Aah yeah I see the issue

#

In bungee, it isn't depend, it's depends

#

Because

#

Md5 cct

#

In the plugin.yml

patent drum
#

Ive tried it still the same issue

nocturne elbow
#

Anyway, you have to call LuckPermsProvider.get() inside onEnable

#

Is that mentioned nowhere tho?

#

!api for me

frank driftBOT
patent drum
#

Sure the onEnable calls the Object wich call the api

crystal bridge
#

@nocturne elbow we tried that one even though 10 seconds after server startup

frank driftBOT
#

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

crystal bridge
#

oops sorry

nocturne elbow
#

So you're constructing MessageHandler inside onEnable?

crystal bridge
#

yes. We already tried this. Later, to see if it is really not loaded, we made a scheduler which ran the thing 10 seconds after startup :D

#

But still nothing happened

nocturne elbow
#

Well first make it depends, not depend, secondly how are you building your plugin? I'm assuming Gradle (since Kotlin)

patent drum
crystal bridge
#

yes

nocturne elbow
#

Mm send your build.gradle plss

patent drum
#

Ive changed it to: depends: [LuckPerms]

nocturne elbow
#

> are you shading the luckperms api into your plugin?
> No
> implementation("net.luckperms","api","5.2")

#

Make it compileOnly

#

You were shading the API lol

patent drum
#

Oh sorry i thought I wouldnt shade it. Thank you for your patience !

nocturne elbow
patent drum
#

Thanks for the quick support !

cedar thorn
#

Would it be possible to let LuckPerms on Fabric know of a permission if it was used outside of a command, so it can show up under 'auto-complete' when you go to set permissions? I have a mod that can lock block entities via shift-rightclick, which can be checked well past init; there's no check at initialization-time that would let any permissions system know of its existence ahead of time.

nocturne elbow
#

!api

frank driftBOT
nocturne elbow
#

!cookbook for some api usage examples

frank driftBOT
nocturne elbow
#

Nah it's a very clean API once you get to work with it

#

And I know something I won't tell but this will get easier ;)

hybrid panther
#

Hello

#

Wrong channel

crystal sonnet
cedar thorn
#

hm, how would I check them at init time?

#

since there's nothing to really 'check' for during that time

#

Would null be sufficient actually

#

could also pass Server itself ๐Ÿค”

royal condor
#

@cedar thorn you could load a user (for example the UUID 00000...00000) and then perform permission checks through the API

hybrid panther
#

Brain peepoClap

atomic canyon
#

Can i ask support here?

turbid solar
#

For api yes

#

Else general 1 or 2

crystal sonnet
buoyant moat
#

How can I get a player object from the NodeMutateEvent?

cedar thorn
nocturne elbow
#

bruh mAcKeNzIEeeeEe

uncut panther
#

SOoo I am trying to set the parent group of a user to a group.
I am now doing the following:
BandiCore is my Main class

fun setGroup(player:Player, group:String){
    var user = getUserByUUID(player)!!
    user.primaryGroup = group
    BandiCore.luckpermsAPI!!.userManager.saveUser(user)
}
nocturne elbow
#

!cookbook it's in Java but it has an example for a setgroup command

frank driftBOT
nocturne elbow
#

Primary group is not the parent group

#

The primary group is calculated based on config and current state of inheritances

uncut panther
#

ahhh

#

makes sence

#

thnx for the cookbook doh ๐Ÿ™‚

nocturne elbow
#

Is neat

uncut panther
#

hmm for some reason the modifyUser() function does not exist in getUserManager()

nocturne elbow
#

What API version are you targeting?

uncut panther
#

5.0

nocturne elbow
#

5.2 is latest

uncut panther
#

ah

#

gret

nocturne elbow
#

(although that isn't the signature either :p it's modifyUser(UUID, Consumer<User>)

uncut panther
#

๐Ÿ˜›

nocturne elbow
#

why on Earth are you targeting java 6 lmao

uncut panther
#

I dont even have touched it in this project

#

only java 8

#

could it be handy to show my POM here?

#

okay putting it ti 1.8 did not rlly fix the issue

#

fixed it

nocturne elbow
#

Hm?

#

Oh yeah the version goes in the pom.xml/build.gradle

uncut panther
#

So I am now setting my user to a group.
But is is kinda weird. The group is changing etc. bcs prefixes are transfered. But like permissions arent?
To regain my perms, i'll have to manually set my group with /lp

fun setGroup(player:Player, groupName: String){
    val group: Group = BandiCore!!.luckpermsAPI!!.getGroupManager().getGroup(groupName)!!
    if(group == null){
        return
    }
    BandiCore.luckpermsAPI!!.getUserManager().modifyUser(player.uniqueId) { user: User ->
        user.data().clear(NodeType.INHERITANCE::matches)
        val node: Node = InheritanceNode.builder(group).build()
        user.data().add(node)
    }
    BandiCore.luckpermsAPI!!.getUserManager().saveUser(BandiCore.luckpermsAPI!!.userManager.getUser(player.uniqueId)!!);
    BandiScoreboard.updateScoreBoard()
}
crystal sonnet
#

Not sure what language that is, so can't help all that much

turbid solar
#

Not api related

obtuse jolt
nocturne elbow
#

Also modifyUser returns a CompletableFuture, you should also call updateScoreboard in CompletableFuture#whenComplete to ensure it runs after the data was applied and saved

uncut panther
#

TThanks. But the thing I am struggeling with is that permissions wont transfer correctly or something

#

with or without the saveuser()

nocturne elbow
#

And before manually setting your parent group what does lp user <user> info show? (parent groups and primary group)

nocturne elbow
#

how can i make lucky perms to copy all rules and make them go into a higher rank?

turbid solar
#

parent add

#

!inheritance

frank driftBOT
odd vapor
#

how get weight user with api?

hybrid panther
#

What

nocturne elbow
#

okay but the prefix is always odd

#

its not the prefix it should have

turbid solar
#

setup weights

nocturne elbow
#

K

odd vapor
turbid solar
#

get their primary group then get the weight?

odd vapor
#

get the rank with the highest weight and check this weight

#

@turbid solar you know how make this?

frank driftBOT
#

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

odd vapor
#

oh you have tag helpfull ๐Ÿ˜ฎ

nocturne elbow
#

User#getNodes(NodeType)

#

Get nodes for type INHERITANCE and check their weights

main dagger
#

Is there any way to check if a player explicity has a permission (can be inherited from groups), instead of just returning true if they are op?

nocturne elbow
#

If you're on Bukkit easiest way (taking contexts and LP settings into account) would be with Permissible#isPermissionSet(String)

#

If not, you would need to PermissionHolder -> getCachedData -> getPermissionData -> getPermissionMap

main dagger
#

would i need to do isPermissionSet and hasPermission (to check if its not set to false), or is setting a perm to false just an lp thing that is automatically handled?

nocturne elbow
#

isPermissionSet will return true if it's explicitly (inherited and) set to either true or false

#

hasPermission will return the value it's set to, if it is not set it will default to whatever the plugin author defines it as (unless you turn off bukkit defaults in LP config)

nocturne elbow
#

How to make a color changing prefix?

#

@nocturne elbow don't post in every channel

nocturne elbow
#

Now in the right channel;

Hey. We are currently in the process of moving a lot of proxy related commands to a standalone system (like /party /friend etc) since that's just way easier to update and it doesn't require proxy reboots. I managed to make Luckperms work in to that environment and it uses the proxy context, but we'd also like to check other contexts depending where the user is located or what command they're using. I can not seem to find anything related to this in the docs, but is it possible with LuckPerms to request a context that isn't defined in the config, as in am I able to get a Tristate result with a specific context given?

#

Tristate result = getPermissionUser().getCachedData().getPermissionData(queryOptions).checkPermission(permission, PermissionCheckEvent.Origin.PLATFORM_PERMISSION_CHECK).result();

Currently using this to check permissions, and that works perfectly fine for the context given in config, but is it possible to give your own context to it like for example 'survival' which isn't defined in config.

jaunty pecan
#

Yes, it is possible

#

firstly, it seems like you are using the internal LP classes there instead of the API ones - I recommend you don't do that, especially since what you are doing is supported by the API in a very similar way

nocturne elbow
#

Yeh, I think I found it though.

#

You can just create a ContextSet right and search on that?

jaunty pecan
#

you have two options, either, you can define and register your own ContextCalculator, which will impact all permission checks made

#

or, you can take the QueryOptions object you have, and modify the context in it

sterile rampart
#

I have a problem with luckperms for Spigot, i can't set any prefix or suffix, but i can set the permission or groups, someone can help me?

wild whale
nocturne elbow
echo marten
#

hiya! I'm new to the API, and I'm trying to utilize it in skript with skript-reflect. I'm trying to get an offline player's prefix (player.getCachedData().getMetaData().getPrefix()), but I don't know what to import at the top to do so.

turbid solar
#

what?

#

you need to load the user & skript?!

echo marten
#

I just want to use the luckperms api to get the user's chat prefix when they are offline

#

I'm new to java & skript-reflect (skript-reflect allows you to use java in skript)

turbid solar
#

!cookbook for examples

frank driftBOT
turbid solar
#

no clue how that would work in skript

echo marten
#

ty

#

me neither tbh lol

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
#

!commands

frank driftBOT
hybrid panther
#

i'm very confused on where contexts get their "value" from when being calculated.
been analyzing ExtraContexts + luckperms context managers and calculators for a while, and I feel like i'm missing something silly. it seems like contexts just submit their value (like target.isWhitelisted()), and then the value just goes into the void

here's my situation:
I am trying to add a context for minimum-playtime=<time in ticks>, which (obviously) requires the Player to have a Statistic.PLAY_ONE_TICK >= <time in ticks>. I have cloned ExtraContexts and registered it and everything:

    @Override
    public void calculate(Player target, ContextConsumer consumer) {
        consumer.accept(KEY, String.valueOf(target.getStatistic(Statistic.PLAY_ONE_TICK))); // Where does this get compared? How can I pass the provided <time in ticks> to be compared?
    }

So my questions are; where is "player's data" compared to the context "value" to return true or false for each context, and how can i modify this behaviour to simply check "is the players playtime >= <time in ticks>" of this minimum-playtime context?

All I need is a permalink to a line # for even the built in gamemode context. Where is their gamemode compared to the value of the gamemode=<gamemode> context?

I hope this makes sense, maybe i am overthinking it. not sure ๐Ÿ˜›

nocturne elbow
#

Contexts are more of a "constant state" of sorts, the returned value is compared to a node's expected contexts when it is being checked

#

Contexts are states as in "possibilities", you can't really make something work if a value is greater or smaller than X, you can see that in all currently existing contexts you basically have a list of values (discordsrv:booster true false, dimension overworld nether the_end, worldguard:region <applicable regions>, etc)

#

@hybrid panther hi

#

Read

hybrid panther
#

reading

nocturne elbow
#

Good

#

Keep reading

#

๐Ÿ”ซ

#

r e a d

hybrid panther
#

thanks for the info, that makes more sense. still confused where that comparison happens, but good to know my idea was not very practical. thanks fefo cutePepeWave

nocturne elbow
#

LP asks your calculator to calculate the current value for your context key and compares what you gave the consumer to the value for that key on the node

#

See how you give it a string for value

#

It basically just String#equals it

#

To check if it's a yay or nay

hybrid panther
#

okay

#

thanks fefo

jaunty pecan
#

as for "where that happens", it's here

#

so what fefo said is absolutely right - basically it only supports equals comparisons, not >= etc

#

it would be cool to try to support that, but it's not super easy to change the system once it's already been written & depended on in the API etc!

main dagger
jaunty pecan
#

Yes, that would be possible

#

I said it wasn't super easy, not that it was impossible :p

jaunty pecan
#

I had a go at implementing it just to see how easy - the biggest issue I've realised is that having contexts that change frequently (like time based ones) makes the current caching system completely ineffective

#

so, not gonna work without some big restructuring I'm afraid :c

hybrid panther
#

Thank you

tribal wave
#

i think there's an example of how to get a player's prefix on the wiki

#

!api

frank driftBOT
tribal wave
#

you cannot

#

get them by uuid

#

yeah

#

that should work

#

icky

rustic laurel
jaunty pecan
#

the cache holds user + context --> resolved permissions for user

#

if the context is constantly changing, then it's gonna have to resolve user permissions on each call

#

in other words, the cache is useless

rustic laurel
#

Hahaha

jaunty pecan
#

so, I think the only way to implement further time based restrictions (like the current expiry functionality) is to do something outside of the context system

rustic laurel
#

Or completely overhaul contexts :D

jaunty pecan
#

or we could do away with the cache - but that seems like a step in the wrong direction

rustic laurel
#

Ah yeah cache is what I meant

jaunty pecan
#

interestingly, zml is trying that approach to expiries in pex2

#

but yea, I think it'll be a fun time making that perform decently

craggy ember
#

I love how actually useful this API is compared with like 99% of these other "API"s you find in plugins these days

#

good to know there is developers who actually give a fuck about their fellow developers

#

well done lucko

jaunty pecan
#

haha

#

erm, np!

turbid solar
#

get the group object then getWeight()? or get the nodes & filter for weight (?)

hybrid panther
#

jordan peepoClap

sudden pelican
#

aber ๐Ÿ˜ƒ

hybrid panther
#

what are you finding complex?

#

its not meant for you to just copy and paste

turbid solar
#

again don't just copy everything

hybrid panther
#

no?

turbid solar
#

remove the 1st thing

#

get a instance of your main & the api

#

and rename your method to onUserPromote

#

yes

sudden pelican
#

there's also a UserDemoteEvent btw

#

try UserTrackEvent maybe

hybrid panther
#

why cant there just be an event to be fired for both
why should there be ๐Ÿ˜›

#

less events != better

turbid solar
#

ssssssstaatic

#

fyi your code will error if a group doesn't have a weight

#

did you register it?

#

how?

jaunty pecan
#

are you actually using the promote/demote commands

#

UserTrackEvent will not be fired for those changes

#

you more likely want NodeMutateEvent

#

Yes, that one ^

#

check if the e.getTarget() is a User

#

and check if the e.getNode() is an InheritanceNode

#

correct

hybrid panther
#

then change your code to use it ?

turbid solar
#

getDataBefore & getDataAfter

#

should read the jd

nocturne elbow
#

Allows for flexibility

#

A lot

hybrid panther
#

gm fefo cutemeowwaveawa

nocturne elbow
#

It isn't complicated once you get to know how to use the API

nocturne elbow
turbid solar
#

others do

nocturne elbow
#

Well, this is what you have :d

hybrid panther
#

ok ill stop talking in wrong channel now o/

nocturne elbow
#

Again, it's easy to use once you get to work with it a bit more

#

Have you heard of instanceof?

#

Have you heard of casting?

turbid solar
#

by trying

nocturne elbow
#

instanceof

#
if (a instanceof B) {
  B b = (B) a;
  b... // use B methods in that object
}
#

check if the e.getTarget() is a User
and check if the e.getNode() is an InheritanceNode

#

You can get the group name from an InheritanceNode

#

That's what they do actually lol

#

All yours

wild whale
hybrid panther
#

๐Ÿคจ

tribal wave
#

that code smells a little fishy

#

you should stop looping through the e.getDataBefore() as well as e.getDataAfter() as soon as you find what you want

#

instead of looping through the entire list(s) each time

#

well, i'd hope so - i've never seen you so idk

#

๐Ÿ˜‰

narrow olive
#

Good evening,

Could someone help me?
How can I rank a player from the api?
(I may be blind and tired so sorry if the question is silly.)

#

set

turbid solar
#

!cookbook has examples

frank driftBOT
turbid solar
#

tried debugging?

#

console errors?

#

how do you know it doesn't get fired?

#

paste your full code

#

and do you get any startup errors from your plugin?

#

and don't reload that's bad

#

plugins might

#

try restarting

#

does your plugin load?

tribal wave
#

are you... tagging it as an event handler?

#

do you need to do that for luckperms events, even? idk

turbid solar
#

no, should still work tho

#

also that code won't work

nocturne elbow
#

LuckPerms event listeners are not registered through Bukkit's PluginManager because they aren't Bukkit events

turbid solar
#

afaik a Node can't be an instanceof a Group

nocturne elbow
#

^

narrow olive
jaunty pecan
#

i've just added some example listeners to the cookbook using NodeAddEvent and NodeRemoveEvent

turbid solar
#

mind turning pings of for replies

jaunty pecan
#

what are you trying to achieve?

#

ok, well here is an example of a listener that listens for a player being removed from a group

#

and you can just add an identical method using NodeAddEvent to catch them being added

rustic laurel
#

well yes

#

that's the idea - you mix and match to catch what you need

#

it's not realistic to make like platypus events where there are pieces from everywhere just for one or two use cases

#

there is, but it's split up

#

and it's not dumb it's how you design an API

nocturne elbow
#

"let me make an event from when you demote a user from the lowest group in a track from an applyedits in another server in the network that also removed the group and they are now default, BroadcastedEditorUserDemoteFromLowestGroupRemovedEvemt"

#

There is, it's called NodeMutateEvent

#

You just have to check the target type and the data that changrd

#

Changed*

#

It's literally that

#

And again, that won't work because a Node will never be a Group

#

A Node can be an InheritanceNode that represents a group

turbid solar
#

use a better ide then

hybrid panther
#

^

narrow olive
hybrid panther
#

then set it up right

nocturne elbow
#

No, that's why you check the JavaDoc and.. you were literally told to check for InheritanceNode... . _.

tribal wave
#

you can hover over the 'invalid' part and it should tell you exactly what's wrong

turbid solar
#

probably selected the wrong version or something then

#

less lines, more sentences

nocturne elbow
rustic laurel
#

you're using userdemoteevent

#

from what you've said I do not believe that is the event you are after

#

these two are

#

or what fefo said

#

demote is only when a player is demoted along a track with the /lp user <name> demote command

nocturne elbow
#

Omfg

#

NodeMutateEvent

rustic laurel
#

because people don't design APIs for your use cases

#

you need to work with bricks to build houses

#

people don't ship houses

#

because everyone wants something different

#

Luck's providing you with e bare bones you need to do literally anything you want with luckperms, use them

#

using two events is not the end of the world, and if you see it that way then im sorry but you're either not experienced enough to work with an advanced api or you're just too stubborn to

nocturne elbow
#

I cannot help you if you can't help yourself

#

UserDemoteEvent is called exclusively when you run the demote command Larry mentioned above

#

You were told countless times the ones you're looking for the editor are NodeMutateEvent, NodeAddEvent or NodeRemoveEvent

#

And you refuse to accept that

#

"tried it once" making the wrong checks which we pointed out too

#

I'm sorry I just can't do this

jaunty pecan
#

dude I literally linked you to code you could copy and paste and have it just work

#

\o/

narrow olive
jaunty pecan
#

yes - NodeAddEvent to listen for adds, NodeRemoveEvent for removals

#

just subscribe to both

nocturne elbow
jaunty pecan
#

that will not work

#

because getDataAfter returns all of the nodes the user has after the event

#

not just the ones that were added/removed

rustic laurel
#

@nocturne elbow im not sure you realize this but luck wrote this api and is giving you personalized advice on doing exactly what you want to do - why not just take it?

narrow olive
nocturne elbow
#
  • that break will stop the loop and break out of the method lol
wild whale
#

break =/= continue

nocturne elbow
narrow olive
nocturne elbow
#

Yeah that looks good other than you should return in that null check but excluding that it should work

turbid solar
#

NodeType.INHERITANCE i think

wild whale
#

why are you cancelling every logpublishevent think11

nocturne elbow
#

He returns if it is

#

i.e. does nothing

sudden pelican
#

luck has != not equals

wild whale
#

use == and != for primitives and enums, .equals for objects

#

also what happens if someone adds a prefix node or a meta node

#

i.e. if you only want inheritancenodes, shouldn't you be checking ... .getType() == NodeType.INHERITANCE or whatever it is

narrow olive
# nocturne elbow For pushing the updates bit https://discord.com/channels/241667244927483904/4205...

Like this ?

LuckPerms luckpermapi = LuckPermsProvider.get();

User proxiedUser = luckpermapi.getPlayerAdapter(ProxiedPlayer.class).getUser((ProxiedPlayer) p);

luckpermapi.getUserManager().modifyUser(proxiedUser.getUniqueId(), (User user) -> {
                                //Remove all other inherited groups the uer had before
                                user.data().clear(NodeType.INHERITANCE::matches);

                                //Create a node to add to the player
                                Node node = InheritanceNode.builder(titan).build();

                                //Add the node to the user
                                user.data().add(node);

                            });```
jaunty pecan
#

I made a mistake, just corrected it

#

the others are right, it should be getNode().getType() == NodeType.INHERITANCE

#

looks good to me

#

btw, if you're not using LogPublishEvent and UserLoadEvent - you should probably remove those listeners from the top

wild whale
#

i.e. you shouldn't really have a listener that just cancels every single event

jaunty pecan
#

well I mean, it's valid

#

just I assume not intended :p

narrow olive
#

i'm dumb

#

๐Ÿ˜‚

nocturne elbow
hybrid panther
wild whale
#

if you don't mind me asking, what even is the use case for this right hand man?
b/c kicking on group changes feels like an XY problem

turbid solar
#

make sure the event actually gets registered

#

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

wild whale
#

are you actually using the class anywhere?

#

the one w/ the listener?

#

like if you never instantising the class, it'll never be registered

turbid solar
#

can you paste your full main class

#

thats nothing lol

wild whale
#

think11 I mean that'll work but no point registering the class w/ the bukkit event bus if it doesn't listen to any bukkit events

#

holy arrow code batman

#

obligitory package names should be all lowercase

#

yes

turbid solar
#

are you (soft)depending on luckperms?

#

you'll want to do that

wild whale
#

well that would have been good to mention lol

#

where's the nPE

#

erm invalid stynax

turbid solar
#

[Vault, LuckPerms]

wild whale
#

reloads?

turbid solar
#

again, don't reload

wild whale
#

never ever ever reload

nocturne elbow
#

(soft)depend is case sensitive

#

I learned it the hard way lol

#

Huh?

wild whale
#

do not /reload

turbid solar
#

then stop doing it

wild whale
#

reloading is almost certinaly breaking things

#

/restart, never touch that command again

nocturne elbow
#

depend/softdepend is just to tell Bukkit "hey, my plugin should load after that other one", there's nothing else to it

#

No

#

Same thing

wild whale
#

-_-

nocturne elbow
#

Full restart

wild whale
#

boo hoo

turbid solar
#

does it work now?

#

try just doing new OnUserPromote(this, Luckperms); somewhere in ur main

nocturne elbow
#

?

#

He didn't say "put an event listener in main"

turbid solar
#

what

hybrid panther
#

ok

nocturne elbow
#

And you are absolutely right

#

Each class should have its own, almost isolated, objective/responsibility

turbid solar
#

??????????????

nocturne elbow
#

wat

hybrid panther
#

Ok

turbid solar
#

before you register it log something to console & after

#

then in the method also log stuff

#

every line

wild whale
#

welcome to debugging

turbid solar
#

i.e
loghere player.op logagain

narrow olive
frank driftBOT
#

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

nocturne elbow
#

Dumbcord

wild whale
#

discord dumb

#

yeah exactly

nocturne elbow
#

Xactly

#

Nice one

wild whale
#

hush

hybrid panther
#

Ctly

#

Isn't it nodemutateevent from the editor?

wild whale
#

try using commands to promote, just in case

turbid solar
#

!usage

frank driftBOT
turbid solar
#

Console has tab lol

wild whale
#

read the error

#

bukkit hates async

#

no

jaunty pecan
#

wrap the kick in a call to the scheduler

#

like this

turbid solar
#

(all explained on the wiki iiirc)

#

getScheduler()

#

runTask

wild whale
#

it's probably calling mutate not add is my uneducated guess

#

well yeah

turbid solar
#

send a full screenshot of code

wild whale
#

you got what node was removed

nocturne elbow
#

that's what NodeAdd is for ๐ŸŒ

#

well it isn't what it's for

#

it's one of the many use cases

#

but you are removing one and adding another one, right?

wild whale
#

lowkey curious why you need to kick on promote/demote tho

#

lol fair enough

narrow olive
nocturne elbow
#

Uuh probably something like () -> api.getMessagingService().ifPresent(MessagingService::pushUpdate)

narrow olive
#

he don't like () ->

nocturne elbow
#

how are you doing it?

narrow olive
nocturne elbow
#

you're missing a (

#

so thenRun(() -> ...)

narrow olive
hybrid panther
#

yes

narrow olive
#

Ok i will try

nocturne elbow
#

uh wait

#

non

#

show the whole thing

#

I smell something

narrow olive
nocturne elbow
#

aah yes what I thought

#

again, everything runs async and modifyUser already saves the user in storage for you so the way you ensure that the messaging service notifies the other servers is by telling it to do so when the modifyUser is finished

#

...modifyUser(blah blah).thenRun(blah blah blah)

narrow olive
#

Like this ?

nocturne elbow
#

yeah but remove the one below lol

narrow olive
#

ups

#

I can delete this "Optional<MessagingService> messagingService = luckpermapi.getMessagingService();" ?

nocturne elbow
#

yeah the whole thing below

narrow olive
#

Now it should work

ripe ice
#

Hello guys, I want to catch when a user parent group is changed.
I've tried to listen the PromoteEvent (but didn't work of course..)
I didn't find any event who do that, someone already do this ?

nocturne elbow
#

yep

nocturne elbow
ripe ice
#

I'll try, thanks

nocturne elbow
#

check that the event target is a User and the node is an InheritanceNode

ripe ice
#

work ๐Ÿ™‚

nocturne elbow
narrow olive
#

Color of new rank but prefix of old rank

nocturne elbow
#

hm?

#

what does /lp user <user> info show?

#

share a screenshot please

narrow olive
wild whale
#

offline mode ๐Ÿ‘€

narrow olive
wild whale
nocturne elbow
#

this sounds like a weights issue

#

!weights

frank driftBOT
narrow olive
#

luckpermapi.getUserManager().getUser(p.getName()).setPrimaryGroup("titan"); ?

nocturne elbow
#

setPrimaryGroup
don't even bother with that tbh

#

it has no effect by default

narrow olive
#

it work

#

thank you very much

ripe ice
#

With NodeAddEvent, how I can retrieve the last user primary group ?
I tried with DataBefore but I got empty Set ๐Ÿ˜ฆ

nocturne elbow
#

hm? what are you trying to do exactly?

#

what do you need this for?

ripe ice
#

I do a 'link' to a discord server, then I need to retrieve the last group to remove it

#

and then add the new role (already done)

nocturne elbow
#

but.. if you are adding a parent group.. what do you need to listen the event for?

ripe ice
#

hmm

#

I want to catch when the primary group is changed.
Then I remove the old primary group in Discord and add the new.

nocturne elbow
#

oh right

ripe ice
#

๐Ÿ™‚

nocturne elbow
#

well.. with NodeAddEvent you get the new parent group(s)

#

and with NodeRemoveEvent you get the "old" ones

ripe ice
#

It doesn't work, when I use "lp user Brokeos parent set newgroup", the event isn't catch

nocturne elbow
#

noderemove?

ripe ice
#

yes

nocturne elbow
#

try with nodeclearevent

ripe ice
#

ok ๐Ÿ˜‰

#

ok so it work, and I have to use getDataBefore I guess ?

#

ok it's work ๐Ÿ™‚

#

thanks bro

sonic bough
#

How can i check if luckperms depends is installed? Do i check with "if (provider !=null) {" or?

nocturne elbow
#

well, if LP is a depend of your plugin, then yours won't even start lol

#

if it's a softdepend on the other hand, you can either check if the provider is null or use reflection to see if the LuckPerms class exists

sonic bough
#

Yeah softdepend sorry

nocturne elbow
#

well if you're on bukkit you can check if the plugin is enabled

#

with PluginManager#isPluginEnabled(String) or something...?

sonic bough
#

Yeah i already found it. PluginManager.getPlugin ๐Ÿ™‚

nocturne elbow
#

yeah don't do that

#

just check if isPluginEnabled and get the API from the provider

ripe ice
#

Hmm, I got the event.getDataBefore() (and do something very ugly lul like .iterator().next() to get the first node, which correspond to the group node).
But I can't retrieve the Group object, I've tried by using the GroupManager, but the value returned by the Node isn't corresponding to the group name

nocturne elbow
#

While LuckPerms is the API class, it's not the plugin type so you'll get a totally different thing

nocturne elbow
ripe ice
#

okok

#

Ok so it's work but my server doesn't like that issou

nocturne elbow
#

what?

ripe ice
#

My bad, infinite loop ๐Ÿ˜„

#

But now it work very fine ๐Ÿ˜„

sonic bough
#

For me to be able to check groups list i need to implement method for mysql aka check mysql or?

nocturne elbow
#

? not at all

#

GroupManager#getLoadedGroups or something like that

sonic bough
#

Ohhhhhhhhhhhhhh ok ok

nocturne elbow
#

will return all groups currently loaded which are all of them tbh

crystal sonnet
#

Can I create a ContextCalculator for the User or UUID class?

jaunty pecan
#

Yes, but you can't register it with LP directly :p

sonic bough
#

Can i post here question regarding other plugins code or is just for LuckPerms?

crystal sonnet
#

Actually no need. I have platform independent native user object handling, so it doesn't matter anyways

void holly
#

hello is it possible to connect your plugin to essentialsx

turbid solar
#

For chat?

void holly
#

yes

turbid solar
#

!chat

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

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

List of chat/tablist formatting plugins that work with LuckPerms
turbid solar
#

Make sure you have Vault & essx chat

void holly
#

i have

turbid solar
#

Does the prefix show in /lp user <user> info?

void holly
#

chat:

radius: 0

format: '{DISPLAYNAME} &7ยป&f {MESSAGE}'

group-formats:
default: '&4Wล‚aล›ciciel | &r{DISPLAYNAME} &7ยป&f {MESSAGE}'
wlasciciel: '&4Wล‚aล›ciciel | &r{DISPLAYNAME} &7ยป&f {MESSAGE}'

#

its my config in essentials

#

I don't know if it's correct

frail coral
runic pelican
#

how is possible to delete a node through the api?

#

node.toBuilder().expiry(0);

#

in this way?

turbid solar
#

no

#

!api

frank driftBOT
turbid solar
#

!cookbook has examples

frank driftBOT
runic pelican
#

user.data().clear(NodeType.PREFIX::matches);

#

What if I want to remove only prefix node with a specific priority?

runic pelican
#
Predicate<Node> is_color_chat = node -> node.getType() == NodeType.SUFFIX && ((SuffixNode) node).getPriority() == 80;  
user.data().clear(is_color_chat);
#

in this way?

craggy ember
#

does clear accept a Predicate?

#

I don't know so that's why I ask

runic pelican
#

yes

#

i've not tested it yet, but i think that the cast will cause problem

jaunty pecan
#

you can also do

#
Predicate<Node> is_color_chat = NodeType.SUFFIX.predicate(n -> n.getPriority() == 80); 
#

does the cast for you ;)

runic pelican
#

Ty

runic pelican
#
                LuckPermsManager.modifyUser(this.getServer().getPlayer(username)).getUniqueId(), user -> {
                    
                    Predicate<Node> is_custom_suffix = NodeType.SUFFIX.predicate(n -> n.getPriority() == 100); 
                    user.data().clear(is_custom_suffix);
                    
                    System.out.println("SUFFIX DELETED!");

                    SuffixNode newNode = SuffixNode.builder(suffix, 100).build();

                    //FROM NOW ON NOTHING IS BEING EXECUTED

                    System.out.println("SUFFIX CREATED! "+ suffix);

                    user.data().add(newNode);

                    LuckPermsManager.saveUser(user);
                });
#

Someone knows what could be the problem?
It seems that .build() keep stuck the function and nothing is executed from that point

hushed turtle
#

I'm trying to set new primary group using set parent group (there is no set parent group, only primary from what i can see) but it's not doing anything :/ am I doing it wrong?

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

user.setPrimaryGroup("knight");
api.getUserManager().saveUser(user);

please @ me if you respond

turbid solar
#

!cookbook have a look at this

frank driftBOT
hushed turtle
#

thanks
edit: got it working!! thanks :D

turbid solar
trim valley
#

srry

brisk escarp
#

Anyone have a basic setup I can look at using maven? Never used java and so im lost, only know python and lua. Just trying to get player rank when they do /link

frail coral
#

Maven is pretty easy

#

just download MC Dev

jaunty pecan
#

!cookbook

frank driftBOT
jaunty pecan
#

use that

frail coral
#

or that

#

i guess

brisk escarp
#

ooo i see neat thanks ๐Ÿ‘ . I'm way over my head on this, trying to make a sqldb storing uuid, rank and random stats for a mybb forum. eh ill struggle till it works

sonic bough
#

Is there a way i can make to disable world thru in-game command ? So players cannot go into this world ?

turbid solar
sonic bough
#

Oh i though this is dev api since i'm coding custom plugin ๐Ÿ‘€

rustic laurel
#

channel topics ๐Ÿ˜‰

sonic bough
#

Oh i didn't even noticed this ๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ

stark locust
#

Hi, can someone say me how I can check if a user gets a new parent, I can't find it in the docs...

crimson ferry
#

How should I get the LuckPerms Api then if not so?

turbid solar
#

LuckPermsProvider.get()

#

!api read this

frank driftBOT
crimson ferry
#

Thx

nocturne elbow
#

getPlayerAdapter isn't static

#

you need to call it from the LuckPerms object

crimson ferry
#

How can I execute something when a Player gets a new Group?

hybrid panther
#

Listen to nodemutateevent and check if node is a group

crimson ferry
#

Uh

#

What?

hybrid panther
#

Wat

turbid solar
#

NodeMutateEvent

#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
hybrid panther
#

Cas peepoClap GWcmeisterPeepoLove

crimson ferry
#

Okay?

#

So I create a new "Listner"?

turbid solar
#

with the event bus yes

hybrid panther
#

I reccommend reading the articles we are sending you

#

Not wasting your time and our time asking questions we have already answered peepoClapJamminMoment

crimson ferry
#

Okay.

nocturne elbow
#

You subscribe to that event

#

There is an example for that one exactly

#

Bruh discord is stupid slow

crimson ferry
#

Oh above

#

I don't understand how to do it..

turbid solar
#

Did you read the wiki?

#

What don't you understand?

crimson ferry
#

I don't understand how that can help me to execute something when a User gets a new Rank.

turbid solar
#

Use NodeAddEvent or NodeMutateEvent

hybrid panther
#

We told you, NodeMutateEvent

turbid solar
#

!cookbook has examples

frank driftBOT
turbid solar
#

check if the node is instanceof an InheritanceNode then do what you want wit that

crimson ferry
#

Ok.

nocturne elbow
#

In that repo there is an example literally for what you want, for that event for when changing parent groups

crimson ferry
#

That?

turbid solar
#

thats for when its removed

crimson ferry
#

When I change it to Added?

hybrid panther
#

see how it says node REMOVE event

#

Change to ADD

crimson ferry
#

I do

#

I already done

hybrid panther
#

Ok! peepoClap

crimson ferry
#

Help?

turbid solar
#

whats on line 25

hybrid panther
#

Inb4 constructor with no params!

crimson ferry
#

That

hybrid panther
#

ok give me $50

crimson ferry
#

?

#

How do I fix?

turbid solar
#

public LPRankUpdateListner(LuckPerms luckPerms) {

#

then change wherever you register it

crimson ferry
#

Ok

#

That should log the Name of the Players Primary Group or?

#

If the primary group was changed it logs the New Name

turbid solar
#

well no cus you're not registering it

crimson ferry
#

I register it in main

turbid solar
#

uh

#

still won't work

crimson ferry
#

What is wrong?

turbid solar
#

How is java supposed to know what you're doing with the class? The only things it'll know of is luckPerms and plugin

nocturne elbow
hybrid panther
crimson ferry
#

But its not logging anything

turbid solar
#

sigh

hybrid panther
#

I have been holding this back but I strongly suggest you get a decent grip of basic OO java before doing this

nocturne elbow
crimson ferry
#

...

nocturne elbow
#

LuckPerms uses it's own event system, completely separate from the event systems used by platforms (e.g. Bukkit or Sponge). This means that instead of registering your listener with the server, you must register it directly with LuckPerms.

crimson ferry
#

Yes

nocturne elbow
#

which you are not doing

#

you are "registering the listener" on the platform's event system

#

and that will not work

crimson ferry
#

Oh

turbid solar
#

also variables should normally be lowercase

#

luckPerms

crimson ferry
#

So?

#

Is that registered correctly?

turbid solar
#

yes altho why both LuckPerms & this.LuckPerms?

crimson ferry
#

So?

nocturne elbow
# crimson ferry

I don't know, you tell me what parameters the constructor of that class takes

crimson ferry
#

But it works

#

Thanks ๐Ÿ˜„

nocturne elbow
#

[8:55 PM] Basti ๐Ÿ”ฎ๐Ÿ›ก: Idk
[8:55 PM] Basti ๐Ÿ”ฎ๐Ÿ›ก: But it works

uuh consider learning Java....

#

Useful resources:

Java API: https://docs.oracle.com/en/java/javase/11/docs/api/
Basic Java Tutorials: https://docs.oracle.com/javase/tutorial/
Online Java Course: https://www.codecademy.com/learn/learn-java/
Object-Oriented programming in Java: https://java-programming.mooc.fi/
Interactive tutorials through projects: https://hi.hyperskill.org/
____________________________________________

Start with this -
https://docs.oracle.com/javase/tutorial/java/concepts/index.html
Breeze through this skipping stuff that doesn't seem relevant like bitwise operators-
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html
and then hit this
https://docs.oracle.com/javase/tutorial/java/javaOO/index.html

They're the first three from this larger thing - https://docs.oracle.com/javase/tutorial/java/index.html
Which you should definitely go through overall. But those three should be enough for slightly better understanding of wtf is happening here without feeling like a huge time sink
That one is a small part of this larger site - https://docs.oracle.com/javase/tutorial/index.html
wherein "Essential Java Classes" and "Collections" also have good useful stuff
____________________________________________

For plugins: https://bukkit.gamepedia.com/Plugin_Tutorial

A few challenges you can try and solve: https://github.com/PiggyPiglet/Challenges

Things you want to take a look at when making plugins: https://bukkit.gamepedia.com/Plugin_Tutorial#onEnable.28.29_and_onDisable.28.29
https://bukkit.gamepedia.com/Plugin_Tutorial#Commands
https://bukkit.gamepedia.com/Event_API_Reference

crimson ferry
#

Yes

#

I'm bad in java

#

but I'm learning.

nocturne elbow
#

thus the resources ;)

narrow moat
#

Not sure if this is the right place for this question, but i'm using luck's fabric-permission-api with LuckPerms and I get an NPE everytime I respawn. The permission check works but I get this error that fucks the server (chunkticketmanager stops working and i die everytime handleChunkLeave is called, and /stop shuts down the server but the process is still running until i ctrl + c it). Is this an error with my usage of the api or the permission api itself? https://paste.gg/p/anonymous/dfe0d983821c415fb2b1ca03b6b4c92f

jaunty pecan
#

that's a luckperms bug, not the permissions api

#

update from here, it's fixed already :)

#
narrow moat
#

:o thanks

real mist
#

Hi, does anyone know how I can get the prefix and suffix of a player using the API?

craggy ember
#

right, here we go

#

first, get the LuckPerms instance (either with RegisteredServiceProvider or by using LuckPermsProvider.get())
then, get the user manager, with getUserManager()
then, get a User from that manager with getUser(UUID) (by UUID) or getUser(String) (by name)
then, get their prefix/suffix nodes, with getNodes(NodeType) (NodeType.PREFIX for prefixes and NodeType.SUFFIX for suffixes)
then, you can stream that and get the minimum value when sorted by priority (highest priority = primary prefix)

#
LuckPermsProvider.get().getUserManager().getUser(uuid).getNodes(NodeType.PREFIX).stream().min(Comparator.comparing(PrefixNode::getPriority))
```looks about right
#

then you can get the actual prefix from that node with getMetaValue()

real mist
#

It says that I can't pass parameters to "getNotes()".

jaunty pecan
#

That's also.. not the way to do it :p

#

there's an example here

stark locust
#

Hi, I am getting this error: org.bukkit.plugin.InvalidPluginException: java.lang.IllegalStateException: The LuckPerms API is not loaded.
On the LuckPerms Website it says that if I am using LuckPerms api = LuckPermsProvider.get(); it will throw an IllegalStateException if the API is not loaded.
but how can I load the API?

turbid solar
#
  1. soft depending on LuckPerms and 2. make sure you're not doing it statically
stark locust
#

I am trying to register the NodeChangeListener from the cookbook, and if I dont do it statically, instead of with the Bukkit ServicesManager I also get an error

turbid solar
#

Are you soft depending on LuckPerms?

#

Is LP on the server?

stark locust
#

LP is on the Server, yes

turbid solar
#

what about the (soft)depend?

#

You need to make sure LuckPerms loads before your plugin

stark locust
#

here

#

thats my main

stark locust
turbid solar
#

ah i see

#

move the LuckPermsProvider.get() into your onEnable()

stark locust
#

k, I'll try

#

now it works!

#

thank you ๐Ÿ˜„

cerulean gull
#
public boolean isAdmin(UUID uuid) {
    LuckPerms api = LuckPermsProvider.get();

    User user = api.getUserManager().loadUser(uuid).get();

    if (user.getPrimaryGroup().equals("admin"))
        return true;

    return false;
}

will this work?

turbid solar
#

yes

#

well

#

depends

cerulean gull
#

can this be used on both bungeecord and spigot?

turbid solar
#

You'd probably want to search thru their nodes and filter for InheritanceNode that is "admin"

#

yes

cerulean gull
#

yes

cerulean gull
turbid solar
#

yes

cerulean gull
#

and it is possible not with uuid, but with name?

turbid solar
#

No

#

Why?

#

Dont think so atleast

livid thunder
#

Hey, I wondered how can I handle the placeholder based time from luckperms without instance with,
I mean I can check if the player has cartein permission but once it's become 0 seconds left it's returns empty string according to your docs

#

I want to make it 00d, 00m, 00s instead of null string

#

Is it possible?

hybrid panther
#

maybe i dont understand your question, but couldnt something like this work? (bad pseudo code)

if (expiry.equals("")) {
  expiry = "00d, 00m, 00s"
}
doStuffWithExpiryStringNow();
open pendant
#

Does api provide ability to insert custom data source?

livid thunder
#

is it possible?

#

instead of writing a whole worldedit time plugin

turbid solar
#

fork placeholders repo and edit it?

livid thunder
#

Edit what?

turbid solar
#

edit what it outputs

#

actually upto placeholderapi iirc

livid thunder
#

Oh, It can't be done without fork it?

#

About the placeholder time

turbid solar
#

Config maybe idk

livid thunder
#

Well

nocturne elbow
open pendant
#

Luckperms?

#

I dont want to use sql or monogdb

nocturne elbow
#

What?

hybrid panther
#

that would be very pepega to add

nocturne elbow
#

You mean a custom storage method?

hybrid panther
#

i think they want to add a whole new storage method

#

Luckperms for Big Data when?

nocturne elbow
#

Yu can register a custom messaging service but the storage methods are the ones they are

turbid solar
#

don't think you can add custom storage without adding it into the plugin itself?

#

there are methods for it, just not in the api

open pendant
#

can't seem to find intreface or apstract class that i could extend and do my things

turbid solar
#

its not in the api

#

(afaik)

nocturne elbow
#

I still don't fully understand what you're trying to do lmao

nocturne elbow
#

How I can import the Prefix from LuckPerms into my Chat Plugin?

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
nocturne elbow
#

I'm just starting to developeMinecraft-Plugins and I don't really understand it yet. (LuckPerms-Api)

turbid solar
#

look at the cookbook

craggy ember
#

cookbook + Google + beginner's Java tutorial (if you're new to programming too) = good things

misty hinge
#

cookbook?

#

what the fock is a cookbook

hybrid panther
#

!cookbook

frank driftBOT
idle steeple
#

how do i get group of player

hybrid panther
idle steeple
#

ty

idle steeple
#

?how do i get a group's prefix/

#

?*

rustic laurel
#

!cookbook

frank driftBOT
rustic laurel
#

there is an example here

brisk escarp
#

is there an option other then getInheritedGroups to get the top weighted group of the user

#

i can just remove anything after the first group but this would be nice

stark locust
#

how can I set the parent of an user with the api? user.setPrimaryGroup(group); does not work for me

nocturne elbow
#

!cookbook

frank driftBOT
nocturne elbow
#

Has an example command for that

stark locust
#

tanks

cerulean gull
#

hello, how to get offline user with username?

turbid solar
#

what?

#

Do you mean load a User?

cerulean gull
#

yes, I have his nickname, and I want to load it

turbid solar
#

You'll need their UUID btw

snow willow
#

How can I check if an OfflinePlayer has a Permission

turbid solar
#

load the user

snow willow
#

does getUser(user).getNodes() contains the parent Nodes or only the Nodes that are specific set for the Player

turbid solar
#

iirc only their nodes

#

Javadocs should explain it

#

!jd

frank driftBOT
#

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

turbid solar
#

!javadocs

frank driftBOT
fallow imp
#

please improve the shity api.

turbid solar
#

what?

fallow imp
#

It's very bad to work with nodes and I don't know why it's nodes ?!!
just do easy methods to work with users and simple

turbid solar
#

What don't you understand

fallow imp
#

Try to a offline player's group

turbid solar
#

loadUser

#

getNodes & filter for inheritance

fallow imp
#

try to get a group's list members

fallow imp
turbid solar
#

yes

fallow imp
#

OMG

#

how to get the group users?

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook has examples

frank driftBOT
fallow imp
#

did you know

#

you are making the api easier now xD

#

I was very very hate your plugin's api

hybrid panther
#

monkaGiga pebkac

nocturne elbow
#

"pLeAsE iMpRoVe ThE sHiTy ApI" it took you like what? 3 minutes of reading?

#

Holy

tribal wave
#

i've been trying to use the cached permission checks as shown in the cookbook but they seem to give me different results than the regular spigot api results

#

and i can't tell if it's my ranks/setup that is weird or of it's the api itself that's behaving different than i'd expect it to

#
User luck_player = api.getUserManager().getUser(p);
return luck_player.getCachedData().getPermissionData().checkPermission(perm).asBoolean();

this is the code i'm running

#

and when I have nothing except the default rank it works perfectly fine, but once i assign myself my developer rank it returns true for a bunch of permissions i don't have defined in any of my groups

#

at the same time, using something like

return (player.isPermissionSet(perm) && player.hasPermission(perm));

returns false regardless of what rank I have (as expected)

nocturne elbow
#

you also have autoop

#

so I presume that "returns true for a bunch of permissions i don't have defined in any of my groups" is because of that

#

and, as the name suggests, isPermissionSet returns true if the exact permission is set explicitly somewhere down the inheritance tree

floral panther
#

Hey ๐Ÿ‘‹
I have listeners for the NodeMutateEvent , NodeAddEvent and the NodeRemoveEvent. However, they only fire if I change the players permissions using /lp user SalZx permission set demonic.phantom. If I use the editor the permissions do change but no event is triggered.
I'm not on any Bungee network (the channel history revealed that this is one cause of this problem).

tribal wave
tribal wave
nocturne elbow
#

what I'm pointing out is that teams.own.blue isn't explicitly set anywhere

tribal wave
#

right

nocturne elbow
#

so isPermissionSet will return false, but hasPermission and checkPermission will return true

#

but hasPermission isn't called because isPermissionSet evaluates to false

nocturne elbow
tribal wave
#

so basically autoop is what's messing me up here

hybrid panther
#

yeah i remember that too, fefo

nocturne elbow
tribal wave
#

gotcha, thank you fefo ๐Ÿ™‚

nocturne elbow
#

kinda messy but those would be the equivalents and you can see that (if I am server op) I don't have the permission but it still evaluates to true, which doesn't happen if I am not

hybrid panther
nocturne elbow
#

which class do I have to import if I want to use that getPlayerGroup() method?

#

Well, players can have several parent groups

#

Do you mean the primary group? (the one with highest weight by default)

#

yes

#

User#getPrimaryGroup lol

#

!api

frank driftBOT
nocturne elbow
#

ok, ty

wintry canyon
#

is there a way to syng groups in all of my servers i mean i have a owner rank in lobby and i want to be synged in all servers how i do that ?

nocturne elbow
#

with the dev api...?

#

I'll safely assume you are misusing the channels, @wintry canyon please refer to #support-1 or #support-2 for general LP support

#

!sync anyway

frank driftBOT
wintry canyon
#

sr miss channel

uncut panther
#

So I was checking the cookbook recently to implement a group change command in my own plugin.
it sort of works. but permissions do not transfer correctly when the group of a player changes.
the permissions dont work untill I run a LP command for that player.

Code to set the group (Similar to the cookbook)
https://sourceb.in/hKqlte3WDy

My info after I set my group with my command (see image) --> parent group changes but not the permissions. like I cant give others op and such anymore untill I run a LP command for me

craggy ember
#

my guy be using Kotlin wesmart

#

bit dangerous using !! though (try lateinit var thingy: Type instead of val thingy: Type? = null)

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

    BandiCore.luckPermsAPI.userManager.modifyUser(getUniqueId()) {
        it.data().clear(NodeType.INHERITANCE::matches)
        val node = InheritanceNode.builder(group).build()
        it.data().add(node)
        throw GroupChangedException()
    }
}
```just a few Kotlinised changes there for ya btw
#

anyway, maybe I should stop getting distracted with Kotlinifying your code and start helping you solve the actual problem

uncut panther
#

xD

craggy ember
#

sorry, I just get a bit overexcited when I see fellow Kotlin users lol

uncut panther
#

sincs I use kotlin

#

i wont go back to java imo

craggy ember
#

because they're quite the rarity

#

yeah I kinda use a mix

#

some things, like reflection, are better done in Java
other things, like data classes, are better done in Kotlin

#

looks like modifyUser loads the user, modifies their data, and saves it

#

I don't know if loadUser will check the online player cache first or if it'll always get from the database, @jaunty pecan can you save me having to dig through source code please? xD

frank driftBOT
#

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

jaunty pecan
#

it always loads

craggy ember
#

so it's always performing costly database operations to get hold of them?

#

@uncut panther you only using this command for online players btw?

#

or do you want it to work for both