#luckperms-api

1 messages ยท Page 29 of 1

frank driftBOT
short fossil
#

^ (for me)

raven nebula
#

I'm trying to add/remove a user to/from a group via the API

short fossil
#

Ok so you need help getting an instance

raven nebula
#

Yeah that shows an empty message to me, I assume that's intended ๐Ÿ™‚

#

Exactly!

short fossil
#

Ok so really it is rare to pass a instance of your plugin to an API as they don't really care about your plugin

#

Do you have the dependency setup Josse?

#

(In maven, gradle, etc)

raven nebula
#

I just downloaded the .jar file (LuckPerms-Bukkit-5.1.63.jar) and added it as a library in Eclipse using "add external jars"

short fossil
#

Ah not as familiar, if you are going to continue development I would recommend learning maven, it makes workplace management a lot easier

#

As long as you can see recommended tooltips you should be fine

#

Anyways if you look at the wiki you need to check with Spigot's RegisteredServiceProvider

raven nebula
#

Yes

short fossil
#

The wiki spoons it to you like so:

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

larry its on the wiki mate

rustic laurel
#

I know

short fossil
#

blame luck for the spoposn

rustic laurel
#

that's why I'm spoon your message

short fossil
#

lmao

rustic laurel
#

because you're spoonfeeding Josse instead of just like linking the exact part of the wiki that clearly explains this ๐Ÿ˜‚

short fossil
#

ig thats true

rustic laurel
#

I don't mind at all

#

you do you

short fossil
#

โค๏ธ

rustic laurel
#

but ๐Ÿฅ„

raven nebula
#

Yeah I think I actually got it to work now

short fossil
#

coolio

raven nebula
#

Thank you ever so much!

short fossil
#

np

raven nebula
#

Oh yeah: is there a way using the LuckPerms API to check for the permission of an offline player, or do I need to use Vault for that?

rustic laurel
#

you just load them and then check the perm

umbral axle
#

how to check if player has group in a way that includes inherited groups

#

& also takes into account context?

umbral axle
#

like

#

can i do this except without including ops and *

#

well, only ops is relevant tbh

#

dont think any group has * perm

cedar palm
#

Yall how would I give a permission to a player?

turbid solar
cedar palm
#

thats a command tho?

neat jackal
#

It's an example

cedar palm
#

ah

solemn condor
#

Hi @jaunty pecan, is not about the API, I want to know if you have any lightweight API for downloading dependencies at runtime, I saw that you have it at the Luckyperms but is builtin for the plugin or you use other library?
I'm asking this because the Maven Library from apache (aether + maven) is a hole 8mb and I want something more lightweight

frank driftBOT
#

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

solemn condor
#

Sorry old Clippy

jaunty pecan
#

have a look at Byteflux/libby

#

on github

solemn condor
#

Tkx

#

This work outside Minecraft ?

#

I want to use in a IntelliJ plugin too, not just the plugin

#

I'm working on a script system with Kotlin scripting and it will be fully supported in IntelliJ

jaunty pecan
#

yep should do

solemn condor
#

This library do not resolve dependency graph, right?

jaunty pecan
#

nope

umbral axle
#

is there any way at all to check if a player has a group while excluding ops?

rustic laurel
#

Ops have no relation to luckperms unless you use the autoop system, in which case you exclude anyone with the node luckperms.autoop

raven nebula
#

Is it possible to set a permission false for an op-user? Or should I just deop them?

rustic laurel
#

it is possible, but the better way is to use luckperms.autoop because that effectively ops them but it is controllable as a permission and not externally of LP

mortal quail
raven nebula
#

Hi, I'm sorry, it's me the LuckPerms baby here again, but I just appear to be stuck and I don't know what I'm doing wrong... Why does this code not change the group from a user which is in the group "admins+" (which is a child of "admins") to "admins"?

User user = luckPermsApi.getUserManager().getUser(playerToReply.getUniqueId());
user.setPrimaryGroup("admins");
luckPermsApi.getUserManager().saveUser(user);
jaunty pecan
umbral axle
#

Larry: I meant that group.<group> will return true for ops

#

is there a way to check if the player has the group without including ops?

turbid solar
#

&& !Player#isOp()?

umbral wagon
#

Hello everybody! Is there a possibility to set a bungee group via a bukkit/spigot plugin?

neat jackal
#

If they are synced: Yes

umbral wagon
#

what do you mean with synced?

#

like both in the same tables?

trail token
#

Hello, I know there is a way to do this, however Iโ€™m new to the LuckPerms API; but how would a person check if a player in a group, and then if itโ€™s true I may get that groups display name.

crystal sonnet
#

@umbral wagon synced as in the LP instances use the same database server (including the same table prefix)

umbral wagon
#

@umbral wagon synced as in the LP instances use the same database server (including the same table prefix)
@crystal sonnet okay thanks for the information ^^

frank driftBOT
#

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

crystal sonnet
#

@trail token the 5.1 API has getters for the groups a player is in

trail token
#

Ah ok thanks!

crystal sonnet
#

You're welcome

burnt pilot
#

Who want to join voice 1

wanton drum
#

how to connect permission luckperms with my plugin?

crystal sonnet
#

!api @wanton drum

frank driftBOT
crystal sonnet
#

Though what exactly do you want to do?

wanton drum
stuck slate
#

!api

frank driftBOT
crystal sonnet
#

@wanton drum why not check permissions with the platform?

wanton drum
crystal sonnet
#

Aka bukkit

#

That should work

#

If that isn't working something else is wrong

wild whale
#

obligitory why are your method names capitalized

crystal sonnet
#

Also you should prefix your permissions as to not to collide with other pluigins

wild whale
#

the normal format is pluginname.permname

next wren
#

Why when I do getLuckPerms().getUserManager().getUser(userName) it returns null only for some players? Usually, it works for those particular players when they are online, but if they log off, it returns null, even though they are registered with a rank in luckperms

neat jackal
#

!api You have to load them if they're not loaded already. There should be an example on that page:

frank driftBOT
warm hazel
#

any idea why does LP 5.1.64 sometimes return null when called on an online player?

crystal sonnet
#

Example?

#

return null where?

warm hazel
#

i just got a report from my user
LuckPermsProvider.get().getUserManager().getUser(p.getUniqueId()) returned null

crystal sonnet
#

Under what circumstances?

#

Like were they online on the bungee network but a different server?

warm hazel
#

i don't have this information, however it appears to be a single bukkit server, not a network

crystal sonnet
#

WEll you can try to always load the player

#

Like if you're in an async thread use loadUser(xxx).get()

#

That'll guarantee that it's always loaded

timid finch
#

public void onLeaveBed(PlayerBedLeaveEvent event) {
Player player = event.getPlayer();
String name = player.getName();
player.sendMessage(name "died because he left his bed, what a noob!");
}

#

this isnt working ):

crystal sonnet
#

This isn't general plugin programming support

#

And you didn't tell what's wrong

#

And lastly name "died ...

#

C'mon

cold panther
#

What a unique way of doing concatenation. Downright ignore it

crystal sonnet
#

That's almost the C way of compile time concatenation

severe cedar
#

Hello !
I'm looking for get UserDataRecalculateEvent on bukkit but don't find how to register it ...
Can someone have an example please ?

lucid rapids
dense shale
#

How do I get the prefix of a group?

rustic laurel
#

!API one of the first examples on this page iirc @dense shale

frank driftBOT
dawn orchid
#

I'm a new spigot plugin developer so I'm a bit lost with the api
I know that to load a offline player, it requires future
But if I got a command that the parameter can be both online and offline player, and I have to check if they have the permission (which returns boolean or future boolean)
Do I have to build another command for offline player only or is there a way to do it in one command only?

neat jackal
#

You can check if a user is loaded using UserManager#isLoaded

dawn orchid
#

So if the offline player is not yet loaded, start loading it?
But it's future user... so how do I use it as a User in onCommand..?

neat jackal
#

You can use CompletableFuture#join or CompletableFuture#get. These block the current thread tough, meaning you have to wait for the user to load (which can take some time)

dawn orchid
#

so loadUser(UUID).join() will do?

#
User user;
if(p.isOffline) { user = loadUser(UUID).join() }
else { user = getUser(UUID) }
checkPerms(user);
addPerms(user);
#

in onCommand

neat jackal
#

Seems ok
(But make sure you either have a getUser and loadUser method or use LuckPerms#getUserManager to get one and then call the methods on it)

dawn orchid
#

Thank you ><

dawn orchid
#

They do the same thing but I wonder which one better
(from wiki)

public 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();
    }

(checked javadoc and try it myself)

