#luckperms-api

1 messages Β· Page 26 of 1

sturdy niche
#

nothing works?

#

wtf

rustic laurel
#

!api read both of these

frank driftBOT
sturdy niche
#

i did

#

i have luckperms in

#

but i can't get my prefixes?

#
String suffix = metaData.getSuffix();```
These don't work
azure latch
#

Have you defined metaData?

#

It should be an instance of CachedMetadata @sturdy niche

unborn sky
#

Hi I have just finished setting up a 1.12.2 server and add Luck perms. is there a place I can go to that gives the basic walktho on how to add perms like this one to the group

#

homeSweetHome.home.list

gloomy bloom
#

StilauGamer, Do you have a prefix/chat plugin that could do that

#

I use essentials chat and it works

unborn sky
#

I added ultimate chat

#

also this is on Spongeforge

azure latch
#

@gloomy bloom this is for the dev API, he's trying to get it through code, not to display in chat

#

@unborn sky /lp group YOUR_GROUP permission set YOUR_PERMISSION true, you can also add them to specific players. But, wrong channel, #support-1

unborn sky
#

o sorry thanks will try

crystal sonnet
#

!nw @sturdy niche

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

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

For Console Errors:
sturdy niche
#

Hey sorry. I needed to go sadly, but i can tell what i want to do. And i will test some of the help from here tmr

#

I want to have a chatformat

#

And get the lowest weight prefix/main prefix

#

To add into my chat format

rustic laurel
#

Lowest weight is not main, higher weight is higher priority

neat jackal
#

@rustic laurel

rustic laurel
#

@neat jackal

neat jackal
#

I did it again, oh come on. Γ„

rustic laurel
#

πŸ˜›

sturdy niche
#

How do i get the prefix of a rank with luckperms API?

#

like p.getPrefix or smth

rustic laurel
#

!api it's all here

frank driftBOT
sturdy niche
#

I tried!

#

But its not working!

rustic laurel
#

then don't ask how, ask why yours doesn't work

#

and use pastebin to send what you've done

sturdy niche
#

user.getCachedData

#

is not a thing

#

"user"

oak badger
#

are you writing a plugin that only supports luckperms?

#

usually people use Vault to get the prefix

sturdy niche
#

i tried that too

#

but can't find vault's things

#

if i can say it like that

sturdy niche
#

That website was confusing lul

#

but hopefully i will find something useful

oak badger
#

i mean just look up how to get Chat from Vault

#

@sturdy niche that link should help you actually "get Chat"

#

from there you just need to call the method to get the prefix from it

sturdy niche
#

i got permission thingy

#
        RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
        perms = rsp.getProvider();
        return perms != null;
    }```
oak badger
#

yeah but you get the prefix from Chat, not from Permission

sturdy niche
#
        RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class);
        chat = rsp.getProvider();
        return chat != null;
    }```
#

correct?

oak badger
#

yeah and once you have Chat, then you just do .getPlayerPrefix on it πŸ™‚

#

nice and easy, give it a try

sturdy niche
#

buut a question

oak badger
#

btw this is a bit off topic though because this channel is supposed to be about luckperms api i think

sturdy niche
#

do you need to add this inside onEnable(){
setupPermissions();
}

#

shhh xd

oak badger
#

idk put it wherever you want its just an example

#

you just need to get it somewhere

sturdy niche
#

Getting help from someone :) Thanks btw

sturdy niche
#

depend: [Vault, Luckperms]

#

What do i type inside "luckperms"

forest bronze
#

what is th command to give a player all perms? i tryed * and it didnt work

rustic laurel
#

the node * will give all perms

#

the command is lp user <user> permission set *

forest bronze
#

ok thanks

crystal sonnet
#
depend: [Vault]
#

@sturdy niche

#

The entire point of Vault is to not depend on the actual permissions plugins

#

And for the future, don't say "it's not working". Provide your code and describe what's happening

#

!nw

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

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

For Console Errors:
sturdy niche
#

okay

#

but if i want to use things that is in Luckperms

#

like the promoteEvent etc

crystal sonnet
#

Then you need to depend on LuckPerms

#

And using vault then is obsolete

#

I mean we could've told you that if you were just upfront about what you're actually trying to do

marsh matrix
crystal sonnet
#

v4 is no longer supported

marsh matrix
#

I see, fair enough, thanks πŸ™‚

crystal sonnet
#

Any particular reason you're still using v4?

marsh matrix
#

realistically just cause it works fine, and we want to wait for a reset before updating major plugins

crystal sonnet
#

Well, there's really nothing you need to worry about with LP tbh

#

Just replace the jar and you should be good

#

Doesn't hurt to refresh the config (remove/rename the old config, let LP generate it's current default config and apply the changes)

marsh matrix
#

well it's not just LP, it's the plugins that work with it; it should be fine anyways, like updating from GP to GD, but due to past experiences with other things, we are very cautious about it

crystal sonnet
#

And for plugins still needing the v4 API install the api extension

#

!upgrade

frank driftBOT
marsh matrix
#

thanks

crystal sonnet
#

You're welcome

open osprey
#

Hhbb. V v v . v. vv v. v

rustic laurel
#

This is not the server/channel you seek

real flint
#

is there an event to check for when a player gets a new parent set to them?

dusky wagon
#

!events

frank driftBOT
#

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

dusky wagon
#

!help

frank driftBOT
#
Available commands:
β€Ž

!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!cauldron
!chat
!colours
!commandequivalents
!commands
!config
!context
!default
!downloads
!editor
!errors
!essentials
!extensions
!faq
!helpchat
!install

β€Ž

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

dusky wagon
#

UserDataRecalculateEvent ore NodeAddEvent

upbeat cave
#

!permissions

frank driftBOT
twilit jasper
#

How do permissions with numbers work, for example limiting the number of homes? Do developers just query for some "plugin.home.$" permission and extract the int at the end?

lament bay
#

I'm trying to Troubleshoot an issue that I'm having with the API.
The code I'm using was working in 1.14; it tests whether a user inherits from a group,
but it's only finding the user's current group and not the chain of inherited groups.
It's taken verbatim from the wiki:
https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#getnodes
My groups have been defined and each has one parent group added.
https://github.com/lucko/LuckPerms/wiki/Usage#making-a-group-inherit-another-group

wooden zodiac
#
            User user = LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId());
            user.setPrimaryGroup(Main.firstRank);
            LuckPermsProvider.get().getUserManager().saveUser(user);
#

Any reason why that won't work?

lament bay
#

Is this only used for online players?

lament bay
#

I think my problem is related to not selecting a context. If I use /lp group group_name permission checkinherits group.default global then I get the expected message

#
public CompletableFuture<Boolean> inGroup(String groupName, UUID uuid)
{
    checkNotNull(groupName, ERROR_NULL.stringFormat("variable", "group"));
    checkNotNull(uuid, ERROR_NULL.stringFormat("variable", "player uuid"));

    final Group group = permsApi.getGroupManager().getGroup(groupName);

    if (group != null)
    {
        return permsApi.getUserManager().loadUser(uuid)
            .thenApplyAsync(
                user -> user.getInheritedGroups(
                    QueryOptions.nonContextual()
                )
                .stream()
                .map(Group::getName)
                .anyMatch(n -> n.equalsIgnoreCase(group.getName()))
            );
    }
    else
        return CompletableFuture.supplyAsync(() -> false);
}

This is the solution I came up, appears to work now. (I don't have any custom contexts)

oblique cedar
#

is there a method to check the players group ?

crystal sonnet
#

There are a few different things as a player can have multiple groups

#

What exactly do you want?

oblique cedar
#

im making a /reclaim system

#

and i want to check the players group

#

the plugin adds a permission like group.default

#

or something along those lines

#

but permissions wont work because a player can have multiple of those

#

and if the player is opped too

#

that is why i want to check it through the api

lament bay
#

You would use a method similar to the one I linked above

#

I just pass the name of the group and the player's uuid

tight monolith
#

hi, how is it possible (using the api) to list all users that are in a certain group?

crystal sonnet
#

@oblique cedar do you want to check if a player is in a group or get the player’s most important/primary group?

oblique cedar
#

if a player is in a group @crystal sonnet

frank driftBOT
#

Hey RumDum! Please don't tag helpful/staff people directly.

oblique cedar
#

nvm, its ok

#

i made my own data file

#

thanks for responding though

real flint
#

i know you figured it out, but i'm guessing it'd be

User user = ...;
if (user.getPrimaryGroup().equalsIgnoreCase(""))
{
    if (player.isOpped())
    {
        //do stuff here
    }
    player.addPermission("");
}```
oblique cedar
#

