#luckperms-api

1 messages · Page 54 of 1

swift saddle
#

Can you send the Caused by error?

#

Someone has an idea?

night pier
#

What did you do to define uuid

carmine nova
#

it's a string

#

the uuid is set

main dagger
#

i think you need to get it as a UUID object first

carmine nova
#

Main.luckPerms.getUserManager().getUser(uuid) work for uuid string 😢

#

ho wait

#

string is only for username !

main dagger
#

UserManager.getUser() accepts either a username as a String or a uuid as a UUID

carmine nova
#

getUser(@NonNull String username);
getUser(@NonNull UUID uniqueId);

#

i will try with UUID

main dagger
#

you should be able to do UUID.fromString(string) to turn your uuid string into a UUID object

carmine nova
#

yes

#

thank you is done 🙂

#

i have a another question, if player is not online, it's possible to get the prefix?

#

user is null 😢

main dagger
#

you have to load them first

carmine nova
#

Main.luckPerms.getUserManager().loadUser() ?

night pier
#

Evidently, yes

hybrid panther
#

stop

night pier
#

No PepeJediDance

still echo
#

why ?

night pier
#

What does the error tell you

still echo
#

doesn't exist

nocturne elbow
#

does it compile when you try to actually build it?

still echo
#

no

#

I'm going to clear my project cache

night pier
#

Have you tried invaliding your caches

still echo
nocturne elbow
#

Can you share your pom file

#

Also what does it say when you try to run the package task?

still echo
frank driftBOT
nocturne elbow
still echo
#

hm I just clear my cache and re download everything and it's working

prisma trout
#

hey, how do I compile LuckPerms and get the artifacts pushed to my maven local? ./gradlew publishToMavenLocal doesn't seem to put anything in my .m2

jaunty pecan
#

you might need to add this to the build.gradle's you want to install

#
publishing {
    publications {
        maven(MavenPublication) {
            from components.java
        }
    }
}
#

it's not setup to publish anything by default

prisma trout
#

oh gotcha, thank you Luck

#

def what I need

wooden rose
#

what do I do to fix that?

#

couldnt find it on the docs

hybrid panther
#

The docs tell you how to make an instance of the luckperms api

wooden rose
#

ah so thats what that does

#

smart, ty

hybrid panther
#

🤨

wooden rose
#

thought it would have been named the same

#

it wasnt trhough

frank driftBOT
wooden rose
#

anyone know the issue?

#

you know, I prob didnt do it right

#

oh

#

because its

#

null

#

OHHH I DONT HAVE LUCK PERMS INSTALLED!

main dagger
#

Lole!

nocturne elbow
#

how can i get a offline player's prefix

#

with API

#

BungeeCord Core

hybrid panther
#

Read the docs. There is instructions in the cookbook for that

wraith flicker
#

Hey! I have some problems. I want to get the role of a player in Luckperms API but it doesnt return something. I run the luckperms version for bungeecord v5.4.23

#

Do I have to install luckperms for each server?

night pier
#

are you trying to use the API on a backend server?
LPB is for managing proxy permissions, LP should be on all servers if you want to manage the permissions on that server

wraith flicker
#

So i have a plugin. And everytrime a player sends a message, the prefix should be changed based on the role. And the Plugin is on the spigot server. The problem: I cannot get the group. Do I have to run the plugin on the bungeecord? And how i can get the message from the spigot?

night pier
#

If you're trying to access the api on the spigot server, you need to have LP on the spigot server.

wraith flicker
#

but then i have locally permissions?

#

wait

#

If i install LP on the spigot. Are the permission the same as in LPB?

night pier
#

When synced to a remote db, you can share the same permissions/meta across all LP instances

#

!network

frank driftBOT
wraith flicker
#

thank you, i will try