NodeMap playerData = luckPerms.getUserManager().getUser(player.getUniqueId()).data();
PermissionNode permission = PermissionNode.builder("test.perm").build();
playerData.contains(permission, NodeEqualityPredicate.EXACT).asBoolean()
severe cedar
obtuse flame
#

Hello, I have problem with the API
I have on server HUB (on proxy BungeeCord) and i have this code:
THE FILE
And in BungeeCord console it throws this:
java.lang.NoClassDefFoundError: net/luckperms/api/node/Node
In BuildPath i have LuckPerms the newest version for Bukkit (i tryied BungeeCord version but nothing)

frank driftBOT
turbid solar
#

What version of LuckPerms do you have? @obtuse flame

obtuse flame
#

the latest

#

5.1.64

shadow lotus
#

On 1.15.2?

obtuse flame
#

1.8 and only 1 server is 1.13.2.

shadow lotus
#

Ah

obtuse flame
#

i have 5 spigot servers running on BungeeCord proxy server

#

And i making plugin for BungeeCord

#

In /plugins in BungeeCord i dont have luckpers

#

luckperms*

neat jackal
#

Why don't you use the Bungee platform method for that?

obtuse flame
#

bc it didnt work, :/ thats why i have on every server LP Plugin connected with MySQL Database

neat jackal
#

Right, if you don't have LP installed on Bungee the method is also not gonna work.
But LuckPerms API can't work then too

obtuse flame
#

I can try

#

@neat jackal Thank you alot! It works ๐Ÿ™‚

frank driftBOT
#

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

obtuse flame
#

@frank drift Sorry :DDD XD

shrewd plover
#

Hey! Whats wrong here? user.setPrimaryGroup("admin");
It returns FAIL every time.

short fossil
#

Not 100% sure but pretty sure it takes in an group object

shrewd plover
shrewd plover
#

nvm

#

Fixed it

buoyant grotto
#

hi does anyone know how to get the editor to propose my custom contexts? which method to implement? custom contexts are working, but i can't make the editor to propose them :p

neat jackal
#

Are they working when tab completing?

buoyant grotto
#

hmmm nop

#

maybe we missed something ๐Ÿ˜ฎ

dawn orchid
#

So I tried to add the permission to the player

add(PermissionNode.builder(permission).build()

And when I check from /lp user Player permission info ,
that player has no permission set....

#

But isn't the permission added to user?

rustic laurel
#

Once you add the permission, I think you must save the user

neat jackal
#
  1. Use Node
  2. What is your exact code?
    2.1. Be sure to save the user
dawn orchid
#

Oh I think I didn't save the user..

neat jackal
#

If you're using 5.1 you can also use modifyUser

dawn orchid
#

modifyUser?

#

Oh I'm using 5.1

neat jackal
#
user.modifyUser((User userToEdit) -> 
// add etc, saves automatically
);
dawn orchid
#

Oh this is what I need

#

Thanks! ><

dawn orchid
#
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader (file:/E:/DebugServer%201.16.1/plugins/LuckPerms-Bukkit-5.1.26.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of me.lucko.luckperms.common.dependencies.classloader.ReflectionClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Somehow I got this warning when I was starting the server

neat jackal
dawn orchid
#

Ok~

crystal sonnet
#

@neat jackal @dawn orchid Just fyi loadUser will only ever load the user if they are not loaded already. Meaning if they are loaded itโ€™ll just return them. So no need to check if theyโ€™re online or not.

unique horizon
#

Is there a way to edit a meta node's value using lp 5.0+?

rustic laurel
#

Yes I do believe so

#

!API the javadocs within contain all your answers

frank driftBOT
unique horizon
#

I looked for it and couldn't find anything about it

rustic laurel
#

Have tried just replacing the node?

unique horizon
#
String value = user.getCachedData().getMetaData(luckPerms.getContextManager().getQueryOptions(user).orElse(luckPerms.getContextManager().getStaticQueryOptions())).getMetaValue("home-count");
            if (value != null) {
                user.data().remove(MetaNode.builder("home-count", value).build());
                user.data().add(MetaNode.builder("home-count", "" + (Integer.parseInt(value) + 1)).build());
#

this is what I did

#

but i'm guessing this is wrong because data() is not the cached stuff

#

aka when I check the meta of the player, it won't change

rustic laurel
#

Are you saving the user after you edit them? Pretty sure you gotta do that

unique horizon
#

how do I do that then

rustic laurel
#

Oh I just saw something

unique horizon
#

yeah this isn't for meta

#

cause it only takes boolean value

#

aka permissions

rustic laurel
#

That's for saving ^

unique horizon
#

ah perfect

#

ty

rustic laurel
#

Np! Sorry I'm not actually too familiar with the API of LP, just regurgitation of what I've heard before partyparrot

unique horizon
#

yep, I'm still new too

rustic laurel
short fossil
#

Fetching a group via a String (configurable then) then modifying the user

earnest ferry
#

i'm trying to assign a user a group when they join based on what hostname they connect with, i'm running a plugin which runs on my bungee and the rank get assigned correctly however players join the server too quickly and the group is not updated until right after they spawn. I have an event being triggered on join on my lobby servers to test for rank x or rank y to change where they spawn and they do not have the rank upon immediately joining. what can i do, can i have them wait on "Logging in..." a few seconds longer somehow?

earnest ferry
#

can someone explain why i can't call signalContextUpdate, is then even needed? Would this work? Do i need my ContextCalculator on both proxy & normal servers?

crude plover
#

hello i have a bungeecord server
witch server do you set the luckperms bungeecord PLugins or

#

al the server

rustic laurel
#

@crude plover please do not post in a bunch of channels

crude plover
#

sorry @rustic laurel

frank driftBOT
#

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

obtuse jolt
#

loll

orchid widget
#

Hi guys wondering if someone can help me, I'm trying to see if an OfflinePlayer hasPermission but there is no method

rustic laurel
#

Use the Luckperms API; you load the user, then check, then modify if you want, then save them

orchid widget
#

@rustic laurel i'm struggling on how to load the user

frank driftBOT
#

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

orchid widget
#

i have an instance of the api but dont know what method

rustic laurel
orchid widget
#

to use that loadUser method I need a Player instance though

#

I can only get an OfflinePlayer instance because idk they're online

#

ah theres an explanation underneath

crystal sonnet
#

@earnest ferry make sure you save the changes

earnest ferry
#

Its actually working with my custom ContextCalculator on both servers- it works for permissions with context but not groups (unless the group with context is directly assigned to the user), is it not possible to add "group.exampleA" with a context to the default group?

obtuse jolt
#

using luckperms api?

vale hull
#

oh bad channel

orchid widget
#

hi guys, i just want to know if a player (either offline or online) is in the group "iron" but I'm getting stuck on the last hurdle

#

the error on thenAcceptAsync is "The method thenAcceptAsync(Consumer<? super String>) in the type CompletableFuture<String> is not applicable for the arguments ((<no type> result) -> {})"

#

and the errors on the return lines say "Void methods can not return a value"

short fossil
#

If a user is online, use the Player#hasPermission("group." + groupName)
if not, load the user and do the same thing

#

if you are loading the user it would be User#hasPermission

#

@orchid widget

orchid widget
#

how can i do that async because it says it lags the server if its not async

short fossil
#

All loads and database inquiries are by default async

#

So when you use a completableFuture on the loaded user, it will be async

orchid widget
#

there is no hasPermission method for User @short fossil

short fossil
#

Ah was looking at wrong javadocs

#

Well you can stream through the user's groups and check from there

#

just filter with inheritance nodeType

orchid widget
#

as i tried to do in my initial screenshot

#

but i dont know how to format it to get my result

short fossil
#

No, you tried to get their primary group, which will not work in all cases

orchid widget
#

in which cases will it not work?

short fossil
#

If a group has a lower priority

orchid widget
#

i only have 1 track on my server

#

and they're linear priority, it should work for my server in all cases

short fossil
#

Yes but will a player ever have more then one group?

orchid widget
#

nope

short fossil
#

Then I guess you could, though it is bad practice, your problem in your code is your async usages

orchid widget
#

how can i fix that?

short fossil
#

Easiest and most efficient way is to just stream through groups with inheritance, it provides a more robust usage and is 100% outlined in the wiki

orchid widget
#

great where abouts on the wiki

short fossil
#

:/

#

Not really keen on spooning

orchid widget
#

thats not spooning but okay i'll search through it myself

#

thanks for the help

short fossil
#

๐Ÿ‘

orchid widget
#

there is no user#getNodes() method as outlined in wiki

#

have they updated it

neat jackal
#

What API version do you use?

orchid widget
#

LuckPerms-Bukkit-5.1.26

buoyant moat
#

I'm fairly new to plugin development, so... I'm currently using Eclipse and Java (I know some poeple use Kothlin).

I've made a bungeecord (proxy) plugin, and I was wondering how I would fetch a user's primary/active prefix.

#

@ me

idle locust
#

hey guys, can anybody tell me (or just give me a Method xD) how I can add permissions to Users using the Luckperms API?

#

Im on Bukkit 1.8

fervent reef
idle locust
#

thank you very much

fervent reef
#

hey,
Is there an event that is called when a player's group is changed using the Luck-API?

uncut ice
#

Hey, where i can update the player with the api, when i change the group, the player must rejoin but with command it will be set directly

#

Can anybody help me

warm garnet
#

i'm having a lot of trouble understanding and navigating the docs. could someone help me set a prefix or a player and add a parent to a player?

#

or just point me to the part of the docs that shows that?

#
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(uuid);
#

the only methods i can find are like setprimarygroup

#

but i just want to add a parent

#

and add a prefix

uncut ice
#

Use LuckPerms luckPerms = LuckPermsProvide.get();

#

Java Conventions

warm garnet
#

sure

#

but now

#
UserManager user = (UserManager) api.getUserManager();
user.modifyUser(uuid, );
user.modifyUser(uuid, );
#

is this the right thing to do to add a prefix, and to add a parent group to a user?

#

i'm trying to do
lp user <uuid> meta setprefix <prefixWeight> <prefix>
and
lp user <uuid> parent add <rank>

#

i'm just not sure what the action is meant to be?

cold panther
#

@warm garnet Here's an example of how to add a prefix: https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetPrefixCommand.java. I you don't care about removing a user's other prefixes (Their prefixes, not the group prefixes), just omit the user.data().clear(NodeType.PREFIX::matches) line. As for how to add a parent, your best option is to use the UserManager#modifyUser method. An example for that would be:

Group admin = luckperms.getGroupManager().getGroup("admin");

luckperms.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
    Node node = InheritenceNode.builder(admin).build();
    user.data().add(node);
}

That example loads the admin group, then builds group.admin inheritance node and adds it to the user.

uncut ice
#

How can i refresh a player that the server load the perms from the player?

#

it isnt automatically

#

When i set the rank over the api

cold panther
#

It should almost definitely be automated. Can you show the code you're using to add the rank?

uncut ice
#

it refreshes only whne the player rejoin

#

yeah moment

warm garnet
#

like this?

api.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
        // Remove all other prefixes the user had before.
        String prefix = "[test]";
        user.data().clear(NodeType.PREFIX::matches);

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

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

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

        Group group = luckperms.getGroupManager().getGroup("test");
        Node node = InheritenceNode.builder(group).build();
        user.data().add(node);
});
uncut ice
#

