#luckperms-api

1 messages · Page 1 of 1 (latest)

tiny sorrel
#

Hey

#

How do I check if a user has no permissions?

#

using the API

proud wren
#

check if they have any permission nodes ig

wheat lake
#

Sounds to my your plugin is unable to find the correct LP instance of your server.
Sounds dumb and maybe you already checked it, but did you check...

  • witch version of lp is running on the server?
  • Luckperms is enabled and running without errors?
  • in your plugin.yml you declared Luckperms as dependency?
  • In your maven you did shade the latest version as runtime provided?
  • if your plugin is working on a ln empty Dev server with only Luckperms installed?
nocturne elbow
#

(they left)

slim sky
#

Hello ! how do you set a prefix to a player with the luckperms api?

night pier
slim sky
#

euh.... i love you

night pier
#

??dw

#

oh, wrong server

#

!nw

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

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

For Console Errors:
slim sky
#
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("gp")) {
            if (sender.hasPermission("CUSTOM")) {
                if (sender instanceof Player) {
                    Player player = (Player) sender;
                    if (args.length == 0) {
                        String prefix = args[0];


                        Main.getInstance().getLuckPerms().getUserManager().modifyUser(player.getUniqueId(), (User user) -> {

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


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

                            Node node = PrefixNode.builder(prefix, priority).build();

                            user.data().add(node);

                            sender.sendMessage("Prefix changé en §r" + prefix);
                    });

                    }

        }

        }else {
                sender.sendMessage("§6§lHub §f┃ §cVous n'avez pas la permission");
            }

    } return true;

    }```
#

0 error

slim sky
night pier
#

Okay, what actually happens when you run /gp something

slim sky
#

yes

night pier
#

yes?

slim sky
#

that's exactly what i want

night pier
#

What does happen. surely there's not just 0 feedback. any command output? any message in console?

slim sky
#

0 error

night pier
#

Okay, and what does the player see in-game

slim sky
#

nothing

slim sky
night pier
#

please stop replying just to ping me, i will see the messages

slim sky
#

okok

#

@night pier the player see nothing ingame

frank driftBOT
#

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

slim sky
#

@night pier

frank driftBOT
#

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

turbid solar
#

what does that screenshot have to do with anything?

slim sky
turbid solar
#

yes i know

fringe torrent
#

Does clippy autoyeet after so many illegal pings?

turbid solar
#

no

night pier
#

just starting at 5 pings in a single message

fringe torrent
#

Interesting... evil

turbid solar
#

oh your not saving the user

#

nvm

#

remove the args length check~

night pier
#

either that, or flip it to check if args is not equal to 0

night pier
#

@slim sky ^

slim sky
#

ty

#

💌

slim sky
#

how do I do so that we can put a space with another color?

#

@night pier

frank driftBOT
#

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

turbid solar
#

Join the args together

slim sky
#

nop its good ^^

#

how to get the weight of a group

#

?

#

pls

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
turbid solar
#

get the group instance

slim sky
turbid solar
old slate
#

Hello ! can someone help me put the grades in the tab? (with the weight of the rank)

#

!help

frank driftBOT
#
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

tranquil cave
#

Hello, I have a question, is it possible to get user on the survival server, if it wasn't on it before but was on the lobby server? (plugin linked to one database)

old slate
#

Hello ! can someone help me put the group in the tab? (with the weight of the rank)

elfin tulip
#

can somebody help me add teleportation for players on my server plz

elfin tulip
#

to a location

old slate
#

Here Its luckperms api not spigot api

elfin tulip
#

?

old slate
#

Google

elfin tulip
#

i have tried no use

old slate
old slate
elfin tulip
#

thats a plugin

#

cant use plugins

old slate
#

????

#

What do you use ?

#

@elfin tulip

elfin tulip
#

fabric

old slate
#

It's not a salon where we help with fabric

elfin tulip
#

rip

turbid solar
#

what?

#

if you need help with lp api on fabric then you can get help here, if you need help with fabric api in general use their discord or #general

novel canopy
#

just seen the point about api wrappers - is anyone working on a js wrapper? if not then i’d be up for doing one

jaunty pecan
#

that would be cool!

novel canopy
#

i’d do both in one go

jaunty pecan
#

awesome :D

vernal dagger
#

hey luck, just an info, can the standalone version be integrated as a library in a custom backend ?

#

or is it just a cli app?

jaunty pecan
#

at the moment it is just a cli app

#

but using it within another java app wouldn't be a huge jump

#

the only thing that complicates it is the classloading

vernal dagger
#

I wonder if a pure library version with a method like LuckPerms.init(config-file-path, directory-path) is in your plans ?

jaunty pecan
#

yeah potentially

vernal dagger
#

It would make backend developing to check user permissions / give permissions with interactions on websites-app a breeze

old slate
#

Hello ! can someone help me put the group in the tab? (with the weight of the rank)

static jasper
#

is it intended behaviour that the GET /user endpoint doesn't include an user in the array if they don't have any nodes whatsoever, even if the user is actually created (because POST /user returns 409)
unlikely scenario but just something i noticed while attempting to make a wrapper thingy

static jasper
#

@nocturne elbow has informed me that users without nodes aren't stored, but i'd still like to point out the behaviour here that the two methods of the same endpoint use different storage thingies, maybe a little weird idk

frank driftBOT
#

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

nocturne elbow
ivory roost
#

If I wanted to manually give and change user permissions through a website by directly changing the database, would I be able to?

#

Well you can kinda give certain permissions and stuff but how does the expiry work for settemp?

fringe torrent
#

The expiry is an epoch

#

So generate an epoch for the time you want it to expire

#

Iirc you need to tell LuckPerms to sync the data to the player too

#

I remember something about using the messaging service

ivory roost
#

it also puts smth in luckperms_actions table when I use the command so I guess I gotta make an entry there aswell?

ivory roost
#

Hm it seems like I can't update the expiry for some reason

#

k I just deleted the record and inserted again and it works lol

frozen oriole
#

Hi, I’m thinking of making an extension for use with Geyser/Floodgate which allows a context that is whether a player is joining by a Java or Bedrock client, would this be possible to do as an extension? Any response is appreciated 🙂

wild whale
#

don't see why not

frozen oriole
#

Ah good to know, thanks 🙂

wild whale
#

Although If you've already got existing code running on the platform (i.e. plugin/mod), can integrate into that, no extension nessecary. LP API is accessible to platform plugins/mods

frozen oriole
#

Oh ok, thanks that’s really good to know, may I ask what are the advantages/disadvantages of using a extension vs a plugin? Thanks again for your help 🙂

wild whale
#

LP extensions are cross-platform, platform plugin/mod means you have easy access to that platform as well (especially if you've got existing codebase).

jaunty thunder
#

Hey, I couldn't seem to find the correct event for when the parent of a user changes. May I ask which one to use for that?

sweet lily
#

When i change the group of an user via the api, how can I apply these change (prefix in chat) instant, without that the player has to reconnect?
Is there some reload function for the player

main dagger
sweet lily
#

atm the player has to reconnect for the group change

main dagger
#

well then your probably doing something wrong

#

assuming it works fine when you use the command

turbid solar
#

where are you changing it vs where is your chat plugin?

#

bukkit/bungee?

astral vortex
#

How would I query permissions of user based on regex? So queue.priority.([0-9]+)

turbid solar
#

iterate over nodes and check if they start with that

#

but that’s really something you should use the meta system for

frail olive
#

Is there an event for when a permission expires?

nocturne elbow
#

Check that node.hasExpiry && hasExpired

native tartan
#

Hey i have a question vault didnt get updates for the 1.19 and now i must code my system with luckperms. How can i give persons a specific permission like i want to code a rangshop for the players. And in vault was it " Vault.getPermission().playerAddGroup(null, player, rang.getRankName());" but how can i do this (or a better way) with luckperms?

wild whale
#

Vault works just fine on 1.19, hell it'll probably still be working a decade for now.
Since vault doesn't touch any ingame mechanics, it won't break cross-version. LP is (normally) the same

native tartan
#

I updated my plugin from 1.16.5 to 1.19 with the vault integrations and it didnt worked so i switched to luckperms ^^' for coins it workes but not for permissions thats my problem rn

wild whale
#

doesn't work how? If vault was broken we'd have a small apocolypse in our support channels, which we don't

native tartan
#

Idk i didnt changed anything i just updated from 1.16.5 to 1.19 and then i had a huge problem with vault bc of permissions.

#

I reinstalled the vault plugin and mine and nothing changed.

#

No errors or something

wild whale
#

and it didn't work in what way?

native tartan
#

I have a npc that sells you ranks on my server. And it workes via the vault integration when you click on anyrank you want it checks the weight of your current rang and your new rang and when the current rang is higher from the weight then your new rank it dont work. But since the update from 1.16.5 to 1.19 it always said that i have reached the maximum rank i can get (and no i dont had * perms or something like that) i did fixed that problem with luckperms now but i need a way to give the specific rank to the person who clicked on the rangshop

wild whale
#

!cookbook well check the cookbook, but LP hasn't changed and vault's the same old POS it was 5 years ago so I doubt it was something breaking in either of those

frank driftBOT
oak hearth
#

whats the easiest way to get a Player list of who's in a specific group? or just the names of those players in the group

ornate hill
#

So, I'm using the LuckPerms API to get the primary group for a player, and I'm getting this error.

[22:48:14] [Netty Epoll Server IO #12/ERROR] [FML]: There was a critical exception handling a packet on channel pokeninjas
java.lang.NullPointerException: value
    at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_312]
    at me.lucko.luckperms.common.api.implementation.ApiUser.getPrimaryGroup(ApiUser.java:76) ~[ApiUser.class:?]
    at com.pokeninjas.pokeninjas.api.RankTagAPI.getUserTag(RankTagAPI.java:313) ~[RankTagAPI.class:1.0.51]
    at com.pokeninjas.pokeninjas.api.RankTagAPI.getPrimaryTag(RankTagAPI.java:296) ~[RankTagAPI.class:1.0.51]

I've deduced that this is happening because the "value" variable is null, meaning the primary group obtained is null somehow. What could be causing this?

craggy path
#

How to read expiry in database as seconds etc?

turbid solar
#

using the api?

teal barn
#

Is there a version of luckperms for sponge 7.4.7?

wild whale
#

!api7 and wrong channel

frank driftBOT
#
Using Sponge on 1.12.2?

LuckPerms no longer releases updates for API 7 of Sponge, which is what the 1.12.2 version of Sponge uses. However you can still download the last version of LuckPerms that supported API 7 from Ore.

willow folio
#

Does LuckPerms#GetUserManager().getUser(UUID) only work if the player has been online in that session??

nocturne elbow
#

No, it will always provide a valid user

turbid solar
#

only if the user is online?

nocturne elbow
#

oh, I thought it was loadUser, derp

old slate
#

Hello ! how do I make one if the player has the custom on return grade?

#

!help

frank driftBOT
#
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

old slate
#

!api getgroup

frank driftBOT
hybrid panther
#

i don't see what this has to do with luckperms, lol?

turbid solar
#

well it’s the luckperms api???

turbid solar
old slate
#

ty

hybrid panther
#

oh derp i did not see the second screenshot

#

my bad

old slate
#

It does not work

old slate
#

It does not work ;(((

turbid solar
#

show screenshot

old slate
turbid solar
#

that’s not what i told you

old slate
#

mh ?

turbid solar
#

you need to get a group instance

old slate
hybrid panther
#
- if(PluginManager.getGrade(player).equals("CUSTOM")) {
+ if(PluginManager.getGrade(player).equals(GroupManager#getGroup("CUSTOM"))) {
old slate
#

oh ok

frank driftBOT
#

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

old slate
#

oups

old slate
hybrid panther
old slate
#

I don't want to get with permission, I want with the group

#

@hybrid panther

frank driftBOT
#

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

hybrid panther
#

that link shows you how to get a group instance

old slate
old slate
#

its good this *

old slate
#

pls help

#

me

nocturne elbow
#

That looks like it should work

pale imp
#

Hi, I'm trying to make it so that when a player joins, I get whatever their highest group is along a certain track, save it in a variable for future use, and then reset their rank to the first rank in that track. I would also like to promote them along a track. My current idea for getting their highest group along a track is using the track manager to get a list of all groups in that track using plugin.getLuckPerms().getTrackManager().getTrack("track").getGroups(), and then looping through it backwards returning the first rank they have the permission for. If anyone would be able to help me with setting them to the first group in the track and promoting them along a track I would really appreciate it 🙂

drowsy crystal
#

Could someone tell me how do I set a group using api?

wild whale
#

!cookbook

frank driftBOT
drowsy crystal
#

I did not find it

pale imp
#

@drowsy crystal

pale imp
wild whale
# pale imp Hi, I'm trying to make it so that when a player joins, I get whatever their high...

internally as far as the code is concerned, tracks are literally just groups of groups. there's no data stored for position on the track or whatever, so you can just manipulate parent groups like normal to promote (remove old group, add new). There might be a convenience method to do that for you, but I don't recall seeing it when I was last poking around.
Double check the javadocs etc though, I may be mistaken.

drowsy crystal
pale imp
#

Np

pale imp
wild whale
#

Fundamentally yes, inheritance is just determined by a group.GROUPNAME node. Again though, it's been a while since I've poked at the api so there might be a way of adding / removing a group more gracefully

drowsy crystal
pale imp
# wild whale Fundamentally yes, inheritance is just determined by a `group.GROUPNAME` node. A...

Great. I coded it out and if you wouldn't mind could you take a look and tell me if it looks right?

        String oldGroupName = "";
        for (String group : plugin.getSettings().getGroups()) {
            if (player.hasPermission("group." + group)) {
                oldGroupName = group;
                break;
            }
        }
        plugin.getLuckPerms().getUserManager().modifyUser(player.getUniqueId(), user -> {
            Node oldGroupNode = InheritanceNode.builder(plugin.getLuckPerms().getGroupManager().getGroup(oldGroupName)).build();
            Node newGroupNode = InheritanceNode.builder(plugin.getLuckPerms().getGroupManager().getGroup("survivor")).build();
            user.data().remove(oldGroupNode);
            user.data().add(newGroupNode);
        });
drowsy crystal
#

@pale impAfter this declaration , which argument do I put here to serve as an instance to the register a registerCommands

pale imp
#

Whatever you initialized luck perms as in your main class

drowsy crystal
#

I have no idea ashuashuashu

pale imp
#

Send me your main class

drowsy crystal
#

my command executor class is the same as found on github and my mother this is what is imported

pale imp
#

Okay so you'd pass in api

drowsy crystal
#

instance = api?

pale imp
#

luckperms = api

drowsy crystal
#

ok

#

Do you know why this happened?

night pier
pale imp
#

Send line 75 in SetGroup.java

#

(and the lines around it)

night pier
#

That’s not going to be useful.

pale imp
#

Oh ok

drowsy crystal
#

I managed to solve it, then another problem arose to set, the rank shown is null in the message as if it didn't identify any group

#

used api as instance

#

as he said

frank driftBOT
drowsy crystal
hybrid panther
#

It might be possible the group doesn’t have a display name set - it could be nullable

drowsy crystal
#

oh ok

#

I can't solve it

prime iris
#

Anyone knows why I cannot find the class?

prime iris
#

Would love to have this sorted but can't seem to figure this out

turbid solar
#

refresh cache

prime iris
#

Never heard about that

#

For Intelj with Maven project

turbid solar
#

ctrl shift o

prime iris
#

Still not, the IDE is also multiple times restarted

turbid solar
#

try building it

prime iris
ivory sand
#

i'm using luckperms api in my velocity plugin to fetch the player's prefix, and I'm trying to subscribe to the UserDataRecalculateEvent. but it doesn't seem to be triggering my function when i make a prefix change (for example, /lpv group default meta setprefix 2 <blue>). is this the correct event to be listening to?

nocturne elbow
#

That would call the data recalculate event for the group you changed the prefix on, not the inheriting users

#

I'm not exactly sure but it might call it when it refreshes the prefix for the user the next time it is fetched

ivory sand
#

the event only has .getUser() and .getData() so probably that second option

#

"Gets the user whose data was recalculated"

#

what event should i listen to instead?

nocturne elbow
#

Well... it only has getUser because you are subscribing to the UserDataRecalculateEvent

#

Not the GroupDRE

ivory sand
#

oh nvm the event does trigger if i set the prefix on my user

#

so should i just listen to both the User and Group events?

nocturne elbow
#

Yeah for now I guess, I'll see if there's some way around that

ivory sand
#

my global chat plugin is using the api too to get the prefix but when i send a chat message (which means it gets the user and cached metadata again), it still doesnt trigger the event

#

so it doesnt work that way it seems

nocturne elbow
#

mh may i ask why are you listening to that change?

ivory sand
#

the plugin i'm doing right now is a tab list formatter, and i want to automatically update the display name whenever the player's prefix changes

#

otherwise i have to wait for them to either change servers, or relog

nocturne elbow
#

Right

#

Yeah then listening to both Group/UserDRE will suffice. It's.. not ideal because you'll need to loop through all players but it's not exactly an intensive process

ivory sand
#

yeah

#

could there be a race condition between Player#hasPermission and the actual group recalculate event, because for some reason it's working like 50% of the time for me

#

i gtg

#

Oh wait unless I'm supposed to schedule a task inside the event

nocturne elbow
#

Great question but, I don't think so? The event is dispatched into another thread after the whole cache invalidating has taken place. Would be nice to test/see, hm

ivory sand
#

replaced it with user.getNodes().contains(InheritanceNode.builder().group(event.getGroup()).build()), this works every single time, except for the first time i change the prefix after the player joins. any prefix change after that works

#

wtf the group recalculate event is triggering 3 times, every time i change prefix

#

for reference this is my entire function as of now (without the logger lines since its very wordy)

public void onLuckPermsGroupDataRecalculate(GroupDataRecalculateEvent event) {
    server.getAllPlayers()
            .stream()
            .filter(p -> {
                User user = luckPerms.getUserManager().getUser(p.getUniqueId());
                if (user == null) {
                    return false;
                }
                return user.getNodes().contains(InheritanceNode.builder().group(event.getGroup()).build());
            })
            .forEach(this::updateTargetInAllLists);
}
nocturne elbow
austere siren
#

Hi, i'm trying to build a custom plugin who have the luckperms api as dependancy. But when i build i have this error:

Compilation failure
error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider me.lucko.helper.plugin.ap.PluginProcessor not found

My IDE is Intellij version 2022.2 and i use java 11, any idea to fix this ?

craggy path
#

How to get specific node? I want to get the .getExpiryDuration

user.getNodes().stream().filter(Node::hasExpiry).partWhereIamStuck
#

Im kinda new to this

#

Is it possible to just filter with the node key like "test.test1"?

#

string -> string.contains(key)?

#

I want to get only one node not set or collection

craggy path
#

Could you help me with it too? I dont know but this is not working rn

public class PlayerJoin implements Listener {

    public PlayerJoin(bpWicia plugin) { Bukkit.getPluginManager().registerEvents(this, plugin); }

    private bpWicia plugin;
    private LuckPerms luckPerms;

    String joinGroup = plugin.getConfig().getString("join-group");
    int joinTime = plugin.getConfig().getInt("join-time");

    public Node createNode(Boolean value, int hours, String key){

        return Node.builder(key)
                .value(value)
                .expiry(Duration.ofHours(hours))
                .build();
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {

        Player player = event.getPlayer();

        User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);

        if (!(player.hasPlayedBefore())) {

                user.data().add(createNode(true, joinTime, ("group." + joinGroup)));
                luckPerms.getUserManager().saveUser(user);

        }
    }
}
turbid solar
#

you’re not setting the luck perms var to anything

craggy path
#

this is not working for me LuckPerms luckPerms = LuckPermsProvider.get();

hybrid panther
#

how isn't it working?

craggy path
#

i meant it does not add the node

user.data().add(createNode(true, joinTime, ("group." + joinGroup)));
luckPerms.getUserManager().saveUser(user);```
#

        return Node.builder(key)
                .value(value)
                .expiry(Duration.ofHours(hours))
                .build();
    }```
createnode function
scarlet temple
#

Hi guys i need help

#

So i have mine custom gui

#

and in tht i have some roles like doctor engenieer smp cleaner and etc

#

Like i need to add a cmd in tht

#

So i added this cmd

#

/lp user <playername> parent set thugs

#

but it dint worked

#

Plz help

main dagger
#

you dont need to ask your question in every channel

robust yacht
#

How can i add a permission to a player?

#

in a specific world

turbid solar
#

context

robust yacht
#
public void addPerm(OfflinePlayer player, String permission, World world, int seconds) {
        Node node = api.getNodeFactory().newBuilder(permission).setWorld(world.getName()).setExpiry(seconds, TimeUnit.SECONDS).build();
        User user = api.getUserManager().loadUser(player.getUniqueId()).join();
        if (user != null) {
            user.setPermission(node);
            api.getUserManager().saveUser(user);
        }
    }
#

Thats from the old api

turbid solar
#

!api

frank driftBOT
robust yacht
#

thx, that really helped

robust yacht
#

and how do i get all WORLD permissions of the player

robust yacht
#

?

jagged crane
#

yes

floral basalt
#

how can i check if a group's is temporal

clever zodiac
#

temporal

#

that would be time

#

groups are not time

proud wren
#

grab the node for the group from the player and just check hasExpiry on it

odd vapor
#

Hi try get weight from Userjava public static int getWeight(String name) { OptionalInt weightOptional = Main.luckPerms.getGroupManager().getGroup(Main.api.getUserManager().getUser(name).getPrimaryGroup()).getWeight(); return (!weightOptional.isPresent()) ? -1 : weightOptional.getAsInt(); } what do you think about this?

turbid solar
#

might be able to do weightOptional.orElse(-1)

odd vapor
#
    public static int getWeight(String name) {
        return Main.luckPerms.getGroupManager().getGroup(Main.api.getUserManager().getUser(name).getPrimaryGroup()).getWeight().orElse(-1);
    }``` thanks