thanks

nova osprey
#

Guys just a quick question ive been setting up ranks on another server i have three tracks, staff, donor and ranks, i want to make it so when they inherit the donor rank only when they are staff, it doesnt replace their normal rank how do i do that?
I only want this to happen for staff because we dont want more then two prefixes normal players can have the donor and normal rank but when they are a staff member there are then 3 prefixes which looks weird so i want the normal rank to replace the donor rank so staff members only have two prefixes
the staff prefix and the ranks prefix

#

but still inherit permissions from donor

crystal sonnet
wheat veldt
#

yoo

#

so my old method of getting a group prefix doesn't work with version 5 public String getGroupPrefix(Group group) { Optional<String> prefixes = group.getOwnNodes().stream() .filter(Node::isPrefix) .map(Node::getPrefix) .min(Comparator.comparing(Map.Entry::getKey)).map(Map.Entry::getValue); if (prefixes.isPresent()) { String prefix = prefixes.get(); return prefix; } return null; }

#

getOwnNodes() & isPrefix & getPrefix is gonezo

#

would anybody be able to help a fella out?

grim cape
rigid ridge
#

Hi. Just hypothetically speaking, when a player temporarily inherits a ground (i.e. for 7 days), is there a way to fetch the remaining time of the inheritance of the group through the API?
For more context, I'm wanting a command that displays how long a player has left of a group.

#

Please ping me for a reply!

crystal sonnet
#

@wheat veldt get the metadata of the user object and from that get the prefix

nocturne elbow
#

!help

frank driftBOT
#
Available commands:
β€Ž

!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!cauldron
!chat
!colours
!commandequivalents
!commands
!config
!context
!default
!downloads
!editor
!errors
!essentials
!extensions
!faq
!helpchat
!install

β€Ž

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

nocturne elbow
#

!helpchat

frank driftBOT
#
Helpchat

Helpchat is a general plugin assistance discord as well as the home of DeluxeChat, PlaceholderAPI, and many more.

Helpchat Discord
nocturne elbow
#

Hi, how to get the umm User and his primary group?

#

in the newest LuckPerms of course

#

public static String getGroupName(Player p) {
return LuckPerms.getApi().getUser(p.getUniqueId()).getPrimaryGroup();
}

#

i had that

#

that was version 3.5 i think

clever rose
#

Not exactly related to the API, but anyone mind quickly explaining how the luckperms online editor works?

nocturne elbow
#

/lp editor

#

And there you go

clever rose
#

I mean programatically

wheat veldt
#

@crystal sonnet I need the group prefix though, not a players prefix

frank driftBOT
#

Hey Sam! Please don't tag helpful/staff people directly.

clever rose
#

I didn't look into it too much but I didn't see much relating to web requests, but I'd imagine that's what it is?

nocturne elbow
#

I think it connects to the webpage from luckperms via API

clever rose
#

Does it make a new session by making a post request?

#

with all the perms etc.

nocturne elbow
#

And umm lp itselfes is connected too and when you hit the command it will get the session from webpanel and sync the things you edited

crystal sonnet
#

@wheat veldt why?

nocturne elbow
#

Sth like that

crystal sonnet
#

The players prefix includes the ones that come from groups

wheat veldt
#

hm well

nocturne elbow
#

public static String getGroupName(Player p) {
return LuckPerms.getApi().getUser(p.getUniqueId()).getPrimaryGroup();
}
@nocturne elbow how i can get it in v5? BrainStone

#

:c

clever rose
#

i don't think you understand what I mean

wheat veldt
#

if I were to do it that way, id need to be able to get the prefix from a specific track

clever rose
#

how is it obtaining the information about the server

#

is a post request made prior?

crystal sonnet
#

@clever rose LP uploads a JSON with all permission data onto https://bytebin.lucko.me/. That gives back an ID where you can access the data

#

The ID gets appended to the editor link

#

And that accesses the data

#

Saving works the other way round

clever rose
#

ahh

crystal sonnet
#

@nocturne elbow should work the same way

nocturne elbow
#

Nope it does not

#

It is from lp 3.5 or sth like that

crystal sonnet
#

Did you try it?

nocturne elbow
#

Since idk v5 the api is refreshed fully i think

#

Did you try it?
@crystal sonnet sure

frank driftBOT
#

Hey LoΓ―c K. | RainyDev! Please don't tag helpful/staff people directly.

nocturne elbow
#

Srry

#

It is red marked

crystal sonnet
#

Remove the import for the LuckPerms class and let it autoimport

#

That path changed

clever rose
#

I was wanting to do something like this with my own plugin so I was just wondering. Any reason that it doesn't use a post request since it seems like that would be more suited

#

I don't really do web dev, just wondering

crystal sonnet
#

A post request from where to where?

nocturne elbow
#

BrainStone ok, i'll try that

crystal sonnet
#

@wheat veldt what do you mean?

nocturne elbow
#

Umm

#

Have I to import the api itselv or just the normal LuckPerms plugin how it is on Spigot

#

Mc

crystal sonnet
#

Use the API as a dependency

#

Not the plugin jar

nocturne elbow
#

When I've time I'll import in Intellji and use maven

#

Actually i opened in eclipse πŸ˜’πŸ€’

#

I can try i think at 19:30 sth like that :D

crystal sonnet
#

ok

#

@clever rose

A post request from where to where?

#

@clever rose @wheat veldt hello?

clever rose
#

Sorry I left, I thought it would be easier to make a post request from LP to a web api at editor.luckperms.net and that created the id

crystal sonnet
#

There's no difference to where the data gets sent

clever rose
#

I guess I'm straying away from luckperms now, but what would be the best way of handling a scenario where a webapp needs to get information from the server (player count for arguments sake)

crystal sonnet
#

The reason being that it's not uploaded to the editor is that it's just static files. There's nothing on the editor that could handle these requests

#

Either have the server host a web API or have the server upload the data somewhere

clever rose
#

obviously, just wondering why that approach wasn't taken, but I guess it doesn't matter either way as the JSON is still stored and accessed

#

but without hosting a web app in the plugin, there would be no way of querying for the data right? It would just have to be uploaded periodically

crystal sonnet
#

Yes

clever rose
#

is spring the only / main option for that

#

how memory intensive would it be to run spring boot and a spigot serveR?

crystal sonnet
#

Luck decided to upload the data to website because querying isn't necessary and because that makes it a lot more accessible. Many servers are hosted in a way that would prevent them from being able to use additional ports

#

is spring the only / main option for that
how memory intensive would it be to run spring boot and a spigot serveR?
No idea for either

clever rose
#

yeah of course, that makes sense. Just asking for my own purpose as I would want to query the server in order to be able to control certain things, run commands for example

#

alright, thanks!

crystal sonnet
#

To run commands, use the server query

clever rose
#

?

crystal sonnet
#

Minecraft offers a server query

#

Where you can access server data and execute commands

clever rose
#

oh?

crystal sonnet
#

It just needs to be enabled

clever rose
#

on a port?

crystal sonnet
#

server.properties

#

it can even run on the same port as the MC server itself funnily enough

clever rose
#

would you not be able to use that to get server information?

crystal sonnet
#

You can use that to get server information

#

I have never used it so I can't tell you how to do it

#

But it's possible

#

Maybe plugins can add data that's querriable

#

Not sure though

#

You'll need to look into that

clever rose
#

alright, thanks I will

#

thanks for your help

nocturne elbow
#

it does not work BrainStone

#

i added the api

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

It should give you code on how to get the API instance

nocturne elbow
#

brain.exe stopped working

crystal sonnet
#

?

#

Clickl the first link I gave you with the bot command

nocturne elbow
#

k

stray smelt
#