It refreshes the perms only when the player rejoint

#

Ryan can you say me how to update the player?

frank driftBOT
#

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

cold panther
#

In your config, can you checked what your value for sync-minutes is please?

#

@warm garnet That looks fine to me

uncut ice
#

its -1

cold panther
#

Alrighty, that's fine then. Do you mind uploading your config here, just be sure to omit any storage credentials

#

If you upload the file itself, clippy generates a link

warm garnet
#

since i am specifying the prefix weight as i would do with lp user <uuid> meta setprefix <prefixWeight> <prefix>, can i remove this?

Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i + 10).max().orElse(10);
cold panther
#

Yeah, finn

uncut ice
#

Im using MySQL. First i have runned a command over bungeecord. There the player gots the rank directly. But when im using the api over bungeecord, it updates when the player switch the serve

#

How can i update the player?

#

The command does this

#

๐Ÿ˜ฉ

warm garnet
#

thanks!

cold panther
#

Ahhh okay, just to check, do you have messaging-service configured on all your servers?

uncut ice
#

its auto

#

as I said, it works with the command directly, only with the api not

cold panther
#

That's why it's so strange. If the command is always syncing data, so should the API when you're saving the user.

#

What version are you using?

uncut ice
#

The latest

cold panther
#

And when you do /lpb user <user> info and /lp user <user> info, do the UUIDs match?

uncut ice
#

Yes

#

Its synced

#

With my prefix system. When im using /lpb, the rank and the perms updates directly on the subserver (spigot), but when im saving the user with the api, its shows the new rank on /lp and on /lpb, but it dont refresh the perms

cold panther
#

I'm wondering it this is actually an internal issue, because that behaviour is far too strange. Just to check, does luckperms.getMessagingService().pushUpdate(); result in the perms being refreshed?

#

or I suppose luckperms.getMessagingService().pushUserUpdate(user); for that matter

uncut ice
#

Thats nice C;

#

Thank you C;

#

Its function. Now the player is updatet directly

cold panther
#

Awesome!

midnight tapir
#

Hello! It is quite a basic question but I never manipulated Stream and I am currently a bit overhelmed ahah.
Actually, I just need to know if a player have a permission node in his collection, examples from the LuckPerms API wiki clearly look too much for what I want

As an example, I just need to check if an user have the following permission node: mymod.subgroup.permission

(the nodes I am creating are not singleton, so I believe I cannot do a contains() call)

azure latch
#

Why do you need to do an LP API call for that?

#
if (yourPlayerObject.hasPermission("Whateverpermission")) {
  //your code
} else {
  //do smth else
}```
midnight tapir
#

If I remember well, hasPermission is coming from PermissionAPI (I am working with forge), and this embedded api does not handle per-player permissions but only "ALL", "NONE" and "OP"

#

I need to check if a specific player has a PermissionNode, but for now I am getting a bunch of problems with null uuid
(I have been using iterator instead of lambda calcul, but its not the best for the software complexity - but this part is working for now tho)

azure latch
#

Ah yeah, I would only use my way on a Bukkit/Sponge server then

lucid rapids
#

hello, question, my plugin's permissions don't appear in LP's verbose and bukkit's PermissionDefault.TRUE seems to not take affect with LP (as in, the player should have that perm by default). is there anything I can possibly do to make them always appear and PermissionDefault work?

azure latch
#

Specify in your plugin.yml that the permission should be assigned to players by default?

lucid rapids
#

the plugin.yml's permission syntax is wayy too verbose.. i can do it if it's the only choice, but is there nothing else?

#

like, i have a constant Permission(node, PermissionDefault.TRUE) object for each command and subcommand

neat jackal
#

Where do you use the Permission(node, PermissionDefault.TRUE)?

lucid rapids
#

well, essentially it's annotation-based subcommands, so i have an enum which contains all permission nodes and an optionally defined PermissionDefault in the constructor. it constructs the Permission if a perm node string is not null (if null then basically having this permission enum on a subcommand means it requires no permission at all), and inside that same enum it has a high-level method similar to bukkit's hasPermission, which checks if this enum value has a permission and then tests if the player has that permission.

uncut ice
#

How can i add a permission easy to a user

lucid rapids
nocturne elbow
#

how do I get an instance of luckperms? The line luckPerms.getUserManager().getUser(player.getUniqueId()); is throwing an error and I don't know what to import

azure latch
#

You want to get an instance of LuckPerms yet your code is trying to get a User instance, which is LPs Player encapsulation class. Which are you actually trying to get?

nocturne elbow
#

End goal is to get a user instance

#

but don't I need an instance of luckperms before I can get an instance of the user?

#

Apologies. It would appear I'm illiterate. Reading Github more closely helps a lot ๐Ÿ™‚

azure latch
#

Haha

woven frigate
#

Hi. Does luckperms have player group changing event? I just want to remove some player data, if his group changed from vip/mvp to "player"

#

Tag @ me if you know.

rustic laurel
#

!API @woven frigate I believe so, the javadocs here should tell you for sure

frank driftBOT
rustic laurel
#

@nocturne elbow no ads please

nocturne elbow
#

Ok

indigo halo
#

Anyone can explain me how can i remove a MetaNode?
I'm trying with

User user = loadUser(player);
Node node = Node.builder(metaKey).build();
user.data().remove(node);
....saveUser(user);

But nothing happens :S

twin mauve
azure latch
#

Does your plugin happen to load at startup?

#

Also depending on LuckPerms should fix this

twin mauve
#

@azure latch now it's fixed.

#

But I got 1 more question, how do I add a permission node through the API?

neat jackal
oak hull
#

How would I check if a player has a group using the API?

wild whale
#

!api likely has the info you need

frank driftBOT
oak hull
#

I am fully aware that the API has what I need, just wondering how I can access it

wild whale
#

or possibly the API cookbook, see pins

oak hull
#

Found it, thank you.

acoustic notch
#

Hey there, does anyone know a good auto rank plugin, that workes with a timing setup?
For 1.16.1 that workes with LuckPerms

blazing pewter
#

Hello ! I think it's a quite simple question, but i could not find the response so far : how can I filter User::getNodes() (or any user way) to get only nodes that applies to his contexts ?

#

(like a getNodes() with an QueryOptions argument)

thorny echo
fervent reef
#

Hey,
Is there an event that is called when a player's group is changed using the Luck-API?

rustic laurel
#

I believe there is, you should take a look at the javadocs found on the API wiki

#

!api

frank driftBOT
hushed oxide
#

!lp

frank driftBOT
#

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

hushed oxide
#

!permission

frank driftBOT
#

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

hushed oxide
#

!help

frank driftBOT
#
Available commands:
โ€Ž

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

โ€Ž

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

hushed oxide
#

!weight

frank driftBOT
hushed oxide
#

!config

frank driftBOT
short fossil
#

Any ideas as to why LuckPerms won't give all users in a for loop? I've tried using ModifyUser and the CompletableFuture but LuckPerms seems to sometimes just not modify the users groups. It sometimes works with all their groups, sometimes only a few

#

First attempt:

#
private static boolean addGroupToPlayer(String groupName, OfflinePlayer player, boolean isGlobal) throws InterruptedException, ExecutionException, TimeoutException {

            LuckPerms permissions = MinecraftCpas.getPerms();

            Group group = permissions.getGroupManager().getGroup(groupName);


            if (group != null) {
                CompletableFuture<User> userFuture = permissions.getUserManager().loadUser(player.getUniqueId());

                userFuture.thenAcceptAsync(user -> {
                    if (isGlobal) {
                        InheritanceNode node = InheritanceNode.builder(groupName).withContext(DefaultContextKeys.SERVER_KEY, "global").value(true).build();
                        user.data().add(node);

                        permissions.getUserManager().saveUser(user);
                    } else {
                        InheritanceNode node = InheritanceNode.builder(groupName).value(true).build();
                        user.data().add(node);
                        permissions.getUserManager().saveUser(user);
                    }
                }).get(10, TimeUnit.SECONDS);

                return true;
            } else {
                return false;
            }
        }```