floral basalt
surreal sail
#

is here someone that can help me with the luckperms api stuf?
I want to get a players group that he/she has on my server in my custom plugin. i got the code from the site (https://luckperms.net/wiki/Developer-API-Usage#finding-a-players-group) but how do i use it ?

night pier
#

!cookbook here's an example plugin if you need help - there should be an example of that in it

frank driftBOT
surreal sail
#

okey thx

surreal sail
night pier
#

what exactly are you trying to accomplish

surreal sail
#

wel can you come in call it is alot of typing

night pier
#

no

surreal sail
#

okey then i'll do my best

#

so i'm making a minecraft plugin that has the luckperms rank on a scoreboard but i don't know how i get the rank so i googled it and came on some code

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

#

but how do i give it my ranks on the server

night pier
#

it uses the LP Api, your plugin communicates with LuckPerms Bukkit to get the information. that's why this interface exists.

#

this definitely is in cookbook

surreal sail
#

so if i use the code i gave i just neet to pass in the org.bukkit.event.player.PlayerEvent and then for my ranks i need to get it like this "owner, admin, staff, builder, vip, default" ?

night pier
#

if you want their primary group, just get an instance of LP in your plugin, load the user, and get their primary group as a string, and display that on your scoreboard.

surreal sail
#

is here a example form ?

#

(i'm new at this )

night pier
#

Yes, cookbook has multiple examples, as well as comments telling you what the code does. i'm not going to spoonfeed you the code if that's what you're asking for.

surreal sail
#

oke np

terse quail
#

!api

frank driftBOT
modest lance
#

!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
iron matrix
#

line 32 is where I get the api

#

heres it syntaxed

#
17.08 21:30:01 [Server] ING Exception encountered when loading plugin: BungeeStaff
17.08 21:30:01 [Server] INFO net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet!
17.08 21:30:01 [Server] INFO This could be because:
17.08 21:30:01 [Server] INFO a) the LuckPerms plugin is not installed or it failed to enable
17.08 21:30:01 [Server] INFO b) the plugin in the stacktrace does not declare a dependency on LuckPerms
17.08 21:30:01 [Server] INFO c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase
17.08 21:30:01 [Server] INFO (call the #get method in onEnable, not the constructor!)
17.08 21:30:01 [Server] INFO at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:53)
17.08 21:30:01 [Server] INFO at me.ohbuzz.BungeeStaff.onEnable(BungeeStaff.java:29)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:265)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.BungeeCord.start(BungeeCord.java:285)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
17.08 21:30:01 [Server] INFO at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
#