hi hi! is the wiki up to date when it comes to using the API to get a user and grant them a permission node? i've followed the examples and the DataMutateResult is successful but it doesn't seem to add the node to the user and i don't know what i'm doing wrong:


    // ...
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        this.lp = provider.getProvider();
    // ...
        this.permissionNode = Node.builder(String.valueOf(properties.get("node"))).build();
    // ...

    public void grant(UUID playerUniqueId){
        UserManager userManager = this.lp.getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(playerUniqueId);

        userFuture.thenAccept(user -> {
            DataMutateResult result = user.data().add(this.permissionNode);
            System.out.println("granted " + this.permissionNode + " to " + playerUniqueId);
            System.out.println("success=" + result.wasSuccessful());
        });
    }

(using thenAccept instead of thenAcceptAsync because the whole thing is already wrapped in its own async task)

#

building the permission node works so that doesn't seem to be the problem

#

this is my output, is it because there is no context on the node? or does the permission node need to exist somehow (i.e. registered by another plugin) to be added? i have tested with a few fake nodes because i didn't set up any group or other plugin on my test server

[20:04:01 INFO]: success=true```
#

please @ me in case there is an answer and i don't see it c:

rough chasm
#

Is this support for Lucko's Commodore library as well?

#

or only LuckPerms

crystal sonnet
#

@stray smelt make sure to save changes when you're done

rough chasm
#

I've been trying to and understand his custom .commodore file extension , but I'm not completely getting it

crystal sonnet
#

And if you're async anyways you can just use loadUser(xxx).get()

uneven radish
#

hey, good evening πŸ™‚

#

Anyone knows how to set Prefix/Suffix via api?

#

(For a player and for groups)

cold panther
uneven radish
#

Many api changes from 5 to 5.1?

#

AH and thanks πŸ™‚

cold panther
#

5.0 and 5.1 was more a qualify of life update. The update also included some additional methods to have the API more simplistic (ish)

#

The biggest additions being the GroupManager#modifyGroup and UserManager#modifyUser methods. The latter being used in the example I linked

uneven radish
#

Thank you πŸ™‚

cold panther
#

No problemo πŸ™‚

stray smelt
#

ooop right i did forget to save! thank you πŸ™‚ @crystal sonnet

sleek maple
#

Is there a more efficent way to get the weight of a user?

user.getCachedData().getMetaData(queryOptions).getMeta().entrySet().stream().filter(e -> e.getKey()
                    .equals("weight")).mapToInt(e -> Integer.parseInt(e.getValue().get(0))).findFirst().orElse(0);
north basin
#

How can I get all the "active" permissions from a user?
I want to check if a player has a specific permission added to his account (so * will not trigger is, or being opped)?
(Please tag me when responding)

jaunty pecan
#

user.getCachedData().getPermissionData().getPermissionMap()

#

or something along those lines

#

@north basin ^

#

@sleek maple you can just use user.getCachedData().getMetaData(queryOptions).getMetaValue("weight");

north basin
#

Thanks Luck, it worked πŸ™‚

tacit roost
#

Good afternoon, I would like to be informed about the updated api of the new version of LukePerms to get the player prefix

cold panther
tacit roost
#

Tanks

crystal sonnet
#

Hey, how can I listen to the UserManager through the API?
@spring helm what?

tepid night
#

Hello, after using LuckPerms#getUserManager().getUser(#UUID); and getting the prefix of the primary group, I noticed it'll always be default. How would I get the group of a player that's highest on the ladder?

crystal sonnet
#

@tepid night do you really want the highest group, or do you actually want the highest prefix from all groups the player has? (In other words what /lp user <user> info displays as the prefix)

tepid night
#

The latter, yes

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

That should help @tepid night πŸ˜‰

tepid night
#

Thank you

crystal sonnet
#

Just as a quick note, the example uses the 5.1 API

#

If you're on the 5.0 API stuff works different

tepid night
#

That's okay, this should be enough info regardless

crystal sonnet
#

You can also replace this.luckPerms.getPlayerAdapter(Player.class).getMetaData(player) with user.getMetaData()

tepid night
#
user.getCachedData().getMetaData(lp.getContextManager().getQueryOptions(user).get()).getPrefix()```
crystal sonnet
#

That's the 5.0 way

tepid night
#

I'll give it a try and see if that's what I needed. Been hassling with the primary group's prefix for too long

crystal sonnet
#

Because that's not the one you want in the first place πŸ˜‰

tepid night
#

Haha exactly SS_hehe

#

This is for a Pixelmon server which runs on 1.12 / LP 5.0

crystal sonnet
#

Alright

#

I'd recommend to update to 5.1

#

There are no breaking changes

#

Just improvements

tepid night
#

I'm sadly enough not responsible for that or I would've done so as soon as it came out

crystal sonnet
#

Alright

tepid night
#

Thanks a lot though

crystal sonnet
#

You're welcome

tacit roost
#

This version and the LuckPerms-Bukkit-4.2.58 of the plugin I was using but now that I put the latest one doesn't work anymore I would like to know if there is still that version for bungee?

crystal sonnet
#

!api @tacit roost

frank driftBOT
tacit roost
#

extension-legacy-api-1.0.0

#

god

nocturne elbow
#

@proud crypt

frank driftBOT
#

Hey david261! Please don't tag helpful/staff people directly.

nocturne elbow
#

@jaunty pecan

frank driftBOT
#

Hey david261! Please don't tag helpful/staff people directly.

obtuse jolt
#

hmm

#

!paste full server startup log

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!

For console errors:

Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!

Other errors:

Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!

nocturne elbow
#

well done

#

@obtuse jolt

frank driftBOT
#

Hey david261! Please don't tag helpful/staff people directly.

obtuse jolt
#

one more time you ping @nocturne elbow ...

#

also, full server log please

nocturne elbow
#

sorry no english speak [sorry :/]

obtuse jolt
#

Use the free DeepL Translator to translate your texts with the best machine translation available, powered by DeepL’s world-leading neural network technology. Currently supported languages are English, German, French, Spanish, Portuguese, Italian, Dutch, Polish, Russian, Japan...

nocturne elbow
#

yes full logs

#

logs > server ? or elsewhere?

obtuse jolt
#

./yourserver/logs/latest.log

nocturne elbow
#

screenlog I still have

rare inlet
#

