#luckperms-api

1 messages · Page 16 of 1

hollow grotto
#

I know a few of my plugins leverage it heavily. I've even gotten to the point where if I'm just storing something simple then I use meta on the user to do it instead of my own plugin.

rapid egret
#

yea its great

#

its also helping my sponge transition

#

as he provides a ton of features within LP itself

hollow grotto
#

For instance, I was having to do my own implementation of custom join/leave messages per-player, so that's stored in the player's meta. Otherwise it pulls from a pre-defined list of defaults, though I'm not entirely certain how I'm doing that piece yet.

rapid egret
#

ah i support that for claim enter/exit but its stored with claim data

hollow grotto
#

That'll be the interesting piece for me though because I'm doing the same. Sponge's plugin base isn't as large, but most if not all of it is actively supported.

rapid egret
#

but definitely reasonable to have as meta

hollow grotto
#

Fortunately, going from C# to Java isn't terribly painful and I'm able to figure most things out.

#

And when I'm not, Luck's usually willing to help out

rapid egret
#

yes both object oriented

#

and very similar

hollow grotto
#

They generally have the same feel, they just have a slightly different syntax, like enums being all upper or methods being in camel case vs pascal case.

#

My biggest complaint is I often miss some of the syntax sugar from C#, though I hear Kotlin is supposed to help with that. I always see Kotlin in a mobile development context though so I'm not entirely sure how it does with just compiling to Java IL.

rapid egret
#

aye

hollow zodiac
#

okay I am back. @hollow grotto I dont want to have a bunch of custom permissions per each user...

#

I'd rather have custom contexts or metas on a per session basis

#

Kotlin syntax is like typescript...

#

I dont like how you have to declare var name ten the variable type.

#

feels so weird to me...

#

am I the only one?

#

You know what. Example code mwould make a lot of sense. Any example plugins that use the luckperms API? I'd love to tap those for knowledge.

hollow zodiac
#

there needs to be a way to unregister context calculators...

crystal sonnet
#

No matter what you do, don’t calculate anything expensive in your context calculator. They’re essentially called every time a permission is checked and should be made as efficient as possible

#

(They’re cached for a tiny bit but called often. Though you should really treat them like they are called every permission check)

hollow zodiac
#

❤ thank you

#

Okay so I wont do a calculator then.

#

I'll do a transient meta or transient manually set context somehow

crystal sonnet
#

I mean you certainly can do a context calculator

#

Just be sure to calculate the context data outside of it

#

@hollow zodiac

hollow zodiac
#

need to be able to unregister the calculator if i go that route though... otherwise reloading my plugin will turn into a memory leak

crystal sonnet
#

Pretty sure there’s a method to do that. Did you check?

hollow grotto
#

It's spigot. I'd not worry too much about it leaking. 😆

hollow zodiac
#

@crystal sonnet I did, but I was unable to find it...

frank driftBOT
#

Hey Taylor! Please don't tag staff members.

hollow zodiac
#

@hollow grotto I mean. I try to make sure my own plugins are leak free at least. And any plugin devs that dont properly handle reloads I avoid their plugins like the plague.

#

It's just bad practice to not do proper memory management

hollow grotto
#

Nah, you're totally right. I was just making a joke.

hollow zodiac
#

Oh. Sorry.

hollow grotto
#

You're good!

hollow zodiac
#

lol

hollow zodiac
#

searching for the unregister api right now...

hollow zodiac
#

"Everything in CachedData is indexed by Contexts, as this is how LuckPerms processes all lookups internally." Can someone paraphrase this?

#

contexts handle the indexing of cached data?

hollow zodiac
#
   public void test(){
        LuckPermsApi api = this.plugin.getLuckPermsAPI();
        if (api == null) return;
        ContextManager cm = api.getContextManager();
        UserManager um = api.getUserManager();
        CompletableFuture<User> lpUFuture = um.loadUser((UUID)null);
        lpUFuture.thenAcceptAsync(lpU -> {
            UserData cd = lpU.getCachedData();
            // Need to somehow set the user's context so that their context cache will be:
            // "SS3_RedstoneT1" = true   (Is there a way to specify an int and then do a less/greater than operation?)
            // "SS3_RedstoneT2" = true
            // "SS3_RedstoneT3" = true
            // "SS3_RedstoneT4" = true
            
            // (And then I want the cache to be good to go until I update the cache again)
            
            // Now modify the user here.
            um.saveUser(lpU);
        });
    }
hollow zodiac
#

Thank you for your help so far by the way

rapid egret
#

You really should be using meta for that not contexts

astral heath
#

Anyone able to help me with an issue?

hollow zodiac
#

Okay so the meta is really just a caching mechanism then? I basically set meta on a player, then have to calculate contexts from the meta?

#

I really want to use the luckperms interface for configuring permissions, but... this is...

#

It would almost be easier to just do my own custom permission s configuration right now.

crystal sonnet
#

@astral heath try asking your question

astral heath
#

So I use Luckperms obvs... I want it so when a player enters a worlguarded area it will give them a certain permission is this possible?

charred sun
#

I left a question in general before I realized this channel existed. I can copy it over if requested, but it's currently last message in general.

hollow grotto
#

@astral heath The answer to your question is kind of. This can be done through region flags. It depends on what permissions you want to give though. I recommend looking at the WorldGuard wiki to see what you can do here.

If that doesn't meet your needs, you can write a custom context accepting a region name. Consumption would look like this:
/perm user <user> permission add essentials.fly true region=mountain_home

hollow zodiac
#

Hey, can I be added as a contributor to the Luckperms project so I can make a PR for the unregister and unsubscribe methods? my github is Pangamma

#

It's a blocking issue for me, so I'm trying to get it added in.

crystal sonnet
#

@hollow zodiac you don't need to be contributor of the project

#

Just fork it, make your changes and make a PR

#

Standard GitHub procedure

hollow zodiac
#

huh

#

I'll give it a try. I've never been able to quite figure that out until now

hollow grotto
#

@hollow zodiac If you need help, I've documented a procedure on this.

#

Well, technically I stole it from Microsoft

proud crypt
#

@astral heath there is an extension to LuckPerms called ExtraContexts, which will let you define worldguard regions as contexts for permission nodes

hollow grotto
#

Oh perfect, that's the plugin I was talking about last night. @rapid egret

hollow zodiac
#

Which IDE do I use for gradel projects?.... my netbeans IDE thing is not able to open this

#

Thanks FoxTrek

crystal sonnet
#

@hollow zodiac eclipse is what I use and IntelliJ is supposed to work great with it too, though I never really got the hang of it

hollow zodiac
#

Thanks. I'll DL it now

hollow zodiac
#

feel so stupid rn.

#

Are any special eclipse plugins needed?

#

hang on. it is building.

hollow zodiac
#

Could not fetch model of type 'BuildEnvironment' using Gradle distribution

hollow zodiac
#

Alright. I looked into the API....

#

you guys are using functional interfaces for the context creators...

#

great for lambdas...

#

There is a problem though.

#

in order for a removal to work, you need to be able to perform a .equals check.

#

By default, if no .equals method is specified, and the type is of a class or interface, the comparison will be on the pointer.

#

So if you have the pointer to the exact same instance you added, that instance can be used in the removal call.

#

As you can see, that plan just got thrown out the window.

#

In its current state there is no safe way to remove a context calculator.

#

Youd need to provide some form of key or batch set for it.

#

or perhaps return an integer value for the "ID" of the calculator in the map that could be used to remove it. Similar to how the bukkit scheduler works.

#

Man this is painful rn... no one cares about any of this but me.

hollow grotto
#

@hollow zodiac This is a C# best practice though I can imagine it would apply just about anywhere - I strongly recommend using the Unicode form of non-standard (read non-Utf8) characters when possible. The Yen character isn't terribly uncommon, but some encodings still don't support it. This is especially the case if you're going to be pushing to some type of git repository like GitHub or GitLab, as some peoples' computers may not fully support that character. If they do any pushes, that character may get scrambled or replaced by the dreaded .

hollow zodiac
#

@hollow grotto Which encoding are you using right now?

hollow grotto
#

¯_(ツ)_/¯

#

Whatever's default. I think that's utf8.

hollow zodiac
#

Eclipse -> Windows -> Preferences -> General -> Workspaces -> Text file encoding

#

can you check?

hollow grotto
#

I don't have Eclipse

hollow zodiac
#

:/

#

私は今とてもイライラしています。

#

I wonder if japanese people feel weird reading their text left to right

crystal sonnet
#

@hollow zodiac if I’m not entirely mistaken, remove the project from eclipse (make sure your working copy is unaltered) and run ./gradlew eclipse from the root dir (no ./ if it’s the windows cmd. Leave it if you use power shell)