hushed narwhal
#
                case "npc-vaultkeeper" -> {
                    List<String> iRanks = new ArrayList<>(List.of(
                            "group.default",
                            "group.lite",
                            "group.elite"
                    ));
                    if (iRanks.stream().noneMatch(player::hasPermission)) DonorVaults.open(player);
                    else {
                        send(player, "vault.insufficient_rank.open_gui");
                        pling(player);
                    }
                }
        );``` hi! I'm running this code on my server to only allow certain ranks to interact with an npc, and even after I opped myself *and* removed myself from all the mentioned groups, i'm still getting the insufficient ranks message.
nocturne elbow
#

You are running DonorVaults.open if you don't have any of those permissions, if you do have any you're sending the message

hushed narwhal
#

yeah that's the idea

nocturne elbow
#

And being opped (at least by default) means you would have them

hushed narwhal
#

i removed all groups from myself except group.developer

#

still wouldn't let me open

#

ah

#

so i would just check for not opped and has one of those?

nocturne elbow
#

I would use the LP API directly instead of Bukkit's but you can do that, yes
You would also need to make sure, in your permission setup, that developer group does not inherit from default (or any of those groups for that matter)

hushed narwhal
#

the docs seem to recommend just using hasPermission

nocturne elbow
#

Well it's one way, but I'd check in PermissionHolder#getInheritedGroups

sterile pike
#

is it possible to register permission descriptions in luckperms?

#

nvm that doesnt exist eh

#
    @Override
    public void registerPermission(String key, @Nullable String description, PermissionDefault def) {
        if (def != PermissionDefault.TRUE) {
            return;
        }

        groupManager.loadGroup(DEFAULT_GROUP).thenAcceptAsync(defaultGroup -> {
            Group group = defaultGroup.orElse(null);
            if (group == null) {
                try {
                    group = groupManager.createAndLoadGroup(DEFAULT_GROUP).get();
                    group.data().add(WeightNode.builder(0).build());
                } catch (InterruptedException | ExecutionException e) {
                    Logger.getLogger().severe("Failed to register create and load 'default' group:");
                    e.printStackTrace();
                    return;
                }
            }

            group.data().add(PermissionNode.builder(key).value(true).build());
        });
    }
#

Is this an alright way of essentially registering default permissions?

#

Also, nodes are completely immutable right?

sterile pike
#

I was just missing GroupManager#save(Group)

#

How do I register permissions in the permission tree?

novel kindle
#

can i get perms of luck perms

fringe torrent
#

wut

celest acorn
#

does luckperms have groups cache? if so, how can I check if there is already cached group data before trying to retrieve it async from the database?

jaunty pecan
#

luckperms.getGroupManager()

plain chasm
#

how can I use Luckperms API with bungeecord?

hybrid panther
#

As normal

#

It’s platform agnostic

plain chasm
#

How can I get the instance ?

#

i never worked with luckperms api on bungee

sterile pike
#

Why does luckperms do the jarinjar thing?

#

Also is the plugin ID on bungeecord in fact LuckPerms ?

#

I have

softdepends:
  - LuckPerms

and

    @Override
    public void onEnable() {
        //...
        BungeeCordServerHandler serverHandler = new BungeeCordServerHandler(
            this,
            audiences,
            pluginPresent("LuckPerms") ? new LuckPermsHook() : PermissionHook.empty()
        );

yet my onEnable seems to be called before luckperms

#

I checked LP's bungee.yml but idfk

turbid solar
#

for classloading dependency stuff

#

send luckperms hook code

turbid solar
#

do it in the constructor

sterile pike
#

i don't see how that would help unless to debug the line

#

the log shows that luckperms is loading after my plugin

turbid solar
#

private final GroupManager groupManager;

#

public LuckPermsHook() {
groupManager = LuckPerms…..
}

sterile pike
#

instance fields are initialized right before constructors

turbid solar
#

what i said should work

sterile pike
#

oh mb

#

its my static shit

#

regardless that doesn't change anything

#

LP is still being loaded after

#

maybe a whitespace issue in the yml

foggy zenith
#

Hi! Can I use the LuckPerms API in a velocity plugin?

#

Getting Cannot resolve symbol 'LuckPerms'

#

i'm using maven and have added net.luckperms in dependencies

#

nevermind, LuckPerms api = LuckPermsProvider.get(); works just fine I just had to reload the maven project

foggy zenith
#

Is there a ServicesManager alternative for velocity? I want to use LuckPerms API after it has loaded and simply adding it as dependency doesn't seem to do the trick. ideas?

turbid solar
#

soft depend on luckperms

#

then whatever the onEnable equiv is for velocity do luckPerms = LuckPermsProvider.get();

manic gorge
#

!api

frank driftBOT
compact burrow
#

How to sort rank on luckperms?

wild whale
#

wdym sort?

compact burrow
clever zodiac
#

That’s your tab plugins responsibility

#

Try giving them proper weights & check your tab plug-in config

neon sparrow
#

also, unless you are creating your own tab plugin, this isnt the channel

regal bobcat
#

hey so does anyone know how to display the prefixes when you press tab like the guy above me did? if so prefferably without essentailsX as it causes problems with other plugins on my server

fringe torrent
#

!tab

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

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

List of chat/tablist formatting plugins that work with LuckPerms
coarse locust
#

When doing this, players who have OP or * always return true... what's a way to check groups that doesn't have that caveat?

coarse locust
#

I've tried this method and now it seems that it doesn't even matter if they have the group or not

#

It just returns true 100% of the time

coarse locust
#

Nevermind I'm just braindead

#

Should have been g -> g.getName()

turbid solar
#

i think you also could’ve done isPermissionSet ?

regal bobcat
#

ok so i have managed to get the tablist to display my color but how do i display my prefix in the tablist

sudden kelp
#

Hi, I want to grab a meta value from a player.
I got this:

CachedMetaData metaData = user.getCachedData().getMetaData();
return metaData.getMetaValue("griefdefender:accrued-blocks", Integer::parseInt).orElse(0);

That works, but grabs the value from this server. As this metavalue exists on every server, I need to somehow tell LP the ServerKey of the server I need get the MetaData from.
How could I do that?

nocturne elbow
#

There's a getMetaData that takes a QueryOptions, you'd use the QO.builder and add to it whichever context set you desire

sudden kelp
#

Thanks I am struggling when adding a ContextSet to that queryoptions though. How would I build a simple Context with just the SERVER_KEY?

#

Ah found it thanks!

vocal kindle
#

hey there, i have this code for checking an offlineplayer's permission(s), but it doesn't seem to work, right before that there's a chunk of code that checks the same permissions if the player is online (if (online) {code} else {lp code}) and it works, but when the player is offline it doesn't

            OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);

            UserManager userManager = lp.getUserManager();
            CompletableFuture<net.luckperms.api.model.user.User> userFuture = userManager.loadUser(uuid);

            List<String> permissionCountries = new ArrayList<>();
            userFuture.thenAccept(
                    user -> {
                        QueryOptions options = lp.getContextManager().getQueryOptions(player);
                        CachedPermissionData data = user.getCachedData().getPermissionData(options); <--- also tried without options

                        // TODO FIX THIS

                        if (data.checkPermission("bteconosur.projects.manage.country.ar").asBoolean()) {
                            permissionCountries.add("argentina");
                        }
                        if (data.checkPermission("bteconosur.projects.manage.country.bo").asBoolean()) {
                            permissionCountries.add("bolivia");
                        }
                        if (data.checkPermission("bteconosur.projects.manage.country.cl").asBoolean()) {
                            permissionCountries.add("chile");
                        }
                        if (data.checkPermission("bteconosur.projects.manage.country.pe").asBoolean()) {
                            permissionCountries.add("peru");
                        }
                        if (data.checkPermission("bteconosur.projects.manage.country.py").asBoolean()) {
                            permissionCountries.add("paraguay");
                        }
                        if (data.checkPermission("bteconosur.projects.manage.country.uy").asBoolean()) {
                            permissionCountries.add("uruguay");
                        }

                    }
            );
            permissionCountries.forEach(country -> Bukkit.getConsoleSender().sendMessage(country)); <--- debug
            return permissionCountries;
nocturne elbow
#

loadUser (and anything that returns a CompletableFuture) runs async to not perform blocking IO in, potentially, the main thread
By the time the user is loaded and the thenAccept action runs, your method will have had returned already long ago

#

Either .join/.get on the future to block and wait until it's completed (smelly code, bad, blocking) or return a CF<List<String>> instead, do thenApply and pass a function that returns the list (good, non-blocking)

vocal kindle
nocturne elbow
#

that always ensures the action you pass runs on a different thread

#

because it exists the possibility that the returned future already completed, and if that's the case thenAccept will run in the current thread

#

the entire idea around CFs is that they are non-blocking and the "current thread" never stops to wait until the result returns

clever lichen
#

How do i find the weight of a group by a given prefix?

#

i did this but idk if its going to work

#
u.getNodes(NodeType.PREFIX).stream().filter(n-> n.getKey().equals(prefix)).mapToInt(ChatMetaNode::getPriority).max().orElse(0);
swift saddle
#

how to check if an offlineplayer has an X permission?

pearl helm
#

has 1.19 been released for luckperms?

bright osprey
#

hey guys

#

how is excatly determined which mysql driver is unloaded?

#

if other plugin loads other driver before luckperms may it be unloaded by mistake in this code above?

#

@hollow quiver

nocturne elbow
#

LP uses a relocated "version" to me.lucko.luckperms.lib.mysql, and that string right there is relocated as well so it won't clash with another mysql driver

bright osprey
#

@nocturne elbow are you sure?

frank driftBOT
#

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

nocturne elbow
#

Do you know what relocation is?

bright osprey
#

sure, but i see literal string in code, not an import - maybe i'm wrong

nocturne elbow
#

String literals are also subject to relocation

bright osprey
#

ok

nocturne elbow
#

You can easily check so by decompiling the compiled class for that file (from inside the relocated, final jar file)

timber ravine
#

Do i get an event, when a temp punishment expires?

fringe torrent
#

LuckPerms has punishments now? 👀

main dagger
#

probably referring to meta

fringe torrent
#

I figured :D

timber ravine
#

Oops

#

Permissions

main dagger
#

oh

timber ravine
#

When a temp permission expires

nocturne elbow
#

NodeRemoveEvent

#

check that the Node::hasExpiry and hasExpired

sick ibex
#

server.getCommands().performCommand(server.createCommandSourceStack(), "lp user complacentsee group add great");
Trying to be lazy and interact with LuckPerms through the console - this works for say/gamemode but when running a luckperms command it gets unhappy with a very unhelpful log in the server console

[22:55:39] [Server thread/INFO] [minecraft/DedicatedServer]: Incorrect argument for command
[22:55:39] [Server thread/INFO] [minecraft/DedicatedServer]: ...lacentsee group add great<--[HERE]

Anyone know why this wouldn't work?

#

Having to do this as I can't use the proper LuckPerms api with Forge 1.16.5

nocturne elbow
#

why not thonk

night pier
red violet
#

Hello buys, I’ve asked for some api-help, so if you don’t mind, could I ping you here to ask for help?

#support-1 message

turbid solar
#

!cookbook

frank driftBOT
sick ibex
#

is this not true?

#

If so, any idea why I was getting those errors? Will grab message link with code, errors, and build gradle

nocturne elbow
#

Are you using the Sponge build of LP? Because the Forge build only works on 1.18.2 afaik so naturally there is no LP build using the "official" permissions API before then

sick ibex
#

Could that be why the command isn't being recognised from the mod, even though it's recognised through the console?

nocturne elbow
#

ah no clue about hybrids

sick ibex
#

Going to go run and cry into the Arclight discord now lol

high solar
#

i have this code to grab the primary group of a player, is there a way to get the display name of the group? I haven't been able to find one

            User user = luckperms.getUserManager().getUser(uuid);
            String pteam = user.getPrimaryGroup();```
turbid solar
#

!cookbook

frank driftBOT
high solar
#

ive looked through it and havent found something to get the displayname

turbid solar
#

get the Group object

#

then from there the display name

high solar
#

to get the group i have to do getGroup() right? beceause i keep getting Cannot resolve method 'getGroup' in 'LuckPerms' when i use that

turbid solar
#

check the xookvook

wild whale
#

*cookbook

high solar
#

thanks!

flat iron
#

how to get days to group expire

timber ravine
small oasis
#

Hey guys, i copy, pasted and adjusted the code from the api-cookbook for registration of a NodeAddEvent, my problem is that the event doesnt get fired.
Source-Code: https://p.koboo.eu/show?p=58e32ee2-ce19-4dec-9a57-ca8ee5aad296
Bungeecord-Dump: https://p.koboo.eu/show?p=7872d4d9-af23-4f4f-9546-eeed4dd1a877