Hey all, I'm trying to set a players rank on join but this isn't doing anything, what did I do wrong?

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

            if (provider != null) {
                LuckPerms api = provider.getProvider();
                api.getUserManager().loadUser(player.getUniqueId(), player.getName());
                final User user = api.getUserManager().getUser(player.getUniqueId());
                if (user != null) {
                    user.setPrimaryGroup("a");
                }
            }```
crystal sonnet
#

@rare inlet first of all if you use loadUser, use that to get user instance. Second, no need to specify the user name when you have the UUID, third if the player is online, no need to load the user

#

Next setting the primary group is only changing which one of the groups the player has is the most important

#

It doesn't add groups

#

!api for examples

frank driftBOT
rigid ridge
#

Hi. Just hypothetically speaking, when a player temporarily inherits a ground (i.e. for 7 days), is there a way to fetch the remaining time of the inheritance of the group through the API?
For more context, I'm wanting a command that displays how long a player has left of a group.

crystal sonnet
#

@rigid ridge did you find a solution?

rigid ridge
#

Placeholders πŸ‘πŸΌ

crystal sonnet
#

Ok

sleek maple
#

Is there a event when a user get changed?

crystal sonnet
#

chanched
What?

sleek maple
#

changed*

dusk falcon
#

Guys I need help

crystal sonnet
#

changed*
@sleek maple well what do you mean when a user gets changed?

sleek maple
#

jea

dusk falcon
#

So me and my friends have a apex minecraft server, We ALWAYS Use Luckperms and It works AMAZING, and all of a sudden we install some plugins and NOTHING WORKS, It says that you already inherit the perms, but the prefix does not show, It's al properly configured, It worked before, what do i do?

#

pls i really need help

sleek maple
#

You you installed plugins and one of then is now the primary permission provider...

dusk falcon
#

I only installed Prison plugins

#

ill type a list

sleek maple
#

Yea and one of the is a valid permission provider for Vault.
At least is sounds so

crystal sonnet
dusk falcon
#

Ohhh sorry

crystal sonnet
#

@sleek maple I still don't know what you mean

sleek maple
#

I need to execute something when a user get changed, for example if you add a parent

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

There are a few events

#

They are all pretty generic

#

So you need filtering to do

sleek maple
#

... I allready had a look in to it but there is no javadoc or desciption where there get called.
UserLoadEvent is pretty clear bus PlayerDataSaveEvent...

#

*ok there is no javadoc published to the repo

crystal sonnet
#

There's a javadoc

#

Linked pretty far up on the first of those two pages

sleek maple
#

Yes found it but why isn't it in the maven repo too?

crystal sonnet
#

It is?

sleek maple
#

Ok you are right bur my ide didn't want do download it πŸ˜‘

crystal sonnet
#

That's nothing I can help with

static flame
#

Hey, why isn't this code returns the correct rank of the player:

public String getRank(Player player){
        for(String rank : ranks){
            if(player.hasPermission("group." + rank)) return rank;
        }

        return "-";
    }
crystal sonnet
#

What does it do instead @static flame ?

static flame
#

I have an array of ranks (it's prison so it's just A - Z) but it doesn't return the correct one

#

It always returns A

#

Is it because that all the other ranks inherit from A?

crystal sonnet
#

Yes

static flame
#

Lmao nvm

crystal sonnet
#

Start from the other end

static flame
#

I'll just check from the end

#

Yeah I understood what I did wrong when I wrote it XD

#

Thanks anyway πŸ˜„

crystal sonnet
#

You're welcome

rustic laurel
#

!api @tight wave

frank driftBOT
tight wave
#

@rustic laurel thanks.

frank driftBOT
#

Hey Zeronerve! Please don't tag helpful/staff people directly.

tight wave
#

oops sorry

rustic laurel
#

Hehe

tight wave
#

Clippy should be renamed Cringey

#

I rembember how annoying it was in Office apps

rustic laurel
#

Lol that's the idea, just usefuller

normal glacier
#

Hi question about LuckPerms API

Can i remove node from the player? i know nodes are immutable but is there a way?

rustic laurel
#

!api these two links + the javadocs should explain it

frank driftBOT
summer yoke
#

yo

#

is anyone able to help me

rustic laurel
#

all good, just in G2

desert jasper
#

hello i need to setup world guard, i have a bed wars map and spleef i would like the commands to make seten parts of the world where people can not destroy blocks and a parts that people can destoy blocks

rustic laurel
#

!extracontexts

frank driftBOT
#

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

rustic laurel
#

!extracontext

frank driftBOT
#

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

rustic laurel
#

hm

desert jasper
#

ok

nocturne elbow
#

I've seen the spigot version has an api, does the bungee version so I could make a grant gui to run on my bungee as well as spigot

neat jackal
#

The API is for every platform.

mighty heath
#

hey there folks, wondering if it's possible to get what position of a track a user is in? or if someone could point me in the right direction

ashen cradle
#

Luckperms or LuckPerms?

nocturne elbow
#

me no help thanks πŸ™‚

mighty heath
#

I don't know, i just thought it was one luckperms, it's the api that lets you promote/demote players and get their primary group

nocturne elbow
#

why doesn't luckperms work for me? i put in the console lp editor and nothing

ashen cradle
#

@mighty heath PluginManager is case-sensetive im pretty sure

mighty heath
#

sorry I'm not really understanding, how does pluginmanager come into this? I have luckperms already integrated all fine, I just need guidance in how to check how far up a track a player is

nocturne elbow
#

wanna be friends?

mighty heath
#

?

crystal sonnet
#

@mighty heath yes it's possible

#

Have a look here:

#

!api

frank driftBOT
wheat veldt
#

howcome this is returning multiple prefixes? public String getGroupPrefix(String group) { if (Achievements.luckperms.getGroupManager().getGroup(group) != null) { CachedMetaData cachedMetaData = Achievements.luckperms.getGroupManager().getGroup(group).getCachedData().getMetaData(Achievements.luckperms.getContextManager().getStaticQueryOptions()); String prefix = cachedMetaData.getPrefix(); return prefix; }

jaunty pecan
#

check the meta formatting options in your lp config file πŸ™‚

robust loom
#

Hey! Is there anyone who could help me out with global ranks? I would truly appreciate it! If you can please dm me!

gray tusk
#

hello!

#

so idk why but if i set prefix for luckperms bungeecord it doesnt work

wheat veldt
#

thanks luck ❀️

crystal sonnet
frank driftBOT
#
Please ask your question!

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

Why shouldn't I ask to ask?
crystal sonnet
robust loom
#

Will do! sorry :0

oak nexus
#

Help me @jaunty pecan ?

frank driftBOT
#

Hey Altevi! Please don't tag helpful/staff people directly.

tired pond
#

Many other people can help you

#

That's why there's taff

#

staf

#

f

crystal sonnet
#

!ask @oak nexus

frank driftBOT
#
Please ask your question!

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

Why shouldn't I ask to ask?
oak nexus
#

sorry

crystal sonnet
#

Also be aware of what channel you are in

oak nexus
#

Sorry, but I've read the entire wiki and haven't found the error.
The perms I set up on the bungeeluckperms are not working on the other servers.

crystal sonnet
oak nexus
#

ok

crystal sonnet
#

And I mean the gist of the message is to just ask your question

grim cape
#

noob question here, on the wiki it says to add a permission you type this: DataMutateResult result = user.data().add(Node.builder("your.node.here").build());
Do I really need to have the DataMutateResult or can I just type the 2nd part?

grim cape
#

also whats the difference between Node and PermissionNode

mighty heath
#

Have a look here:
cheers πŸ™‚

frank driftBOT
#

Hey EEJAY! Please don't tag helpful/staff people directly.

crystal sonnet
#

You’re welcome

wanton sedge
#

Can anyone pls help me I am about do cry 😭

#

So I am making a plugin where you tp to a certain location, if you do /afk

#

If you do /setafkspawn , It'll save your world, x, y, z, yaw and pitch to a config

#

So that if you do /afk it'll teleport you to the Location

#

The thing is, when I initialize the Plugin, it reads the config and gets a NullPointerExeption for the saved world

#

Can anyone help me?????

grim cape
#

umm, this is for luckperms only. perhaps you could post it on the spigot forums?

wanton sedge
#

They never answer 😭

nocturne elbow
#

please me help

cold panther
#

@nocturne elbow For future reference, #support-1 and #support-2 are for regular help πŸ˜„ That bug should be resolved in the latest version. Download the nukkit version from here:

#

!downloads

frank driftBOT
grim cape
#

They never answer 😭
@wanton sedge Sometimes you just gotta wait a while πŸ˜‰

wanton sedge
#

I did a post 1 week ago

grim cape
#

Hm, make sure you post it in the correct category. You can always bump the thread.

wicked kiln
#

is there a way to check someone weight?

#

or like if i got rank 1,2,3,4,5 and i got a rank voucher system what is the best way to do it.

rustic laurel
#

!api should have the method for getting weight

frank driftBOT
lilac mountain
#

How can I set a suffix through the api rather than dispatching to command

rapid bolt
#

!api not loaded

frank driftBOT
rapid bolt
#

Hello, I am having this error when trying to use the LuckPerms API:

java.lang.IllegalStateException: The LuckPerms API is not loaded.
    at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:50)
crystal sonnet
#

@lilac mountain you have to wait for the API to be loaded before you can access it

#

It’s best to load it in your onEnable

#

Not earlier

rapid bolt
#

@crystal sonnet How would I load the API?

frank driftBOT
#

Hey JoshuaLovesCode! Please don't tag helpful/staff people directly.

rapid bolt
#

Sorry 😦

crystal sonnet
#

The same way you do it right now

#

Just not as early

#

In your onEnable, as I said @rapid bolt

rapid bolt
#

That is the code I am currently using

crystal sonnet
#

You’re calling that code too early

#

I mean I don’t know how else I can explain it to you

lilac mountain
#

no no I have it loaded I just want to set the suffix through the api and I'm not sure how because the code for getting the suffix doesn't have a set suffix method

rapid bolt
#

It has been 35-40 minutes since I started the Bungeecord Proxy with LuckPerms on it.

frank driftBOT
#

Hey JoshuaLovesCode! Please don't tag helpful/staff people directly.

rapid bolt
#

😦 Sorry, forgot again, I am used to pinging people.

nocturne elbow
#

Your name is cringe @rapid bolt

#

Why would you willingly make your name that

rustic laurel
#

Not the place

#

Not nice

nocturne elbow
#

:/ honesty is the best policy tho

#

Tell me I’m wrong.

rustic laurel
#

not when you have nothing nice to say. Remaining silent is better than hurting another for no reason. Unless you take pleasure from it?

#

i doubt you do

#

so be nice πŸ˜›

nocturne elbow
#

You don’t know me

#

Lol

#

Idk just honestly wanna know why he named himself that

#

Don’t tell me you’re not curious

rustic laurel
nocturne elbow
#

You@laughing at the people in there,

#

? ...

crystal sonnet
#

@rapid bolt is LuckPerms installed?

#

And do you (soft)depend on LP?

#

@lilac mountain sorry, I pinged the wrong person

crystal sonnet
#

@lilac mountain getting the suffix works the same as getting the prefix

#

@rapid bolt just to be sure LP loads before your plugin?

crystal sonnet
#

What version of the API do you use?

rapid bolt
#

Quite urgently need help.

jaunty pecan
#

Hmm that's weird

#

I'll look into it now

#

Doesn't seem to be anything you're doing wrong

#

oh

#

do you have the maven shade plugin defined in your pom.xml?

#

@rapid bolt

rapid bolt
#

Hey, Yes, I am using the maven shade plugin.

#

Is there a problem with the shade plugin?

split sparrow
neat jackal
crystal sonnet
#

@rapid bolt don't shade APIs in ever

jaunty pecan
#

yeah that'll be the problem

#

in this section

#

add <scope>provided</scope>

rapid bolt
#

Ah, Thank you!

jaunty pecan
#

fixed it? πŸ™‚

rapid bolt
#

Just compiling and testing πŸ™‚

split sparrow
#

i probably don't have luckperms

jaunty pecan
#

that's what it looks like

split sparrow
#

nope, it's on my other test server

jaunty pecan
#

:p

rapid bolt
#

Mine started πŸ™‚

#

Thank you so much for creating LuckPerms, Keep up the great work.

jaunty pecan
#

Yay good stuff

#

and np:)

rapid bolt
#

πŸ™‚

#

Have a great day/night.

north basin
#

(mention when responding please)

jaunty pecan
#

Yep, those methods are in api 5.1

#

So your users will need to be using a LP version newer than 5.1.0

#

@north basin ^^

north basin
#

Are there other methods for versions below 5.1?

#

I am not joking, but 90% of my customers that using the plugin are actually using outdated versions of LuckPerms

jaunty pecan
#

Yes there are

#

Instead use the getPermissionData() method which accepts a QueryOptions parameter

#

you can get a query options instance for the player from the ContextManager

#

The javadocs contain the release where each method was added

#

Look for a tag like

#
@since 5.1
#

means the method/class was added in release 5.1 ^^

#

if there's no tag, assume it has always existed (since 5.0)

#

Orrrr, nag your users to update LP :p

bold scroll
#

Hello, im trying to figure out version 5 of LuckPermsAPI, how does one get what group a person is in now?

#

since this no longer works and API wiki is outdated ```java
public static CompletableFuture<Boolean> isAdmin(UUID who) {
return api.getUserManager().loadUser(who)
.thenApplyAsync(user -> user.inheritsGroup(Admin()));
}