#

And not having an equals is ok. You just have to store the object somewhere to be able to remove it

crystal sonnet
#

@dapper flame that’s nothing LP deals with

#

Only group displaynames

#

You can get the display name of a player through the platform’s API

frank driftBOT
#

Hey Hoxen! Please don't tag staff members.

crystal sonnet
#

No

#

Or not by default

#

It might if it’s enabled in EssentialsX

#

@dapper flame

#

Check the wiki

#

There’s plenty of examples there

#

Pretty sure they do

#

The page is called Usage under the developer section @dapper flame

hollow zodiac
#

@crystal sonnet you're correct. If you have an instance of the object you can remove that object. But in one instance, you passed in the object to the method and this towards the list as a wrapped object. You have no access to that new object that was just stored

frank driftBOT
#

Hey Taylor! Please don't tag staff members.

hollow zodiac
quaint zinc
#

How can i get the ranks a user has(no display names) with the API

crystal sonnet
#

@dapper flame don’t use the player name to get the user object. Use the proxied player object or the UUID

#

And try using the user’s current context

crystal sonnet
#

...

#

Check the examples

#

Plenty do get the player’s context

#

And also your IDE should help you a lot

long moon
#

screenshot of lpb user <user> meta info?

frank driftBOT
#

Hey Hoxen! Please don't tag staff members.

long moon
#

The API should work consistently across the board

#

use the API singleton on bungee

#

and did any of your messages show up in the console?

#

I mean, you're showing us a lot of code but nothing whatsoever of what is shown in the console

#

Did you register your event handlers in bungee?

#

Something tells me that you probably broke the chat one

#

Okay, stop bungeecord

#

go into the folder and delete the plugin jar, leae the debug messages in there, e.g. the "it works" one at the top of the event and reexport your plugin jar and restart

#

Now, when you chat at the bare minimum you should see the log message

#

Also, make sure that that Utils class is using the logger and not System.out

hollow zodiac
#

Are you un registering your plugins and all of your data every time you unload the plug in?

hollow zodiac
#

speaking of unregister... any chance of a fix today?

long moon
#

I know that you can remove event subscriptions

#
    fun destruct() {
        val iter = plugin.luckPermsApi.eventBus.getHandlers(UserDataRecalculateEvent::class.java).iterator();
        while (iter.hasNext()) {
            val handler = iter.next()
            if ((handler.consumer.javaClass.classLoader as PluginClassLoader).plugin == plugin) {
                handler.unregister()
            }
        }

    }
#