Someone has a clue why this isn't working?

I tested the same code on the bukkit-module of the project and that is working. Does LuckPerms for BungeeCord has another API than the bukkit-part?

sudden kelp
#

Hi, I would like to query the following meta note from a player with that given context:
But this code returns 0

ImmutableContextSet serverSet = ImmutableCo
ntextSet.builder().add(DefaultContextKeys.SERVER_KEY, "pixelmon2").build();
var queryOptions = user.getQueryOptions().toBuilder().context(serverSet).build();
var metaData = user.getCachedData().getMetaData(queryOptions);
return metaData.getMetaValue("griefdefender:accrued-blocks", Integer::parseInt).orElse(0);
nocturne elbow
#

it's a ., not a :, lol

sudden kelp
#

hm think I tried that. What about that backslash? Let me try again

clever zodiac
#

wot

#

Whatever it is, it has to match

#

I believe that meta keys can have dot separators

nocturne elbow
#

you only need to query for the griefdefender.accrued-blocks

#

the backslashes are so LP can distinguish between meta, the key and the value

clever zodiac
#

there’s such a thing?

nocturne elbow
#

yes look at the screenshot

clever zodiac
#

interesting

nocturne elbow
#

the backslash is only for storage purposes, not something you should query for or rely on

clever zodiac
#

Well I know that, didn’t realize LP would add the backslash though

sudden kelp
#

Thanks!

#

was about to say as a \ is not a valid part of a string, at least when its not escaped

nocturne elbow
#

well it depends on how the reader (in this case, LP) interprets and represents it

fluid lark
#

I cant seem to find a event for when a group is changed?

wild whale
#

Define "a group changed", like you mean a group's nodes are mutated? Parent added/removed?

fluid lark
#

yea just alike that

#

parent added/removed

wild whale
#

mmk listen to NodeMutateEvent, filter if it's a user, and then check if the node is in the form group.GROUP_NAME.

#

(can easily filter for a specific group if you need that behavior)

fluid lark
#

Yea, well im using skript with skript reflect and im importing events to update my scoreboard when a user is added to a different group

#

so i really dont know how to filter it, but ill try it

wild whale
#

yeah uh hacky skript stuff isn't really supported. Your milage may vary.
Do note that since LP is cross-platform, it doesn't use the Bukkit event system, so I don't think skript can even listen to LP events

fluid lark
#

yea it didn't seem to understand UserDataRecalculateEvent it says it isnt a bukkit event, so yea it prob wont

wild whale
#

Yup didn't think so.

#

You're SOL then, unless you use proper java

fluid lark
#

Its fine then ill just update it every x second instead of events :P

#

Thx for the help though!

wild whale
#

🙃 seems like a performance hog but whatever they're gone

prisma lantern
#

how would i add a permission node to a user?

clever zodiac
#

!cookbook

frank driftBOT
keen egret
#

hi
how can i add group to player
i couldn't find in the cookbook

sudden kelp
#

Its in there

#

SetGroupCommand

keen egret
hybrid panther
#

@sudden kelp good song, love Odesza peepoClapJamminMoment

sudden kelp
#
GitHub

Tasty recipes (sample usage) for the LuckPerms API. - api-cookbook/SetGroupCommand.java at master · LuckPerms/api-cookbook

sudden kelp
#

Hm seems like you need to learn some basic Java first. Please also read the Luckperms api wiki. Its linked in the channel description. It tells you how to access the luckperms api

azure chasm
#

Hello, is there a way to negate a permission for player?

fringe torrent
#

/lp user <user> permission set <permission> false

azure chasm
#

I ment by using API.

azure chasm
# azure chasm I ment by using API.

But i found it, just didn't look properly at the wiki.

EDIT: For anyone wondering, its User#data().add(Node.builder("your.permission.node").value(true/false).build())

fringe torrent
#

Oh duh

#

didn't even see the channel name, sorry

split hatch
#

do i have to do anything else when promoting a play in a track using the API? Some reason the players are actually being promoted

nocturne elbow
#

so.. it works?

hybrid panther
split hatch
nocturne elbow
split hatch
glossy radish
#

Yo, any easy way to check if user has permission if i have only UUID?

tardy bone
#

Hi, does luckperms api works in bungee plugins?

glossy radish
#

yea, u got same api

nova urchin
#

Hi, i’m currently creating a fake player, using differents bukkit events. When i use luckperms, my fakeplayer cant connect on the server because there is this error:

#

anyone know how to fix that ?

main dagger
#

are you creating a Player or a HumanEntity?

#

because a Player should only really represent an actual player with an actual connection to the server

#

while HumanEntity can be used to make it look like there is a player somewhere

glossy radish
# turbid solar yes

How do i? i dont see any thing like Player.hasPermissions and idk how to use these nodes

nova urchin
nova urchin
visual wadi
#
        at io.github.divinerealms.utils.Helper.getPlayer(Helper.java:34)```
line 34 is `final UserManager userManager = getLuckPermsAPI().getUserManager();`
```java
public User getPlayer(final UUID uniqueId) {
  final UserManager userManager = getLuckPermsAPI().getUserManager();
  final CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);

  return userFuture.join();
}```
and I added luckperms in my main class like

```java
private LuckPerms luckPermsAPI = null;

// inside onEnable logic..
if (!setupLuckPermsAPI()) { 
  // disable plugin ..
}

private boolean setupLuckPermsAPI() {
  RegisteredServiceProvider<LuckPerms> lpp = getServer().getServicesManager().getRegistration(LuckPerms.class);
  if (lpp != null)
    setLuckPermsAPI(lpp.getProvider());
  return getLuckPermsAPI() != null;
}
nocturne elbow
visual wadi
#

Thank you!

azure chasm
#

Hey, how can i get a Group object from user?

clever zodiac
#

!cookbook

frank driftBOT
nimble star
#

How do you get a user's group using a web request

#

like make your server send the user's luckperms rank when a request is made

main dagger
#

make a web server in your own plugin for that

lethal mesa
#

i have a question how do i add more commands to the luckperms since i want admins to be bale to tp and chage gamemode

main dagger
#

wrong channel

nocturne elbow
#

for the api i saw you can get the players top prefix but i was wondering if you can Set the players prefix to smth and it will ignore the priority values and not rename. / mess with anything. Or if there is a way to set a users prefix in their personal value but not just replace that one.

wild whale
#

I mean you can set a prefix node on a user and crank the weight higher than any of the normal prefixes

nocturne elbow
#

I know that was what i was going to do but is there a way to re edit that same one without adding a new one ( Did i miss it when looking through api )

wild whale
#

wdym edit?

nocturne elbow
#

I was going to make it add it the the user personally and make the weight higher then every other one but didnt see the method for changing it, ik how to get it

nocturne elbow
#

is there a method for renaming or just delete and remake

wild whale
#

yeah afaik you can only delete + replace nodes, no editing

nocturne elbow
#

kk

#

btw does getprefix just give you the string and not node?

wild whale
#

check the return type?

#

or the javadocs?

nocturne elbow
#

its the string was checking in javadocs as i sent lol

#

kk ty

flint finch
#

hello, how get player permission without parent groups?

main dagger
#

why would you want to do that? manythink

visual wadi
#

How can I check if target has a permission and ignore inheritance?

visual wadi
#

And how do I check if group has a permission?

night thorn
#

is there a 1.19 release?

wild whale
#

wrong channel, and yes latest works on 1.19

#

!downloads

frank driftBOT
night thorn
fringe torrent
#

Still the wrong channel

wild whale
#

!moss

frank driftBOT
#
Essentials

Make sure you are using EssentialsX and Vault for prefixes. For any other issues with Essentials, you should seek support in either #general or the official EssentialsX support Discord.

EssentialsX Discord
visual wadi
#

How can I check if player has a permission and ignore inheritance, and how do I check if some group has a permission?

turbid solar
#

get the group object

#

and check it

visual wadi
#

Yep, I managed to do that with a group. How can I ignore inheritance when checking permissions for a player? My staff rank has * and if I check permission for them it will always be true.

fringe torrent
#

!nwc

frank driftBOT
fringe torrent
#