jaunty pecan
#

directly in a group? or including inheritance too?

bold scroll
#

I just need to check if user is in group or not

#

so directly yes

jaunty pecan
#
public CompletableFuture<Boolean> isAdmin(UUID who) {
    return api.getUserManager().loadUser(who)
            .thenApplyAsync(user -> user.getNodes(NodeType.INHERITANCE).stream()
                    .anyMatch(n -> n.getGroupName().equals("admin")));
}
#

searches the users own nodes for any group inheritance called "admin"

#

(ignores context)

bold scroll
#

oh, didn't know that was a thing

#

thanks!

jaunty pecan
#

I guess this would be another way of doing it too

#
public CompletableFuture<Boolean> isAdmin(UUID who) {
    return api.getUserManager().loadUser(who)
            .thenApplyAsync(user -> {
                return user.data().contains(
                        InheritanceNode.builder("admin").build(),
                        NodeEqualityPredicate.ONLY_KEY
                ).asBoolean();
            });
}
bold scroll
#

Both of those don't show up, using: ```xml
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.0</version>
<scope>provided</scope>
</dependency>

#

cant change to 5.1

#

doesn't show up as a option

jaunty pecan
#

you might need to refresh the project in your ide after manually setting it to 5.1

bold scroll
#

that worked

#

its the same as above, just nicer without the return

jaunty pecan
#

yep

bold scroll
#

ok

#

thank you

mighty heath
#

might there be a reason why a player relogging into the server gets their rank reset, I'm 99% sure it's something to do with caching

User user = Zelos.permission.getUserManager().getUser(player.getUniqueId());
                    
ImmutableContextSet.Builder immutable_context = ImmutableContextSet.builder();
ContextSet context = immutable_context.build();
                    
Zelos.permission.getTrackManager().getTrack("levels").promote(user, context);

From what I've been able to gather, the "contexts" are which world, server or ect the promotion is applied but I may be wrong there

jaunty pecan
#

You need to save the user after promoting them

fiery quartz
#

i cant put the files from pex over to luck perms :/

#

i dont wanna make all the ranks again

crystal sonnet
#

And second

#

!migration @fiery quartz

frank driftBOT
fiery quartz
#

i couldnt get it to work :/

crystal sonnet
lethal trellis
#

code ~ "Developer" stands for A software developer is a person who is involved in software programming. The term can also be understood to mean an entire company. A software developer is also known as a programmer, computer programmer or application developer.

karmic nebula
#

I've got a method here```java
/**

  • Set group permissions via LuckPerms.
    */
    public void setGroupPermission() {
    User user = api.getUserManager().getUser(name);
    System.out.println(GroupManager.getInstance().getGroupMap().keySet().toString());
    for (String key : GroupManager.getInstance().getGroupMap().keySet()) {
    if (key.equalsIgnoreCase(group)) {
    boolean success = user.data().add(Node.builder("group." + key).build()).wasSuccessful();
    System.out.println("Setting group true: " + key + " : " + user + ":" + success);
    } else {
    boolean success = user.data().remove(Node.builder("group." + key).build()).wasSuccessful();
    System.out.println("Setting group false: " + key + " : " + user + ":" + success);
    }
    }
    }and it's printing[SrAdmin, Owner, Mod, Mvp, Builder, Developer, Admin, Elite, Helper, Master, Matrix, HeadBuilder, HeadOfStaff, Vip, Member]
    Setting group false: SrAdmin : (ApiUser Object):false
    Setting group false: Owner : (ApiUser Object):false
    Setting group false: Mod : (ApiUser Object):false
    Setting group false: Mvp : (ApiUser Object):false
    Setting group false: Builder : (ApiUser Object):false
    Setting group true: Developer : (ApiUser Object):true
    Setting group false: Admin : (ApiUser Object):false
    Setting group false: Elite : (ApiUser Object):false
    Setting group false: Helper : (ApiUser Object):false
    Setting group false: Master : (ApiUser Object):false
    Setting group false: Matrix : (ApiUser Object):false
    Setting group false: HeadBuilder : (ApiUser Object):false
    Setting group false: HeadOfStaff : (ApiUser Object):false
    Setting group false: Vip : (ApiUser Object):false
    Setting group false: Member : (ApiUser Object):false```but when I do /lp user Sms_Gamer_3808 info I just have group default
#

Sms_Gamer_3808 is my username btw, and I have "group" of "Developer"

#

so it's saying I was successful, but when I get my info, it doesn't show my group there

#

wait I might be retarded

rustic laurel
#

hrm

karmic nebula
#

even when I do java public void setGroupPermission() { User user = api.getUserManager().getUser(name); System.out.println(GroupManager.getInstance().getGroupMap().keySet().toString()); user.setPrimaryGroup(group); }it still doesn't work

#

oh I'm getting api fromjava provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); api = provider.getProvider();if that helps

mighty heath
#

You need to save the user after promoting them
oh yep, cheers πŸ™‚

karmic nebula
#

o h

#

welp I just wasted 2+ hours of debugging

#

yep it works when I save the user

#

XD

#

api.getUserManager().saveUser(user);

#

thx so much ❀️

rustic laurel
#

sorry mate, want to help but it's not my specialty lol

#

glad you got it working tho!

grim cape
#

when giving/removing a permission do I need the DataMutateResult? the inspection is kinda bugging me..

#

and yes ik i can disable it but still..

sly charm
#

How do u save a group (I know its a stupid question)

crystal sonnet
#

Pretty much the same way you'd save a group

karmic nebula
#

api.getGroupManager().saveGroup(group); ?

crystal sonnet
#

Give it a try

sly charm
#

Thanks @karmic nebula

sly charm
#

!api

frank driftBOT
sudden kelp
#

Is there a list of changed/removed methods between lp api 5.0 and 5.1?

crystal sonnet
#

To my knowledge there were only methods added @sudden kelp

#

Some methods did receive additional parameter lists, but that's it

sudden kelp
#

Okay nice, I updated few of my plugin with heavy lp usages and all are fine. So seems to be ok. thx

crystal sonnet
#

You're welcome

#

I mean if you're not using 5.1 features stick to 5.0, as 5.1 is fully backwards compatible

#

So you can support LP 5.0 and 5.1

uneven radish
#

Hey,is there a method to call the sync like /lp sync command? And is the sync performed async?

cold panther
#

@uneven radish Since permission data syncs automatically on the server it was altered, do you mean /lp networkingsync to push the update to the other luckperms instances?

crystal sonnet
#

I'd also be interested in the use case

#

Not saying there isn't a valid reason to sync from the storage but there's a high chance it's a round about way of doing things

rustic laurel
#

!api @sly charm

frank driftBOT
sly charm
#

@oak crescent Did u work the api out?

oak crescent
#

That's exactly what I want

sly charm
#

How much java do u know?

oak crescent
#

Enough

sly charm
#

@oak crescent I havent tried to build it or anything but

            CachedMetaData metaData = user.getCachedData().getMetaData();
            metaData.getPrefix();```