this is the error i get when I add the LuckPermsProvider.get() to the onEnable() in my main file as it insists

iron matrix
#

anyone got any tips???

main dagger
#

read the error

iron matrix
#

yes ive read it

#

ive used this same code without an issue

#

but rn its giving an error

#

the luckperms plugin is activated before my plugin

#

it declares it as a dependency

#

im not trying to get the api before the plugin enables

#

which is why Im going to support for the issue

#

ive already tried fixing the issues it gave me

nocturne elbow
#

How are you building your plugin? Maven/gradle..?

iron matrix
#

maven

nocturne elbow
#

make sure you declare the dependency with <scope>provided so you are not accidentally shading it

iron matrix
#
    <dependencies>
        <dependency>
            <groupId>net.md-5</groupId>
            <artifactId>bungeecord-api</artifactId>
            <version>1.19-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.4</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
#

thats in the pom

#

but if i hover it says "Non-Project Files"

#

is it supposed to say that

nocturne elbow
#

what do you run to actually build a jar file?

iron matrix
#

like ide?

turbid solar
#

how are you building the jar

raven sonnet
#

Plz somoene help me i put all the things in lucky perms But dont work i aleary use the add group command in my friend but hes cant use the commands

iron matrix
#

im not too sure what youre asking for but does this help?