#

Second attempt:

#
public void assignGroup(UUID id, String group) {
        // Initialize LuckPerms API
        LuckPerms api = LuckPermsProvider.get();

        Group lpGroup = api.getGroupManager().getGroup(group);

        if (lpGroup == null) {
            Maul.log.warning("Maul assigned admin group does not exist!");
            return;
        }
        
        api.getUserManager().modifyUser(id, (User user) -> {

            Node node = InheritanceNode.builder(lpGroup).build();

            user.data().add(node);
        });
    }```
fervent reef
#

I believe there is, you should take a look at the javadocs found on the API wiki
Thanks for your help... I found an event - it's called UserPromoteEvent - but I think it only works with tracks, doesn't t?

frank driftBOT
#

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

rustic laurel
#

Yes I do believe so

fervent reef
#

Thanks, it works ๐Ÿ˜‚

rustic laurel
#

I think when a group is added to a player there is a node (?) Added to them

#

There is a nodeaddevent

#

In case you don't want to have to use tracks

normal glacier
#

Sooo i have a question probably dumb but how user.getPrimaryGroup works was looking at the docs but i dunno if it gives prefix group node or just the primary group name

rustic laurel
#

Primary group name afaik, or displayname if one is set

normal glacier
#

thank you

twin mauve
#

Is it possible to add a perm node to a list of players?

#

in java?

#
List<SuperiorPlayer> members = SuperiorSkyblockAPI.getPlayer(player).getIsland().getIslandMembers(true);

basically trying to use this list of island members, to be added with a permission node.

azure latch
#

@twin mauve sure it is, use a forEach

#
members.forEach(member -> {
  //get LP User, add permission
})```
twin mauve
#

@azure latch am i getting my list right?

#

because it dont work...

#

there isn't any errors.

abstract walrus
#

if anyone could help with this at all i would appreciate it so much

stuck slate
#

#general because this isn't an issue with LuckPerms or LuckPerms API

abstract walrus
#

๐Ÿ‘

acoustic notch
#

Hey there, I am writing this message as a request to all of the LuckPerms developers..
My request is to please start working at an auto-ranking sistem for the plugin, based on time or experience..
Thank you for the consideration to anyone that will consider this request..

stuck slate
#

it will never get actually implemented

obtuse jolt
#

!suggestions is prob a better place

frank driftBOT
obtuse jolt
#

as if whether it will be implemented is up to the dev (those with red very unlucky tags)

indigo halo
#

Hi!, how can i see all group assigned to an specific user?

#

I think with user.getInheritedGroups(), but i don't understand how QueryOptions works

indigo halo
#

Thank!

midnight escarp
#

Just updateded to the API ver 5

#

how do i create a node??

turbid solar
#

There are some examplews there

midnight escarp
#

thank you

azure latch
indigo halo
#

Hi i have a problem creating a group. I create if with groupManager.createAndLoadGroup(groupName);
The group is create but i cant delete it. If i try to use groupManager.deleteGroup(group) nothing happens and if i try to delete from the Web Site when a apply the changes the log says that the group are removed but if i check it the group still there.

In both cases the group only lose the permission nodes.

Anyone know about ?

frank driftBOT
indigo halo
#

This is the log of my test server. If i remove any group with a custom command are deleted success but if i only generate a link to edit the permission from the site or i try to delete another group by the console , the deleted groups appear again.

https://bytebin.lucko.me/J4n6dLfdhY

nocturne elbow
#

Is there a way to update a existing meta node through the API? When adding a meta node with the same key but different value, it doesn't get rid of the one before.

user.data().clear(testNode -> testNode.getKey().equals("cc-value"));

I also tried clearing any nodes which matched the key but that did nothing either.

#

ah okay, I misunderstood what get key was. fixed by doing

user.data().clear(testNode -> testNode.getKey().startsWith("meta.cc-value."));
indigo halo
#

Hi i have a problem creating a group. I create if with groupManager.createAndLoadGroup(groupName);
The group is create but i cant delete it. If i try to use groupManager.deleteGroup(group) nothing happens and if i try to delete from the Web Site when a apply the changes the log says that the group are removed but if i check it the group still there.

In both cases the group only lose the permission nodes.

Anyone know about ?

Does LuckPerm have a cache or something like that causing the problem? I delete H2 DB files but the problem persists.

short fossil
#

!api

frank driftBOT
indigo halo
#

I found what it's wrong with the groups problem but i don't know how can i fix the corrupted groups.

I has the next code to set a permission node into a group.

groupManager.modifyGroup(groupName, (Group group) -> {
    for(String permission : permissions) {
        PermissionNode node = PermissionNode.builder(permission).build();
        group.data().add(node);
    }
});

When i use a group name with some upper case and try to add a permission the permission doesn't add to this group and the group gets corrupted.

I solved that only adding .toLowerCase() to "groupName" but this solve the future groups but no solve the created groups that are corrupted.

Anyone know, How can i solve it? i think it's a problem with the temporally nodes but i don't know con can i remove they or something like that.

wooden plume
#