uneven radish
#

@crystal sonnet Need that to sync user prefix from bukkit to bungee

frank driftBOT
#

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

uneven radish
#

Thanks Ryan :)

sleek maple
#

How do i check if a user have a spesific parent?
Also when his group has the parent.

grim cape
#

.resolveInheritedNodes()

#

i think

#

im noob

sleek maple
#
Set<UUID> uuids = this.luckPerms.getUserManager().searchAll(node -> node.getKey().equals("core.acp.team") && node.getValue()).get().keySet();
java.lang.ClassCastException: de.lightfall.core.TeamService$$Lambda$354/1254152179 cannot be cast to me.lucko.luckperms.common.node.matcher.ConstraintNodeMatcher
    me.lucko.luckperms.common.api.implementation.ApiUserManager.searchAll(ApiUserManager.java:134)
    de.lightfall.core.TeamService.getUsers(TeamService.java:41)

Do enyone know why i get this error here?

jaunty pecan
#

You need to use one of the matchers defined in NodeMatcher

#

so try with something like

#
Set<UUID> uuids = this.luckPerms.getUserManager().searchAll(NodeMatcher.key("core.acp.team")).get().keySet();
sleek maple
#

thx

sleek maple
#

ok... Have the meta core.acp.team: 'true' and do:

Set<UUID> uuids = this.luckPerms.getUserManager().searchAll(NodeMatcher.metaKey("core.acp.team")).get().keySet();

And allways get a empty result

sleek maple
#

I tried the same with permissions and that worked but not the meta

sick marsh
#

Hello! I am trying to make a simple plugin, but can't wrap my head around the api.
I want to give a permission node to users who join.
When players join, give them a certain permission node. The permission Ii want to add is: deluxetags.tag.BetaTester
I want to give the player the permission node, not to a group, since this is a tag for people who jjoin during the beta period.

sleek maple
#

        User user = luckPerms.getUserManager().getUser(someUser);
        user.data().add(PermissionNode.builder("some.permission").build());
        luckPerms.getUserManager().saveUser(user);

@sick marsh

sick marsh
#

Ty

#

what is someUser and how would I get it?

sleek maple
#

uuid

sick marsh
#

so would e.getPlayer().getUniqueId() work?

sleek maple
#

yes

sick marsh
sleek maple
grim cape
#

        User user = luckPerms.getUserManager().getUser(someUser);
        user.data().add(PermissionNode.builder("some.permission").build());
        luckPerms.getUserManager().saveUser(user);

omg i didnt need the DataMutateResult this whole time

sleek maple
#

ok... Have the meta core.acp.team: 'true' and do:

Set<UUID> uuids = this.luckPerms.getUserManager().searchAll(NodeMatcher.metaKey("core.acp.team")).get().keySet();

And allways get a empty result

nocturne elbow
#

Someone that knows german language good plz?

sleek maple
#

ja ich

#

But this qeustion is for #general @nocturne elbow

nocturne elbow
#

Ow

#

I joined discord german server so they helped me but ty anyway ;D

jaunty pecan
#

PrinterNico, ah

#

didn't know you were looking to grab meta

#

although hm, the meta key method should work for that

sleek maple
#

Yea if i do the same thing with a permission it works

#

but not with a meta

jaunty pecan
#

what storage type are you using?

sleek maple
#

MariaDB

jaunty pecan
#

hm ok, I have a feeling it could be to do with the escaping of the . characters

sleek maple
#

Is there a way so escape . ?

jaunty pecan
#

would you be able to quickly test using a meta key team

sleek maple
#

k

#

sec

#

ok this works

jaunty pecan
#

hm ok sounds like a lp bug then

#

I'll look into it

sleek maple
#

isn't there somthing like a UserManager#searchAll() with cached data?

#
Set<UUID> uuids = new HashSet<>();
        Stream<Group> team = luckPerms.getGroupManager().getLoadedGroups().stream().filter(group -> group.getCachedData().getMetaData().getMetaValue("team") != null);
        team.forEach(t -> {
            try {
                uuids.addAll(this.luckPerms.getUserManager().searchAll(NodeMatcher.key(InheritanceNode.builder().group(t).build())).get().keySet());
            } catch (InterruptedException | ExecutionException e) {
                e.printStackTrace();
            }
        });

Now i have this...
I assume there is not smarter way to do this?
It basicly get all users that inits the meta 'team'

jaunty pecan
#

Uhmmm, yep that looks ok

daring dove
#

How can i set a temp perms on luckperms like for a 2 day perms or 3 days @here

#

@wild whale

frank driftBOT
#

Hey ΰ«―βˆšΒ‘β„“ΰͺ½ΟΒ‘૨‘τ β—₯β–Ά_β—€β—€! Please don't tag helpful/staff members directly.

daring dove
#

need urgent help guys

wild whale
#

Bruh

#

Please don't randomly ping people

#

Those who know about the API will be watching this channel

#

I don't know anything about the api and thus do not follow this channel

daring dove
#

sorry man

willow dust
#

How can i set a temp perms on luckperms like for a 2 day perms or 3 days @here
@daring dove this doesn't have anything to do with the API

sturdy niche
#

!api

frank driftBOT
sturdy niche
#

I cannot make new groups with the API?

sturdy niche
#

?

hard lagoon
#

hello

#

Is it possible to get all player's groups

#

nvm figured it out

sturdy niche
#

I can't make groups with the API?

crystal sonnet
#

@sturdy niche yes you can. Have you checked the group manager?

sturdy niche
#

No

#

Is can't find anything about that on the github

sleek maple
#
        Group test = luckPerms.getGroupManager().createAndLoadGroup("test").get();

5s and I found it....

red meteor
#

Hello guys i have set ranks with lucksperm. And i have a scoreboard plugin. How to i see ranks on scoreboard ?

rustic laurel
#

Unless you mean with the luckperms dev-api, ask in #general

red meteor
#

Oh okey

sturdy niche
#

How do i use events when creating a group?

#

so if you make a group

#

it does smth

naive patrol
#