nocturne elbow
#

Yeah don't actually do that, use maven for its purpose (it's a build tool for.. well.. building), either run mvn package on a command line/terminal in the project dir, or IntelliJ has a little maven tab on the right hand side (by default), somewhere in tasks/goals/lifecycle it lists "package", hit that
Artifacts is IJ's own way of managing dependencies and building, maven is that same thing, mixing and matching them is no bueno

iron matrix
turbid solar
#

Return the user future

#

public static CompletableFuture<User>

#

then return userFuture

#

remove the .join()

hybrid panther
#

These are all questions about java itself and not necessarily the luckperms api - you should checkout the javadocs for the api as well as some of the classes it commonly uses; such as completeablefuture

quiet nest
#

Hi, how can i get player's highest group from lp db?

#

without lp api, bc i'm creating web app

turbid solar
#

there’s a rest api extension

#

but uhh

quiet nest
#

hm?

unreal mantle
grim sentinel
#

How can I add an permission to an User with the API inside from a Plugin?

desert locust
#

Hey, I'm using CompletableFuture and I'm having issues regarding it.
If I run my method to give permissions to a user on the main thread it always gives 34 permissions, but while running it with CompletableFuture it only gives some, sometimes 12 and sometimes 33, so it's random, but never gave 34. Does LuckPerms have a limitation?

#

If not what could be the issue?

turbid solar
#

show code

desert locust
turbid solar
#

addPerm method

desert locust
turbid solar
#

have you tried debugging it yet

desert locust
#

yes, but what do you suggest specifically?

turbid solar
#

logging the steps and what it does i guess

desert locust
jaunty pecan
#

Get the user once and then add all of your permissions in one go

teal vigil
#

how can i get the lenght of a temporary group?

#

please help

main dagger
#

same way you get the expiry time of any other node

quiet nest
#

Hi, how can i get player's permission matched with pattern?

pseudo bison
#

How can I get the permission node of a command using the luckperms API?

unreal mantle
pseudo bison
unreal mantle
#

I don't think you can? That would be something that's handled by the plugin providing the command.

pseudo bison
#

I do believe LuckPerms maps the permission node of every single command once there is a permission query event

#

It then put thats in some database to my knowledge

#

I need to access that database

nocturne elbow
#

It's not quite like that

#

LuckPerms knows nothing about no command, permissions are not "part of a command", and all LP gets is just any permission check regardless of source

unreal mantle
#

The other plugins literally just ask Luckperms "does this user have this permission?" Then the other plugin handles the response.

pseudo bison
#

So its actually not possible?

nocturne elbow
#

a permission is a key to be allowed to do something, whether that's a command or something else like moving around, killing entities etc LuckPerms doesn't know

#

it does keep track of every permission checked since the server was started however, don't know if that is of your interest

pseudo bison
#

alright thanks for the help

acoustic raptor
#

I will output the luckyperms database data as json, but I am not getting some information from the database data.
sample
group owned by a player and their permissions
how can i output this data to json
I will only use the database data for api purposes, I will get json output with php

acoustic raptor
#

plss help

nocturne elbow
acoustic raptor
#

i need this json output

main dagger
#

why do you need all of the data, and not just parts of it from the api

acoustic raptor
#

I want to get this output what should I do in the config

nocturne elbow
#

Querying storage directly isn't exactly supported in general (which is why the REST API extension exists), but if you get the data directly from the database you're... getting it directly from the database and handle it yourself, you can't get it serialised in some other storage format

elfin raptor
#

Hi 👋 I tried to read the LuckPerms doc but I didn't find something I need. I need to set a temp prefix (for a 30 days duration) for a player, how can I do that please ?

elfin raptor
#

!help

frank driftBOT
#
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
elfin raptor
nocturne elbow
#

I don't have the time or energy or willpower right now to do and provide that as for I am going to sleep, but I can link you to the relevant bits and pieces needed to do that.
You can create a builder for a PrefixNode like shown in here https://luckperms.net/wiki/Developer-API-Usage#creating-new-node-instances and in the Builder itself specify the expiry duration with any of the expiry methods from the link above
Then you need to add it to the player's corresponding User object, you get it like explained here https://luckperms.net/wiki/Developer-API-Usage#obtaining-a-user-instance, and then add the built prefix node to the user's node map https://luckperms.net/wiki/Developer-API-Usage#modifying-usergroup-data

elfin raptor
#

Ok, thank you I will try

#

I tried something but I got an error, what's wrong ?

night pier
#

that error has nothing to do with LP

elfin raptor
undone patio
#
    @EventHandler(priority = EventPriority.HIGHEST)
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        String join_message = main.getConfig().getString("join-message");
        for (Player e : Bukkit.getOnlinePlayers()) {
            String prefix = player.getCachedData().getMetaData().getPrefix();
            e.sendMessage(MiniMessage.miniMessage().deserialize(join_message, Placeholder.component("player", player.displayName())));
        }
    }``` Am I doing something wrong?
hybrid panther
#

you need to convert the bukkit player to an lp user to use lp methods

wild whale
#

!api

frank driftBOT
undone patio
#

How would I define luckperms, sorry 😅

wild whale
# elfin raptor The error isn’t at line 41 ?

No it is, it just isn't caused by LP. A NullPointerException (NPE) means that you tried to run a method on a null variable, or was thrown because you passed null to a method.
Thus, either luckPerms is null, or player is null. With that one snippet, I don't have enough info to be able to know for sure which

wild whale
undone patio
#
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            LuckPerms api = provider.getProvider();
        }``` So, this is what I need?
wild whale
#

Something to that effect, yes, although of course you need to keep in mind variable scope

undone patio
#

😅

#

Do I just make a public static with luckPerms()?

wild whale
#

Yes you should have a public getter, although ideally without static abuse

undone patio
#

Using the API, is there a way to determine what prefix has a higher/lower priority?

main dagger
#

i assume there is a way to get the weight

undone patio
#

I can't seem to find anything in the wiki about that.

undone patio
#

Hmm, I'm not sure how to use that. Is there an example on the Usage wiki?

main dagger
#

you dont know how to use what

undone patio
#

getPriority in the instance of the player's group.

main dagger
#

you have to use getPriority on the prefix node itself

undone patio
#

May you point out how to use nodes? I've been looking at the Usage wiki and once again there's not a whole lot that really stands out to look promising.

main dagger
#

!cookbook

frank driftBOT
undone patio
#

Huh

#

That has absolutely nothing relevant to me?

undone patio
#

Here's my current code if needed: java @EventHandler(priority = EventPriority.HIGHEST) public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); String join_message = main.getConfig().getString("join-message"); String resourcepack_join_message = main.getConfig().getString("resourcepack-join-message"); User user = luckPerms.getUserManager().getUser(player.getUniqueId()); String prefix = user.getCachedData().getMetaData().getPrefix();

clever zodiac
#

just adapt it to not just check inherited nodes

#

you also have CachedMetaData#getPrefixes() which returns a map using priority/weight as key

#

so just find the entry with the greatest key

#

you need to really learn to check javadocs and search through api examples, I’ve touched the api very few times and I instantly found 2 methods (albeit with decent knowledge of how it’s structured)

vast hawk
unreal mantle
#

the best way, is to change the chat format.

vast hawk
#

This plugin is for a very specific usecase, sorry about that, just wanted to show the prefix get part.

nocturne elbow
#

Hey guys, I'm working with luckperm and I am wondering how to change the parent of user?

unreal mantle
#

!weights is the easist way

frank driftBOT
#

LuckPerms allows you to set weights in order to determine the priority of certain nodes, like permissions and even prefixes. A higher weight number is a higher priority.

steel plover
#

how do I get user uuid in NodeAddEvent?

unreal mantle
nocturne elbow
unreal mantle
#
    /**
     * Sets a users primary group.
     *
     * <p>This modifies the "stored value" for the users primary group, which may or may not
     * actually take effect, depending on how the platform is calculating primary groups.</p>
     *
     * @param group the new primary group
     * @return if the change was applied successfully
     * @throws IllegalStateException if the user is not a member of that group
     * @throws NullPointerException  if the group is null
     */
    @NonNull DataMutateResult setPrimaryGroup(@NonNull String group);
steel plover
unreal mantle
nocturne elbow
unreal mantle
#

Doesn't work as in, it errors, or just doesn't change the parent group

nocturne elbow
#

I think it's second