(there is probably a more "proper" way than that, but that's what I went for)

long moon
#

Kotlin

#

It's a nifty language, but it has moments where it looks very... ew

hollow zodiac
#

@long moon can you get it to work for comtext calculators?

long moon
#

for context calculators no, I couldn't see anything for them

rapid egret
#

Anyone know how to grab transient permissions from CachedData?

#

Luck told me to use CachedData if i want to inheritance to work but i see nothing for transient

#

created ticket 😃

hollow zodiac
#

Hey I just saw an update on an issue that I created. Looking over the commits it doesn't look like it would actually work though. Has anyone actually tested the unregister methods? Specifically I noticed the bungee cord version of it would not work

#

Also the sponge API still passes in an instance that is wrapped in another proxy object

#

I am reading this for my phone right now though so I could be misinterpreting the commits

stray current
#

Hey i was wondering is there an event for tracking when a user is added to a group ? I have tried to listen to UserPromoteEvent but that doesnt seem to work ?

rapid egret
#

anyone know why when doing a lookup for permission griefprevention.flag.interact-block-secondary.minecraft it returns UNDEFINED when griefprevention.flag.interact-block-secondary is set to true? I'm testing in Paper using permission holder's cached data

#

ah i think my issue is, on bukkit side I should be setting griefprevention.flag.interact-block-secondary.*

#

let me try that 😃

#

yup that solved it, i completely forgot bukkit permissions do not treat a.b.c the same as a.b.c.*

dapper flame
#

The luckperms api is being gay and not loading

boreal briar
#

what has the api's sexuality got to do with anything?

proud crypt
#

gay? i didn't know an api could be homosexual.

dapper flame
#

this is not working >:(

#
public class PlayerTalk implements Listener {

    LuckPermsApi api = LuckPerms.getApi();

    @EventHandler
    public void onChat(ChatEvent event) {
        Utils.log("This is working m8");

        ProxiedPlayer player = (ProxiedPlayer) event.getSender();

        User user = (User) api.getUser(player.getUniqueId());
        ContextManager cm = api.getContextManager();
        Contexts contexts = cm.lookupApplicableContexts((me.lucko.luckperms.api.User) user)
                .orElse(cm.getStaticContexts());
        MetaData metaData = user.getCachedData().getMetaData(contexts);

        String prefix = metaData.getPrefix();

        if (prefix == null) {
            player.sendMessage(new TextComponent("Error the prefix is null!"));
        } else {
            player.sendMessage(new TextComponent(prefix));
        }

    }

}
#

the whole class just doesnt work

#

:(

#

if I remove the code using the luck perms api it works

#

y

#

(BungeeCord)

#

if anyone could help me get it working ill give u 5 bux

#

;)

crystal sonnet
#

@dapper flame make sure to load your plugin after LP

dapper flame
#

how would I do that

#

I just added it as a dependency

#

but I'm not sure how to load it after annother plugin with bungee

crystal sonnet
#

In the plugin.yml

#

You can add a list of plugins to load after

dapper flame
#

with bungee?

crystal sonnet
#

Yes

#

If you don’t believe me, check out the plugin.yml of BungeeChat2

dapper flame
#

Alright

crystal sonnet
#

You might as well check it too it you don’t want to google for the syntax

dapper flame
#
name: BungeeChat
id: bungeechat
main: dev.aura.bungeechat.BungeeChat
version: 2.1.6.855
author: shawn_ian, BrainStone
description: A new way to send private, global or help messages and to do much more with chatting network wide!
url: https://www.spigotmc.org/threads/bungee-chat.93960
softDepends: [BungeePerms, PowerfulPerms, LuckPerms]
#

oooooh

#

I was

#

doing

#
softdepend: ["LuckPerms"]
#

wait

#

;)

crystal sonnet
#

Yeah. The s is important

spring steeple
#

hi, um. i have a question, how to get players Prefix and Group ?

crystal sonnet
#

The wiki has an examples page

quaint zinc
#

Should i use redis if my VPS got redis?

#

Or is mysql faster

#

session driver

hollow zodiac
#

Is there a way we can push a new change for the luckperms API to maven?

#

I really want to use the latest code

#

if not I can wait a day or so

#

just wondering when the next maven update would be

jaunty pecan
#

@hollow zodiac add this repository to your buildscript

#
https://oss.sonatype.org/content/repositories/snapshots/
#

and depend on 4.4-SNAPSHOT

hollow zodiac
#

thanks!

hoary hornet
#

also event.getTarget() instanceof User works fine 🤔

hollow grotto
#

> [03:19:47 WARN]: java.lang.reflect.UndeclaredThrowableException

It's been a while since I've done Java, but don't you need private void myMethod() throws SomeException? It sounds like that may be the cause but I'm also really rusty.

sudden kelp
#

Somehow possible to remove a Meta Node without knowing the value/getting the value first?

hoary hornet
#

@hollow grotto As far as I know java.lang.reflect.UndeclaredThrowableException is throwed because event.isUser() throws exception or rather when you try to call that method

hollow grotto
#

isUser(), judging by its name, should be safe. It should either return true or should some sort of cast fail or something it should return false. It shouldn't ever throw.

I'd say to file an issue and to use instanceof User for now.

hoary hornet
#

My assumption it's because of getTarget() but yeah instance of User worked I guess I should file an issue then.

jaunty pecan
#

@hoary hornet update to the latest version of LP

#

bug was fixed already

#

@sudden kelp Yep, you can do so by using the removeIf methods

#

or maybe they're called removeMatching

hoary hornet
#

@jaunty pecan Alright thanks

frank driftBOT
#

Hey MTM123! Please don't tag staff members.

hoary hornet
#

sorry

sudden kelp
#

Just calling MetaDataMap.remove(key) and it's done? Without building a node and unsetting it? I am not that advanced:D

#

Ah, guess create a MetaNode with the key and an empty string and call clearMathcing on Permissionholder and pass the created node?

jaunty pecan
#

nope

#

use clearMatching and check for equality

hollow grotto
#

Extending off my question in #support-1, if I am going to be storing a collection of items in a user's meta, can I store that directly or should I do something like String.join(';' myCollection)? and store the collection as a string in a known format?

graceful cliff
#

Need some one on one help please and thank you

crystal sonnet
#

@hollow grotto I'd just do it with the join

#

As that makes the value easily humanly editable

#

@graceful cliff try asking your question first

hollow grotto
#

That's definitely true. Fortunately, this field should normally only hold one value, though I want to provide the capability to have more than one.

Essentially I'm making a plugin that has feature parity to EasyTitlesReloaded but for SpongeForge, but I want players to be able to have their own custom titles should they donate and buy one.

#

So I'm storing user-specific titles in user meta, as well as their currently selected title.

crystal sonnet
#

Yeah. Do it like that

graceful cliff
#

I figured it out thanks though

#

Much love

marble pasture
#

hey guys can you help me with something?

#

how do you add a primary group with luckperms

hollow grotto
#

The default group is built in and is roughly analagous to @Everyone from Discord in that it's a role everyone has.

marble pasture
#

But I want to add a primary group for a plugin I'm using....

hollow grotto
#

What is it exactly you're trying to do?

marble pasture
#

Ok so I'm using a plugin called DiscordSRV

#

And when I type in chat it broadcats to discord

#

but It doesnt broadcast my prefix

#

But if I add a primary group to me

#

then it will broadcast that before my name

hollow grotto
#

Ah, ok. So your primary group in that context whatever group you have with the highest weight.

#

Typically, default has a weight of 0 and that goes up until you hit your admin or owner group, which should have a weight higher than any other group. That's also how prefixes are determined in-game.

#

If you run /lp user <username> info it should show what your primary group was resolved to be.

marble pasture
#

ok

#

How do I set a primary group for the person?

hollow grotto
#

The primary group is calculated based on the most superior group the user is a member of.
For instance, if I were to list the groups I am a member of with their weights, I'd have the following:

default - 0
mod - 90
admin - 100

Because the admin group has the highest weight, that makes it the most superior, and therefore that is calculated to be my primary group.

#

If you want to see all groups and their weights, you can use /lp listgroups. To configure a weight for a group, use /lp group <group> setweight <weight>

marble pasture
#

So if I'm owner I set 100

hollow grotto
#

The important thing is that superior groups have a higher weight than inferior groups. The exact weight doesn't matter, but you should use something that gives you ample breathing room in case you need to add groups later. I used 100, but you could use 500 or 1000 or whatever you like. Just don't get too crazy with it.

marble pasture
#

Im a use 350

#

😄

hollow grotto
#

That works

marble pasture
#

Ok, but how do I create a group

hollow grotto
#

!usage

frank driftBOT
marble pasture
#

ok I see

#

/lp creategroup

hollow grotto
#

Everything you could possibly want to know should be in that link or nearby

#

Yup

marble pasture
#

Hope this works....

hollow grotto
proud crypt
#

crystal sonnet
#

This is for the LP API

reef nimbus
#

Can someone help me with api ?

#

How i can get prefix of the group where is the player ?

crystal sonnet
#

@reef nimbus the wiki has plenty of examples

sterile gulch
#

Any way to depend on the common core of luckperms without depending on a platform of luckperms? Having to re-create context calculations and subjects for representation in a platform.

crystal sonnet
#

I’m guessing the API itself is not enough for that?

sterile gulch
#

correct, it isn't

#

lots of graphing and context calculations classes that end up needing me.lucko.luckperms.common

crystal sonnet
#

If it’s not on the maven, I’d make a feature request on GitHub

heavy zodiac
#

does this method take the string prefix with color codes in it ?

rapid egret
#

Is there no way to grab transient permissions from LP API?

#

@jaunty pecan please add support for transient permissions via API.

frank driftBOT
#

Hey bloodshot! Please don't tag staff members.

jaunty pecan
#

yes there is already

rapid egret
#

how?

jaunty pecan
rapid egret
#

oh i was talking cacheddata. So for transient i go through that

#

ok

jaunty pecan
#

cacheddata already includes transient

rapid egret
#

ok sounds good

#

thanks

rapid egret
#

OK so I see the transient permissions are contained within nodes and each node has a ContextSet along with a permission. So will there multiple nodes with the same contexts and different permissions?

jaunty pecan
#

Could be yes

rapid egret
#

Could you add a way to grab all permissions from a ContextSet without going through nodes?

#

I'm currently building it myself internally

#

would be nice to just do this via API

rapid egret
#

k got it all working internally 😃

jaunty pecan
#

I'm not sure what you mean by that

rapid egret
#

yea sorry i meant grabbing a Map<ContextSet, Map<String, Boolean>> for transient permissions

#

currently i have to build the map myself by going through all nodes

#

easier to handle over Node

rapid egret
#

how do I clear ALL permissions for a PermissionHolder?

#

ah found it

#

clearNodes

#

Anyone know if clearNodes(contextSet) will clear nodes that contain the set?

#

so for example, if a node has contexts [A,B,C] and you say to clearNodes passing context [A]

#

i assume not

#

nm figured it out 😃

rapid egret
#

how do you set an option?

#

Node only accepts boolean for value

#

ah buildMetaNode

#

got it 😃

sour gull
#

If we want to use the LuckPermsApi for a BungeeCord plugin.
How should we import your API ?
Are we obliged to call it statically

LuckPerms api = LuckPerms.getApi();

Or there is another way to do so ?

crystal sonnet
#

One Bungee you can only get it like thaw

#

*that

sour gull
#

Ok Thank you 😃

dapper prism
#

Probably a really dumb question, but i havent found the solution yet and im super tired, I am just wanting to pull the colored prefix of players for an event message to post in chat, but getting white text with the &color codes in it

#

MetaData userMeta = cachedData.getMetaData(contexts.get()) ;

               String prefix = userMeta.getPrefix().;

               String finalMessage = prefix+": "+player.get().getName()+": "+mess;
crystal sonnet
#

@dapper prism check the wiki. Under the developer section, the usage page contains plenty of examples

dapper prism
#

musta missed the one on colored prefixes, ill go back thanks

surreal acorn
#

ChatColor.translateAlternateColorCodes('&', value); ?

#

dont know the api tho

crystal sonnet
#

There really is no difference between colored prefixes and non-colored prefixes

dapper prism
#

sponge actually, but thanks

#

so maybe thought i missed something, but nope, just 1 usage example for bukkit, but hey ill just refer back to the only advice once more and check the wiki, thanks for at least trying to be helpful @surreal acorn and @crystal sonnet i could be wrong but i typically think its safe to assume someone asking for help has probably already googled a few times especilaly when they said they couldnt find a solution, sorry for being an idiot, but hey check the wiki again is helpful........ man i hate people who think being a dick does someone good

frank driftBOT
#

Hey LGCM! Please don't tag staff members.

dapper prism
#

ha wow alright yeah im out ill figure it out on my own thanks for bein so helpful brain, ill be sure to check those bukkit examples a few more times

proud crypt
#

huh

#

who is being a dick?

#

wow, some people get so upset over nothing lmao

minor relic
#

Probably didn't like getting brushed off

#

But yeah eoe

#

Wow

proud crypt
#

he was told where to find the information

#

not really brushed off

crystal sonnet
#

I was gonna say the same

#

And not trying to be rude, but it's safe to assume that the person hasn't googled/searched for themselves

#

Which is sad

#

@LGCM#2297 And I'm still not really sure what your exact issue is

#

Lol. Goodbye then

#

Some people...

hollow grotto
#

And thus LMGTFY was born! With their powers combined, Google, Yahoo, and Bing have dedicated their lives to fighting ignorance and the forces of evil!

#

Wait, maybe not Bing 😆

sullen karma
#

Was this a Power Puff Girls reference?

proud crypt
#

Nah fam that's captain planet!

bleak agate
#

Hey is there a way to add permission and groups temporary ?

#

Please tag me

jaunty pecan
#

Yes

#

Node.Builder has methods for setting expiry times

bleak agate
#

Ok

winged radish
#

hi is there a wiki for a list of commands? Also how do I delete someone from a group?

hollow grotto
#

Unless you mean in-game commands? If so, you're looking for #support-1.

#

@winged radish

willow dust
#

I am trying to use the LuckPerms API, but the part where the octo-boolean connects the protocol keeps on failing. It does work with another DNS, though. Is this a bug?

#

Also it comparates the IPv6 address, too.

bleak agate
#

How to add a group(Not primary group)

#

?

long moon
#

parent add, instead of parent set

#

Wait, are you using the API?

#

if so, you add a group like any group, use the node builder and make it a group node

bleak agate
#

I have LuckPerms.getApi().nodeFactory.makeGroupNode("My rank");
How to add this node to a user

#

Can I use User#setPermission(node.build())

#

?+

#

@long moon

long moon
#

There is a wiki linked in the channel description which goes over all of this

#

Afaik that looks correct, but I don't have anything open to go look

sour gull
#

I was on the Wiki on github (https://github.com/lucko/LuckPerms/wiki)
And i tried to access to "Modifying existing nodes" but i can't access it. It said "You do not have permission to update this wiki."

Maybe I've done something wrong but i don't think so.

jaunty pecan
#

Fixed 😃

sour gull
#

Thanks

sour gull
#

How can i get a list of all the Prefix that a player have ?

#

I tried to get that using user.getAllNodes() and them the Stream and the Filter Node::isPrefix

#

But then ?

#

I need one precise prefix who have a define weight in my Plugin but can't find a way to get this prefix using the API

rain lodge
#

Hey? My plugin isn't loading the LP API

#
at me.lucko.luckperms.LuckPerms.getApi(LuckPerms.java:55)
at net.modrealms.conversify.Conversify.onEnable(Conversify.java:74)
at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:226)
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:289)
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:112)
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)```
#
@Override
    public void onEnable(){

        luckPermsApi = LuckPerms.getApi();

    // lots of other stuff
}```
#
depends: [LuckPerms]```
crystal sonnet
#

@rain lodge Did you shade the API in your plugin?

rain lodge
#

I did 😄

#

All sorted.

#

Thanks

surreal acorn
#

is there a way to see when a player has been promoted to a specific rank?

crystal sonnet
#

There’s an event fired when permissions change

surreal acorn
#

I just want the date

timber blaze
#

How do I setup bytebin with WAMP?

long moon
#

bytebin is a java app

timber blaze
#

I’m trying to add bytebin to the Virtual Host

long moon
#

use a reverse proxy

timber blaze
#

Ok, thanks

#

Thanks for your help

dreamy patio
#

I'm creating a plugin of kits
How do I check if a player is in a track and he also has a group?

hollow grotto
#

I don't think tracks exist how you think they do. They just set up a handy advancement system. A group can be a member of a track, but a player can not. As far as the LP Player object is concerned, it's just a member of a group.

If you wanted to see that, you'd need to get a collection of all of the groups the player is a member of and then test each group to see if it's part of the track you want.

compact zinc
#

Is it possible to get a player's rank from a certain ladder?

crystal sonnet
#

Not that easily

#

You'll have to check "manually"

compact zinc
#

Is there a way to get the user's groups? There's only a method for primaryGroup()

nocturne elbow
#

How can i check with the Api the Player Permissions in BungeeCord ?

#

i have this:

#

LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
UserData cachedData = user.getCachedData();
Contexts contexts = Contexts.allowAll();
PermissionData permissionData = cachedData.getPermissionData(contexts);

#

but i dont know how i check the Permission

#

So i have this to check

hollow grotto
#

@nocturne elbow If you're just wanting to know if a player has a particular permission regardless of context (judging by Contexts.allowAll()), then just use player.hasPermission("some.plugin.node"); from Bukkit.Entity.Player (I think that's the right namespace...)

opal salmon
jaunty pecan
#

It does 😃

hollow grotto
crystal sonnet
#

Literally the most important concept in computer science/programming

hollow grotto
#

At least in OOP, yeah

crystal sonnet
#

I don't know a single paradigm where that knowledge isn't essential

#

@hollow grotto

hollow grotto
#

You know, now that you mention it... I can't either.

crystal sonnet
#

I know only three things that are essential and present in pretty much every programming language or paradigm:

  • pointers/references vs. values
  • arithmetic
  • conditional branching/if statements and loops
#

And ironically that's really all a computer can do

fossil sparrow
#

What's the command to give someone a permission?

ruby zenith
#

Hello, I'm trying to set a meta node via the API, the node I'm trying to set is "limit = 2" and that is working so far, now, I want to increase that node. But setting a node with the same key does not overwrite the old key and just adds another "limit = 3". I couldnt figure out how to delete or overwrite a meta via key without having the value. Can anyone tell me how to delete a meta node when just having the key?

vagrant dome
#
int permsamount = Main.lp.getUser(target.getUniqueId()).getOwnNodes().size(); 
List<Node> perms = Main.lp.getUser(target.getUniqueId()).getOwnNodes(); ```
this is the way im getting the permissions but it shows other stuff aswell which i dont want how would i fix this?
opal salmon
#