@sturdy niche (I have no idea here) but look at the docs for event.group, that's what's called (afaik) when groups are created

sturdy niche
#

tried, but didnt find what i tried to find

#

:/

sturdy niche
#

uhm?

crystal sonnet
#

As the docs say, don't use the built in event system

sturdy niche
#

what do i do?

#

because interface don't work for me :/

sturdy niche
#
        
        @Nonnull
        Group getGroup();

        @Nonnull
        CreationCause getCause();
    }```
#

I made that ^^

crystal sonnet
#

Read

#

The

#

Fucking

#

Docs

sturdy niche
#

I DID

crystal sonnet
#

No you didn't

sturdy niche
#

i

#

did

crystal sonnet
#

Because if you did then you are blind

sturdy niche
#

bruh wtf

crystal sonnet
#

Because there's an entire section that covers the event system

sturdy niche
#

is this the respond when i can't get something to work?

#

W

#

H

#

E

#

R

#

E

crystal sonnet
#

I know because I used that section myself

#

!api

frank driftBOT
crystal sonnet
#

Note that there are two links

sturdy niche
#

Y

#

e

#

s

#
    private final MyPlugin plugin;

    public TestListener(MyPlugin plugin, LuckPerms api) {
        this.plugin = plugin;

        // get the LuckPerms event bus
        EventBus eventBus = api.getEventBus();

        // subscribe to an event using a lambda
        eventBus.subscribe(LogPublishEvent.class, e -> e.setCancelled(true));

        eventBus.subscribe(UserLoadEvent.class, e -> {
            System.out.println("User " + e.getUser().getUsername() + " was loaded!");
            // TODO: do something else...
        });

        // subscribe to an event using a method reference
        eventBus.subscribe(UserPromoteEvent.class, this::onUserPromote);
    }

    private void onUserPromote(UserPromoteEvent event) {
        // as we want to access the Bukkit API, we need to use the scheduler to jump back onto the main thread.
        Bukkit.getScheduler().runTask(plugin, () -> {
            Bukkit.broadcastMessage(event.getUser().getUsername() + " was promoted to" + event.getGroupTo().get() + "!");

            Player player = Bukkit.getPlayer(event.getUser().getUniqueId());
            if (player != null) {
                player.sendMessage("Congrats!");
            }
        });
    }

}```
#

This

#

ik

#

i

#

don't

#

understand it

#

BUT FINE

#

Be like that

crystal sonnet
#

Then you shouldn't be making plugins

#

This code is very clear and well comented

#

Easy to understand

#

Which means either you don't want to understand it or you can't

#

And in both cases I strongly advise against developing plugins

#

I've said it a billion times and I will a billion more:
Minecraft plugins are not the place to learn programming.
And using the LP API without a solid understanding of Java and MC plugins is even worse of an idea

sturdy niche
#

im so done

oak badger
#

it's frustrating if you don't have a good programming background

#

my experiences with the api have been nothing but positive so far, LP does a great job at documenting

sturdy niche
#

dude i know Java, but i am bad at reading tutorials etc

oak badger
#

with some practice, you should be all good to go

sturdy niche
#

i am not good at reading docs

#

i know it sounds stupid, but i am

#

but ok

oak badger
#

reading docs is an essential skill for programmers

rustic laurel
#

you need to practice reading docs mate, there is too much for us to explain everything

#

pop's right

#

focus on one thing at a time

sturdy niche
#

i've never seen an API like this before

crystal sonnet
#

reading docs is an essential skill for programmers
I'd go to say that if you can't read docs, you're not good at programming

sturdy niche
#

lmao

#

ok

#

then im bad

#

great

oak badger
#

hence it is an "essential" skill

crystal sonnet
#

the LP API is one of the more complicated ones

#

Definately not beginner friendly

oak badger
#

lots of abstraction, you have to read into it a bit to understand how everything works

crystal sonnet
#

Plus you need a solid understanding of how LP works on a fairly deep level

sturdy niche
#

Getting this is null: EventBus eventBus = api.getEventBus();

#

bruh

crystal sonnet
#

That's odd

#

When are you calling that?

sturdy niche
#
        this.main = instance;
        EventBus eventBus = api.getEventBus();```
crystal sonnet
#

When are you calling that

#

In the onEnable or before that?

sturdy niche
#

Bukkit.getPluginManager().registerEvents(new LuckPermsListener(this, luckPerms), this);

#

private LuckPerms luckPerms;

crystal sonnet
#

You don't register that event handler with the bukkit even bus

sturdy niche
#

and what do i need to do then?

crystal sonnet
#

Just construct the class...?

#

I thought you were good at programming...
I mean knowing how to call a constructor is kinda more essential in Java

#

And btw are you getting null as the return value or are you getting a NullPointerException?

#

Huge difference

sturdy niche
#

NullPointerException

crystal sonnet
#

So you pass null for the API instance

#

Which means you didn't initialize the private LuckPerms luckPerms; field

#

C'mon

#

That's what I mean

#

Super basic stuff

#

Now let me explain:
I'm really really not trying to discourage you.
I'm trying to tell you that this is too advanced for you and that you need to first learn the basics.
This stuff is essentially the Iron Man and you're struggling to run a quarter marathon

sturdy niche
#
    private void setupLuckPerms(){
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if(provider !=null) {
            LuckPerms api = provider.getProvider();
        }
    }```
#

okay

#

then i'll do something else than that

crystal sonnet
#

Ok. You store the intsance into a variable called api but do nothing with it

#

How is that supposed to work

sturdy niche
#

yup

crystal sonnet
#

Did you expect that magic programming fairies to tell the compiler that you wanted to store that into the field instead?

sturdy niche
#

your right im too stupid for this

#

i'll just do it when im bette

#

r

crystal sonnet
#

It's not that you are too stupid

sturdy niche
#

yup it is

crystal sonnet
#

It's that you're no where expecrienced enough for this

sturdy niche
#

your right im too stupid for this
@sturdy niche

crystal sonnet
#

You need solid Java knowledge

sturdy niche
#

pls

#

stop

#

with

#

that

#

java

#

I have been banned on other discord, bcs i randomly i can't java

#

i know java

#

but fine

crystal sonnet
#

Clearly not

sturdy niche
#

i don't wanna continue this

crystal sonnet
#

Or not good enough

sturdy niche
#

so bye

crystal sonnet
#

I won't ban you

#

But I'll say the truth

sturdy niche
#

"your bad"

#

ik

#

im bad

#

bye

crystal sonnet
#

Then get better

#

It's literally that simple

#

Work on a simpler projects

#

Work on your documentation reading skills

#

Work on your code reading skills

#

Work on your debugging skills

#

Work on your error reading skills

#

Oh and work on your actual programming skills

#

That's literally all it takes to be a good programmer

#

And the patience of a saint xD

hard lagoon
#

hi

crystal sonnet
#

Hi

hard lagoon
#

question

crystal sonnet
#

!ask

frank driftBOT
#
Please ask your question!

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

Why shouldn't I ask to ask?
hard lagoon
#

is there a way to get

misty hinge
#

java is easy, if u know what ur doing

#

Β―_(ツ)_/Β―

hard lagoon
#

a player's groups

crystal sonnet
#

!aoi

frank driftBOT
#

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

crystal sonnet
#

!api

hard lagoon
#

i tried the group.(group name)

frank driftBOT
crystal sonnet
#

Sure

hard lagoon
#

but i have parents for each group

#

so for example admin would say srmod

#

because admins have group.srmod

#

any other way?

crystal sonnet
#

!api

frank driftBOT
hard lagoon
#

i read

#

only way was group.(group name)

crystal sonnet
#

Well keep in mind that the guides on the wiki are just a very rough and basic guide

hard lagoon
#

i know that's why im here

crystal sonnet
#

If you want to know everything that is possible, check the java docs

hard lagoon
#

link?

crystal sonnet
#

They are linked on the first page of the bot embed

#

Fairly far up

hard lagoon
#

ok thanks

#

!

crystal sonnet
#

API version 5.1 did get some serious upgrades

oak badger
#

i appreciate brainstone for how far he goes to help even though most people would have stopped way earlier

#

hopefully stilau took the criticism well

sturdy niche
#

πŸ‘

toxic ocean
#