unreal mantle
#

?

nocturne elbow
unreal mantle
#
     * Sets a users primary group.
     *
     * <p>This modifies the "stored value" for the users primary group, which may or may not
     * actually take effect, depending on how the platform is calculating primary groups.</p>
     *
#

Did you read that bit

nocturne elbow
#

Ah I didn't I'll read it

unreal mantle
#

In the config for luckperms, what is the primary-group calculations set to?

steel plover
nocturne elbow
nocturne elbow
unreal mantle
nocturne elbow
#

ahh the other's (what will change to) primary groups should be higher weight than original groups(player's group) am I understand right?

unreal mantle
#

Because parents-by-weight is set, whichever group the player has with the highest weight, will be the players primary group

nocturne elbow
unreal mantle
#

Using the api? Quickest way is to just do it in LP itself.

nocturne elbow
#

Ahh kinda like cmd in game?

unreal mantle
#

lp group <name> setweight <weight>

nocturne elbow
#

ahhhh

unreal mantle
#

Otherwise it's weight.<weight> in the editor

nocturne elbow
#

Ahhh I got it

#

thank you for support

unreal mantle
unreal mantle
# steel plover but I can't use e.getTarget().getUniqueId()
    private void onNodeAdd(NodeAddEvent e) {
        if (!e.isUser()) { // Checks if the event is getting triggered for a player
            return; // return out of function if it wasn't a user. (i.e It was a group instead)
        }

        User target = (User) e.getTarget(); // The user the event is getting triggered for
        Node node = e.getNode(); // The node that was added

steel plover
#

thanks

nocturne elbow
unreal mantle
#

Yes

steel plover
#

and is a method to get who has give the node?

unreal mantle
nocturne elbow
unreal mantle
#

Try, haven't done it myself personally.

nocturne elbow
#

Ok I'll try it

unreal mantle
nocturne elbow
elfin raptor
steel plover
#

but how can I get source on a NodeAddEvent?

#

e.getSource() does not exists

turbid solar
#

please look at the java doc

#

!javadoc

frank driftBOT
elfin raptor
#

Hi, I don't understand everything at how work the API of luckperms, I have this code here but it doesn't change my prefix, can you help me why please ? (I got no error)

turbid solar
#

you can just do data().add(node…

#

don’t think it’s a good idea to do a toString on a prefix mode

elfin raptor
night pier
#

well what's the error

elfin raptor
turbid solar
#

remove the node.builder

elfin raptor
elfin raptor
#

Anyaway, instead of using the api, i’ll use console command

grim sentinel
#

How can I add an Permission with the Luckperms api? Can you send me the Code for that?

main dagger
#

!cookbook

frank driftBOT
undone patio
#
                Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
                int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i).max().orElse(10);``` I have this, how could I get the prefix of the `priority` variable?
#

My goal is to have a prefix for the highest and lowest priority.

main dagger
#

you want to get a prefix from an integer...?

undone patio
#

Well, not exactly, something similar though

#

I'll of course need to alter the int variable to a string, just not sure what else to put.

vast bobcat
#

Hello, if I create a contextcalculator on velocity, can that same context also sync data to the bukkit-based servers?
If yes, how so, it doesn't seem to do it by default? If no, are there other recommended ways to sync data without leaving the luckperms environment? If all else fails, I will probs go back to redis or plugin messaging.

#

(context: I only want a group to apply under a certain circumstance. This circumstance is known by the proxy and therefore I was hoping to use contexts rather than adding and removing groups on players... that seems like it is prone to issues)

main dagger
#

you could have you proxy plugin communicate with a plugin on the backend server to apply the context there

#

you would need to implement that yourself though

alpine storm
#

developer of 90k+ member server asking for help

main dagger
#

is there a problem with that?

shadow scaffold
#

Why should I struggle when I can ask the team that provides the plugin we use x)

#

Just because I maintain a big server doesn’t make me all knowing aMisc_dogpat

#

(i wish it did tbh)

main dagger
#

what its like running a server

desert chasm
#

Any way to make %luckperms_primary_group_name% display when player is offline?

#

of some way to display the prefix of a player when they're offline?

main dagger
desert chasm
#

It displays "no-match"

main dagger
desert chasm
#

I assumed it could of been to do with api

main dagger
#

are you creating a plugin?

desert chasm
main dagger
#

then you would not be using the api

desert chasm
stoic pollen
#

I am trying to set a player's group with the developer API but when I check the result it returns FAIL. What am I doing wrong? ```java
var lp = LuckPermsProvider.get();
var player = event.getPlayer();
var user = lp.getPlayerAdapter(Player.class).getUser(player);
user.setPrimaryGroup("dev");
lp.getUserManager().saveUser(user);
ALog.debug(user.getPrimaryGroup());

turbid solar
#

!api

frank driftBOT
stoic pollen
turbid solar
#

!cookbook

frank driftBOT
fluid tendon
#

in my plugin.yml I have this gmc: description: Easily toggle gamemode creative permission: hycordia.gmc usage: /<command> [player] the hycordia.gmc permission is required to change your own gamemode, and the hycordia.gmc.other permission is required to change someone else's gamemode. How can I add the permission hycordia.gmc.other to the plugin?

main dagger
#

what do you mean by "add the permission"?

#

all you need to do is make a permission check like you normally would

fluid tendon
#

I want it to show up within luckperms

main dagger
#

it will

fluid tendon
#

in my gmc command: ``` if (!checkPermission(player, "hycordia.gmc.other")) {


```public static Boolean checkPermission(Player player, String permissionNode) {
        User lpUser = getLuckPermsAPI().getPlayerAdapter(Player.class).getUser(player);
        CachedPermissionData lpPermissionData = lpUser.getCachedData().getPermissionData();
        return lpPermissionData.checkPermission(permissionNode).asBoolean();
    }```
main dagger
#

is there a reason you arent just using bukkits CommandSender#hasPermission() method?

fluid tendon
#

does that take into account luck perms?

main dagger
#

luckperms is a permissions plugin

#

it provides permissions

#

using the luckperms api directly for normal permission checks is just locking yourself out of using other permission plugins if you ever want to switch, or stops other people from using whatever they prefer if you make the plugin public

fluid tendon
#

I am making this plugin for my server

#

not gonna release it

#

but yeah I get it

nocturne elbow
main dagger
#

it wont be a bad thing until one day some new better permissions plugin comes along and becomes the most used permissions plugin and then theres stuff that only works with LP for some reason

nocturne elbow
#

never!!

gleaming dew
#

can we speak italian?

bright crag
#

How can i send a Update ping for a user?

main dagger
#

wdym by update ping

bright crag
#

when i set a suffix like this:
User user = luckPerms.getUserManager().getUser(spieler.getUniqueId()); if (user == null) return; SuffixNode node = SuffixNode.builder(suffix, 150).build(); user.data().add(node); luckPerms.getUserManager().saveUser(user); Are the changes only there as soon as the user rejoins

main dagger
#

does it update correctly if you change it manually with the command in-game?

bright crag
#

yes

#

But if I change it via my bungee plugin the user has to rejoin first.

main dagger
#

are you getting its value on bungee or a backend server?

bright crag
#

via bungee, but all backend servers and bungee a connected via sql with the same database

#

Do you have any idea how I can update it myself? I can't find anything about it in the docs...

main dagger
#

what is the result of the add call?

#

it should return a DataMutateResult

bright crag
#

i did that
DataMutateResult result = user.data().add(node); System.out.println(result);
and i get SUCCESS

#

is that right?

main dagger
#

probably 🤔

#

what happens if you get the suffix right after saving and print it

bright crag
#

before saving i get the suffix and after saving still the suffix

#

but it dont updates ingame xD

#

only if i rejoin

main dagger
#

if you print it before and after though does it change?

bright crag
#

nope

#

bevore saving i get this ImmutableNode(key=suffix.150. test, value=true, expireAt=0, contexts=ImmutableContextSet([]) and after it the same

#

That are my methods to remove and add the suffix

#

I'm pretty new to programming so sorry if it's not quite right

jaunty pecan
#

The saveUser call will store the new data in the database

#

Then you send an update ping using the msging service to notify other servers “hey the data has changed, refresh from the db”

bright crag
jaunty pecan
#

LuckPerms.getMessagingService

bright crag
#

just that?

jaunty pecan
#

MessagingService.pushUserUpdate

#

Those two, chained together

#

(Sorry I’m on mobile)

hybrid panther
bright crag
main dagger
#

luckPerms.getMessagingService().pushUserUpdate() i think

bright crag
jaunty pecan
#

Something like that

#

The class/method names will not match exactly

bright crag
#

Thank you ;D

#

Thank you all! It's finally working luckpet

jaunty pecan
#

Awesome 😎

shut skiff
#

Hey, how i can get expiry date of the parent group with the highest weight ?

distant bobcat
#

Is it possible to get the list of cached permission nodes that luckperms uses for it's webGUI auto completion?

distant bobcat
#

Figured out I could use LuckPermsProvider.get().getPlatform().getKnownPermissions()

warped hinge
#

Hi, how do I determine whether a user has some permission? This is the first time I'm working with LuckPerms from a mod/plugin perspective and the API is a bit overwhelming.
I just need to test whether a user has some permission like my_mod.command.reload

turbid solar
#

Can't you use the permission api of the platform you're using?

warped hinge
glossy radish
#

How do i get group track?

main dagger
#

groups can be on any number of tracks

#

it could be none, it could be 12

glossy radish
#

so can i have collection of group tracks using api?

main dagger
#

go through every track and see if it has the group you want

rare abyss
#

How can I remove context from a Node I copied?

This works to add a world as context, but how do I remove?

group.data().add(node.toBuilder().withContext(DefaultContextKeys.WORLD_KEY, world).build());
rare abyss
#

nvm got it. took me a bit

somber sun
#

Hi ! How to set player suffix please ?

main dagger
#

same way you set a prefix

#

!cookbook

frank driftBOT
somber sun
#

thx

zinc storm
#

How should I add my CustomStorageProvider on Spigot?
Because the necessary classes aren't exposed as the part is isolated in the jarinjar

cunning lily
#

Hello! I'm using PlaceholderApi for my plugins, but i'm doubting if I should use luckperms papis or objectiveScore papis (these check vanilla scoreboards, for example a score 0 or 1.)
What is more efficient? LP's papis, or to check scoreboards?

main dagger
cunning lily
main dagger
#

benchmark it and find out ¯_(ツ)_/¯

#

why not just use a map or something in your plugin though?

#

and if you want persistent storage, javas file classes arent too difficult to work with

cunning lily
#

I will take a look into it, thanks!

zinc storm
main dagger
#

first,

Wonder why you want to do this in the first place.

zinc storm
#

I want to use a database which isn't implemented, because it is better for my use case in most situations

main dagger
#

what database?

zinc storm
#

OrientDB

main dagger
#

according to wikipedia, orientdb supports sql queries

#

have you tried that with luckperms yet?

#

if it works, itll certainly save you a lot of effort

zinc storm
#

But I want to implement it another way as it is build as a document database with graph capabilities which wouldn't be best to use with relational design

misty hinge
#

i kinda oofed luckperms

#

i kinda did a oop

#

i always like to break luckperms XD

#

but fun thing is. im not even using offline lookups

night pier
#

send your code

misty hinge
#

unless

#

i yeeted something i shouldnt have yeeted

#

fun thing is. i never had that message popup so idk if i broke something

karmic shadow
#

scheduleSyncRepeatingTask?

#

like

misty hinge
#

did that so the tablist updates

night pier
#

yeah, you're doing a player lookup on the main thread.

misty hinge
#

should i not do that?

night pier
#

sync = on main thread

karmic shadow
#

Ask the author of the plugin making the request to perform Vault calls for
offline players "asynchronously"

#

No

misty hinge
#

but then why is it that i never had that message popup?

karmic shadow
#

Dont block-lag your server with lookups on main lol

nocturne elbow
#

Aren't there methods in Vault that take the Player directly? Why are you checking by player name?

misty hinge
#

WAIT FUCK

night pier
#

and why are you using the variable p in your for loop, but using player right below it?

misty hinge
#

I SEE WHAT HAPPEND

#

OOP

misty hinge
#

i just noticed this

#

im stupid

#

see. a weekend isnt something for me lol

#

now the message is gone

dusk spade
#

how to denied to join any world? in luckperms

main dagger
#

asking the same question in 4 channels will not get you a response any faster

night pier
#

!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!

fathom sundial
unreal mantle
fathom sundial
#

yes

unreal mantle
#

No, i meant as an actual dependency in your pom.xml or gradle build file

fathom sundial
unreal mantle
#

You missed the <scope>provided</scope>

fathom sundial
#

Thank you very much

#

now it works

rare abyss
#

this is more of a Java question.. but does anyone know of a way to return that value from a lambda function? I want to return if a player has a specific role while their offline

    private boolean isTimedOut(UUID uuid) {
        LuckPerms api = LuckPermsProvider.get();
        UserManager userManager = api.getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(uuid);
        
        userFuture.thenAcceptAsync(user -> {
            Collection<Group> inheritedGroups = user.getInheritedGroups(user.getQueryOptions());
            for(Group group : inheritedGroups) {
                if (group.getName().equals("timeout")) {

                    //this returns the labda function not isTimedOut(UUID)
                    return true;

                }
            }
            
        });
        
        return false;
    }
wild whale
#

You can't. Treat a lambda like it's an entirely different method, because it is.

#

There's a couple different ways to handle this situation, easiest being just blocking the thread, but this will also cause problems if anything else is on the thread

rare abyss
#

hm.. thanks

#

i'll probably just put the code in my onCommand( so I don't have to return from the labda

#

I can't access the main thread from inside lambda

wild whale
#

well yeah as the method says it's running it async

rare abyss
#

oh

#

is there any way to get an offline user's groups non async?

wild whale
#

No because it requires a data load, which is expensive

#

LP won't allow you to do a data load sync since it'll cause a massive lag spike

#

easy way around that, schedule a task inside the lambda to run sync, then toss whatever sync code you want in there

rare abyss
#

ah.. I should probably rethink how I'm managing timed out players, maybe I shouldn't make it tied to a role

wild whale
#

Well why do you need to query it when they're offline?

rare abyss
#

when a mod toggles their timeout

wild whale
#

(also the one problem with the schedule a task solution is you start getting into "callback hell" aka a mess of nested lambdas)

#

mmk fair enough

rare abyss
#

yeah it will be a lot of nested labdas

#

:/

#

ok putting it in a scheduled task worked, thank you!

modest ermine
#

Hey everyone! I had a question about the API regarding how permissions are checked. Cause I'm not totally sure how that's taken care of by minecraft in the backend.
All say I'm working in paper and velocity.
I'm wondering if I'm able to just use the player.hasPermission to check if a player has a permission that's been granted via luckperms. Does that information get saved in a way that I can access it through that method? Or do I need to actually get my hands dirty through the API?

main dagger
#

for simple permission checking, all you need to do is use the standard method of checking permissions on whatever platform you are using. i only know that bukkit has a hasPermission method for CommandSenders (which includes entities, players, command blocks, and the console), but i assume velocity and bungee have a similar easy way to do that.

modest ermine
main dagger
#

yeah

modest ermine
#

awesome, thank you.
This is my first time really working with minecraft's permissions system (usually I just use the default command perms that you can define in plugin.yml) so I'm pretty new to it haha

main dagger
#

well its not minecrafts permission system

#

minecrafts "permission system" is op levels

#

which are not very useful

#

i think bukkit was what started the current standard for permissions, but it still only exists with mods

modest ermine
#

okay yeah, sorry that's sorta what I meant, cause yeah I know that vanilla doesn't really have any useful permission stuff as you mentioned

full dagger
#

heyy i want to setup some perms to my sever
can anybody help me??

basically i want a builder role who has perms to place/break blocks but cannot drop items because he/she is in creative

lone summit
#

Hello everyone, tell me how to delete player accounts

clever zodiac
full dagger
bright tapir
#

update on this issue: switching to promoting the user via UserManager#modifyData seemed to solve my issue. I’ve not a clue why, but it works for me so 🤷‍♀️

restive shoal
#

how do y'all do wildcard support with unregistered permission nodes

main dagger
#

what do you mean?

#
  • just means every permission
#
  • is valid for fjhaiefhisdhfjhdsaifhisadhfjiasdhfi if you checked that permission
restive shoal
# main dagger what do you mean?

not by default, for wildcard to work permission nodes have to be registered in the plugin.yml of a plugin, but somehow luckperms gets the unregistered ones 🤔

main dagger
#

luckperms doesnt care about plugin.ymls

#

at least not as far as i know

#

im pretty sure only bukkit has them anyways

#

fabric and forge at least have no such thing

wild whale
#

I mean it does for permission discovery for completions, but it doesn't affect calculation afaik

#

Actually if there's no node set for something, it might respect the default setting if it's set to all

#

but it won't affect wildcards

main dagger
#

actually theres an option in lp to respect plugin.yml default permissions

#

defaults to true

#

but its only for bukkit

wild whale
#

ok yeah thought so

#

but yeah for sure the wildcards arer all LP

main dagger
#

but that has nothing to do with wildcards

restive shoal
#

(for reference for other coders) they get the crafthumanentity from the player, and get the perm declared field which is a PermissibleBase object. They then create a new permissible of their own creation which extends PermissibleBase and set all of the permissions in the old perm to the same in the new one of which they then set to the perm object in crafthumanentity using NMS. Their extension class of PermissibleBase contains methods such as hasPermission which they override to include wildcard checking

cobalt otter
#

Hey, how would I go about finding the server url and Api key of my luckperms server

#
    apiKey: '<your API key>'```

Anyone know how to find the apiKey?
thorny echo
#

@cobalt otter Hey, I assume it was you who sent me an email 🙂 Where you find the URL depends on what type of hosting you're using. Are you on shared hosting like BisectHost, Shockbyte, etc, or do you use a VPS/Dedicated Server/your own PC?

The API key can be set in your LuckPerms config after installing the LuckPerms-rest extension if I remember correctly

cobalt otter
willow folio
#

Is there a quick n easy way to get an offline player's permission nodes as strings after loading the user data?? Something really simple that resembles Player#hasPermission ?

nocturne elbow
#

!api

frank driftBOT
nocturne elbow
#

check the second page linked^ @willow folio

willow folio
#

Yeah I figured something out, thanks though :)