is there a 'permission' that a player always has? like, not a specific node, but say for example, would this ```java
player.hasPermission("")

#

I know this aint about the api, but I felt it would be the most relavent place to ask about generic permission stuff for java

uncut ice
#

Try it.

split jolt
#

How can i give a player a permission node?

#

would it work similarly to a group assignment?

turbid solar
split jolt
#

Thanks!

dreamy patio
#

Hi, I was using LuckPerms

#

But the API changed

#

What would be the new events?

#

I was using this UserDemoteEvent and UserPromoteEvent

rustic laurel
#

It's all on the wiki/javadocs

#

!api

frank driftBOT
balmy current
#

Any recommendations for storing permissions data for players that haven't logged in yet? atm I load user from the UUID then completeAsync removing their data, adding a specific accepted group, then saving the user. It works, however for every few users that are added (every 3-4 UUIDs) it adds a second worth of lag for LP pulling up the editor with /lp editor. With only about 500 players (some logged in, some not), it has 30s of worth of delay when using MariaDB

https://pastebin.com/jTgh85uG

balmy current
#

When I manually purge any users that come up with just UUIDs from the DB (the bottom four in the screenshot below, for example) then the lag goes away. Makes me feel like I'm using the API wrong. https://i.imgur.com/QCUMQ9t.png

balmy current
#

Seems that storing usernames remedies the issue. LP might have an issue with reading MariaDB data if it doesn't have a username specified.

obtuse jolt
#

@unreal mantle here as well ^^ lol

nocturne elbow
#

Guys

#

Can you give a string for issuing groups? Like this
public String getGroup(Player player) { try { PermissionUser user = PermissionsEx.getUser(player); return user.getGroupNames()[0].toLowerCase(); } catch (Exception var3) { return ""; } }

stuck slate
#

why there is PermissionsEx when it's help about LuckPerms API?

nocturne elbow
#

Yeah, I know

#

I want to rewrite this system under LuckPerms

#

PermissionsEx to LuckPerms

obtuse jolt
#

!api prob start from here

frank driftBOT
obtuse jolt
nocturne elbow
#

Hey,

when i try to load the luckperms api, but it returns null

turbid solar
#

How are you getting the API?

nocturne elbow
#

LuckPermsProvider.get()

azure latch
#

Is LuckPerms on your server?

potent citrus
#

thats the first thing you ask

pseudo bramble
#

Luckperms would be on the server, otherwise heโ€™d be getting a CNFE

#

So more than likely, heโ€™s requesting the API before itโ€™s even been setup

#

Just kidding, that throws an exception

#

best to show the code you are using so someone can help spot the problem

rigid void
#

Their api makes 0 sense

nocturne elbow
#

But my plugin loads AFTER LuckPerms

turbid solar
#

Show the code?

nocturne elbow
#

My PC isn't on but i have an private variable which i set in my init method, the init method is called in the onEnable and last i have an getter

#

the mode how i set is: LuckPermsProvider.get()

pseudo bramble
#

it'd still be best for us to see the code and full exception you get

#

otherwise, we will just be playing the back and forth game for a while

nocturne elbow
#

I don't get an exception

#

That's the joke

pseudo bramble
#

Then how are you getting a null pointer?

nocturne elbow
#

When i am trying to use the luckperms api

pseudo bramble
#

just show the code

nocturne elbow
#

Bro, i tried to sout the luckperms and its null

#

But wait

#

I'll show you

pseudo bramble
#

does your plugin.yml specify the dependency?

nocturne elbow
#

no, but why?

pseudo bramble
#

You should certainly have that

#

otherwise, you can load before Luckperms

#

But you shouldn't be getting a null there, either an IllegalStateException or the service

nocturne elbow
#

also null

pseudo bramble
#
/**
     * Gets an instance of the {@link LuckPerms} service,
     * throwing {@link IllegalStateException} if an instance is not yet loaded.
     *
     * <p>Will never return null.</p>
     *
     * @return an api instance
     * @throws IllegalStateException if the api is not loaded
     */
    public static @NonNull LuckPerms get() {
        if (instance == null) {
            throw new IllegalStateException("The LuckPerms API is not loaded.");
        }
        return instance;
    }
#

never null

pseudo bramble
#

best thing to ask is, did your plugin load correctly

nocturne elbow
#

Yes

pseudo bramble
#

Soooo

#

that's not null

#

that's the API right there

nocturne elbow
#

Yes

#

But at the twice screenshot

pseudo bramble
#

Then you're likely executing that code before you have even enabled

nocturne elbow
#

No

pseudo bramble
#

hard to give you a full answer when you censored the rest of your boot process

nocturne elbow
#

The Code is after my Join

pseudo bramble
#

when is the listener created?

#

during enable I assume

#

but before or after the LuckPermsProvider.get() call

nocturne elbow
#

I use the listener AFTER my Join

pseudo bramble
#

yes, obviously

#

when do you setup the listener

nocturne elbow
#

after

pseudo bramble
#

All I can say is

#

The LuckPerms API is available and present

#

some issue in your code is why you're getting the null pointer

#

Can't say much more without being able to see the full picture

nocturne elbow
#

Do you want this?

#

its the last listener

pseudo bramble
#

The problem is InventoryUtils

#

you've created it before you've established the API

#

which is asking your plugin instance for the luckperms API immediately, which from your variable, is still null at that moment

nocturne elbow
#

Ohhhh

#

Thxxx

#

Im Stupid

pseudo bramble
#

That's why full context helps!

nocturne elbow
#

Oh okay

rigid void
#

can I get the user's rank with this api?

turbid solar
#

Yes

#

Examplss there

rigid void
#

so if I wanted to print out their rank I would do player.hasPermission("group." + group)

warm garnet
#

can i set a player's nickname with luckperms api?

#

player.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4test")); does nothing

rustic laurel
#

lp api doesn't do nicknames afaik

warm garnet
#
User user = (User) player;
user.setNickname(ChatColor.translateAlternateColorCodes('&', String.format("&%s%s", selectedColour, chosenNick)));
#

i think this is it

#

from essentials

short fossil
#

Initial code should work

azure latch
#

Finn java player.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4test"));That will set a players chat name

warm garnet
#

kats that didn't work actually

#

did nothing

#

setnickname worked, although can't cast directly from player to user. it's working now anyway

tranquil locust
#

Does anyone know if it's possible via Vault API to set a permission with a server context?

#

Or will I have to use the LP API

rustic laurel
#

Think server contexts within LP need the LPAPI

tranquil locust
#

The name of the server used within Vault operations.

#

I assume that means whenever I use vault to set a permission, it will default to the server set by vault-server in the config

rustic laurel
#

perhaps, actually! give it a shot!

tawny breach
#

Hello. I have a question: when changing a playerโ€™s group (/lp user username parent set groupname) is the UserDataRecalculateEvent event raised three times? If so, for what reason? The fact is that I use this event in order to update some displayed information about the player in my plugin. Screenshots of my code below. Everything works as expected, but triggering the event 3 times in a row is slightly alarming. Is there a way to solve my problem better or easier?

marble geyser
#

how do i check player group?

rustic blade
#

@marble geyser

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

How can i get all Groups ? ๐Ÿ˜‚

marble geyser
#

how do i get boolean?

rustic blade
#
public static boolean isPlayerInGroup(Player player, String group) {
    return player.hasPermission("group." + group);
}```
marble geyser
#

playerInGroup("group_name")

#

thanks

rustic blade
#

^^

rustic blade
#

Does someone know how to get All Groups?

is it getLuckPerms().getGroupManager().getLoadedGroups()?

nocturne elbow
#

@jaunty pecan how can i contact you? king regards

frank driftBOT
#

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

rustic laurel
#

Also please follow the rules it appears you have been asked several times

idle locust
#

Hey, is it possible to give Groups temporaly with the API? and if yes, how ๐Ÿ˜„

vital oar
#

Can I retrive prefix in BungeeCord the same as in spigot?

neat jackal
#

Yes, there is no difference of the LP API in different platforms

vital oar
#

ok

idle locust
#

what about my question? xD

crystal sonnet
#

Yes itโ€™s possible. Check the methods on the node builders @idle locust

#

!api

frank driftBOT
idle locust
#

!api

frank driftBOT
vital oar
#

how can i get prefix in a static method

fervent citrus
#

Hi, I gave the group "default" the permission to set users primary parent to "player". When I now issue the "/lp <user> set parent player" command via TextComponents' ClickEvent.Action.RUN_COMMAND, only the text "[LP] Running LuckPerms v...." appears in the chat. Do I need to give the default group another perm as well?

fervent citrus
#

Anybody an idea?

fervent citrus
#

Found another way ๐Ÿ‘

distant patio
#

how can i make it for players cant craft im making a rpg world and i dont want them to craft

turbid solar
distant patio
#

sorry

uncut ice
#

is there an event when a rank expires

#

so when the rank got removed

#

?

tepid night
#

Closest I can find is NodeAddEvent so perhaps try that?

#

Considering groups are nodes identified by group.groupname

#

@hardy violet Hey, you had a post a few months ago regarding adding a node and then saving the user, did you manage to get that working? I can't seem to figure it out:

user.getNodes().add(LuckPermsProvider.get().getNodeBuilderRegistry().forPermission().permission(node).value(true).negated(false).build());
LuckPermsProvider.get().getUserManager().saveUser(user);```
uncut ice
#

How can i check which node is added?

tepid night
#

On event or just checking someone's permissions?

neat loom
#

what to replace the data lines with, so that it is like in pex, only in the LP

#

plz help

neat jackal
#

Looks like SQL to me, why do you want to query the database directly?

normal hedge
#
public boolean hasPermission(String permission) {
        User user = this.getLuckPermsUser();
        if (user == null) throw new NullPointerException("User cannot be null");

        Set<Node> permissionNodes = user.getNodes().stream().filter(NodeType.PERMISSION::matches).map(NodeType.PERMISSION::cast).collect(Collectors.toSet());
        if (permissionNodes == null || permissionNodes.isEmpty()) return false;

        return permissionNodes.stream().map(Node::getKey).collect(Collectors.toList()).contains(permission.toLowerCase());
    }
#

I was wondering if this is the right way of checking if a user has a certain permission

#

NodeType.PERMISSION is what I should be using right?

normal hedge
#

Anyone?

tepid night
#

@normal hedge Found in docs:

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

    CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
    return permissionData.checkPermission(permission).asBoolean();
}```
You can finetune that the way you want but there's no reason for you to go through all nodes the way you do if you can simply check it through `CachedPermissionData`
normal hedge
#