What's the problem you're trying to fix here? If you don't need the other data, don't use it.
Also, just use int permsamount = perms.size()

#

@vagrant dome

sweet path
#

Is there any way to detect when a group receives or is removed permissions?

vagrant dome
#

@opal salmon i want to get the players permissions but it shows like this https://paste.helpch.at/okabunovon.cs

         List<Node> perms = Main.lp.getUser(target.getUniqueId()).getOwnNodes();
       sender.sendMessage(C.color("&7Permissions &8(&e"+ perms.size() +"&8) &7: &e" + perms).replace("[", "").replace("]", ""));```
opal salmon
#

You are invoking List.toString here, which probably doesn't get the output you want.
I suggest doing a forEach on perms and sending the Node.getPermission()

#

Be aware that a permission might be negated, so check with Node.getValue()

#

@vagrant dome

crystal sonnet
#

@sweet path yes. There are events. Check the docs

#

They are generally pretty generic, so your best bet would be to filter them yourself

vagrant dome
#

@opal salmon how could i do that?

#

ive never used forEach

long wyvern
#

nvm

long moon
#

was juuuust about to ask "what's wrong with the loadUser method?"

long wyvern
#

xD I didn't realize that method actually exists 😛

crystal sonnet
#

Step 1: Make a feature request/issue asking about a feature
Step 2: Check if that feature already exists

Fucking. Genius 🤪

opal salmon
#

@vagrant dome Please look into the documentation - Google is your friend

vagrant dome
#

I did Google it and found nothing to what I need

opal salmon
autumn tide
#

So I'm running a copy of the plugin on the proxy (bungee) and the sub servers, from a proxy plugin how would i get an instance of the api?

wicked kiln
#

Hey

#

how do i import pex?

long moon
#

Wrong channel, there is a wiki page on migrating

autumn tide
#

Does the Bungee plugin not instantiate an instance of the Api?

autumn tide
#

@gilded bane

gilded bane
autumn tide
#

I was using that

#

It's not initialized

#

On the proxy

gilded bane
#

Are you waiting until after LP has loaded?

crystal sonnet
#

Also make sure to not shade in the API @autumn tide

brave saffron
#

permission.getExpiry().getDay()+"d. "+permission.getExpiry().getHours()+"h. "+permission.getExpiry().getMinutes()+"m."

#

Should return 29days 23hrous 59minutes or similar

#

something to 30 days

crystal sonnet
#

Is that a question or a reply to someone?

brave saffron
#

Something doesnt match up

crystal sonnet
#

Are you trying to make a GUI for LP?

brave saffron
#

I already made it, but that's not the point

#

it's Luckperms in gui

crystal sonnet
#

Then I don’t understand what you’re even asking

brave saffron
#

I add a parent group for 30 days

#

Luckperms in console says 30 days

#

But api shows 1 day, 16h and 11mins

crystal sonnet
#

Ah

#

Please try writing proper questions. Helps us help you

brave saffron
#

You are fast enough that I didn't manage to ask 😄

#

What could be an issue, that permission.getExpiry().getDay() doesn't show the correct day?

#

and others too

crystal sonnet
#

What does it say by now?

brave saffron
#

Didn't understand the question

crystal sonnet
#

Make a screenshot again. I want to see the output now

#

Several minutes later

brave saffron
#

Still the same

#

Hasn't changed

#

./lp user AsVaidas parent list shows correctly

crystal sonnet
#

Just to be sure.

#

You did close the GUI between checking again?

brave saffron
#

Yes

crystal sonnet
#

Ok. Then I don’t know

brave saffron
#

😄

#

Will try debuging, maybe async causing the problem

#

Is time in getTime() in miliseconds?

#

Ohhh, I got it

#

permission.getExpiry().getDay()+"d. "+permission.getExpiry().getHours()+"h. "+permission.getExpiry().getMinutes()+"m." will show when it expires, not how much time is left

crystal sonnet
#

That makes sense

autumn tide
#

@crystal sonnet thanks for the reply to the issue, just closed it 😃

frank driftBOT
#

Hey Marshall Walker! Please don't tag staff members.

quaint zinc
#
apply plugin: 'java'

group = pluginGroup
version = pluginVersion

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/groups/public/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
    compile 'me.lucko.luckperms:luckperms-api:4.3'
}

import org.apache.tools.ant.filters.ReplaceTokens

processResources {
    from(sourceSets.main.resources.srcDirs) {
        filter ReplaceTokens, tokens: [version: version]
    }
}
#

I got this

#

But it doesnt download luckperms in extrernal libraries 😦

crystal sonnet
#

What external libraries are you talking about?

#

@quaint zinc

quaint zinc
#

luckperms

#

But i already found it out

crystal sonnet
#

@quaint zinc

#

That's some stuff you can't do with maven

#

Or not nearly as easily

quaint zinc
frank driftBOT
#

Hey PixelNotFound! Please don't tag staff members.

crystal sonnet
#

And that file are the accumulated scripts and tricks I collected over time, put into one big script

crude plover
#

hello
how do you set a player in a group

crystal sonnet
#

@quaint zinc That's a gradle script I linked

quaint zinc
#

what does it do?

crude plover
#

@crystal sonnet

frank driftBOT
#

Hey janschaaf! Please don't tag staff members.

crystal sonnet
#

@crude plover there are examples on the wiki

#

@quaint zinc A shit ton of different stuff

quaint zinc
#

Okay

crystal sonnet
#

Everything I've found useful in 2+ years

quaint zinc
#

BrainStone you are longer in the developer game. How can i sync my gitlab with my intellij project

#

I couldnt find the answer myself

crystal sonnet
#

Contains stuff like automatic versioning, tagging of versions, source code formatting, test suites, etc.

#

I don't know

#

Don't use InteliJ myself

quaint zinc
#

Oh okay

crystal sonnet
#

Though just using git should work

quaint zinc
#

What do you use

#

But i dont understand that git thing

crystal sonnet
#

Eclipse

#

Then learn it

#

Else GitLab is utterly useless

quaint zinc
#

I tried the git bash thing and followd the commands but it said that it couldnt find the commands

crystal sonnet
#

Try fixing that

quaint zinc
#

How xD

#

I am running out of ideas

#

And google didnt help much either

crystal sonnet
#

Did you install git too?

nocturne elbow
#

Hey guys

#

I want get the all player groups, and I need help

#

I'm try this:

#
    public static List<String> getGroups(Player player)
    {
        List<String> groupsString = new ArrayList<>();
        if (player == null)
            return groupsString;
        LuckPermsApi api = LuckPerms.getApi();
        if (api != null) {
            Set<Group> groups = api.getGroups();
            if (groups != null && !groups.isEmpty()) {
                for (Group group : groups) {
                    if (group != null) {
                        if (player.hasPermission("group." + group.getName())) {
                            String displayName = group.getDisplayName();
                            if (displayName != null && !displayName.isEmpty()) {
                                groupsString.add(displayName);
                            }
                        }
                    }
                }
            }
        }
        return groupsString;
    }
#

But it's not working

crystal sonnet
#

What is it doing then?

nocturne elbow
#

the groupsString retuns empty

crystal sonnet
#

Check the javadocs of getDisplayName. It might be that it returns nothing if no display name is set @nocturne elbow

hollow grotto
#

String displayName = group?.getDisplayName() ?? group?.getName();

#

Erm, wait, ignore me

#

That's the weird C#/Java crossbreed code again

nocturne elbow
#

Woo

#

tanks

#

ok

#

how I can get the group prefix's and suffix's?

hollow grotto
#

That should be very well documented.

nocturne elbow
#

I already solved this! tnks

hollow zodiac
#

It would be super cool if I could use 4.3.100 or whatever it is for my maven API work

#

This is why I don't like maven. I can't just pop in a jar dependency and call it good.

brave saffron
#

Just a quick note, to the mods:
LuckPerms GUI doesn't use API to change any of the groups, tracks or users information (permissions, etc). Plugin uses API to get information, but only for that. It runs commands as a player to change that information (like adding a prefix plugin runs command as a player /pl group $group prefix add "prefix"). So if user has any issues with Luckperms, it really isn't because of the GUI, and you can support those users

crystal sonnet
#

Doesn’t mean we know which ones it uses

#

And out of principle I don’t support unofficial addons

crystal sonnet
#

Maybe except the ones I know throughly

brave saffron
#

But it doesn't change any information via API, so that is equal as if player itself run those commands

#

You can dont give support to addons, but the base principle how GUI works is that evey change is made via commands

#

So if something doesn't work, GUI has not a slightest effect on it

crystal sonnet
#

Again. I don't know which commands it runs @brave saffron

brave saffron
#

Example: "lp user "+g.getName()+" parent add "+message

crystal sonnet
#

Sure

#

I get that

#

But I don't know which action runs which command

#

Also there could be errors in the implementation creating invalid commands

#

Especially with edge cases

#

Like spaces could be passed incorrectly

#

So unless you provide us with a way to know which commands have been run it's beyond our scope to help

#

And even if you do, you can't expect us to do support for your plugin

#

Even if it's an addon

#

Or do you provide addons for your plugin that you are not familar with (and didn't create)

brave saffron
#
Tools.sendCommand(p, "lp user "+g.getName()+" unset "+'"'+permission.getPermission()+'"'+" "+Tools.contextConverter(permission.getFullContexts()));
#

This command is used everywhere where I remove any permission

crystal sonnet
#

Posting your code won't change anything

brave saffron
#

Yea

#

I should make it an open source

crystal sonnet
#

Even then

#

It is not our job to provide support for your addon

brave saffron
#

I didn't say that

#

And you shouldn't

crystal sonnet
#

Then I honestly don't understand you informing us that your plugin just uses commands

brave saffron
#

I sow a message that a person had issues with LuckPerms, and someone wrote that they don't support addons (even when the issue still existed without it)

#

So I just want to make clear that GUI doesn't change anything with API, everything is with commands

crystal sonnet
#

As long as they're not using commands, it's not our buisness. Even if it's not within your addon

brave saffron
#

So if a plugin runs the same command as it would be done normally, then it won't be supported?

#
If you have issues while changing any information, first try the same thing with LuckPerms commands before contacting me or LuckPerms developers!

Then this line is needed in the resource

#

Thanks for clarifying it

crystal sonnet
#

I can’t provide support if I don’t know the commands the user is running. Or the GUI running for them

opal salmon
#

Does UserManager.loadUser return a valid user instance even for players that never joined?

crystal sonnet
#

It should @opal salmon

opal salmon
#

thanks! :)

opal salmon
#
    private static void setPrimaryGroup(UUID uuid, String group) {
        if(!luckPermsApi.isPresent()) {
            log.severe(String.format("Failed to set group %s for player %s - LuckPerms API not present", group, uuid));
            return;
        }
        UserManager userManager = luckPermsApi.get().getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(uuid);

        userFuture.thenAcceptAsync(user -> {
            user.setPrimaryGroup(group);
            userManager.saveUser(user);
            log.info(String.format("Successfully assigned %s to group %s", uuid, group));
        });

    }

Output: Successfully assigned ((uuid)) to group member

But the database entry for this uuid is still default - what am I doing wrong?

#

Please, can someone have a look, it's kinda urgent 😅

hollow grotto
#

@opal salmon This is how I do it. This is tested and it works.

public void addToGroup(Player player, String groupName) {
    // player.sendMessage("In Add Method");
    User user = loadUser(player);
    Group group = luckPermsApi.getGroupManager().getGroup(groupName);
    if (group == null) {
        player.sendMessage("Group " + groupName + " not found!");
        return;
    }

    Node node = luckPermsApi.getNodeFactory().makeGroupNode(groupName).build();

    user.setTransientPermission(node);
}
#

Oh, wait, you're trying to set the primary group...

opal salmon
#

Thanks for your response!
I am, but this might be sufficient. Will test asap

hollow grotto
#

fwiw this comes from a class I built called LuckPermsTool. When the plugin loads, I do the following:

// Hook LuckPerms
luckPermsTool = new LuckPermsTool(this);
if (luckPermsTool == null) {
    log("Unable to hook LuckPerms!");
    return;
}
log("LuckPerms hooked!");
#

Because the LuckPerms API is a hard dependency for this plugin, if it is unable to load it, then it calls return, which aborts loading the plugin.

#

Here's the relevant ctor

private final LFUtils plugin;
public LuckPermsApi luckPermsApi;

public LuckPermsTool(LFUtils plugin) {
    this.plugin = plugin;

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

    if (provider != null) {
        this.luckPermsApi = provider.getProvider();
    }
}
#

After that, whenever I need to do something with LuckPerms, I use the tool.

@EventHandler
public void onAfkChangeEvent(AfkStatusChangeEvent event) {
    IUser user = event.getAffected();
    Player player = user.getBase();

    // player.sendMessage("In AfkListener Event!");

    // getValue = isGoingAfk()
    if (event.getValue()) {
        // plugin.luckPermsTool.addAfkPrefix(player);
        plugin.luckPermsTool.addToGroup(player, "afk");
    } else {
        // plugin.luckPermsTool.removeAfkPrefix(player);
        plugin.luckPermsTool.removeFromGroup(player, "afk");
    }

    plugin.nametagEditTool.refresh(player);
}
opal salmon
#

So...
user.setPrimaryGroup(group); returns DataMutateResult.FAIL
Any idea what might cause this? @crystal sonnet

frank driftBOT
#

Hey Flare! Please don't tag staff members.

opal salmon
#

sry

crystal sonnet
#

@opal salmon yes. Setting the primary group is not the same as assigning a group

#

And with default settings it does nothing, as the primary group is calculated automatically

#

You’ll need to assign the user the group

normal hedge
#

How do I get Displayname of a group with API?

teal tartan
#

group.getDisplayName()

normal hedge
#

hmm

#

Doesnt work

#

@ripe thorn

frank driftBOT
#

Hey xCodiq! Please don't tag staff members.

normal hedge
#

Found it

nocturne elbow
#

plugin doesn't compile why?

#
  • What went wrong:
    Execution failed for task ':common:checkLicenseMain'.

License violations were found: src\main\java\me\lucko\luckperms\common\util\CaffeineFactory.java

crystal sonnet
#

@nocturne elbow make sure you're up to date with the plugin

nocturne elbow
#

just cloned

#

before worked

#

now doesnt

crystal sonnet
#

@jaunty pecan you broke your plugin it seems

jaunty pecan
#

Woopsie

jaunty pecan
#

ok all fixed now

crystal sonnet
#

@nocturne elbow

misty hinge
#

oof

compact zinc
#

Does getPrimaryGroup return the group with the highest weight?

#

Also UserPromoteEvent doesnt seem to get called when I add a user to a group

proud crypt
#

probably because it only fires when you promote along a track

#

not sure but that would be my reasoning for it

compact zinc
#

Yeah that's kinda was I thought when it didnt work. Is there an event that gets fired when a player is added to a group?

proud crypt
#

NodeAddEvent ?

#

or NodeMutateEvent

compact zinc
#

How does getPrimaryGroup work?

#

Will it return the group with the highest weight the player has?

jaunty pecan
#

It depends

#

on what this option is set to

viral comet
#

how do i get the player rank

jaunty pecan
#

rank or ranks?

#

in luckperms, players can inherit from multiple groups

#

you can get their "primary group" - maybe that's what you're looking for

compact zinc
#

What can cause a NodeMutateEvent?

#

Also is there a better event to check for when a player's group is changed than NodeMuate?

willow dust
#

what’s a primary group?

compact zinc
#

uhhh depends on your settings. If you want to see what primary group would return for a player just do /lp user [player] info

crystal sonnet
#

@compact zinc NodeMutateEvent is fired on any change

#

Though check it's Java docs

#

@willow dust And the primary group is like "the most important group a player has"

#

LP only even has that becuase Vault mandates it

upper nacelle
#

Anyone know how to get who gave a user a group/permission? Or when someone got it? I found api.getActionLogger(), however I can't figure out how to link it to api.getUser("").getPrimaryGroup()

hollow grotto
#

I don't believe LP audits that by default. If it does, it's most likely in a log file somewhere, not stored in a database.

Why do you need to link it to a user's primary group?

crystal sonnet
#

Yes it stores that in the database @hollow grotto

#

@upper nacelle my guess is that you’ll have to iterate over the logs to find the most recent appropriate change

hollow grotto
#

Oh? TIL. That's outstanding.

upper nacelle
#

I am creating a system that shows who gave a player a rank and when. Looks like this might not be easily doable. rip

crystal sonnet
#

Yeah. The logs aren't really designed for that

#

And there could also be manual changes to the database

hollow grotto
#

Your best bet might be to hook... there's an event for that, but I don't remember what it's called. I'd say watch for that event and then record that information yourself. If you use Helper, you can hook into an H2 or MySQL database pretty easily.

undone edge
#

hi

undone edge
#

Someone knows how to work with mysql?

proud crypt
#

just ask your question

hardy halo
#

is it possible to add a transient permission trough the LP api? and if it is how would do that is there some example i can look up?

#

or i just need ability to add and remove permission to a specific player

crystal sonnet
#

If it wasn’t possible, I wouldn’t have mentioned it 😉

#

Not sure if there are any examples on it, but all examples can be found on the wiki @hardy halo

#

Though in any case, the Javadocs should explain pretty much everything

hardy halo
#

yea i figured how to use it did what i needed, will see later if it works when he tests it @crystal sonnet

frank driftBOT
#

Hey Lynx! Please don't tag staff members.

crystal sonnet
#

Awesome

nocturne elbow
#

Hey all just sanity checking? User#setPermission(Node) where Node is a group node == add user to group?

#

I see User#setPrimaryGroup -- but I've handled that case, now just need to handle how to add a regular weighted group.

crystal sonnet
#

You are correct

#

And you can completely ignore the primary group method

#

It’s for settting which of players groups is the primary one. And not for changing the groups the plate is in @nocturne elbow

nocturne elbow
#

aha!

#

so I always use setPermission(Node) to get them in there, but setPrimaryGroup to actually signal the primary?

crystal sonnet
#

Yes. But by default the primary group is calculated automatically

#

So attempting to change it won’t even do anything

#

Just ignore it

nocturne elbow
#

Meaning what? Let me give some context on what I'm doing. I am creating a plugin to hook between AdvancedAchievements and LuckPerms. Essentially, when a user receives an achievement it runs through a list of arbitrary requirements on my end and then applies a group or groups. There is an option however to add a group that will be primary to the user. What's the proper way to set the primary group for a user?

#

(If it's calculated.)

crystal sonnet
#

It means that whenever the groups of a player change, LP looks at them and automatically selects one of them as the primary group

#

At least with the default settings

nocturne elbow
#

I see. Hmm ok. I was looking at this as if the primary group would override the weighted prefixes. However, if I'm wrong in that sense then I understand what you're saying by "ignore it"

#

Thank you!

crystal sonnet
#

Prefixes are completely independent of the primary group

nocturne elbow
#

Do I need to do something to merge immediately or something?

#

No luck (😉 ) 😦

#

If the group is in a track, am I required to promote?

long moon
#

Have you like, considered saving your changes?

nocturne elbow
#

that's what im asking

#

do I need to do that? Docs do not state so

#

it says just call the method

long moon
#

Yes

nocturne elbow
#

With what method? There is no save documented for updating player data

#

Ah

long moon
nocturne elbow
#

smallest section possible

#

Okay

#

am blind

#

thanks

#

aaaaaaand fixed thanks cat

long moon
#

as per my PM, ur bad ❤

hybrid remnant
#

how do i add perms to players

#

LuckPerms.getApi(). what?

#

what next?

crystal sonnet
#

There are plenty of examples on the wiki

hybrid remnant
#

link plz

crystal sonnet
#

Also check the Javadocs

hybrid remnant
#

yh

crystal sonnet
#

They exists for a reason

#

!wiki

frank driftBOT
hybrid remnant
#

yh thats what i ned

#

that does not contain any javadocs, and if it does where are they?

crystal sonnet
#

Oh boy...

hybrid remnant
#

bit rude mate cya

crystal sonnet
#

The wiki does not contain the javadocs

#

Well how are you including the API?

crystal sonnet
#

Lol. They left 😂

teal tartan
#

Oof

hybrid remnant
#

what?

#

thanks chinese mark thats what i need

#

perfect!

crystal sonnet
#

What

#

It clearly showed you were gone... my bad

#

Anyways I’ll go out of my way and help you with something that’ll help you a shitton in the future when working with Java

#

How are you including the LP API in your workspace @hybrid remnant ?

hybrid remnant
#

what yh

#

can u tell me where the docs are to give and remove permission>

#

?

crystal sonnet
#

As I said. For basic stuff like that, there are examples on the wiki

#

And you haven’t answered my question

hybrid remnant
#

yes i have

crystal sonnet
#

I asked how you include the LP API

hybrid remnant
#

oh sorry i did not read that right

#

i have built the path yh

crystal sonnet
#

What do you mean?

#

You downloaded the repo and built it yourself?

hybrid remnant
#

ohh im getting confused!

#

Can I start again, how would I go around implementing a way to give perms to players. Can I not just add LuckPerms to my build path

crystal sonnet
#

Yes. But you kinda shouldn’t

#

You really should just use the API jar

hybrid remnant
#

OHHH

#

AAAAAAH

#

i see

crystal sonnet
#

Also you should use gradle or maven

hybrid remnant
#

gradle i hate, ill use maven

crystal sonnet
#

Then it’ll automatically include javadocs and sources in your IDE

hybrid remnant
#

yh which is good

crystal sonnet
#

So hovering over classes and methods will show you the docs for that method

hybrid remnant
#

Yes, thats easier. Bukkit doesnt do that, how would I change a normal java poject into a maven one, or do i have to restart?

vernal sonnet
hybrid remnant
crystal sonnet
#

Bukkit can also be included with Maven or Gradle

#

And in fact should

#

As that also will include javadocs

#

Which is beyond helpful

#

Though out of interest, what do you dislike about gradle?

hybrid remnant
#

Ik thanks. Can I make a java project into a j=maven one?

crystal sonnet
#

I’d just google that

#

Should be fairly easy

hybrid remnant
#

oh ok

#

I have had bad experiences with it... like when trying to make mods for forge and other cases

crystal sonnet
#

Ok. Really up to you

hybrid remnant
#

well thanks for the help

crystal sonnet
#

Though it’s far superior in pretty much every way. Except maybe popularity

#

And for a basic java project it’s ridiculously simple

#

Though in any case pick one and start familiarizing yourself with it

vagrant dome
tacit tiger
#

Hello! So I am working on a custom staffchat plugin for bungee. I am curious on how to use LuckPerms as an add-on, or if this is even possible.

teal tartan
#

Like get prefix or what?

tacit tiger
#

Yeah

#

So I want to replace [prefix] with their prefix over bungeecord.

#

Pretty simple except for getting their prefix

#

Oh wait I just figured out that I can use vault to do this.

#

That makes a lot more sense.

#

Now the only other thing I have to figure out is how to check their permission. Will probably use vault also.

neat jackal
#

How to check for permissions:

Player p = how.yougettheplayer();
if(p.hasPermission("some.perm")) {
    //if he has
      //some code
} else {
    //if don't has
     //some code
}
#

Or moment, bungeecord

#

Not plain bukkit

tacit tiger
#

What?

#

That checks their bungee perms

neat jackal
#

That works for Bukkit Plugins, but I don't know if it works for Bungee too

tacit tiger
#

It may work for bungee, but bungee perms are different then bukkit perms

tacit tiger
#

Yeah vault doesnt work

#

Bungee is super confusing

teal tartan
#

@tacit tiger lp has it's api

tacit tiger
#

For bungeecord?

drifting valley
#

Yeah, lp's api works for bungeecord

#

you just need lp on the bungee

tacit tiger
#

hmm is there any documentation for using the bungee api?

teal tartan
#

@tacit tiger

crystal sonnet
#

@tacit tiger the LP API is the same for all platforms

eager lark
#

why does api return "default" group as primary when player has another one on the server he is on

hollow grotto
#

Is that player on the hub server and the world world when that line is hit in code?

crystal sonnet
#

@eager lark does helper have a higher group weight?

proud crypt
#

they posted in general, it does

#

LP is displaying the correct primary group (as you can see in that screenshot) but the API isn't

crystal sonnet
#

Ah ok

sick elbow
#

This causes the server to crash with a NPE

#

Any help would be appreciated 😄

crystal sonnet
#

That shouldn’t throw a NPE

#

Are you sure that’s what’s throwing it?

hollow grotto
#

I think that's his IDE being over-protective

#

It's possibly seeing getUser and saying "that could return null"

crystal sonnet
#

But since the player should be online from what I understand, that should never happen

sick elbow
#

Yea, it didn't do that before

crystal sonnet
#

It’s likely throwing elsewhere

sick elbow
#

Let me try something hold on, I think I know what might be causing it

hollow grotto
#

Oh, rip me. I didn't read that it was actually throwing.

crystal sonnet
#

Check line 30

sick elbow
#

private CommandSource source;

#

Weird, I just tried this and it worked

#
        for (Player player : Sponge.getServer().getOnlinePlayers()) {

            Bossbar();
            Sponge.getServer().getBroadcastChannel().send(TextSerializers.FORMATTING_CODE.deserialize(LuckPerms.getApi().getUser(player.getUniqueId()).getPrimaryGroup()));
        }```