willow folio
#

Oh nevermind it doesn't work

#
        User user = luckPerms.getUserManager().loadUser(player.getUniqueId()).join();
        if(user.getNodes(NodeType.PERMISSION).contains(Node.builder("arthworld.rank.owner").build())) return Rank.OWNER;
#

Wouldn't this work??

#

Oh it doesn't consider inherited data

nocturne elbow
#

correct

#

you should use the cached data
which is explained in the second page linked :p

willow folio
#

Well cached data wouldn't always be up to date right

nocturne elbow
#

it will

#

it's cached in the sense of calculated

robust yacht
#

How do i set the world group/player prefix?

unreal mantle
#

Create a PrefixNode and use the .withContext(DefaultContextKeys.WORLD_KEY, "<world name>")

#

To add the context to it

#

Then just assign that prefix node to a group/user

#

@robust yacht ^

robust yacht
#

thx

#

and how do i get the world prefix?

unreal mantle
#

world prefix?

robust yacht
#

prefix of a group in a world

unreal mantle
#

String prefix = user.getCachedData().getMetaData().getPrefix();

To get the prefix users current prefix

#

PrefixNode does have a getContexts() method as well, since it inherits from Node

robust yacht
#

so this should work?

#

w8 nvm

unreal mantle
#

Should work. Try it and see what happens