Cheers mate

neat loom
#

can anyone help me set up to the site. privileges were granted to the database when PEX was installed, it issued normally, but now, there are a lot of new tables and I donโ€™t know what to use for what, please help

neat jackal
#

What do you want to do?

tepid night
#

How would I get all nodes (including negated ones)?

neat loom
#

@neat jackal I have a website, you can buy privileges on it when PEX was on, everything worked, but now that there is perm, there are a lot of tables and I donโ€™t understand why it doesnโ€™t work

frank driftBOT
#

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

neat loom
#

May go to Private messages and I will show, but I do not know English well

#

please or someone else\

hardy violet
#

@tepid night Hey, yeah I did actually figure it out eventually.

Node permission = LuckPerms.getNodeBuilderRegistry().nodeBuilder.forPermission().permission("somepermissionhere").build();
User user = LuckPerms.getUserManager().getUser(playerUniqueID);
        user.data().add(permission);
        LuckPerms.getUserManager().saveUser(user);
rustic blade
#

Hey ๐Ÿ™‚

How can i set the parent group of an player if hes not in this group rn ?

check it first with hasPermission("group." + groupName) ?
And after that how can i put him into the group ?

thorny echo
#

!api

frank driftBOT
nocturne elbow
#

Which event should I listen to if I want to do something on /lp user <user> parent set <group>? There doesn't seem to be an event for adding/removing parent groups from a user.

#

Should I listen to NodeAddEvent and check if the node key starts with group.?

neat jackal
#