Try to steer away from assigning *

compact dust
#

I add a permission to a player via api. Now how can I give this permission context like "server: Lobby-1"

rapid schooner
#

Can someone tell me how to add a parent group to a user using the LuckPerms API?

visual wadi
#
// loop through String[] permissions and give them to the player
for (final String permission : getHelper().getPermissions())
  getHelper().addPermission(target.getUniqueId(), permission.replace("%team%", teamName));

// getHelper().addPermission()
public void addPermission(final UUID uniqueId, final String permission) {
  getUserManager().modifyUser(uniqueId, user -> user.data().add(PermissionNode.builder(permission).build()));
}

For some reason this doesn't give all the permissions all the time (there are 7). Should I do something else?

visual wadi
visual wadi
main dagger
#

why wouldnt you just make a group?

visual wadi
#

No reason, I'm just asking for alternatives so I don't have to rework the current way I'm doing things.

main dagger
#

but if you have a group, you dont need to manually assign multiple permissions to a user at a time

visual wadi
#

I know.

main dagger
#

thats what groups are for though lmao

#

why would you do it the hard way?

visual wadi
#

because i didn't think of it when i first started working on the plugin? 🤣

main dagger
#

also without reworking anything, you can just give a group.<groupname> node, which is how luckperms handles tracking which groups a user or other group inherits from

visual wadi
#

thanks, I will need to rework a lot of stuff because I want to make those groups via commands with meta and permissions instead of just giving meta and permissions to users

tepid night
#

Hi, trying to get the prefix from a specific rank. ```java
Group group = luckPerms.getGroupManager().getGroup(rankName);

if (group == null)
return null; // this does not trigger

group.getCachedData().getMetaData().getPrefix();```
This returns nothing despite of the editor showing it has prefix.97.&6&lHelper and /lp group helper meta info also displays -> 97 - 'Helper' (inherited from self)

After some more testing, the following also returns null java group.getCachedData().getMetaData().queryPrefix().result()

tepid night
#

This is what I'm trying to fetch

nocturne elbow
#

what does lp group helper info show?

tepid night
#

No prefixes

nocturne elbow
#

does the node have any contexts applied to it?

tepid night
#

No it's a rather naked group

nocturne elbow
#

then something is misconfigured in the config file that is ignoring global stuff, care to share it?

tepid night
#

Just in case I'm missing out on info

nocturne elbow
#

yeah so it's the meta-formatting settings that are affecting it

tepid night
#

Jesus man

#

I changed it before realizing I won't be using that

nocturne elbow
#

yeah if you're not gonna make use of those settings just change the format entry back to highest which is the default

tepid night
#

Stupid mistake on my end, cons of being here at 4 AM

#

Thanks a lot miss

nocturne elbow
austere spindle
#

where can i get repository?

#

to pom?

#

!api

frank driftBOT
austere spindle
#

I only have dependencies

turbid solar
#

what?

#

oh

#

you don’t need the repository block for luckperms

#

it’s on maven central

austere spindle
#

Okay working

#

But how can i add permission to player

wild whale
#

!cookbook

frank driftBOT
astral vortex
#

I'm confused aren't users cached?

#

on every lp user command it loads the user

nocturne elbow
#

they're cached if they're online, for commands if the user isn't loaded it'll be loaded from storage (and unloaded right afterwards I believe)

astral vortex
#

Because I'm very confused why UserDataRecalculateEvent is not called

#

The only event it calls is UserLoadEvent

#

I'm running my made standalone version

#

I would expect it to call this

main dagger
#

is your server based on an existing server software?

astral vortex
#

It's a standalone application

#

It's not a server software

main dagger
nocturne elbow
#

is it not called on bukkit/velocity/etc.. too?

astral vortex
#

No

#

It's my own platform

nocturne elbow
#

that's not what I'm asking

astral vortex
#

It's literally just plain java

#

It's not a server or anything

nocturne elbow
#

can you read my question

astral vortex
#

Sorry

#

Lemme have a look

main dagger
#

what are you using LP in a standalone java application for manythink

#

im sure you have good reason, im just curious

astral vortex
#

well our server architecture is that we have a "master controller"

#

that controls the network

#

So I didnt want to make redis calls to proxy to check for permissions

main dagger
#

multi-proxy server?

astral vortex
#

Yes

main dagger
#

whats wrong with redis then? 🤔

astral vortex
#

Well having to make calls to check for permission seems a little bit a waste of redis

main dagger
#

tbf ive never used redis, but isnt that kind of thing what it was made to do?

astral vortex
#

redis is for messaging yes

#

But it adds delay

#

We utilize redis to communicate between servers, but for checking permissions it's a little bit too much overhead

#

Okay lets see if proxies call Recalculate event

nocturne elbow
#

Also where are you doing that logging?

astral vortex
#

Okay so recalcualing on proxies do seem work

#

Does Luck perms check if the player is online?

#

Cause well on standalone there's no players 'online'

astral vortex
nocturne elbow
#

No, it doesn't check that

#

Where did you put the logging statement things

#

in the code

astral vortex
#

I've made this to add the players in the cache

#

in the event bus

main dagger
#

so how exactly does your standalone thing solve the issues redis causes for you? 🤔

nocturne elbow
#

Right - some events are not dispatched if there are no listeners for them

astral vortex
#

Oh

#

That's why

#

Cause I use my own event system

astral vortex
nocturne elbow
#

specifically everything-postAsync and perhaps a few other ones but every event dispatched asynchronously is checked for subscriptions first

astral vortex
#

So I need to override

main dagger
astral vortex
#

is it Bus#shouldPost?

astral vortex
nocturne elbow
#

yes that's what that's used for

astral vortex
#

Well I cannot overwrite bus without reflection

#

I guess imma have to reflect

#

Or actually nvm I don't need to

#

There we go, works like a charm, thanks!

main dagger
astral vortex
#

Yes

fringe torrent
#

yes

astral vortex
#

Cause joining is handled in the master controller, so it needs to check for permissions 2fa, etc and before you would need to send proxy a message saying HEY! I need to check if the user has permission, wait for the response then deny or allow the join, now I just directly call the LP api

nocturne elbow
#

I mean you still need to wait for the user object to be loaded from storage

astral vortex
#

Yea but the same would happen on proxy

nocturne elbow
#

right, and you still need to cross-communicate somehow, and there will be a minimum of latency anyway

astral vortex
#

Not anything noticeable by player

nocturne elbow
#

neither is... waiting for storage loading? which still needs to happen on the proxy and on the servers too, if anything you're adding an extra layer manythink

astral vortex
#

and I rather have less redis messages since luckperms ain't linked to our redis discovery service

main dagger
#

couldnt you just use a second redis instance?

rugged tinsel
#

im making a velocity chat plugin so how would i set a players prefix

#

also how do i get an instance with bungee

nocturne elbow
#

From the LuckPermsProvider class

nocturne elbow
rancid marsh
#

hi i have problem with api becose LuckPerms api is null

night pier
rancid marsh
rancid marsh
#

@night pier

frank driftBOT
#

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

turbid solar
#

did you add luckperms as a soft depend

slender jacinth
#

Could someone explain to me how contexts.json works?

main dagger
#

!context

frank driftBOT
main dagger
#

wrong channel though probably

slender jacinth
rancid marsh
nocturne elbow
rancid marsh
#

Yes

vital grove
#

I am making a bungeecord plugin and i want to use your api, but i do not know how to import it in my plugin

wild whale
#

!api

frank driftBOT
vital grove
#

when i try to use api version 5.4 it says that it does not exist but allows me to use version 5.3\

turbid solar
#

did you try building it

vital grove
#

no

#

also it does not load the package

turbid solar
#

screenshot

vital grove
#

screenshot of what

turbid solar
#

your pom/build.gradle and the error

vital grove
#

i am using maven

#

btu sure

frank driftBOT
vital grove
#

and the error

turbid solar
#

did you run mvn clean package?

vital grove
#

how

turbid solar
#

terminal

vital grove
#

it cannot find the package and so when i try to add this:
getLogger().luckPermsApi = LuckPermsProvider.get(); it doesn't can anyone help?

wild whale
#

...wat

vital grove
#

i have

#

added the luckperms dependency here:

frank driftBOT
main dagger
#