Hello, i have a bungeecord server and a i have luckperms installed on the bungeecord server, but i want to add the permissions for the plugins that arent on the bungee server. So i entered all the permissions i wanted, but they arent working. How do i fix this or what is wrong??? @ping me if you can help

tired pond
#

@toxic ocean You need it on the spigot servers as well

#

and a database to connect them all

toxic ocean
#

What database should I use? @tired pond

toxic ocean
#

?

obtuse jolt
frank driftBOT
hybrid python
#

help me pls

obtuse jolt
#

...

#

another multi-poster

dull rover
#

Lol

#

Why doesn't clippy just handle that?

obtuse jolt
#

hmmm possible clippy improvement?

halcyon forum
#

Hello! I've been having a bit of trouble. I've recently made a new role on luck perms after I made this, it instantly put every player under that role. So I deleted the role and it still gives every player the role. I'm not sure what to do next. Any help would be great! Thank you!

crystal sonnet
wide stone
#

I am having trouble setting a users group using the api.
I am handling network ranks using my own system so I solely want to set admins to the admin group.
user.setPrimaryGroup() does nothing as far as I can tell

cold panther
#

@wide stone User#setPrimaryGroup simply sets an already inherited group as their primary group. To set a user's group, you'd need to add an Inheritance Node to the user's data, while also clearing any pre-existing Inheritance Nodes. The best way to set a group can be found here: https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java#L56

frosty meteor
#

Dear Luckperms Support, we downloaded both Luckperms and Luckperms BungeeCord for a BungeeCord server, successfully installed them and connected the MySQL. However, with / lpb, despite multiple rights assignment in the console, only the error message with references to the command for luckperms. * Is indicated without further information in the logs. Sincerely, SneaX

rustic laurel
#

@nocturne elbow not appropriate, read the #rules

#

@frosty meteor if you haven't already, ask in #support-1 or 2

This is for developer API support. If you've already asked or been helped, disregard me

royal aurora
#

Lars, can you ask me a simple question?

#

I checked the wiki and didn't find the answer

rustic laurel
#

You know my position

dull rover
#

What is 2 + 2?

rustic laurel
#

Piracy is bad

#

So when online-mode is true I can, in general 1 or 2 or off-topic

dull rover
#

What is he leaking?

#

Oh

obsidian kindle
#

Hello

How do I use LuckPerms API to remove a specific permission (possible with a wildcard, e.g. * or worldedit.* or my.perm.one) from a player? My current code is (LP Wiki used):

...

User user = luckPerms.getUserManager().getUser(p.getUniqueId());
List<String> forbiddenPermissions = ... // from config

...

            for (String perm : forbiddenPermissions) {
                if (hasPermission(user, perm)) {
                    getLogger().warning("Excessive " +
                            "permissions detected: " + p.getName() + ": " + perm);

                    DataMutateResult result = user.data()
                            .remove(PermissionNode.builder(perm).build());

                    getLogger().info("DataMutateResult[" + perm + "]: " + result.name());
                }
            }

...

    private boolean hasPermission(User user, String permission) {
        ContextManager contextManager = luckPerms.getContextManager();
        ImmutableContextSet contextSet = contextManager.
                getContext(user).orElseGet(contextManager::getStaticContext);

        CachedPermissionData permissionData = user.getCachedData().
                getPermissionData(QueryOptions.contextual(contextSet));

        return permissionData.checkPermission(permission).asBoolean();
    }
...

This code detects "excessive permissions" but does not remove them, here is the debug: https://blob.sx/nT7v

jaunty pecan
#

also, your haspermission method is going to return true even if the user inherits one of those forbidden permissions from another group

#

or if they have a wildcard set

#

or if they're opped

#

which is why you're getting the FAIL_LACKS result when removing the first 3

obsidian kindle
#

the hasPermission method is from LP wiki

#

what I want to achieve is to detect if a player has permission from a configured list (no matter why β€” op, group, whatever) and remove these permissions
How can I do that?

oak badger
#

best way to avoid op problem is just dont use op

obsidian kindle
#

it's a security plugin I write to avoid people hacking ops/permissions

rustic laurel
#

you can disable OP in the LP config

#

i think it's enable-autoop

#

makes OP a node

#

much easier to deal with

#

plus /op stops working too

oak badger
#

how does that work with stuff that actually does require op sometimes?

#

vanilla features like placing command blocks while opped + creative

rustic laurel
#

makes them appear OP when something is checked

#

afaik

obsidian kindle
#

so I just tweak enable-autoop and keep my hasPermission code as is?

oak badger
#

it'd probably be better to tell your users to toggle that as part of the setup for your plugin

#

automatically changing settings for users without telling them is a bit of a sketchy practice in my opinion

#

it's theirs to configure -- not yours

obsidian kindle
#

I'm writing this plugin privately for a server I work on^^
I mean I just tell the admin to tweak that setting, without changing my code, right?

left badger
#
        UserManager userManager = LuckPermsProvider.get().getUserManager();
        CompletableFuture< User > user = userManager.loadUser( uuid );```
this seems to be how you get data about an offline user
is there a different way for bungeecord
cold panther
#

@left badger Could I see where you're invoking the getPlayerDisplayname on line 156 please

#

I'm pretty sure the error is occurring since the bungee api doesn't have any way for you to get the UUID of an offline player, resulting in the UUID being passed to these methods being null. I'm pretty sure you'll either need to query the mojang or namemc api to get the UUID from the username, or you have some form of central database were you simply collect user UUIDs and usernames. The latter option probably isn't very efficient however.

jaunty pecan
#

you're passing a null uuid to getPlayerDisplayName

left badger
#

okay thanks. I just wanted to make sure that I was using the proper method of loading user information for bungee

#

as long as im doing that right, i can work out my null errors

#

thank you

junior sorrel
rustic laurel
#

Send what you're currently trying to and what you're attempting to get it to do

junior sorrel
#

Well, I'm trying to make a plugin that gives you permissions depending on your "faction"
I'm doing it in the most simple way, but I'm having issues with "hasPermission" so I wanted to try with the Luckperms' Permission Check

rustic laurel
#

!extracontexts should be able to do this with placeholderapi, afaik

frank driftBOT
junior sorrel
#

I'll look it, thanks

rustic laurel
#

i mean, might as well use the surface level option where available, saves a lot of problems haha

junior sorrel
#

Yep, but the permissions that I want to "add" is a "NameTag" permission, so it gives you a special NameTag depending on your Faction like "Ghozkiu Alexandria"

rustic laurel
#

that will still work, if your factions plugin has a placeholderapi registered placeholder for faction name

junior sorrel
dull rover
#

What shader / texture pack is that?

rustic laurel
#

in the config, you enter under

placeholderapi-placeholders:
  factionname: "%faction_name_placeholder%"

then you can use the context factionname to give the nametag.tag perm if they satisfy that factionname criteria

junior sorrel
#

in the config, you enter under

placeholderapi-placeholders:
  factionname: "%faction_name_placeholder%"

then you can use the context factionname to give the nametag.tag perm if they satisfy that factionname criteria
@rustic laurel Wow, love u haha, I'll try it, thx

frank driftBOT
#

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

dull rover
#

Okay but what's that texture and shader

rustic laurel
#

however you'd need to add the tag perm for every new faction - why not just use the placeholder in the actual nametag

junior sorrel
#

Yep np, thx πŸ˜„

dull rover
#

Dammit Larry

rustic laurel
#

pls tell Glare he will be sad

dull rover
#

This is why I don't play Roblox with you.

stuck pier
#

Shhh

#

Be shhh

junior sorrel
#

What shader / texture pack is that?
@dull rover Well, it's a Custom texturepack from my server, and I think the shader is "Sildurs Vibrant" I'm not sure.

dull rover
#

Ahh okay

junior sorrel
#

haha, sorry

dull rover
#

I'll sort with that for now

#

Thanks

steady jay
#

Hello, some of my users are getting this error that i'm still trying to get my head around. I'm not using the LuckPerms API I'm just using the vault api to hook into LuckPerms. Here's the error, I don't honestly know what is null as i've tested and tested and still don't get the error my users are getting.

steady jay
#

any help?

crystal sonnet
#

What's the exact call you're making @steady jay ?

steady jay