Check if the node matches with an InheritanceNode`

#

if (Node.getType() == NodeType.INHERITANCE) or something like that iirc

nocturne elbow
#

But for that command it should be on that event, no way around that, right?

neat jackal
#

Yes, I think so

nocturne elbow
#

Alright, thanks!

tepid night
#

@hardy violet Thanks a lot!

hardy violet
#

You're welcome! ๐Ÿ˜„

rustic blade
#

!api
@thorny echo Does not help bc i know that i have to do something with the node stuff but i dont know how xD Thats my problem

frank driftBOT
#

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

rustic blade
#

Hey Clippy! I just quoted his message. ๐Ÿ˜‚

steel edge
#

How can I get all player groups?

tepid night
#

I think with LuckPermsProvider.get().getGroupManager().getLoadedGroups()

steel edge
#

It really was easier than I thought, lol

tepid night
crystal sonnet
#

@rustic blade elaborate your problem

rustic blade
#

Im just want to set the parent group and if the user already is in the group its returning false xD nothing else

dull rover
#

Haven't really had an issue with using Vault before to add perms for players, but did something change recently? Doing permission.playerAdd(null, player, perm); doesn't make it show up in a /lp editor for the player.

signal musk
#

heey @tepid night

tepid night
#

?

signal musk
#

i want permission plugins

#

its this

tepid night
dull rover
#

Okay, so it actually looks like playerAdd is working fine, but using playerRemove doesn't look to actually remove the permission.

mint kayak
#

Hey!

#

how do i get the player Rank Prefix

#

as | Gamer | F4res ยป LoL

#

on hcat

#

chat*

#

| Gamer |

#

how do i use it!

crystal sonnet
#

@mint kayak are you making your own plugin?

mint kayak
#

yes!

#

i need to use the player rank prefix on chat

#

@crystal sonnet

frank driftBOT
#

Hey Hi - F4res,! Please don't tag helpful/staff members directly.

mint kayak
#

@frank drift SORRY

crystal sonnet
#

!api

frank driftBOT
mint kayak
#

i've read it

#

I've understand nothing

crystal sonnet
#

Gonna sound harsh, but using the LP API requires a solid understanding of programming, Java and how plugins work

real flint
#

does nyone know how to set a user's prefix?

crystal sonnet
#

@real flint take a tiny peek above. The last two embeds will help you

real flint
#

xd ye tyy

#

i was not aware there was a prefix node >.<

crystal sonnet
#

Now you are

real flint
#

xD

#

ty

real flint
#

am i allowed to drop plugins related to luckperms here

turbid solar
#

Jars or links to the github?

crystal sonnet
#

Depends on the reason @real flint

real flint
#

ye github

#

just a plugin i made but idk if i can post it

#

its a simple plugin but idk

crystal sonnet
#

What for?

#

Self promotion?

real flint
#

๐Ÿ˜ฆ

#

not reallyy

#

just to show that i made my first public plugin d:

#

thats why i asked first

#

๐Ÿ˜ฆ

crystal sonnet
#

Not the place

real flint
#

aightt

#

kewl

#

ty

crystal sonnet
#

You're welcome

lost geyser
#

hi, ive read the java docs and forums around and couldnt find out why I cant the get group to work (since most of the code has changed in version 5). It is intended to return false since it is not the same group."" but it is only currently observing true (for any group the player is in). I think this mite be because its not "attached" to the luckperms database. I'm also pre new to this plugin

#

i've also read the github but still the same result

crystal sonnet
#

I have no idea what you're trying to do

lost geyser
#

basically im trying to print out in console if a group is identified

#

each time a player connects

crystal sonnet
#

if a group is identified
What?

lost geyser
#

public static boolean isPlayerInGroup(Player player, String group) {
return player.hasPermission("group." + group);
}

#

this

#

but it is showing false each time

crystal sonnet
#

Does it also show false after the player has joined?

#

Also make sure the group name is lowercase

lost geyser
#

i mean true* sorry

crystal sonnet
#

Test it on a non OP player

lost geyser
#

ok

#

will do

#

the opping worked thanks brainstone ๐Ÿ™‚

crystal sonnet
#

You're welcome

nocturne elbow
#

how do i setup luckperms api? and then get the prefix for each player?

neat jackal
#

!api

frank driftBOT
nocturne elbow
#

@neat jackal

frank driftBOT
#

Hey Gonรงalo Filipe! Please don't tag helpful/staff members directly.

nocturne elbow
#

can help?

neat jackal
#

The line looks correct to me, probably something before

wind slate
#

i need help
BAD HELp

rustic laurel
#

No need to ask in several channels

rigid void
#

Use a var

dull egret
#
[18:30:23 ERROR]: Could not load 'plugins\Core-1.0.jar' in folder 'plugins'
org.bukkit.plugin.UnknownDependencyException: Unknown dependency luckperms-api-4.4. Please download and install luckperms-api-4.4 to run this plugin.
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:272) ~[patched_1.16.1.jar:git-Paper-89]
        at org.bukkit.craftbukkit.v1_16_R1.CraftServer.loadPlugins(CraftServer.java:388) ~[patched_1.16.1.jar:git-Paper-89]
        at net.minecraft.server.v1_16_R1.DedicatedServer.init(DedicatedServer.java:208) ~[patched_1.16.1.jar:git-Paper-89]
        at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:940) ~[patched_1.16.1.jar:git-Paper-89]
        at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.1.jar:git-Paper-89]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_251
#

I keep getting this error

#

please help

#

and yes I have downloaded the jar file

turbid solar
#

Did you download the apiv4 expansion?

#

Also tell the plugin dev to use the v5.1api

golden forge
#

don't know how to create the clickable text like the text after /lp editor

dull egret
#

Did you download the apiv4 expansion?
@turbid solar yes

turbid solar
#

Use the new API (v5.1)

dull egret
#
public static String getPrefix(Player player) {
        try {
            if(Bukkit.getServer().getPluginManager().getPlugin("LuckPerms") == null)
                return "";
            final LuckPermsApi lpApi = LuckPerms.getApi();
            User user = lpApi.getUser(player.getUniqueId());
            Contexts userCtx = lpApi.getContextForUser(user).get();
            return ChatColor.translateAlternateColorCodes('&', user.getCachedData().getMetaData(userCtx).getPrefix());
        } catch (Throwable e) {
            return "";
        }
    }
#

then that ^ code won't work

turbid solar
#

examples there for new api

dull egret
#

ty

fiery lava
#

How can I add a User temp. to a group via the API? So I want my plugin to have the same effect as If the Console runs /lp user ... parent addtemp VIP 1w

dull rover
#

Any idea why when using Vault with LP, the Permission#playerRemove doesn't actually remove the permission? Adding perms works just fine.

crystal sonnet
#

@dull egret if you really don't want to use the new API, you can still use the old one and use the legacy api extension

#

!legacy

frank driftBOT
#

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

crystal sonnet
#

!extension

frank driftBOT
#

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

dull egret
#

Thank you Brian!

crystal sonnet
#

!extensions

frank driftBOT
crystal sonnet
#

That one

dull egret
#

tysm

#

๐Ÿค

acoustic grail
#

How to get information about groups of different players?

crystal sonnet
#

!api

frank driftBOT
acoustic grail
#

Thx sorry for bother

crystal sonnet
#

No problem

near bramble
#

I want luck perms on my server, but itโ€™s forge, is there a alternative? For forge

crystal sonnet
#

LuckPerms is only available for Sponge @near bramble

fresh summit
#

hey guys, i need placeholders for prefix for TAB and Essentials pls

rustic laurel
#

This is not the correct channel

#

And do you mean LP placeholders?

fresh summit
#

yeah

rustic laurel
#

!placeholders

frank driftBOT
dull rover
nocturne elbow
#

@dull rover Wouldn't know, it's always worked fine for me... And by the look of things, for everyone else too lol because no one said nothing on that

dull rover
#

Yeah, it's pretty weird.

nocturne elbow
#

Any idea why when using Vault with LP, the Permission#playerRemove doesn't actually remove the permission? Adding perms works just fine.
@dull rover You sure youre doing it right?

dull rover
#

I'm fairly sure. It's just Permission#playerRemove(player, perm)

nocturne elbow
#

isn't it #playerRemove(World, OfflinePlayer, String)? nvm you're right too lol

#

but

#

for #playerRemove(Player, String) it also says:
Will attempt to remove permission from the player on the player's current world. This is NOT a global operation

#

so you might be better doing perms.playerRemove((World) null, player, node)

#

@dull rover sorry for the ping ๐Ÿ˜›

dull rover
#

I tried that too, sorry, I should've mentioned that.

nocturne elbow
#

aaa aa

dull rover
#

I also tried giving the player the perm with the world too and removing it with the world and nothing.

#

At first I thought it was because I was doing it async, so I forced it back to sync, and still nope.

nocturne elbow
#

๐Ÿค”

#

manythink lol why is this emote here

#

I love it

tribal wave
#

hello humans

#

i'm trying to make a discord bot which would interact with the luckperms permissions database, and I this is the most relevant channel to that end

#

is there any information about how to get certain information about a player straight from the database, without going through the luckperms API?

#

or maybe there already exists an API which doesn't need to be implemented in a plugin

rustic laurel
#

There's not much to it I suppose, just get the information like you would from any other database. However that kinda does avoid the LP API which you'd probably be better off using for a few reasons

#

The main one is primary group calculation, which is done through the LPAPI but not in the database-in the database the primary group needs to be manually set, while LP will calculate the highest weight one for the API

tribal wave
#

hmm well i'd much rather use the API too, not only for that but also because i've never worked with SQL databases before so i'll have less hurdles

#

but i was under the impression that i could only use the API within a plugin, since it uses the LuckPerms plugin object

#

and since i want to make a discord bot i want it to be separate from my plugins / server, and all that

rustic laurel
#

That's something I hadn't considered; tbh idk about that- however perhaps you can make a plugin that is the discord bot, in a way.

tribal wave
#

i was thinking about that too, but i'm a little bit concerned about performance

rustic laurel
#

As for whether the LPAPI is solely for plugins, I have a feeling that it may not be but I don't know for sure, so best to leave that question here. However you can peruse the docs on that here

#

!api

frank driftBOT
tribal wave
#

alright, thanks once again Larry ;)

rustic laurel
#

Np!

near bramble
#

Hmm... How do u use LuckPerms with sponge forge

rustic laurel
#

The developer API?

slow idol
#

Alright, here's one I haven't been able to figure out (bare with me, I am new to this)

#

How do I get all of the users in a specific group?

#

To be honest, I don't even need the users, I just want to know how many there are

#

I don't really understand how to use the searchAll function, there isn't really an example for it or any explanation as to how to use it in the docs

#

Oh, wait, I'm dumb, nevermind

#
Map<UUID, Collection<Node>> col = luckPerms.getUserManager().searchAll(NodeMatcher.key("group." + group.getName())).get();

The col.keySet() is the list of user UUID matches, simple enough

dull rover
#

I'm a little noobish for the API, but, what's the proper term or way to check if a group has a subgroup? Is that the track weight thing?

jaunty pecan
#

group.getNodes().stream().anyMatch(NodeType.INHERITANCE.predicate(node -> node.getGroupName().equals(subgroup)));

#

is one way to do it

#

you could also use group.getInheritedGroups()

dull rover
#

Ooo okay cool

maiden quest
#

hey

#

where can i report errors?

#

i have a big error that popped out of no where

#

it doenst let anyone join i htink its because of memory

rustic laurel
#

If it related to the dev-api, ask here. If not, #support-1

maiden quest
#

okay

slow idol
#

To add a user to a group, would I just do

DataMutateResult result = user.data().add(Node.builder("group." + groupName).build());

?

#

'cause I see in the usage wiki it shows to do so for a permission, but when I try it with a group nothing happens

rustic laurel
#

save the user after as well

slow idol
#

Ahhh, okay, I missed that part on the wiki. I'll try that, thanks

#

Sweet, it worked. Thanks!

rustic laurel
#

np!

dull rover
#

So I saw there's a method to load all groups, is there one for all users? Or do I have to get all the unique UUIDs and then load each one individually?

marsh matrix
#

Hello! I'm having some issues @ loading LP provider on server start (sponge). The strange thing is that I have 2 projects, with the exact same gradle file, and the exact same ProviderRegistration

#

but when trying to load, it comes up with this:
java.lang.NoClassDefFoundError: Lnet/luckperms/api/LuckPerms;

#

(for 1 project only, the other one works fine)

pseudo bramble
#

@marsh matrix does the failing project have luckperms depended on? Could be a case of luckperms not yet being constructed

marsh matrix
#

it depends on luckperms indeed, both of them do, but literally same gradle, and same code section of the loader. Something that I'm thinking of, is that one plugin starts with the M (the one that works) and the one that doesn't work starts with an H

#

so ig it's trying to load that before LP, as it starts with an L?

#

I'll try to use the gamepostinitializationevent, and see if that fixes it

pseudo bramble
#

Mind if I see your main class?

#

Itโ€™s definitely sounding like class loader issues

marsh matrix
#

sure, sec

crystal sonnet
#

@marsh matrix don't shade/include the LP API in your jar

marsh matrix
#

I'm not

#

and even then, the gradle file is the same

crystal sonnet
#

Double check that please

pseudo bramble
#

You forgot the dependency aspect of the plugin annotation

#

So itโ€™s going to load itself before luckperms thanks to alphabetical loading

crystal sonnet
#

And that

marsh matrix
#

yup, that was it, have never really had to add dependencies, but makes sense, thanks a lot for the help guys!

dull rover
#

Would there be any reason that I'm missing that the API would not load all groups when running api.getGroupManager().loadAllGroups().join();? (Yes, I know this is blocking).

crystal sonnet
#

Typically speaking all groups should be loaded

#

Have you tried getting all loaded groups instead?

dull rover
#

Yes, and it's iterating some loaded ones but not all that should be there when calling loadAllGroups()

crystal sonnet
#

Anything special about those groups? And is it always the same groups?

dull rover
#

Here's what actually is returned from that method.

#

Yeah, it's only those groups that actually load.

crystal sonnet
#

And what happens when you do the same with the loaded groups?

dull rover
#

Wdym?

crystal sonnet
#

The group manager has a call to give you all already loaded groups

#

Have you tried that?

dull rover
#

Correct, it's empty if I don't do api.getGroupManager().loadAllGroups().thenRun(()

crystal sonnet
#

How early are you calling this?

dull rover
#

It's command-based so I wait till I can login to run the command.

crystal sonnet
#

So groupManager#loadedGroups is empty with an active online player?

dull rover
#

Let me double check. One moment please.

#

Ahh, it's the same, my bad. So calling the method to load doesn't seem to add the rest.

crystal sonnet
#

I would have been surprised

dull rover
#

In the web editor, I do see all 44 groups.

crystal sonnet
#

Do these missing groups have any permissions?

dull rover
#

Yup, they all do.

#

It's just weird that according to the API, it's only 7 or 8 groups loaded.

crystal sonnet
#

And youโ€™re really just iterating over them. Not filtering any out, right?

dull rover
#

Correct!

#
            api.getGroupManager().getLoadedGroups().forEach(group -> {
                System.out.println("ADDING GROUP: " + group.getName());
            });```
crystal sonnet
#

What happens if you try to get a group thatโ€™s not on the list by name?

dull rover
#

Would you like me to just run a get or try to load it manually by name first?

crystal sonnet
#

Try both

dull rover
#