i swear i keep reading luckyperms even though people are putting luckperms tharpyFine

wild whale
#

Unless that getLogger() method is returning something very weird though, that isn't valid code

vital grove
#

and in the bungeemain class

#

it cannot register the luckperms api

wild whale
#

can you send full code and any errors?

vital grove
#

ok

#

code:

frank driftBOT
wild whale
#

!paste pls

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ 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!

vital grove
#

ok

wild whale
#

or whatever clippy upload can do iti

vital grove
#

!paste

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://pastes.dev/ 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!

wild whale
#

yeah ok this is just plain and simple invalid code

#

why are you trying to set luckpermsApi on your logger?

vital grove
#

so i can check if it works

wild whale
#

but that's not valid code

#

like regardless of if LP is working or not, that code will never work because it's invalid java

#

It's highly encouraged that people know java before trying to interact with the LP API, it makes everyone's lives much easier

vital grove
#

ok but i do not understand how to add the luckperms api in my plugin cuz it is on the pom file

#

and in the bungeemain i cannot use it.

main dagger
#

we cant fix your lack of java experience

turbid solar
#

!cookbook. me

frank driftBOT
turbid solar
#

is there a searchAll example?

#

there is nvm

ember hedge
#

Do CoextCalculators absolutely need to provide the context to the ContextConsumer?

LuckPerms appears to still be checking for contexts sometimes while the server is shutting down, and this of course leads to errors because my plugin is already shut down.

#

Please ping me if you reply 😉

jaunty pecan
ember hedge
#

Ah, that’d make sense

#

Thanks 🙂

clever lichen
#

Im going to ask again, how do i get the weight of a group if i have its prefix

#

the prefix that i have is from user.getCachedData().getMetaData().getPrefix()

main dagger
#

does getPrefix() return the string?

#

if it does, im not sure what you would do, but if returns something else it might have a reference to the group/player it belongs to

clever lichen
#

It return the string

shadow scaffold
#

Hey user.getCachedData().getPermissionData(QueryOptions.defaultContextualOptions()) should return permissions for the default context right?

main dagger
#

define "default" context

#

you shouldnt need to worry about contexts unless you are trying to add a new context

shadow scaffold
#

I want to check perms on that context.

main dagger
#

thats used to automatically add contexts to permission nodes when you do commands. so for example if you did /lp group default permission set my.cool.perm in game, with that config it would automatically add the server=opsb context to the permission node it adds

#

not sure why you want to check perms in that context though

rancid marsh
#

hi i am making plugin for chat that use luckperms prefixes and suffixes but i get an error that says LuckPerms api that I set to provider is null

main dagger
#

your gonna have to share code

shadow scaffold
#

I don't wanna define per gamemode what the name is, so I thought I can use something to get the default context

#

And look on that

main dagger
#

you can add as many static contexts you want in the section above that

shadow scaffold
#

How do you get the default defined ones using API then, I wanna check their perms on whats inside default-contexts

#

Is that possible?

rancid marsh
main dagger
#

so you could, for example, give your seasonal ranks with a context of season=9 (assuming that s9 means season 9) and have "season": "9" in your static contexts, and then when your season 10 starts, change the 9 to 10 and then anyone who has the rank with season=9 wont have any of its permissions anymore. no api usage needed

#

or you could register a context in your plugin with the api if you dont want to change that config file manually

shadow scaffold
#

That's not the question, I get that I can just change the season and the old ones will be removed yes. But the problem I have right now is once you own a rank on opsb_s9 context and some have opsb, when you purchase a rank upgrade it checks if you have the previous rank, so lets say group.rank1, this returns true if you just check hasPermission(), I want the check to only look for opsb for that group, and not on the seasonal context we defined.

Each gamemode has their own short name as default context so I am trying to find a way to check a user his perms on the default contexts and not the other ones

#

Is that possible

#

user.getCachedData().getPermissionData(QueryOptions.defaultContextualOptions()) I did this but that doesn't work, just says no perms no matter on what context you have it

nocturne elbow
#

defaultContextualOptions does return a QOpts for those default contexts yes

shadow scaffold
#

Then I am confused on how it's not working

clever lichen
#

so no one can help me with the prefix thing?

main dagger
#

why do you need the weight of the group that has the prefix?

clever lichen
main dagger
#

so you want to sort your staff ranks?

clever lichen
#

no

main dagger
#

so not like the tablist would be?

clever lichen
#

no

main dagger
clever lichen
#

Im just trying to get the prefix with the most weigth in all servers for a player

#

like for example, you have mvip in survival with weigth 90 and helper in factions with 100

#

then since the factions rank has the most weight, the factions one is the one that stays

nocturne elbow
#

the prefix from CachedMetaData#getPrefix may not correspond to a single group, it can be from multiple (see meta-formatting in config) or none at all

clever lichen
#

to get the prefix and the weight

main dagger
#

how did you plan on getting the prefixes from other servers?

clever lichen
clever lichen
#

and they send the prefix back to the bungee plugin

main dagger
#

if your servers are connected to the same db you can just use contexts

clever lichen
#

they arent

#

thats the thing

#

since this server doesnt have global ranks

main dagger
#

you can do per-server ranks with a db

clever lichen
#

let me check just in case

main dagger
#

and if you did have a db you could use a meta value thats context independent that has their highest prefix

#

or just its weight

clever lichen
#

its not using the same db

#

Im the server manager so its not my server pep_shrug

#

I could try getting the group instead

vital grove
#

hello. i am making a bungeecord plugin. I have added the luckperms api. The plugin shows no errors. Then i load it on my bungeecord server and it shows this error:

main dagger
#

are you doing any of those things?

tardy bone
#

Hi, how can I use the api to get a list of all permissions from a player, including the once inherited

nocturne elbow
#

You can get the permission map for a player from their cachedData/cachedPermissionData

tardy bone
#

I'll see

vital grove
#

any idea how to load my plugin after luckperms?

wild whale
#

Assuming Bukkit-based platform, add it as either a dependency or a soft dependency in your plugin.yml. (Soft dependency means optional)

vital grove
#

oh sorry its bungeecord....

#

and i've tried using depends: ["Luckperms"]

#

but then the plugin doesn't load at all

nocturne elbow
#

It's LuckPerms, capital P

vital grove
#

ohhhhhh

#

how can i check if the luckperms api has loaded?

vital grove
nocturne elbow
#

how are you building your plugin? maven, gradle... ?

vital grove
#

maven

nocturne elbow
#

can you share your pom xml please

vital grove
#

sure

frank driftBOT
nocturne elbow
vital grove
#

?

fringe torrent
#

She said

nocturne elbow
#

Are there any errors during startup?

vital grove
#

no

nocturne elbow
#

mmh could you share the uh

#

logs/latest.log from the proxy

#

or if you're using plain bungeecord instead of waterfall I think it has a proxy.log.0 because.. idk why

vital grove
#

i can send

#

but

frank driftBOT
nocturne elbow
vital grove
#

the failed loading luckperms api idk it is accurate

#

cuz i am using this piece of code

#
            try {
                LuckPerms api = LuckPermsProvider.get();
                getLogger().info(ChatColor.GREEN + "Loaded LuckPerms API.");
            } catch (Exception e) {
                getLogger().info(ChatColor.RED + "Failed loading LuckPerms API.");
            }
        }
#

which i got online

nocturne elbow
#

'tis weird; your pom file seems correct but can you check you don't have LuckPerms classes inside your own jar?

vital grove
#

i have the lp classes in my own jar

#

also i have also download the api.jar

#

and imported it on my project as well

nocturne elbow
#

okay there's the problem

#

what are you doing step by step to get a jar for your plugin?

vital grove
#

i added that piece of code to my pom.xml

#

then

#

went here

nocturne elbow
#

huh

vital grove
#

and downloaded

#

the api.5.4.jar

#

oh you mean how i added it?

nocturne elbow
#

I mean what are you doing to compile the project into a jar file

vital grove
#

build

#

ing

#

it

#

to a jar

#

on intellij

#

i click

#

on

nocturne elbow
#

can you not spam please

vital grove
#

file -> project structure -> clicked on artifacts then i added it to jar from modules and dependencies

#

then clicked on build -> build artifacts

#

and then build.