#

and it said [Server thread/INFO] [minecraft/DedicatedServer]: default

#

Ah okay, I found the issue

#

Thanks for helping :p

crystal sonnet
#

Ok 👌🏻

sick elbow
#

nevermind 😅

#

i don't think i'm doing anything wrong

crystal sonnet
#

@sick elbow yes you are

#

Don’t convert the UUID to a string

sick elbow
#

lemme try that

#

No luck

#

I was doing this before and i received these errors in console

#

oh nevermind, just got it 😂

#

sorry to bother

crystal sonnet
#

Also you really should turn on line numbers

sick elbow
#

i do have it on, that's just a snippet of my screen

crystal sonnet
#

Ok

sick elbow
#

thanks for the help 👍

hollow grotto
#

For future reference, I'll often break down code like this when I get errors like that.

{
    try
    {
        var api = LuckPerms.getApi();
        var user = api.getUser(player.getUniqueId());
        var group = user.getPrimaryGroup();
    }
    catch (NullPointerException ex)
    {
        // ...
    }
}```
#

Splitting it into multiple lines helps the JIT debugger when stepping through your code

#

(also I know the var keyword gets a lot of flak in Java but I'm a C# dev so fite me)

sick elbow
#

good to know

#

that'll be handy

hollow grotto
#

Just as a general rule, only use var when the type is obvious from context.

// good - user is a User
var user = api.getUser();

// bad - what is file? A string array? A stream? 
var file = input.read();
eager lark
#

yes the player the player was in the hub, the api don't found primary group

rapid egret
#

@hollow grotto you shouldn't be catching an NPE like that...If the user is not loaded, you should be attempting to load it. If it is still null at that point, then the user has never logged into the server.

#

use LP's UserManager

#

ah @sick elbow was making the call 😃

#

I recommend always using the UserManager to handle all user operations

hollow grotto
#

Good point. That was more of a demonstration of splitting your code into multiple lines for debugging purposes, though I should have mentioned the user manager.

eager lark
#

tab, don't found primary group of luckperms

#

i have version 4.3.73

sick elbow
#

thanks bloodshot 👍

rapid egret
#

@eager lark update to LP 109

eager lark
#

I have updated.. nothing changed

#

tab dont found primary group from lp, on the server where you are

neat jackal
fringe solar
#

Oh, was confused sorry bout that

eager lark
#

any help for me? T-T

neat jackal
#

Ask in TAB support?

eager lark
#

i have asked, They told me to ask here for the API

wispy harness
#

You can just use the Vault api

#

🤔

eager lark
#

it's on bungee, ther's no vault version i think

hollow grotto
#

This will let you know what's failing, if you're not getting any explicit exceptions in the console

eager lark
#

"i am not getting any exceptions
my code works
just their api returns something else"

#

from neznamy dev of TAB

eager lark
#

any help? ç_ç

vagrant dome
#

@me if you can help

long moon
#

Take a look at the Node class on the javadocs, it has methods for working out what type of node a node is

vagrant dome
#

are you able to link me to it @long moon ?

vagrant dome
#

i have no idea how to get it lol

crystal sonnet
#

You can literally browse it online with the link @vagrant dome

vagrant dome
#

I mean I'm not sure how I would get just the players permissions from using node

long moon
#

You have a List of nodes, each of those does represents an entry on the users permissions, e.g. groups, meta, etc; There are methods exposed on Node, which allow you to check what type of node a node is, meaning that you can take that list and filter out what you want

hybrid remnant
#

does anybody know how to create a Node so i can add permissions to players on a server?

#

LuckPerms.getApi().getUser(p.getName()).setPermission(a node here);

long moon
hybrid remnant
#

thanks

keen tree
#

I am wondering is there a way to get the next rank hierarchy in the API?

wheat lily
hollow grotto
#

@keen tree You mean next highest group by weight or the next highest group in a track?

#

Both can be done, just very differently.

keen tree
#

Just api in where I can find it. How to use/ call.

gilded bane
#

Just a quick question: is it possible to create and save a User from a UUID alone, without having an associated Player?

crystal sonnet
#

@gilded bane as far as I know, that should just work

gilded bane
#

Okay, just checking

#

Wasn't sure because getUser's docs say it throws a NPE if the user doesn't exist

crystal sonnet
#

I mean LP can handle unknown UUIDs just fine. I’d be surprised if the API didn’t

deft scroll
#

Hello all! Not sure if this is the right place, if not my appologies.

Completely new to Luck perms and how to make it work for me. I'm configuring a pixelmon server using the sponge version of Luck Perms in conjunction with Nucleus.
I've run into some problems...

-Though I've managed to set basic perms for users mods and admins don't get access to any of the admin level commands even if I can see the codes for these in the /lp group <group> edit tool.

-I'm also unable to find how to add basic minecraft commands like /gamemode to Luck Perms in a way that actually allows it XD

-I can not seem to figure out how to re-enable my ability to edit protected spawn areas.

-Lastly I have not been able to figure out how to set my self as server owner, with 0 restrictions.

I am using Nodecraft Server hosting.
Thank you all for your time and help! This Discord has become my last fallback for answers having spent a good 6 hours researching and testing last night

modern veldt
#

@deft scroll still need help?

deft scroll
#

I do!

modern veldt
#

Okay let's go to general since this is for API questions

velvet hatch
#

i have pixelmon installed but the auto fill for pixelmon and pixel extras is not showing up in the editor neither is normal minecraft

#

@modern veldt

modern veldt
#

I am pretty sure you can search up the pixelmon permissions on google

#

Also this is API chat please use general

velvet hatch
#

i tried that

#

still says i need op

#

even if i have op it still says that

modern veldt
#

Did you give yourself the right group?

velvet hatch
#

yes

modern veldt
#

Scroll down it has all permissions nodes

velvet hatch
#

i put the command it said into my user group and myself just the same need to be OP

#

stuff from nucleus works tho

modern veldt
#

Because you are doing something wrong with the permissions

#

This isn't a LuckPerms problem i am sure.

velvet hatch
#

i just did another command it works

#

im trying to add the check spawns plugin for pixelmon and then it doesnt work but others seem to

modern veldt
#

Maybe the plugin isn't working at all, And it isn't a permissions error

velvet hatch
#

luckperms or pixelmon

sick elbow
#

Hello, I'm trying to set the permission node keepinventory.enabled to false, but it doesn't seem to be working.

#

Would someone be able to tell me if I'm doing something wrong? Thanks 😄

long moon
#

You need to save your changes

sick elbow
#

thank you 😄

#

works like a charm, thank you

sinful moat
#

Hi ! I use the bungeecord api and to get the suffix I have to get the context but I don't know how it work , my code is ```java
public String getSuffix(ProxiedPlayer player) {
User user = LuckPerms.getApi().getUser(player.getDisplayName());
Contexts contexts = LuckPerms.getApi().getContextForUser(user).orElseThrow(() -> new IllegalStateException("Could not get LuckPerms context for player " + player));
MetaData metaData = user.getCachedData().getMetaData(contexts);

    String suffix = metaData.getSuffix();
    System.out.println(suffix);
    return suffix;
}```
crystal sonnet
#

Don’t use player.getDisplayName(). Use player directly when getting the user @sinful moat

sinful moat
#

Ok

crystal sonnet
#

The wiki also has examples on how to get stuff @sinful moat

sinful moat
#

The method getUser doesn't accept a ProxiedPlayer so I get the UUID

#

And it doesn't work

crystal sonnet
#

Erm yes it does?

#

What makes you think it doesn’t?

#

@sinful moat

sinful moat
#

I think it's the contexts

#

my suffix is null but my user no

crystal sonnet
#

That doesn’t answer my question

#

But as I said. The wiki contains plenty of examples on how to get stuff from the API

sinful moat
#

I'm already looking for an exemple but I don't found

crystal sonnet
#

Did you find the examples at all?

sinful moat
#

I find that exemple Contexts contexts = api.getContextManager().getApplicableContexts(player); but if I replace api with Luckperms.getApi() it tell me that I have to cast it to an object

drifting valley
#

Yeah, create an object and then run that command LuckpermsAPI api = Luckperms.getApi();

fiery helm
#

LuckPerms chat-prefix not working on my minecraft server.. Why?
i have essentials-chat

#

please help

#

@here

gilded bane
#

This channel is for developers making use of LuckPerms' API

fiery helm
#

Okay 😄

sinful moat
#

I've a problem , I did everything you said but eclipse tell me I have to cast api , but it cast at LuckpermsPlugin

gilded bane
#

LuckPermsPlugin isn't part of the API; what dependency are you using

winter zodiac
#

hi

clever charm
#

Hey guys. Haven't really been active with Minecraft since college as well as work but I used to host the server called "RuneCraft" for five years.

I currently work as a SR Identity and Access Manager for a company and was looking for project opportunities to work on for identity governance to put on my resume. Do you guys need support in the development of your plugin?

Experienced in:
Creating connectors between third party applications and our enterprise application.
Creating schemas to extract consumer data and map it to the enterprise application.
Code optimization and documentation for enterprise applications.

crystal sonnet
#

@clever charm Luck is the sole writer of the plugin. Though I think he’s good for now

#

In any case, the plugin is open source, so feel free to jump onto issues marked as “help wanted”

hollow grotto
#

I was at one point looking at hooking into the LP API and providing AD Sync, but that's sorta on the backburner.

#

Essentially it would allow mapping LP groups to AD groups and Minecraft users to AD accounts.

#

So when a player joins the server, it does a check for AD groups and ensures they're in all of the corresponding LP groups.

#

And when one is updated, it updates the other.

#

But due to the nature of the component, I definitely feel a stand-alone plugin would be better. That's probably best in your case too, Ri - I'm sure these tools would be useful for someone and may even get an honorable mention on the LP readme, but I feel that functionality might be a bit too localized for a majority of users to leverage.

clever charm
#

Is there not a standalone plugin for that already @hollow grotto ?

#

Seems like something that would be developed already haha

hollow grotto
#

No idea. This was just something on my to-do list

#

I've not actually researched it yet

clever charm
#

Time to develop it before you kek

hollow grotto
#

Tbch though, I'm not sure if that would've been developed already. We may be the only two people on the planet interested in hooking LP/Minecraft to AD.

#

Most people have no interest

clever charm
#

Oh I mean like minecraft to ad

#

Lp wouldn't be a part of it haha

hollow grotto
#

I'd probably do this in two parts - an LD API that maps users by GUID to the corresponding AD GUID, and a second plugin which hooks that API and LP's to perform group syncs

#

That said, it'd probably need to be a read only API for safety reasons.

#

I doubt Minecraft's a very secure platform (doesn't need to be). I mean, it's secure enough for what it is, but if you give it write access to an AD environment, you gotta be very careful.

clever charm
#

I'd much rather just support write requests than read requests since if you had the plugin able to read the ad user if it was misconfigured you could have staff members get members personal information on their ad account. If it was writing it could cause data issues if massive amounts of AD users were generated but at least the server wouldn't be able to read in PII.

The connectors would be writing
minecraft server to ad server, then having a third party application such as your website reading from the ad server.

If you wanted to read from the AD I'd have the server able to read from it but not allow any ingame commands even if the user is op if that is possibly from the Minecraft server. Haven't touched programming in minecraft for a while though so not sure what would be supported or not.

nocturne elbow
crystal sonnet
#

No need to register it. Just use it @nocturne elbow

nocturne elbow
#

So LuckPerms.getApi() is just enough?

crystal sonnet
#

Yup

nocturne elbow
#

Oh okay

#

Why should I not use this for bukkit as well?

crystal sonnet
#

No reason

#

It’s designed to be used on all supported platforms in the same way

nocturne elbow
#

Oh nice!

#

Thank you 😃

gilded bane
#

getApi works on all platforms, but those platforms with a services manager have an additional way to retrieve it

hollow grotto
#

I've mentioned this before, but while LuckPerms.getApi() works fine, for safety reasons I've wrapped it in a class called LuckPermsTool

#
public class LuckPermsTool {

    private final LFUtils plugin;
    public LuckPermsApi luckPermsApi;

    public LuckPermsTool(LFUtils plugin) {
        this.plugin = plugin;

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

        if (provider != null) {
            this.luckPermsApi = provider.getProvider();
        }
    }

    // Utility methods here
}```
#

That way, if lpTool.luckPermsApi == null I can abort the start of my program or else handle it as needbe. If it's non-essential, my utility methods are configured to be non-op (i.e. they don't do anything).

#

It also gives me one centralized location that I can use for any utility methods I may need, like adding/removing group memberships and so forth.

nocturne elbow
#

java.lang.IllegalStateException: API is not loaded.

#

How to be sure that it's loaded?

hollow grotto
#

The safest way is probably the way described in my code sample above.

#

Since swallowing exceptions is considered bad practice, you can do something like this in your onEnable():

// Hook LuckPerms
RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
if (null == provider) {
    log("Unable to hook LuckPerms!");
    return;
}
log("LuckPerms hooked!");
#

Be sure to also place it in the dependencies section of your plugin.yml (assuming you're building a Bukkit plugin). This will delay Bukkit loading your plugin until at least all of its dependencies are loaded.

gilded bane
#

getApiSafe returns an Optional