Okay! Trying a raw get without loading.

crystal sonnet
#

And a load and get for a different one

dull rover
#

It works without the loading.

crystal sonnet
#

Alright. Thatโ€™s what I thought

#

What plugin version?

dull rover
#

5.1.75

crystal sonnet
#

Alright. Looks like a bug to me. Iโ€™d post it on GitHub

dull rover
#

Alrighty. I can do that. Thank you.

#

Actually, what the heck...

#

I just debugged the size of the loaded groups and it's 44.

#

But it's only iterating over the first 7.

#

Hmm ๐Ÿค”

rustic laurel
#

Big bug time

dull rover
#

I'm just going to hush now. I think it's something on my end cause I just changed how I debugged it and now everything works.

rustic laurel
#

Glares

dull rover
#

Smh. Like 2nd time touching API.

rustic laurel
#

It was a pun bro

crystal sonnet
#

Odd

#

Btw 10/10 pun XD

marsh matrix
crystal sonnet
#

If it throws a NPE one of the earlier method calls threw null. Not the getGroup call @marsh matrix

marsh matrix
#

Apparently this one is throwing it
HeldItemStopper.instance.getLP()
Is it still related to the alphabetic loading issue?

crystal sonnet
#

Depends

#

You might just call it too early

marsh matrix
#

It's after everything

crystal sonnet
#

Check if api is null or not

marsh matrix
#

sure, but why would it be? it sets api to provider().get().getProvider()

crystal sonnet
#

Test it

marsh matrix
#

yea I am, just takes a while to boot up

crystal sonnet
#

So you know if you need to look into that or another place

marsh matrix
#

it's like it cannot find the getLP() method

#

but the IDE is 100% ok with it

crystal sonnet
#

No

#

That would give compiler errors

marsh matrix
#

exactly

#

but it looks like that

crystal sonnet
#

The question is does instance.getLP() return null or throw a NPE?

#

And why do you think that?

marsh matrix
#

I did this

#

LuckPerms getLP() { if (api == null) { System.out.println("no"); } else { System.out.println("yes"); } return api; }

#

and console didn't print neither of those

#

just the NPE error

crystal sonnet
#

Good. Then your instance variable is null

marsh matrix
#

oh

crystal sonnet
#

If a x.y() throws a NPE it's typically x that's null. Especially if you know that y() can't throw a NPE

marsh matrix
#

I'm absolutely retarded

crystal sonnet
#

Programming 101

marsh matrix
#

I apologize for wasting your time lol, just noticed that

crystal sonnet
#

Time to brush up your debugging skills

split hatch
#

i realized I should have asked my question here. I'm really braindead when it comes to this stuff. How does one change out an API. For example LuckPerms verion 4.1.7 requires a version 6 API and I went and I thought I installed version 6 however in my console it still says I am running a version 7.2.0 API.

crystal sonnet
#

Are you talking about the Sponge API?

split hatch
#

yes

crystal sonnet
#

So are you developing a plugin or just running a server?

split hatch
#

running a server lol

crystal sonnet
split hatch
#

ah ok sorry

raven pelican
#

Hey, how do i get the prefix of the highest group of a user

rustic laurel
#

!api

frank driftBOT
raven pelican
#

Should i use the CachedMetaData of the player? or do i need to get an instance to the group or something

rustic laurel
#

What have you tried?

#

This may be useful

#

this as well

#

(and pretty much everything on the second link)

raven pelican
#

is the cached prefix always the prefix of the highest group?

rustic laurel
#

It's probably the highest weighted prefix

#

But I can't guarantee

#

because i have no clue

runic trout
#

Never used the API before so IDK much.

Should I use the API to remove a player permission or just dispatch a bukkit command?

slender palm
#

Hi, what is the best way to catch players' prefix changes?
I've tried listening to NodeAddEvent but the problem is that it only gives me the changed prefix and i want all the stacked prefixes. I can surely get them from Vault using Chat::getPlayerPrefix(Player) but it only updates prefixes after NodeAddEvent is finished so I cannot use it within my listener.

warm garnet
#

does the LP api have an event for a temporary permission expiring?

slender palm
#

Any thoughts about my problem? Pls

verbal cape
#

Boys imma be here soon

#

I want a gui to come when you first join the server

#

And you choose what rank you get, each has their separate luckperms track you can rank up through. can I do that?

#

So Iโ€™m gonna ask really basic questions

#

How can I use the luckperms api in my plugin?

neat jackal
#

You can assign groups and get group information using the API, so yes.

#

!api read the usage page linked here

frank driftBOT
neat jackal
#

There are some easier methods than some that are used on said page

verbal cape
#

Ok I use maven

#

So where do I add the dependencies

neat jackal
#

In pom.xml, if you already have <dependencies>...</dependencies> add a new <dependency>...</dependency> entry

verbal cape
#

Ok maven or gradle

#

Which is better

azure latch
#

Gradle

crystal sonnet
#

I second this

nocturne elbow
#

maven

tired pond
frank driftBOT
#

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

crystal sonnet
#

Taken care of

tired pond
#

Thanks Brain โค๏ธ

opal chasm
#

hey, i need to be able to compare two players' positions in a particular track but i'm not really sure where to start. any tips?

#

basically i need to know how to get the position of a group in a track that a specified player is in

spring creek
#

how can i ask if a group has that permission/or is in that group and then as example set a scoreboard team or a chat color

rustic laurel
#

the setting scoreboard team or chat colour is not up to LP, but as for checking for a permission see these links

#

!api

frank driftBOT
spring creek
#

thx

opal chasm
#

basically i need to know how to get the position of a group in a track that a specified player is in
never mind i've figured out a way to do it :)

unique horizon
#

java.lang.NoClassDefFoundError: net/luckperms/api/node/Node

#

I'm getting this when using the meta note builder on bukkit

#

on sponge, it's fine

#

but for some reason on magma, it won't work

#

or bukkit, just tried

turbid solar
#

Do you have LuckPerms on the server

crystal sonnet
#

Also make sure it's the API v5 and LP v5 @unique horizon

unique horizon
#

@crystal sonnet they are both that

frank driftBOT
#

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

unique horizon
#

And I do have it

crystal sonnet
#

Did you declare a (soft) dependency on LP?

unique horizon
#

Does it matter? Just asking

#

I know LP is loaded cause luckperms work

#

It's just that mine doesn't on magma

crystal sonnet
#

Yes that's important

#

Especially if your plugin is alphabetically before LuckPerms

unique horizon
#

Hmm, will try thank you

crystal sonnet
#

Btw you should declare the dependency on Sponge too

stray current
#

Hey. I am getting a npe when trying to create a node. This is the line creating the node
Node node = luckPermsApi.getNodeBuilderRegistry().forKey(perm).build();

the error is

[07:07:35] [ForkJoinPool.commonPool-worker-4/WARN]: Caused by: java.lang.NullPointerException
[07:07:35] [ForkJoinPool.commonPool-worker-4/WARN]:     at me.lucko.luckperms.common.node.types.Inheritance.parse(Inheritance.java:76)
[07:07:35] [ForkJoinPool.commonPool-worker-4/WARN]:     at me.lucko.luckperms.common.node.factory.NodeBuilders.determineMostApplicable(NodeBuilders.java:64)
[07:07:35] [ForkJoinPool.commonPool-worker-4/WARN]:     at me.lucko.luckperms.common.api.implementation.ApiNodeBuilderRegistry.forKey(ApiNodeBuilderRegistry.java:60)
[07:07:35] [ForkJoinPool.commonPool-worker-4/WARN]:     at io.shaded.nprisonbande.github.freakyville.utilsupdated.v1_13.luckperms.LPHandler.lambda$hasPermission$11(LPHandler.java:201)

I am using version 5.0.72 of luckperms on the server and 5.1 of the API

#

Sometimes I should just read the documentation and not just assume stuff, its Node.builder(perm).build() instead

rustic laurel
#

Also why are you using 5.0 on server and 5.1 API

#

!update @stray current

frank driftBOT
stray current
#

Yea Just upgraded the API version, I had tried with 5.0 API version too

hexed fiber
#
package fr.Phosphate.rankplus.commands;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import me.lucko.luckperms.common





public class CommandTest implements CommandExecutor,LuckPerms {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {

        if (sender instanceof Player)
        {

            player.sendMessage(ChatColor.RED+player.getDisplayName()+"is now player");
        
        }
        
        return false;
    }

}


#

@tribal wave

#

I want to bring up the player's info.

tribal wave
#

you shouldn't be implementing luckperms

hexed fiber
#

how I implement ?

tribal wave
#

first, i'm going to assume you have the API as a dependency

#

right?

hexed fiber
#

hum ...