nocturne elbow
#

okay that is indeed not how you do it when you're using maven

#

go to Project Structure and remove the api-5.4.jar from the libraries/dependencies section
you want to build with maven, it manages dependencies, compilation etc - intellij has a tab on the right side for maven, you compile and package your project into a jar by running the lifecycle -> package task
otherwise you can run mvn package from a terminal in the project dir

vital grove
#

let me see

#

i run mvn package on terminal

#

and it exported

#

but in the plugin

#

there is no longer the luckperms classes

nocturne elbow
#

yes that is how it should be

#

luckperms provides the luckperms api

#

not your plugin

vital grove
#

ok

#

as i see in console as well

#

there is no error no more

#
01:10:41 [WARNING] Plugin listener me.lucko.luckperms.bungee.listeners.BungeePermissionCheckListener took 50ms to process event PermissionCheckEvent(sender=AA12Pro, permission=bungeecustomcmds.staff, hasPermission=false)!
01:10:41 [WARNING] Plugin listener tk.aa12mc.BungeeCustomCommands.StaffChat took 50ms to process event ServerConnectedEvent(player=AA12Pro, server=net.md_5.bungee.ServerConnection@2b449d99)!```
#

thanks for your help!

#

i have to go now.

nocturne elbow
real cobalt
#

Is there any benefit to using the LP api to check if a player has a permission, rather than using Vault's API?

#

i need to check permissions for a potentially offline player and want to cover as much ground as possible

main dagger
#

for online players you can just use bukkits hasPermission method, but no idea how vault handles offline players

wild whale
#

Vault can do offline iirc, you just need to ensure you do so async, otherwise LP will refuse to load the data (to prevent a lagspike)

nocturne elbow
#

Well there are two situations ("I need this permission check right now" (like cancelling or modifying an event) or "I can wait for a Future to return" (like responding to a command or reacting to some event without modifying it)) but bearing in mind the player may be offline (and the LP User unloaded), if it happens to be that case, LP's Vault implementation will complain (if you're on the main thread)

Either way there are no downsides to using the LP API directly, since you can load the User ahead-of-time if needed for the first situation (and you can cancel LP's user unload event), and you can also chain things with futures for the second situation

proud wren
#

Is there a standalone api for LuckPerms? Either official or community?

turbid solar
#

as in? Thatit can be used w/o something a bukkit server?

#

If so, no public ones that I know of

proud wren
#

Yeah, something that doesn't require a server to use

main dagger
#

what are you trying to do with it?

proud wren
#

We've got a microservice that dishes out some stuff, and I would like to modify the stuff that it dishes out based on the meta of a user. So, yeah, just want to access the API without the need for a server basically

tardy bone
#

Hi

#

I've used the api in bukkit before, and used this line to get the LuckPerms reference
LuckPerms luckPerms = Bukkit.getServer().getServicesManager().load(LuckPerms.class);

does anyone knows a similar method that works on bungee?

turbid solar
#

!api

frank driftBOT
turbid solar
#

use the static thingy

#

very confused, should be 99h but it gets removed immediatly? https://i.imgur.com/Qo3wSa0.png
It does get set since i can see it on the scoreboard

update: Doesn't actually have anything to do with expiry, it gets added (shows on scoreboard & prefix in chat) when I do /lp user powercas_gamer info it gets removed

tardy bone
turbid solar
#

im very stupid

calm mauve
#

Hey, how can I get the LuckPermsAPI on Bungeecord?

night pier
#

!api

frank driftBOT
night pier
#

first link

signal raft
#

How can I get color of Group?

main dagger
#

groups dont have colors

nocturne elbow
#

how can i get the primary group with the api?

unreal mantle
#
User user = luckPerms.getUserManager().getUser(uuid); // Gets the LP user instance
user.getPrimaryGroup() // Returns the users primary group
visual wadi
#

How can I remove groups by weight from a player? I don't want to remove the primary group, but the group with the x priority (weight).

unreal mantle
visual wadi
#

Thank you.

slender pebble
#

Ello, what event is called when a User's Prefix Metadata is changed?

nocturne elbow
slender pebble
#

We were using NodeMutateEvent but it seems to be unreliable.

nocturne elbow
#

Is there an event in the API to be able to tell when a player's parent group has been changed?

unkempt mortar
#

yo, i want to add a luckperms rank prefix, but i dont know how... any ideas?

main dagger
#

!cookbook

frank driftBOT
proud wren
#

do context calculators have to be typed with the type associated with the platform you're on? can they just be User instead?

#

i wanna make a calculator cross platform and just wonder if i need to bother with making it generic or not

proud wren
#

based ty

nocturne elbow
#

Just out of curiosity, how would you make use of a User in a calculator? manythink

#

Like usually contexts are created from the platform's Player state, and getting some things from the User in there can lead to some funny stack overflows lol

proud wren
#

in my particular case the context is just based on env vars in the server

#

so i don't even care about the user

main dagger
#

why not use static contexts?

nocturne elbow
#

oh - maybe a ^

proud wren
#

ngl, did not know that was a thing

main dagger
proud wren
#

dope - thank you!!

twilit thorn
#

Hello, the plugin i'm working on is struggling with reloading permissions.
Basically i have a reload command for my plugin which reloads the config files and adds/removes permissions based on the config.
Every time i call the reload command, the time spent on readding permissions is increasing, has to be something with bukkit permission api.

getServer().getPluginManager().addPermission(); and getServer().getPluginManager().removePermission(); are taking longer each time they are called.

I add permissions with this function:

    private void addPermission(PluginManager pm, String perm, PermissionDefault permDefault, Map<String,Boolean> children, String description) {
        if (pm.getPermission("magicspells." + perm) == null) {
            if (description == null) pm.addPermission(new Permission("magicspells." + perm, permDefault, children));
            else pm.addPermission(new Permission("magicspells." + perm, description, permDefault, children));
        }
    }

And remove them with the plugin manager:

PluginManager pm = getServer().getPluginManager();
pm.removePermission("magicspells.grant.*");
pm.removePermission("magicspells.cast.*");
pm.removePermission("magicspells.learn.*");
pm.removePermission("magicspells.teach.*");

I was wondering, how does LP handle this stuff, are there any better ways to handle this to remove the memory leak after reloads?
If i reload the plugin over like 5-10 times, the server hangs up and i have to restart it, each reload increases the time spent by a sec or more and its only the permission part, checked with timings and internal debug.

Here are the load and unload functions which setup the config, objects and permission stuff if needed:
Load: https://github.com/TheComputerGeek2/MagicSpells/blob/main/core/src/main/java/com/nisovin/magicspells/MagicSpells.java#L215

Unload: https://github.com/TheComputerGeek2/MagicSpells/blob/main/core/src/main/java/com/nisovin/magicspells/MagicSpells.java#L1766

GitHub

The MagicSpells plugin for Bukkit. Contribute to TheComputerGeek2/MagicSpells development by creating an account on GitHub.

twilit thorn
#

i have a reload command for my plugin which reloads the config files and adds/removes permissions based on the config.
Literally second line explaining i have a custom reload command not the /reload unsupported one.

main dagger
#

sorry i missed that

twilit thorn
#

But from what i've checked today LP only manages permissions instead of adding/removing it to the plugin manager

#

so i guess there is no fix to that atm, maybe something will change once paper overrides it

#

SimplePluginManager is the bukkit extension of PluginManager interface

#

issue lies within permission recalculation

#

which is done each time someone adds a perm

#

Its even mentioned in the docs that it shouldn't be run often by a plugin

nocturne elbow
#

A problem with the PluginManager#add/remove etc is that it forces a full recalculation of all existing permission attachments each time you call it - while LP's overriding of Permissible tries its best to mitigate that, it's... still not good

main dagger
#

ngl ive dont think ive ever seen that addPermission method before

#

is that like supposed to be the "proper" way to register permissions if you dont put it in the plugin.yml?

nocturne elbow
#

Any particular reason why you're registering them in the PluginManager tho?

main dagger
#

^

#

afaik you can just not

nocturne elbow
#

I guess defaults

twilit thorn
#

Because the permissions are created from objects during plugin initialization

main dagger
#

you can make entirely arbitrary permission checks

twilit thorn
#

I would like to rework the entire system but not plans for that yet

nocturne elbow
twilit thorn
#

Hmm what about auto completion?

main dagger
#

does LP use whats registered? or only what it knows it has checked for before?

nocturne elbow
#

what's been checked before

twilit thorn
#

LP auto completes permissions registered in the plugin manager

nocturne elbow
#

not necessarily

main dagger
#

LP has no issues auto completing permissions that are not registered properly as long as they have been checked with LP at least once

nocturne elbow
#

it adds what's been checked, if that also happens to be what's in the plugin manager then well yes, but LP doesn't check in the plugin manager directly tho

main dagger
#

i use js scripts to do permission stuff all the time and LP autocompletes that and i just do player.hasPermission calls with no setup

nocturne elbow
#

There was an issue on GitHub regarding this exact same thing, the performance degrading, I wasn't able to reproduce it locally even after thousands of calls but maybe it's to do with player count? Idk

main dagger
twilit thorn
nocturne elbow
main dagger
#

cant you do that with a plugin.yml though?

nocturne elbow
#

yeah but you can't use the plugin.yml if you're doing perms dynamically

main dagger
#

yeah but if making js scripts i could just pick a plugin and edit its plugin.yml lmao

nocturne elbow
#

uh no, that is not reflected during runtime unless you reload the full plugin

#

plugin.yml is read only once during load

main dagger
#

i mean for like static permissions in js

nocturne elbow
#

ig

main dagger
#

hacky solutions go brrrrrrrr

torn shale
#

Hi, has anyone use the luckperms api in forge ? It doesn't work for me, the provider return null (my mod load aftter luckperms), if you have an example that could be good :).
There is another solution with the user capabilities i can use this (i think) but with the jarinjar i can't refer to "UserCapabilityImpl" just the interface
PS : for better understanding i want to use the api to request prefix and suffix and some permissions

Update : No problem at all :D, just an issue with my code, all is 👌

sudden fractal
#

is luckperms bungee just Luckperms as a dependency?

main dagger
#

luckperms bungee is for handling permissions on bungee itself, like the /server command

sudden fractal
#

how do i make this bungee ```java
Player player = (Player) sender;

    // Get a Bukkit player adapter.
    PlayerAdapter<Player> playerAdapter = this.luckPerms.getPlayerAdapter(Player.class);

    // Get a LuckPerms user for the player.
    User user = playerAdapter.getUser(player);

    // Get all of the groups they inherit from on the current server.
    Collection<Group> groups = user.getInheritedGroups(playerAdapter.getQueryOptions(player));

    // Convert to a comma separated string (e.g. "admin, mod, default")
    String groupsString = groups.stream().map(Group::getName).collect(Collectors.joining(", "));```
nocturne elbow
#

You'd use a bungee ProxiedPlayer instead of a bukkit Player

sudden fractal
#

oh wait ProxiedPlayer may work

#

How can i get the groups in an array

nocturne elbow
#

groups.toArray()? that's a very vague question though, what's the context?

torn wagon
#

Caused by: net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
This could be because:
a) the LuckPerms plugin is not installed or it failed to enable
b) the plugin in the stacktrace does not declare a dependency on LuckPerms
c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
(call the #get method in onEnable, not the constructor!)

#

LuckPerms api = null;
getServer().getServicesManager().load(LuckPerms.class);
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
System.out.println("isint null");
api = provider.getProvider();

    }
torn wagon
#

plugin in 1.19

proud wren
#

are you depending on luckperms in your plugin.yml?

proud wren
#

and you can see in the logs it enabled happily before your plugin?

torn wagon
#

it may be api's fault because in 5.4.30 they added 1.19 support and you can not download this version of api only 5.4

nocturne elbow
#

That's nothing to do with that
How are you building your plugin? Maven/gradle..?

torn wagon
#

gradle

nocturne elbow
#

can you send the build script

torn wagon
#

shadow jar

#

plygin

#

but luckperms

#

is null

nocturne elbow
#

can you send the build script

torn wagon
#

dependencies {
compileOnly 'io.papermc.paper:paper-api:1.18-R0.1-SNAPSHOT'
compileOnly 'net.luckperms:api:5.4'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
implementation 'eu.okaeri:okaeri-configs-serdes-bukkit:4.0.6'
implementation 'org.projectlombok:lombok:1.18.24'
implementation 'eu.okaeri:okaeri-injector:2.1.0'
implementation 'eu.okaeri:okaeri-configs-json-gson:4.0.6'
implementation "io.papermc:paperlib:1.0.7"
implementation 'eu.okaeri:okaeri-placeholders-bukkit:4.0.3'
implementation 'com.iridium:IridiumColorAPI:1.0.6'
}

#

my dependencies

#

ok

#

is run

main dagger
#

!reload

frank driftBOT
#
Using `/reload` or plugman?

Using Bukkit's /reload command causes issues with many plugins, including LuckPerms. If you are adding or removing plugins, you should always fully restart your server.

What about plugman?

Plugman causes all of the same issues as /reload as it is fundamentally doing the same thing as /reload

mental terrace
#

Yo guys

#

I would like to hide a prefix from a group

#

Just for the user who select to hide it

#

Is that possible with lp api?

hybrid panther
#

that seems more like some sort of advanced chat formatting plugin option

#

how are you formatting chat right now?

wheat lake
#

Give them an empty prefix with a higher weight

mental terrace
#

i'm using this

mental terrace
#

I hope you got what i'm using right now Marti

hybrid panther
#

oh yea marti has a good idea

mental terrace
#

but how can i use it arberdeener?

#

Since i'm using prefix stack system

clever zodiac
#

why not a group in all tracks “hidden” with a prefix at the highest weight “” @mental terrace

#

that sounds like it’d work, a little hacky but not that bad imo

vernal raft
#

Hey guys!

#

I added the luckperms api to my project using maven and imported the API using the singleton method,

#

But how can I add a player to a group?

#

Oh wait 😂

#

I should use the permission

#

But how can I add a permission to a plaayer with the API?

vernal raft
#

I found it!

#

But what's the user variable though?

#

I need to add a permission to a player,

#

But how can I get the user variable the method needs?

clever zodiac
#

!cookbook

frank driftBOT
vernal raft
#

Ah okay thanks

#

I already found how to get the user object 😅

#

Great documentation!

mental terrace
#

and there're 20 different ranks

#

with everyone its custom permissions

#

oh i just make the no prefix group with the highest weigh

#

and add it to the player

clever zodiac
#

yes

#

you just create 1 group named hidden and add it to all 3 tracks at the highest position, along with an empty prefix at the highest weight for the new group

turbid solar
#

is there a similar method, or a way for UserManager#searchAll to also include the user' groups nodes?

nocturne elbow
#

hm?

#

like applying inheritance? I don't think that's possible

#

well, you could load every single user and check manually lol but that's not gonna be pretty

turbid solar
#

well it only needs to be online people

#

i guess i can loop thru loaded users, their nodes + inherited groups?

nocturne elbow
#

yeah

chilly elm
#

Good Evening,
i have a question to the LuckPerms API.
I use this Code to get the Prefix:

public String getPrefix(Player player) {
    User user = getLuckPerms().getPlayerAdapter(Player.class).getUser(player);

    return ChatColor.translateAlternateColorCodes('&', user.getCachedData().getMetaData().getPrefix());
}

But i get the result on the screen:

Sry for my broken english.

turbid solar
#

show where you handle chat

#

your toStringing a component somewhere

chilly elm
#

I don't understand, what you mean with toStringing

turbid solar
#

your calling toString on a Component somewhere

turbid solar
#

as it doesn’t have anything to do with LP

chilly elm
#

I only put it into the AsyncPlayerChatEvent:

@EventHandler
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
    Player player = event.getPlayer();

    event.setFormat(plugin.getPermissionUser().getPrefix(player) + player.displayName() + " §8» §f" + event.getMessage());
}
turbid solar
#

use player.getDisplayName

chilly elm
#

Deprecated. in favour of displayName()

#

But it works

#

thx :=)

turbid solar
#

you can’t mix legacy and components

night pier
#

deprecated as of when..?

turbid solar
#

paper

#

adventure

night pier
#

If they're using paper, why are they using AsyncPlayerChatEvent, and not AsyncChatEvent

turbid solar
#

¯_(ツ)_/¯

night pier
chilly elm
#

Because i dont understand how to use AsyncChatEvent xD

#

I know thats stupid xD

#

A little question. Can i make a sorted tablist with luckperms?

hybrid panther
#

!tab

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

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

List of chat/tablist formatting plugins that work with LuckPerms
frail olive
#
LuckPerms api = provider.getProvider();
User user = api.getUserManager().getUser(player.getUniqueId());

assert user != null;
Track track = api.getTrackManager().getTrack("ranks");
assert track != null;
track.promote(user, ImmutableContextSet.empty());
api.getUserManager().saveUser(user);

I use this logic to rankup players but I had some issues with 3 players that ended up having lots of previous ranks after ranking up
A player for example had rank4, rank5 & rank6

#

Am I doing something wrong?

proud wren
#

Is there an easy equiv to checking for the group.group_name permission when just working with a User instance?

#

yee found it on the wiki nvm

frail olive
red violet
#

Hello there!
Let me to burst in with a big enough question "to think about".

I'm fighting troubles with BungeeTablistPLus and LuckPerms.
(But as I realized describing this issue in BTLP support, the problem is in my plugin code working with LP API)

I'm not sure why, but when updating the LuckPerms player's group VIA MY CODE, the BTLP !switch message is not applying correctly. It applies only when re-join the server. BUT!!! The permissions work kinda fine, because I also have hew holograms set up for different groups of players, and they (the holograms) switch exactly when the permissions are changed. But BTLP message - not. Another BUT: BTLP nickname format - changes well to.

So, BTLP works 50/50 correctly.

Here is an explanation in screenshots:
Step1: https://ibb.co/py315hV
Step2: https://ibb.co/x5ZJ0zP
Step3: https://ibb.co/8gr8w2x

BUT:
I thought about trying to test with the regular /lp command.
and you know what? **It works fine! **TAB message changes simultaneously.
So, both: tab-message and tab-nickname are changed to the right group.

The conclusion is that BTLP and LP work fine, the only shitty developer here is me.

So here are my main question: what do I do wrong in my code using LP API to update the player's group?
So here is my function that changes the player's group. Part of it I've just copy-pasted from LP API examples (lines 26), part of them - my own shitty code:
https://pastebin.com/P77aPFvj

To be honest, I wrote that code for 1.17 (but only a few months ago), and not sure does I have the same issue at that time. Anyway, here we are.. and I need to solve that issue.
Could someone help me with that? 🙂

red violet
nocturne elbow
#

im trying to get a group with weight but idk how to do it with api

frail olive
turbid solar
#

check pins @red violet

red violet
#

this one?

red violet
turbid solar
#

yes

#

or so I think

nocturne elbow
#

hey so i put the luckperms api as a dependency in my pom.xml.

#

and for some reason it shows up as red???

#

i did what the site told me to do and it wont be a normal color,

wild whale
#

"it shows up as red" what is "it"? Could be a bunch of things

nocturne elbow
nocturne elbow
wild whale
#

Have you reimported since adding it? Should be a little reload icon with the maven M

nocturne elbow
#

ah ok

#

now it works

#

i didnt see that m thing

#

tysm

wild whale
#

(for the record whenever you make any change to your pom.xml besides comments or whitespace changes, you'll need to reimport)

nocturne elbow
#

ah ok ty

#

the thing is right, i never used maven until today.

#

( since id just manually import the stuff. )

wild whale
#

all good!

nocturne elbow
#

but yeah once again tysm for your help and sorry if i seemed a bit harsh earlier 😅 wasn't trying to be

wild whale
#

one more person using a build tool instead of IDE for dep management is always a good thing

nocturne elbow
#

true

wild whale
#

nah it's fine, I've been on your side of convos like that many times

nocturne elbow
#

still, sorry >_<

#

not trying to bother anyone but how can i get the users prefix???

#

bc like the lp api doesn't have LuckPermsAPI with in it... apparently

wild whale
#

!cookbook iirc this is one of the things in the cookbook?

frank driftBOT
nocturne elbow
wild whale
#

!api read how to get an instance of the api

frank driftBOT
wild whale
#

(top link)

nocturne elbow
#

yeah ive been using the sites api link

#

and the luckPerms part isn't an existing thing apparently

#

I think i might of gotten it hold up

#

i got it

#

we gud now

tender hawk
#

hey, im using the luckperms bungeecord plugin. I want to check in my spigot plugin if a player have permissions. So i tried with hasPermissions("") but this is always false. What can i do?

red violet
#

Hello there guys!

I'm not sure I really understand this PINed message which I was advised to review.

So I have this part of code in the end of my function where I'm changing players parent group:

// Load, modify & save the user in LuckPerms.
        api.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
            // Remove all other inherited groups the user had before.
            user.data().clear(NodeType.INHERITANCE::matches);

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

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

            // Tell the sender.
            if (debug) {
                Logger.info(user.getUsername() + " is now in group " + group.getDisplayName());
            }
        });

Where should I put advised code from the PINed message (to which I also reply with this message)??

turbid solar
#

after the last )

#

to ).thenRunAsync(…)…..;

turbid solar
#

I'm out of ideas or doing something wrong. How can i get the player group (context) that their currently in. player's group is is spartan with context server=skyblock, i'm doing this on the proxy and i can't get this to work correctly lol

main dagger
#

server= or world=? on the proxy world is for what backend server the player is on and server is which proxy they are on for multi-proxy setups

turbid solar
#

using server

main dagger
#

is that from /lp or /lpb//lpv?

turbid solar
#

/lp

#

I'm using the bungee api btw

main dagger
#

but your plugin/whatever is on the proxy?

turbid solar
#

yes

#

LP is also on proxy

#

synced w/ mysql & redis

main dagger
#

oh wait are you trying to get what the player group would be on the backend server?

turbid solar
#

yep

main dagger
#

oh ok

turbid solar
#

okay so it sort of works

#

for 1 player (temp rank w/ context) it works, other p[layer (perm rank w/ context) it doesnt

turbid solar
#

....nvm

fresh smelt
#

hello, could you comment i can add all the commands of a plugin like "true" directly a group?

nocturne elbow
#

I have a question

#

if I would use BungeeCord

#

and have luck perms directly on Bungee

#

Would it be still possible to use lpb?

#

on a server

#

cuz I have a plugin for my item shop

#

and it would execute commands

proud wren
#

no, servers executing commands can't ever reach the proxy

#

just install luckperms on your server too and sync them using one of the sync options

nocturne elbow
#

Ok

muted acorn
#

Can someone help me using LuckPerms API ?

#

i added it as dependency to my POM

#

but i still cant Use LuckPerms in my main class of my spigot plugin

nocturne elbow
#

Hi , i have a question, is it possible to add a group to a player using the api ?

#

cuz i can't seem to know how

fringe torrent
#

!api

frank driftBOT
fringe torrent
#

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

nocturne elbow
#

anyways thank you bro

fringe torrent
fringe torrent
muted acorn
fringe torrent
#

minecraft.command.teleport for example

#

groups are also nodes

fringe torrent
nocturne elbow
fringe torrent
#

When they are available they will help

nocturne elbow
#

@muted acorn any errors ?

muted acorn
#

there cant be any errors

#

since it cant be used

#

ill send ss wait

nocturne elbow
#

i meant

#

in the damn

#

pom.xml

#

god damn

muted acorn
nocturne elbow
#

maybe it can't read the completions

#

yes yes

fringe torrent
#

Don't we have a cookiecutter

frank driftBOT
#

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

#
Available commands

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

!locale
!meta
!migration
!notworking
!nowildcard
!offline
!pasteit
!permissions
!placeholders
!reload
!selfhosting
!spongeseven
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translationprogress
!translations
!tutorial
!upgrade
!usage
!userinfo
!verbose
!version
!weight
!whyluckperms
!wiki

nocturne elbow
#

trying just writing LuckPermsProvider.get() @muted acorn

#

it should work

#

my IDE doesn't read it among the completions too

muted acorn
#

i can use it but how should i save it as variable

#

that can be accessed

#

much easier

nocturne elbow
#

you dont need to but sure

#

just make the variable then assign it

muted acorn
#

well it is much easier to call it as variable rather than writing it 100 times