unreal mantle
nocturne elbow
#

Hi, I'm trying to get when a user primary group is set using the parent set <group>

#

What's the event that's triggered when this particular command is executed ?

unreal mantle
nocturne elbow
#

never printed out anything

nocturne elbow
#

Can anyone assist me please

#

i wanna know how to get the default group

main dagger
#

get the group with the name default

nocturne elbow
#

should i make it configurable ?

nocturne elbow
#

Getting the group with the least weight

main dagger
#

in luckperms, it will always be default

nocturne elbow
main dagger
#

!default

frank driftBOT
nocturne elbow
brazen spire
#

Is there some API to use custom weighted meta nodes? I want to store the tablist color for users as weighted metadata to allow important groups to overwrite other colors.
I like the idea of prefixes with the weights but I don't see a way to implement own weighted metadata.

nocturne elbow
brazen spire
#

oh, that should be good enough, i can use the group's weight too. thx

hearty turtle
#

i have a small issue
whenever i update a user permission (in my case : "bungeecord.command.server")
it update successfully in the web editor but i have to quit the server and rejoin for the permission to be applied how could i fix it?
my code :

User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(p);

user.data().add(Node.builder("bungeecord.command.server").value(true).build());

LuckPermsProvider.get().getUserManager().saveUser(user);

Mention me when replying 🙂

#

and how to add and remove players from groups will help me too .

brazen spire
hearty turtle
#

yes, this code is in a backend server (spigot server) but i am checking it in the same project

#

i am doing a login plugin so when you successfully logged in you should get that role to go to "Lobby" server

brazen spire
#

Then you should use the messaging service to push the user update to the proxy.
Should be ..saveUser(user).thenAccept(n -> LuckPermsProvider.get().getMessagingService().ifPresent(s -> s.updatePing(user));

hearty turtle
#

but my plugin is in backend server will this work ?

brazen spire
#

Yes, the backend LuckPerms instance will push a update message to the proxy and LuckPerms on the proxy will reload the permission data from the user

hearty turtle
#

that sounds good i'm gonna try it now

#

your code should be under my code right?

#

wait a sec i figured it alone 😂

brazen spire
#

Yes, but updatePing is probably the wrong method name

hearty turtle
#

i got those

#

brooooooo it works!! Thanks a lot i just trying to fix this since 2 days 😂
for anyone who has the same problem use this code:

User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(e.getPlayer());
user.data().add(Node.builder("permission").value(false).build());
// Now save changes.
LuckPermsProvider.get().getUserManager().saveUser(user).thenAccept(n ->
        LuckPermsProvider.get().getMessagingService().ifPresent(s ->       s.pushUserUpdate(user)));
#

thx to @brazen spire

limpid terrace
#

Hello, how can I get the group prefix? I already have the group instance

main dagger
#

!cookbook

frank driftBOT
limpid terrace
glass crescent
#

how do you get a groups members?

unreal mantle
#

Just search for the "group.<group name>" permission

limpid terrace
#

Hello is there an event when a player changes of group? I want to update their ranks in the tab when it changes

jaunty pecan
prisma lantern
#
    public static Group getPrimaryGroup(UUID uuid) {
        LuckPerms luckPerms = LuckPermsProvider.get();
        User user = luckPerms.getUserManager().getUser(uuid);
        if (user == null) return null;
        return user.getInheritedGroups(QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build()).stream().max(Comparator.comparingInt(a -> a.getWeight().orElse(0))).orElse(null);
    }```
#

that doesn't seem to get the group when they are offline

#

however does (using a Player object rather than a UUID) when they are online

wild whale
#

Yup, offline players aren't loaded. You have to load them

prisma lantern
#

so userManager.loadUser()?

prisma lantern
#

why is this so painful

#

so many completable futures

#

fuck it, i don't even want to use it anymore

#

i'll just rely on cached data

#

unless there's another way

celest acorn
#

is there any way to know if the offline user's cached data is up to date?

#

or if I want always up to date data, do I have to use UserManager#loadUser(UUID) method? does this method always fetch the database?

wild whale
#

Correct, load is it loading from the storage method

ripe hedge
#

how do i make it so my rank transfers through other servers?

nocturne elbow
#

Hello, I want to add players who join for the very first time to a group, I've tried

User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(player);
            user.setPrimaryGroup("group.admin");

and I have also tried

User user = LuckPermsProvider.get().getPlayerAdapter(Player.class).getUser(player);
 DataMutateResult result = user.data().add(Node.builder("group.admin").build());

But none of these work it does not add the player to that group for some reason? If anyone could help I would really appreciate it

turbid solar
#

save the user

celest acorn
#

are there any cases when LP doesn't have all groups loaded?

nocturne elbow
# turbid solar save the user

I tried that as well, but I’m getting luckPerms is null when I create
private LuckPerms luckPerms; and make a constructor for it, how do I make it not null?

turbid solar
#

get the api

#

LuckPermsProvider.get()

#

!cookbook

frank driftBOT
nocturne elbow
#

nvm figured it out, thanks!

gusty lava
#

Is it possible to get a meta data tag of an offline player?

#

I am trying to parse the rank name, specially formatted (aka the metadata tag). On a leaderboard where all players should be able to be offline, and their rank still display on the leaderboard. However with my current code it only is able to fetch the rank name when the player is online.

Basically I want to take out the placeholder middle man and make my own query of an offline player for a meta data tag
Here is my current code

LinkedHashMap<TopVoterPlayer, Integer> topVoters = votingInstance.getMainClass().getTopVoter(topType)

            int i = 1;
            for(Map.Entry<TopVoterPlayer, Integer> entry : topVoters.entrySet()) {
                if(i == position) {
                    OfflinePlayer potentialPlayer = Bukkit.getOfflinePlayer(entry.getKey().getUuid());
                    String rankPrefixRaw = PlaceholderAPI.setPlaceholders(potentialPlayer, "%luckperms_meta_prefix_board%")
                    String rankPrefix = PlaceholderAPI.setPlaceholders(potentialPlayer, rankPrefixRaw)
                    return rankPrefix + " " + entry.getKey().getPlayerName()
                }
                i++;
            }```
unreal mantle
#

That will tell you the process to getting data from offline players

prisma lantern
#

is there a way to load an offline player without completable futures?

turbid solar
#

no

gusty lava
#

I'm trying to fetch the data of an offline player, but this is just returning empty, and I'm very sure that it is a player that has logged in and a proper UUID. As well as the api is loaded, otherwise I'd have an NPE. It just returns an empty string

for(Map.Entry<TopVoterPlayer, Integer> entry : topVoters.entrySet()) {
                if(i == position) {
                    UserManager userManager = luckPermsApi.getUserManager()
                    CompletableFuture<User> userFuture = userManager.loadUser(entry.getKey().getUuid())
                    userFuture.thenAcceptAsync {user ->
                        CachedMetaData metaData = luckPermsApi.getPlayerAdapter(User.class).getMetaData(user)

                        return user.toString()
                    }
                }
                i++
            }```
#

I just checked and I believe the line CachedMetaData metaData = luckPermsApi.getPlayerAdapter(User.class).getMetaData(user) is actually just stopping the thread

#

Apparently the player adapter is only for the online player object?

nocturne elbow
#

the player adapter is for the platform's player type

#

Player.class, ProxiedPlayer, ServerPlayer, ...

#

you already have the user object, you can simply getCachedData getMetaData

gusty lava
#
 
for(Map.Entry<TopVoterPlayer, Integer> entry : topVoters.entrySet()) {
                if(i == position) {
                    UserManager userManager = luckPermsApi.getUserManager()
                    CompletableFuture<User> userFuture = userManager.loadUser(entry.getKey().getUuid())
                    userFuture.thenAcceptAsync {user ->
                        Bukkit.getLogger().info(user.getNodes(NodeType.META).size())
                        Bukkit.getLogger().info(user.getNodes(NodeType.META).getAt(0).metaKey)
                        return user.getNodes(NodeType.META).getAt(0).metaKey
//                        return user.getNodes(NodeType.META).stream()
//                        .filter { node ->
//                            node.metaKey.equalsIgnoreCase("prefix_board")
//                        }.collect(Collectors.toList()).get(0).metaKey
                    }
                }
                i++
            }```

This produces the output

1
lp-editor-key

#

If I am trying to get a meta node that the user inherits from a group should I get their highest weight group and read the meta from the group instead?

nocturne elbow
#

huh

#

what do you want to do?

gusty lava
#

I want to get meta data from the users highest weight group

#

Should I just get their inherited groups and sort the stream by weight or

nocturne elbow
#

and why not the resolved value from the cached metadata?

gusty lava
#

because it only has the user's meta data

#

it doesn't have its inherited meta data

#

from what i can tell

#

if it did my user would have way more meta nodes than just one

nocturne elbow
#

the user itself will only have whatever the user has, the user's own nodes do not include inherited ones

gusty lava
#

Exactly

nocturne elbow
#

that's what the cached data is for

#

the cached data resolves the whole tree

gusty lava
#

I got it working

#

thx

hallow saffron
#

Hello When my friends are nicked in my server with luckperms chat and essentials the nick only showes up in tab and not in chat does anybody know the reason for this?

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
thorn canopy
#

Hey, is there any distribution of LP implementations? I wanted to run the game on the IDE with LP loaded

wild whale
#

!download ?

frank driftBOT
thorn canopy
#

Sorry should have clarified I mean of artifacts on maven like just the API has

wild whale
#

eh no there's no platform implementations on maven since that doesn't make sense. Maven is only used for APIs.
What are you actually trying to do?

thorn canopy
#

I'm developing a fabric/forge mod and recently added LP compatibility for permission checks, I wanted to be able to run the game in debug mode with a LP distro w.o having to rely on flatfile deps

wild whale
#

can't you just load the LP mod like normal?

thorn canopy
#

we can but it's nowhere near as convenient when you're not the only developer

#

but ig the answer is no, it's usually a common thing for more prominent mods to provide but ig LP is new to the space, thanks for your time :D

wild whale
#

I guess that must be a wierd workaround for the modded community because from what I've seen in the plugin community, people just manage other plugin deps for dev servers manually

misty hinge
#

!api

frank driftBOT
sour patrol
#

hi, how to remove parent group from a player with api?
i tried Objects.requireNonNull(user).getInheritedGroups(user.getQueryOptions()).remove(group) but it doesn't work, and don't see other ways

unreal mantle
sour patrol
noble seal
#

Hi i want set to a player a parent, do you think its better use Server Command or use API?

turbid solar
#

probably api

surreal sail
#

I got a question is here anyone who can help me i'm making a plugin and wants to put a players luckperms prefix (his rank) in my score board. But my problem is that it won't work (i got the prefix but i cant get it in my scoreboard)

unreal mantle
#

If your scoreboard supports placeholderapi, just use the placeholder for the prefix

surreal sail
#

if my scoreboard supports placeholderapi

main dagger
#

by looking at its documentation

surreal sail
main dagger
#

no

#

do you see any voice channels?

surreal sail
#

no i was thinkin private chat

main dagger
#

no

#

what dont you understand

surreal sail
#

oke i'll see if it supports the placeholderapi

#

i don't think it supports placeholderapi (i'm using the org.bukkit.scoreboard )

main dagger
#

oh you are making a plugin

surreal sail
#

yes

main dagger
#

then just add placeholderapi support to your plugin

surreal sail
#

and can you give me an exemple how i can do that (i'm new at making plugins)

main dagger
#

this is luckperms support

surreal sail
#

ow oke

tidal ermine
#

how i can get permissions of a group?

#

or check a specific permission?

unreal mantle
tidal ermine
#

how i can get queryOptions of a group?

unreal mantle
tidal ermine
#

Is it possible or not to take the queryoptions from a group?

#

I don't really understand the developer api

unreal mantle
#

What are you trying to do with the Api?

tidal ermine
#

I want to get a specific permission from a specific group

#

I already know how to take prefix, suffix, etc from a group, but I'm getting confused with the permissions

unreal mantle
tidal ermine
#

In this way it took the cachedmetadata of a group

#

I am trying to do another way to get the CachedPermissionData

unreal mantle
#

You should be using something like:

RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
    LuckPerms api = provider.getProvider();
    
}
``` To get an instance of Luckperms then using something like:


```java
User user = luckPerms.getUserManager().getUser(uuid);
``` To get an instance of the user.
#
Group group = luckPerms.getGroupManager().getGroup(groupName);
if (group == null) {
    // group doesn't exist.
    return;
}
``` Or that if you're wanting a group
#
QueryOptions queryOptions = group.getQueryOptions();
CachedPermissionData permissionData = group.getCachedData().getPermissionData(queryOptions);

That's the easiest way to get the cachedPermissionData of a group.

#

@tidal ermine

tidal ermine
#

Oh okay

#

I already understood

#

thanks

tidal ermine
#

fixed

lean mirage
#

Hi all! I ran into such a problem, I wanted to make the / info command in one of the social networks. I get the player's nickname as a string. Therefore, in api I get the player as a string. So, if the player does not enter the server at least once, and on the server he has both donations and that's it, the user will be null

lean mirage
main dagger
#

what

lean mirage
#

?

#

If a player leaves and some time passes, then there will be no data about him, why?

nocturne elbow
#

Users are unloaded when they are no longer needed (i.e. after they log out)

#

If you are unsure whether they are online or not you need to load the user

fickle marten
#

Not sure if this is the right place it ask or #support-1 was better but...

What is the easiest way to get an expiry time for a temporary permission but in seconds?

I was happing to use this info inside a JavaScript Placeholder to compare permission nodes expiry time and than have the output depend on which permission node has the longest expiry time. Just haven't been able to figure how to get the time in seconds.

vast bobcat
#

Hello, does anyone know if all luckperms groups (not users) are loaded on startup or if they are loaded as players join?

If they are not loaded immediately, is there a known cache timeout before it will unload unused group data?

lean mirage
#

Hello, how to get a list with all groups in luckperms?

snow socket
#

а хуй его знает

snow socket
#

@lean mirage мб так

lean mirage
#

мб

#

попробуй, спасибо

zenith mantle
#

Server crashed and this came up. Luckperms was mentioned in the server dump

#

What can I do to fix

clever zodiac
#

@zenith mantle go to one of the support channels, and also include the server dump

#

this channel isn't meant for that, and no one can help with Spigot's default err message

grizzled compass
#

Hey a small question where can I find the maven dependency for the BungeeCord API ?

nocturne elbow
#

it's the same api for all platforms

#

!api

frank driftBOT