#luckperms-api

1 messages · Page 3 of 1

wheat lake
#

!cookbook check this if you need help or examples how to use the LP API

frank driftBOT
snow flame
#

Ok thanks

#

@unreal mantle again the same error ;-;

frank driftBOT
#

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

snow flame
snow flame
#

But i have to do this before new year

night pier
#

send your full class

snow flame
#

.

#

here

#

sir

night pier
#

send your Main class

#

!paste and use a pastebin

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!

snow flame
#

Wait

#

Main Class

night pier
#

You did nothing in that for LP

snow flame
#

And Join class

snow flame
snow flame
night pier
#

!api please read this.

frank driftBOT
snow flame
#

Ah ok

vital grove
#

in my plugin i am trying to do run something after a players prefix is changed how can i check when it happens

main dagger
#

its not quite that simple

#

many things go into determining the players prefix, and afaik luckperms doesnt track when the prefix changes, it just calculates its value every time a plugin asks for it

vital grove
#

i could also work with groups

main dagger
#

and a player can have multiple prefixes displayed at once depending on how a user may have configured their meta stacking

vital grove
#

like group.owner

main dagger
#

what are you actually trying to do with that information?

vital grove
#

when the players group changes

#

reset the prefix

#

like clear or the meta data the player has

#

this clears the prefixes : user.data().clear(NodeType.PREFIX::matches);

#

but i wanna check first when the group changes

main dagger
#

why do you need to do that?

#

also are you making this plugin for your own server or to release?

vital grove
#

i made a rankcolor plugin like hypixel

#

my own server

#

and maybe release at a later date

main dagger
#

instead of directly changing the players prefix, you can include a placeholder for the color

vital grove
#

no wait

#

i am trying

#

to do it

#

when the player is no longer on for example mvp++ group

#

their prefix doesn't stay for example "&6[MVP&c++&6] "

#

but getting it cleared

main dagger
#

if you just make the mvp++ prefix use a placeholder for the color, you dont need to add it directly to the player, and thus dont need to clear it when their group changes

vital grove
#

like make it if the player has for example the red ++ color to use in the message something .replace(prefix, BungeeMain.getConfig.getString("Prefix");

polar junco
#

What is the <> of prefix

split coral
#

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

    public boolean checkPermission(Player player, String permission) {
        try{
            LuckPerms api = LuckPermsProvider.get();
            User user = api.getUserManager().getUser(player.getUUID());
        }catch (Exception e){
            // LocalPlayer - no LuckPerms - has no permission
            return false;
        }
    }
jaunty pecan
#

if you have a player already, why not just use player.hasPermission() ?

split coral
jaunty pecan
#

ah ok

#

best way is to use the forge permissions api

split coral
jaunty pecan
#

yeah I was just looking too and I can't find any either lol

#

basically, you have to register your permission nodes using this event

#
@SubscribeEvent
public void onPermissionGather(PermissionGatherEvent.Nodes e) {
}
#

then you can check them using

#
PermissionAPI.getPermission(player, permissionNode);
#

the design is a bit ehhh

#

you can also depend on the LP UserCapability

split coral
#

I see thanks for all your help, do you have the forge version of luckperms on any repository or should I add it as a file lib?

jaunty pecan
#

would have to be file lib for now

split coral
#

Alright will try to the the UserCapability class

jaunty pecan
#

actually on second thought it is probably better to do it using the proper LuckPerms API instead of the user capability

#

since the player is online it should be pretty easy

split coral
#

If you have any docs / examples on hand it would be really helpful

jaunty pecan
#
public static boolean checkPermission(ServerPlayer player, String permission) {
    LuckPerms luckPerms = LuckPermsProvider.get();
    PlayerAdapter<ServerPlayer> playerAdapter = luckPerms.getPlayerAdapter(ServerPlayer.class);
    return playerAdapter.getPermissionData(player).checkPermission(permission).asBoolean();
}
split coral
#

Thank you for your help, and for the work that you have done for us to not have to deal with well... the forge api 🙂

jaunty pecan
#

haha no problem :)

final bronze
#

Do api events run as Spigot events?

nocturne elbow
#

No, they run through LP's own event bus

grizzled crypt
#

I remember that when I was using luckperms with spigot, the permissions for all commands were displayed automatically when I configured my server with the /lp editor command.
But now with Fabric, no permission is displayed (gamemode, ...). How can I make a specific command from another mod or from Minecraft vanilla to be forbidden
I dev. a mod with fabric that uses commands, how to set this up easily so that users can configure commands easily (with autocompletion in the luckperms editor) ?

main dagger
#

suggestions are taken from permission checks that have occured on the server, there is no api for adding them

#

if a permission was checked before creating an editor session, that permission will show up in the suggestions. i would recommend instead of trying to add your permissions to the suggestions manually, just document on your mod/plugin page what permissions there are and what each one does

nocturne elbow
main dagger
#

you technically could do that but it would need to be on a player joining rather than startup probably

grizzled crypt
#

Im trying now for testing to deny gamemode command, so i typed /gamemode creative, then /lp editor (but in editor no suggestion about any "gamemode" permission. Is that normal ?

main dagger
#

you said you are on fabric right?

grizzled crypt
#

ye

main dagger
#

vanilla commands do not have permissions, so you need a mod that adds permission checks to them

past hound
#

Hello, does the API offer a way to get a list of all groups sorted by weight? Or do I just get the loadedgroups and sort it myself by weight?

ocean anchor
#

Hi ! How I can set rank with your api, because I see only add and not set :/

#

Juste I want set also when I use /lp user <pseudo> parent set <rank>

#

without use this command...

nocturne elbow
#

Remove existing inheritance nodes and add the one you want to set, that's what the command does

#

There's a clear method that takes a predicate, should end up with something like user.data.clear(NodeType.INHERITANCE::matches) or similar

ocean anchor
#

ok thanks !

dreamy helm
#

Hey, I'm trying to give the players a role upon joining but can't figure out the PlayerJoinEvent event (https://pastes.dev/o5CfM4fKK6) - I've not worked with API's before and have already looked at the Luckperms Developer API wiki (https://pastes.dev/RMSq5xX6d8 - Both the override and Eventhandler)

orchid estuary
#

How to clear user permission?

dreamy helm
tardy raptor
#

Hi! How do i change the Group name of a group that already exists? With the API? There isnt a Node for that

nocturne elbow
nocturne elbow
tardy raptor
#

Ok thanks

ionic ginkgo
#

How do I give an npc command so that it only gives vip to that player (someone clicks on an npc and automatically gets VIP)

tardy raptor
#

You mean with Citizens 2?

ionic ginkgo
#

no NPC

ionic ginkgo
tardy raptor
#

With that Plugin you can add commads to npc

ionic ginkgo
#

I know but i dont no command :D

tardy raptor
#

You have a Plugin to give a Player VIP or Luckperms?

ionic ginkgo
#

LuckyPerms

tardy raptor
ionic ginkgo
tardy raptor
#

Type that exactly COmmand in chat but change the GroupName that adds it to your selcted npc

#

You have citizenscmd installed?

ionic ginkgo
#

Oh thanks it works :D

tardy raptor
#

ok

ionic ginkgo
# tardy raptor ok

I when you put there the owner, which has * rights, so it goes, but VIP what does not * so does not go

tardy raptor
#

Can you show me the Command you typed and the error?

ionic ginkgo
#

parent add VIP But you can't give that rank to that player

tardy raptor
#

No give me the exact Command you wrote to the npc it starts with /npcmd

ionic ginkgo
tardy raptor
#

And what happens when you click the Npc?

ionic ginkgo
tardy raptor
#

So it woked

ionic ginkgo
#

But my rank is still the same

tardy raptor
#

I think you have both ranks. Look at /lp editor and show me what groups your user is in

ionic ginkgo
#

Don't want to connect to my server and do it?

tardy raptor
#

Ok send me ip

ionic ginkgo
#

Dm's

tardy raptor
#

jup

pastel juniper
#

With that api, Can I make a discord bot to make a synchronize bot for a mc server to discord

#

or it is impossible

covert pasture
#

LuckPerms API has nothing to do with a discord bot

wild whale
#

Doesn't need to be JDA, could be whatever discord lib you want. LP doesn't know or care what you do with the API

#

(although JDA is certainly the most popular)

pastel juniper
pastel juniper
covert pasture
#

I don't think you can bind js with java / mc

pastel juniper
#

no a plugin

covert pasture
#

still

night pier
#

You can, considering Luck made a REST api for LuckPerms.

nocturne elbow
#

Hi, trying to use the LuckPerms API for some custom prefix stuff. I wanted to know how I could implement a specific server context to the prefix?

#

At the moment I have the basic code from the API cookbook, which works fine, but I only want it to apply to this specific server, not the other servers in the network.

#
luckPerm.getUserManager().modifyUser(uuid, (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("&8[" + prefix + "&8] &7", priority).build();

    user.data().add(node);
});
#

This is what I've got at the moment.

#

Any and all help would be appreciated, thanks!

jaunty pecan
scenic shore
#

the ".getApi()" generate this error

#

😦

#

can anyone help me?

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
scenic shore
#

😠

turbid solar
#

The documentation state how to get an instance of the API

scenic shore
#

i've read all the documentation, you're not helping me at all

turbid solar
#

That says how to get it

scenic shore
#

yet it seemed to me that i had already done it, i try again

turbid solar
#

The wiki says something else then what you have

scenic shore
#

mh 😵

scenic shore
#

so?

#

you didn't tell me how to fix it

#

i am left with the same problem

nocturne elbow
#

The wiki page Cas linked shows you exactly how to get an instance of LuckPerms to work with it, with code examples.

#

You have something entirely different than what the docs say

scenic shore
#

not found

nocturne elbow
#

The wiki does not say LuckPerms.getApi()

scenic shore
#

so what do i do? D:

nocturne elbow
#

The wiki page Cas linked shows you exactly how to get an instance of LuckPerms to work with it, with code examples.

#

Read it

scenic shore
#

okay, i'll stay that way forever

#

alright, here to help just 0

night pier
#

Its up to you to help yourself. no one is going to spoonfeed you.
you have been given direct links to code examples for obtaining the LuckPerms API, and have failed to listen to them.

scenic shore
#

i've now opened the documentation 100 times

nocturne elbow
#

The wiki page Cas linked has the exact answer to your question

#

Letter by letter

#

And yet you have something that is completely different

night pier
#

just opening the docs isnt going to change anything, you have to read it, and apply to your code.

nocturne elbow
#

Where did you get LuckPerms.getApi() from? What page are you even reading? Could you link it?

scenic shore
#

i start over

nocturne elbow
stiff valley
#

Hi! How can I remove group from a user?

#

I've tried ```java
InheritanceNode groupNode = InheritanceNode.builder(group).build();
DataMutateResult result = user.data().remove(groupNode);

but `result.wasSuccessful()` was always `false`
#

Fixed it! I was putting the wrong group into group variable

peak siren
#

@stiff valley type /lp user {user} parent set default

scenic shore
#

i run "/lpcookbook-setgroup MrFil_27 admin" command

#

as it was shown in the code example, why is it giving me this error?

scenic shore
#

!api

frank driftBOT
scenic shore
#

what is it?

#

thisi s the code 😦

#

this time i did everything right

main dagger
scenic shore
#

so, i loaded the LuckPerms class in the Main class after importing the dependency in the pom.xml, then i created a "private final LuckPerms luckPerms;" in the Command class and its constructor, if any, by doing "this.luckPerms;"

#

i did this

night pier
#

!paste send your full creategroup class and main class

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!

scenic shore
night pier
#

What is what

night pier
#

stop pinging me.

#

I told you exactly what I wanted you to do

#

“.” Doesn’t clear up any confusion.

scenic shore
#

sorry

left minnow
#

@rustic laurel @thorny echo (nsfw already got deleted)

frank driftBOT
#

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

scenic shore
night pier
#

send your full createGroup class, and your main class

scenic shore
#

ah

#

tomorrow

minor girder
#

does anyone know why when i add the placeholder api this happens to my ranks in chat? i downloaded expansion and everything

upper nacelle
#

Whatever chat system you are using does not hook into PAPI/Vault?

scenic shore
#

import net.luckperms.api.LuckPerms;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.group.GroupManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class createGroup implements CommandExecutor {

    private final LuckPerms luckPerms;

    public createGroup(LuckPerms luckPerms) {
        this.luckPerms = luckPerms;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player p = (Player) sender;
        if(!(sender instanceof Player)){
            Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Non puoi eseguire il comando da questa istanza.");
            return true;
        }

        if(args.length < 1){
            p.sendMessage(ChatColor.RED + "Utilizzo: /creategroup <group>");
            return true;
        }

        String groupName = args[0];

        GroupManager groupManager = this.luckPerms.getGroupManager();
        Group group = groupManager.createAndLoadGroup(groupName).join();

        p.sendMessage("Il gruppo '" + groupName + "' è stato creato con successo.");

        return true;
    }
}```
#

createGroup class

#

import net.luckperms.api.LuckPerms;
import net.madeinrp.luckpermstest.commands.createGroup;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {

    private LuckPerms luckPerms;

    @Override
    public void onEnable() {
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            LuckPerms api = provider.getProvider();
        }

        //Commands
        getCommand("creategroup").setExecutor(new createGroup(luckPerms));

    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}```
#

the Main class

main dagger
#

!paate please

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!

scenic shore
#

???

main dagger
#

read the embed

scenic shore
#

ok

scenic shore
main dagger
#

send the other file too

#

we dont just magically have access to it after you save it

scenic shore
#

ah

#

this?

scenic shore
main dagger
#

what are you expecting this to do?

scenic shore
#

idk, i brought back the LuckPerms class from the Main class

#

so i was helped

main dagger
#

and that pulls from the main class how?

#

(hint: it doesnt)

scenic shore
#

then tell me how I can create this blessed group please D:

#

i'm just trying to understand

main dagger
#

get an instance of the api in your main class. use that instance from your other classes

#

i am not going to spoonfeed you exactly how to fix it

scenic shore
#

i try again 😦

#

but the API instance i get in the onEnable method when i do

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

main dagger
#

how much programming experience do you have...?

scenic shore
#

i had 1 year of experience, but for a while i had to let it go, now that i've started again i missed some things 😦

#

okay, as long as i try to figure out how to use it i'm dealing with something else

foggy warren
#

Failed to handle packet net.minecraft.network.protocol.game.ServerboundClientCommandPacket@5a4de493, suppressing error java.lang.IllegalStateException: Capability missing

#

This is how I'm checking it
user.getCachedData().getPermissionData().checkPermission(permission).asBoolean()

#

Forge 1.19.2

snow flame
#

Why I am getting this error?

#

I have the plugin Installed

turbid solar
#

where are you getting the api instance?

snow flame
#

In main class

#

Look i am new to API Think so yeah

#

talk in simple Lang

#

So i can understand

#

(^_~)

#

@frank drift Look Can i please ping Staff members i need support fast so please cooperate. 😜

#

@unreal mantle

frank driftBOT
#

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

snow flame
unreal mantle
#

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

snow flame
#

W8

#

Here you go

snow flame
#

⌚ Waiting

turbid solar
#

save an instance of it, so

LuckPerms luckPerms;

onEnable() { luckPerms = …. }

snow flame
#

= ?

#

Oh ok i got it

scenic shore
#

Cannot invoke "net.luckperms.api.LuckPerms.getGroupManager()" because "this.luckPerms" is null

#

this time i tried the command found in the cookbook-plugin and it still gives me this error, what can I do to fix it?

scenic shore
#

here's what i did:

  • i imported the luckperms api into the pom.yml file as indicated in the guide
  • i got the api instance with the Bukkit ServicesManager, again as indicated by the guide
  • i registered the denend in the plugin.yml file
  • i tried to run a test with the SetGroup command from the GigHub file, and here it doesn't work
#

if someone could help me...

fast delta
#

You'd use the instance you got from the services manager

#

Save it in a field, pass it to your command class, etc and use it from there

quiet nest
#

Hi, does NodeMutateEvent execute on all servers connected to the same db?

fast delta
#

No, it only fires on the server/proxy it happened (command was run, editor changes applied, changed through API etc)

quiet nest
#

Okay, thanks

carmine elbow
#

Hey I've got a small problem. I'm hosting server for my friends and everything would be fine if they had premium version. I noticed that if I set online-mode in server.properties to false no one can join the server, even premium users. Could someone help me?

rugged hedge
turbid solar
#

Okay so I need some help, I have global & specific server only groups, how can I get meta either from a global heigher weight or, if set the meta from the context if that makes sense?

inland osprey
#

How to check how much longer the user will have rank?

#

And return duration string

fiery rose
#

how can i do when peaple join they get a rank instantly

turbid solar
#

with the api?

fiery rose
#

yeah i guess

turbid solar
#

on join, add the node

#

!cookbok

frank driftBOT
fiery rose
#

thx

frank driftBOT
jaunty pebble
#

Hi, can someone send me a code example how to check if a player has permission or a group permanently or only temporarily.

upper nacelle
#

!cookbook

frank driftBOT
brazen shadow
#

How to set group for user using api ?
I tried:

                Group group = luckPerms.getGroupManager().getGroup(args[1]);
                if (group != null) {
                    net.luckperms.api.model.user.User user = luckPerms.getUserManager().getUser(args[0]);
                    if (user != null) {
                        user.setPrimaryGroup(group.getName());
                        luckPerms.getUserManager().saveUser(user);
                        s.sendMessage("§aUstawiono grupe §2"+group.getName()+" §adla §2"+args[0]);
                    } else {
                        s.sendMessage("§cUzytkownik nie istnieje!");
                    }
                } else {
                    s.sendMessage("§cPodana grupa nie istnieje!");
                }```

After use nothing is changed, group is still the same.
daring sandal
#
final var claimedRewards = user.getCachedData()
        .getMetaData()
        .getMetaValue(AeroPlus.CLAIMED_REWARDS, value -> new ArrayList<>(List.of(value.split(","))))
        .orElseGet(() -> new ArrayList<>(1));

if (claimedRewards.contains(actionOrAmount)) {
    sender.sendMessage(user.getUsername() + " has already claimed reward for month " + actionOrAmount);
    return;
}

user.data().clear(node -> node.getKey().equals(AeroPlus.CLAIMED_REWARDS));
claimedRewards.add(actionOrAmount);
user.data().add(MetaNode.builder(AeroPlus.CLAIMED_REWARDS, String.join(",", claimedRewards)).build());
LuckPermsProvider.get().getUserManager().saveUser(user);```
How can I update the value of a meta key? I need to read a comma separated list of integers from a key, add an extra int and then sent it back, but currently with this setup, the key is duplicated
```java
[11:45:51 INFO]: [LP] -> aeroplus_claimedrewards = '1' (inherited from self) 
[11:45:51 INFO]: [LP] -> aeroplus_claimedrewards = '1,2' (inherited from self)```
#

welp, looks like this worked

user.data().clear(NodeType.META.predicate(node -> node.getMetaKey().equals(AeroPlus.CLAIMED_REWARDS)));```
nocturne elbow
#

Hello, I'm trying to update an old project that used LuckPerms and something is wrong with this peace of code : https://pastes.dev/jTm6OJKYA9

I'm getting these errors in Eclipse

Node cannot be resolved to a type
The method getNodeFactory() is undefined for the type LuckPermsProvider
The method getUserManager() is undefined for the type LuckPermsProvider
User cannot be resolved to a type```

I'm using Java 17 and the latest LuckPerms
Any idea on how to fix it?
turbid solar
#

what version of the API is that

#

!api

frank driftBOT
turbid solar
#

!v4

frank driftBOT
#

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

nocturne elbow
#

4.4.27

turbid solar
#

you'll need to udpate it to the new api

sick sandal
#

!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
!velocitycheck
!verbose
!version
!weight
!whyluckperms
!wiki

timid heron
#

!wili

frank driftBOT
#

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

timid heron
#

!wiki

frank driftBOT
steady nebula
#

!bedrock

frank driftBOT
#
Using Geyser?

If you're having issues with permissions for bedrock players, or it's telling you that a bedrock player's name is invalid, try setting allow-invalid-usernames to true in the LuckPerms config.

spice wind
#

!weight

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.

glass pecan
#

its saying true for everything when the user only has kit.default

hazy idol
#

!tutorial

frank driftBOT
main dagger
glass pecan
#

i tried that

#

all were true

night pier
#

did you define it in your plugin.yml so they're not defaulted to true

main dagger
#

!verbose try this

frank driftBOT
main dagger
fast delta
#

yesn't, it defaults to ops only, whereas false defaults to false for everyone, ops included

mighty oak
#

Hello, I'm getting this error while getting LuckPerms on Velocity:
https://hastebin.com/ubufepurax.sql

...
@Plugin(
        id = "virtualrememberme",
        name = "VirtualRememberMe",
        version = "1.0.0",
        description = "Save user's last server",
        url = "https://virtualhit.es",
        authors = "YoSoyVillaa",
        dependencies = {
                @Dependency(id = "luckperms")
        }
)

public class VirtualRememberMeVelocity {

    ...
    @Subscribe
    public void onProxyInitialization(ProxyInitializeEvent event) {
        LuckPerms luckPerms = LuckPermsProvider.get();
    }
}
nocturne elbow
#

How can I use the LuckPerms API to get a player's highest rank on a given track?

analog atlas
#

!extracontexts

frank driftBOT
analog atlas
#

!extensions

frank driftBOT
silk star
#

Hey! Do I need for %luckperms_group_expiry_time% the PlaceholderAPI? Or is there any other way to get this time?

molten shore
#

When I use the command "lp user nick group addtemp..." the events 'NodeRemoveEvent' and 'NodeAddEvent' are called... In this case, I just wanted to handle the Add and cancel the Remove, because in settemp theoretically the Node is not removed. How can I do this?

wild whale
#

Yeah you can pull the expiry time from the inheritance node

tidal onyx
#

whats wrong?

turbid solar
#

save the user

tidal onyx
#

how?

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
tidal onyx
turbid solar
#

yes

tidal onyx
#

is there something wrong? the add part works but when removing it doesn't

stray path
#

is there an api to get all permission list, like luckperms tabcomplete do?

main dagger
#

no

#

luckperms does not know every permission

stray path
#

alright thanks

scenic shore
#

hello, in the wiki i can't find the method that tells me how to delete groups

#

can you help me?

#

i do this

boolean success = api.getGroupManager().deleteGroup(partyLeader)

scenic shore
#

😦

scenic shore
fast delta
#

deleteGroup does not return a boolean

scenic shore
#

ok i can try later

vital grove
#

I have made this:
https://srcb.in/BsQLOTG2J8
which checks for whenever the users group changes. how can i make it run though whenever that happens

turbid solar
#

!api

frank driftBOT
signal raft
#

Any clues why it errors?

fast delta
#

getPermission is returning null

signal raft
#

aah just realized my mistake
tysm

#

well it didn't fix it o_o
this is my config:

aand this is my method of retrieving perms:

public static String getPermission(String section,String name){
    return get().getConfiguration().getSection(section).getString(name);
}
#

now it doesn't even send that INSUFFICIENT_PERMISSIONS
it just errors

#

same stuff still

#

not even with not changing permission

fast delta
#

Are you still getting an error?

prisma mural
#

database error

leaden mirage
signal raft
signal raft
leaden mirage
#

never mind

inland dew
#

hello

#

how do i use this %luckperms_check_permission% ? like can i do something like %player_has_permission_<permission>%

upper nacelle
#

What placeholder engine are you using?

#

PAPI?

inland dew
#

yes

upper nacelle
inland dew
#

yes i see

#

thx

upper nacelle
inland dew
#

yes this is what i needed %luckperms_check_permission_skin.flash%

#

thank you!

timid heron
#

Is this java skript ????

#

@neon sparrow

frank driftBOT
#

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

turbid solar
#

no

#

THere's a restapi that's in js

scenic shore
#

sorry, how can i define if the player inherits the "work.manager" group? i can't find it in the documentation

zinc wing
#

Hey has anyone got any mod examples of using the luckperms api from fabric that i can read through?
I tried using the static access method LuckPermsProvider.get(), but I can't avoid the luck perms api is not loaded error.
I am calling from Fabric's onInitialize() with luckperms declared as a dependency in fabric.mod.json

#

nvm found the solution above

craggy umbra
#

Hey! Just a quick question. Is the User#getUniqueId cached in any way, or should I cache it myself? Thanks!

upper nacelle
#

The User object stores the player's UUID in the object itself, User#getUniqueId is not doing any lookups

craggy umbra
#

Oh, perfect. Thanks

bleak vector
#

Hi there, I am having some issues utilizing the API. When I attempt to create a track and then modify it, the plugin crashes and states that the track object is null. Additionally, when I add a node with context, the context does not get added when the node is built. Any suggestions?

turbid solar
#

how are you creating the track

#

you might also need to save it most likely

bleak vector
#

I’m creating it and then saving and then trying to call it but still null

turbid solar
#

Can you show some code

bleak vector
#

Yea

turbid solar
#

ok

bleak vector
# turbid solar ok
        luckPerms.getTrackManager().createAndLoadTrack(groupName);
        Track thisGroupTrack = luckPerms.getTrackManager().getTrack(groupName);
        thisGroupTrack.insertGroup(luckPerms.getGroupManager().getGroup("default"), 0);
        luckPerms.getTrackManager().saveTrack(thisGroupTrack);
        thisGroupTrack.appendGroup(thisGroup);
        luckPerms.getTrackManager().saveTrack(thisGroupTrack);```
#
Node regWorld = Node.builder("multiverse.access." + groupName)
                .value(true)
                .withContext(DefaultContextKeys.SERVER_KEY, luckPerms.getServerName())
                .build();

        luckPerms.getGroupManager().modifyGroup(groupName, group -> {
            group.data().add(regWorld);
});```
main dagger
#

please use code blocks for code

#

```
code
```

unreal mantle
#

If you add java after the first three ` It will colour it nicely as well

silk star
vital grove
#

Hello, i am making a bungeecord plugin and for some time i have been trying and failing on how to do something whenever a players group changes any ideas?

bleak vector
radiant path
#

i just added the perm but its saying i dont have it

night pier
#

show the code you used to set the permission

radiant path
#
    public static boolean payFor(Player player, int price, String permission) {
        if (Main.api==null) {
            player.sendMessage("ERROR: LuckPerms api is null please report to the server owner/dev");
            return false;
        }
        PointUser user = GamePointsAPI.getUserData(player);
        user.takePoints(price);
        User lpuser = Main.api.getPlayerAdapter(Player.class).getUser(player);
        Node node = Node.builder(permission).build();
        Bukkit.broadcast(Main.parseMesage(player,"&8[&6&lLP-KOT-EXTENTION&8] &ePlugin &e&lKOT &eadded permission &e&l" 
        + permission + "&e to player &e&l" + player.getName()), "tab.staff");

        DataMutateResult result = lpuser.data().add(node);
        if (result.wasSuccessful()) {
            return true;
        } else return false;
        
    }
turbid solar
#

need to save the user

radiant path
#

oh totally forgot about that

azure shard
#

Hello, i'm trying to add the LuckPerms API to my minecraft plugin.. here is the pom.xml (dependencies) ``` <dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-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>``` but "net.luckperms", and "api" are red and if i clicks on it it says dependency: net.luckperms:5.4 non found, solutions?
nocturne elbow
azure shard
#

thank you, it worked

crude badge
#

How to fix it?

night summit
#

How can i get the weight from a player into a int?
I have tried many ways but all of them return is a null

turbid solar
#

if it’s not set it’ll be null

#

they return an OptionalInt

night summit
#

and how do i make it a normal int?

turbid solar
#

.get() or orElse(0)

night summit
#

Can you give a example of the whole code, I think I'm getting a array or something?

noble relic
#

Can someone tell me what event fires when I change the group of a user?

#

I'm using UserTrackEvent and that doesnt seem to be it

nocturne elbow
#

@slim warren

quasi iron
#

How does one get the Dependancy of LuckPerms if running it on bungeecord?

turbid solar
#

!api

frank driftBOT
flint scarab
#

hi

#

how is the luckperm weight / teams system working ?

azure shard
#

Hi, this is my code: String newprefix = plugin.getConfig().getString("Prefix.staff-prefix").replaceAll("&", "§"); int StafftPriority = plugin.getConfig().getInt("StaffPriority"); PrefixNode node = PrefixNode.builder(newprefix, StafftPriority).build(); user.data().add(node); LuckPermsProvider.get().getUserManager().saveUser(user);
how do i memorize the priority of the group, because now i set it to (int) an if the value on the config is every number the plugin ignores it an set i to 0, should i try (double)?
thanks

serene skiff
#

I was using aternos. I switched to virtual machine. I downloaded luckperms files but luckperms is not working

turbid solar
bleak fulcrum
#

how can I get the groups inherited in other servers?

#

User#getInheritedGroups returns only the groups for the current server

Edit: found the method

scenic shore
#

why???

turbid solar
#

it returns a CompletableFuture

scenic shore
#

uh

#

i don't know how to fix this

turbid solar
#

you change it from Group to CompletableFuture<Void>

scenic shore
#

ok i try it

vapid terrace
#

Hey! We're (german minecraft community) currently developing a (real) GDPR plugin. Is there any chance that you guys are interested in joining the project with some code contribution for automatic user data deletion?

turbid solar
#

if you post the project link ehre, people(not just lp ‘staff’) could look at it

vapid terrace
#

however, this is mostly to be addressed to plugin maintainers/developers that are interested in making their plugins GDPR compliant

#

The project is kind of new and still in prototyping phase - but we will release this and we will use it as our GDPR solution to become 100% compliant

#

Currently we're trying to talk to as many maintainers as possible to get maximum impact

dark ruin
#

hello?

#

i need help with getting bukkit plugins on my server

nocturne elbow
#

hey, im on fabric and i used luckperms a while a go, is it possible to still use luckperms 4.0

#

is there still a documentation?

main dagger
azure shard
#

is it possible to use the luckperms api in a bungeecord plugin?, how do i registrer the provider.. in the wiki i didn't found anything about the lp api in bungee.

fast delta
#

bungeecord doesn't have a service manager, you'll have to use the static accessor (it's the 3rd one listed in that subtitle of the wiki)

azure shard
#

ok, thanks

stiff turret
#

TreeMap<Group, Integer> sorted = new TreeMap<>(groupMap); generating an error

#

it uses HashMap<Group, Integer> groupMap = new HashMap<>();

turbid solar
#

what's the error

stiff turret
#

nvm already fixed

#

and i couldn't convert it to the treemap

nocturne elbow
#

and i could make it require commands permissions with Permissions.require("example") but cant do so rn

#

how could i do it now?

main dagger
#

you just use fabrics permission api like normal

nocturne elbow
#

and it works fine?

#

oh nice

light moon
#

hello, is it possible to get remaining time from temp permission?

main dagger
#

didnt even stay long enough to get an answer 💀

light moon
#

i resolve it

#

so i left

peak basin
#

broo how to call this method correctly?

turbid solar
#

what is node

#

getValue returns a Boolean

#

If it's a MetaNode use getMetaValue()

rare veldt
#

Im using a custom core which doesn't let users use spigot plugins. I'm running luckperms on the velocity server, and I want to use the data of the database in my custom core. Is that possible? I get this error when trying to get the luckpermsprovider because I cannot install luckperms.

turbid solar
#

what server software are you using

rare veldt
#

minestom

turbid solar
#

And no, you cannot use the API without LuckPerms on the server

rare veldt
#

oh, oke

rare veldt
turbid solar
#

You can try to build it yourself, currently no support for it

rare veldt
#

oke

#

thank you

full arrow
#

Hi 🖖 i'm searching for a way to get User permission (perhaps as list or by boolean) but without groups permission.

for eg:

Steve has permission "hello, hola, " and has a primary group called "default" . The group default have permission "hi, bonjour, gutentag"

i want to get only "hello and hola"

i have try with this, but it provide me all permissions :
user.getCachedData().getPermissionData()

i think it's possible cause when i type lp user <playername> permission info it only display payer permission ...

edit : found the answer:

Set<String> perms = user.getNodes(NodeType.PERMISSION).stream()
                .map(PermissionNode::getPermission)
                .collect(Collectors.toSet());
nocturne elbow
#

p

rotund briar
#

help my. install api on maven and error

turbid solar
#

send full pom

rotund briar
rotund briar
main dagger
#

that doesnt look like the full file to me

rotund briar
turbid solar
#

try restarting idea

crude wraith
#

How can i get all the saved users?

turbid solar
#

getLoadedUsers

crude wraith
#

I shows only the online ones

turbid solar
#

getUniqueUsers()

rotund briar
crude wraith
turbid solar
#

user is null

#

maybe

#

something is null

mellow iron
#

how can i show the group a player is in?

I have a plugin that includes chat formatting, and I want it to show player's group name thru the HoverEvent stuff

or make it show what I want depending on the group the player is in

wheat lake
#

!cookbook

frank driftBOT
mellow iron
turbid solar
#

show code

mellow iron
#
    public static void onChat(AsyncPlayerChatEvent event) {
        Player player = event.getPlayer();
        TextComponent nickname = new TextComponent();
        nickname.setText(event.getPlayer().getDisplayName());
        nickname.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
                        new ComponentBuilder(NEED GROUP NAME OR STUFF HERE).create()));

        TextComponent divider = new TextComponent();
        divider.setText(" > ");
        divider.setColor(ChatColor.WHITE);

        TextComponent message = new TextComponent();
        divider.setText(event.getMessage());
        message.setColor(ChatColor.WHITE);

        player.spigot().sendMessage(nickname, divider, message);
        event.setCancelled(true);
    }```
turbid solar
#

get the players group then the displyname of the group

mellow iron
#

and that's what i need, but i cant, my programming skills is kinda low, i just dont know how

        LuckPermsApi api = LuckPerms.getApi();
        User user = api.getUser(player.getUniqueId());
        Group group = api.getGroup("moderator");
        
        TextComponent nickname = new TextComponent();
        nickname.setText(event.getPlayer().getDisplayName());
        nickname.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
                        new ComponentBuilder(group.getDisplayName()).create()));```
i tried to do it like this, but 

java.lang.NoClassDefFoundError: me/lucko/luckperms/LuckPerms in chatEvent, line 31 which is "LuckPermsApi api = LuckPerms.getApi();
Caused by: java.lang.ClassNotFoundException: me.lucko.luckperms.LuckPerms
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:179) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:126) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
        ... 15 more
im literally noob in Java
#

also that was made with this stuff

night pier
#

why are you using an old repo

mellow iron
#

fixed

mellow iron
#

btw

how to make this "metadata" give group's prefix
its almost 4 AM, potato mode enabled

wise root
#

Hey, I currently have a prefix manager plugin compatible with Luckperms via vault ( Which I submitted a pull request for ).

I was thinking on adding direct support for LuckPerms to remove the vault dependency and maybe make it more appealing for LP Users. But I did read somewhere that you guys don't recommend hooking direct into LP but instead using vault

night pier
#

I don't think so? Luck worked hard on the API for it to be used.
if you're planning on making a plugin that ONLY uses LP, no point in wasting time on supporting vault. if you're adding support for multiple permission plugins, vault would be the easiest route.

fast delta
#

Uh where did you read that?

#

There are benefits by using LP API directly as opposed to through Vault (more specifically, you can do things you can't through Vault), but both are perfectly fine, none is particularly encouraged over the other

wise root
#

I'm pretty sure someone in here from the team suggested hooking into vault instead of LP directoy but I could be wrong. I want to directly support LP as well as vault for other permissions plugins

wise root
#

If I use

     CachedMetaData metaData = BetterPrefix.getApi().getPlayerAdapter(Player.class).getMetaData(player);

And then do

metaData.getPrefix();

How are multiprefix handled? What if the user is using prefix stacking? Will #getPrefix() return all the prefixes from stacking?

fast delta
#

yes

wise root
#

Amazing, thank you!

#

Man this API is so detailed. my god

#

No wonder every developer knows LuckPerms is just insane

#

It's hard to even wrap my head around how stuff is organized to even use the api.

I'm trying to make a loop to get every groups name and weight

tiny cypress
#

how get user perms from specific server?

fast delta
wise root
#

Is the correct way of getting a groups weight to get the permission node weight.<weight>

#

But I do see Node has a type WeightNode

wild whale
#

That's a way, although I think there's API for it

#

Like a proper way of getting a weight from a Group

#

!cookbook

frank driftBOT
wise root
#

I believe so. Looking at the wiki

wild whale
#

probably something the cookbook has, if not skim the jds

tiny cypress
viscid grove
#

Hey guys i just tried to use the luckperms api but i constantly get the same error
error in pic

This is my code
RegisteredServiceProvider<LuckPerms> provider;

@Override
public void onEnable() {
  provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
    if (provider != null) {
         api = provider.getProvider();
    }
}
turbid solar
#

send code of player oin listener and tablistmanager

viscid grove
turbid solar
#

are you (soft) depending on LuckPerms

viscid grove
#

yes

turbid solar
#

send your plugin.yml

#

also i'm assuming the Butterfly#getApi() just returns api right

viscid grove
#

yes

#

i generate it

hybrid panther
#

how do you generate it

viscid grove
#

with net.minecrell.plugin-yml.bukkit

turbid solar
#

can you send your whole main clas

#

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

viscid grove
turbid solar
#

send your log file

#

also add some debug statements bc that should work

viscid grove
#

ok

frank driftBOT
viscid grove
#

that is without debug

turbid solar
#

print if the provider isn't null

viscid grove
#

ok

frank driftBOT
viscid grove
#

provider is null

#

cant load api

fast delta
#

perhaps you are mistakenly shading the LP API inside your plugin, can you share the gradle build script?

viscid grove
turbid solar
#

set it to compileOnly

#

also don't shade in adventrure-api sinc that's already in paper

#

same for gson

viscid grove
#

ok

#

same error

#

nothing changed

turbid solar
#

send your build.gradle again

#

also try a clean build

#

./gradlew clean shadowjar

#

or whatever

viscid grove
turbid solar
#

the luckperms dep

#

oh its in there twice

#

remove the implementation one

viscid grove
#

hmm ok i got no error but it isnt working the way i want xD

turbid solar
#

did you remove the implementation('net.luckperms:api')

viscid grove
#

yes

#

ok thx @turbid solar you fixed my problem the rest i have to figure out my self ^^

frank driftBOT
#

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

normal elk
#

does anyone know of a luckyperms tap plugin (lucktap)
I need urgently

turbid solar
normal elk
#

ok

neon otter
#

When adding a group node to a user and saving them, via the luck perms provider, is there a something you need to do to tell like Vault to refresh it's data so the prefixes are updated? When I open the luck perms editor the prefix gets updated instantly, so I think I am missing some sort of invalidate call

hybrid panther
#

hey 👋
you are able to directly interface with the standalone lp client via its HTTP rest api if you want

#

there are some community made wrappers for it in php and javascript

raven badge
#

where can i found info about api usage?
i want to get player metadata (permissions, prefix, etc)

turbid solar
#

!api

frank driftBOT
turbid solar
#

!cookbook

frank driftBOT
raven badge
raven badge
# frank drift

this couln't be necessary (for me), i want to use api in forge

main dagger
#

the actual api is the same across all platforms

crude wraith
#

How can i get this using the luckperms api, because i tried using the UserManager#getLoadedUsers() but it returns only the online ones

turbid solar
#

What are you trying to do

crude wraith
#

To get the member list of a group

#

I tried by getting the loaded users and check their parent groups, but it shows only the online players

turbid solar
#

bruh

#

UserManager#searchAll

grizzled relic
#

how can i get the group of a player based on context on Velocity?
right now the only thing i could get from the Velocity API is ImmutableContextSet([world=survival-spawn])
world is the server which hosts the player but the spigot server also has a context
how can i get that context from proxy?
i know that LP Velocity has proxy contexts which are different from spigot ones
i just wanna know which group the player is in from the proxy but without knowing the context it's impossible

crude wraith
#

How can i make it async, every time i recover the members the server freezes

#

I tried using getUserManager#searchAll(NodeMatcher.type(NodeType.INHERITANCE)).thenApplyAsync(uuidCollectionMap -> {}); but it return nothing

neon otter
tranquil beacon
#

how kann i get the suffix with the api ?

bleak fulcrum
frank driftBOT
bleak fulcrum
frosty laurel
#

Hi all. I have a problem with the API. I'm sorry if I'm on the wrong channel and please correct me.

I'm creating a plugin that, in the course of certain actions, grants rights to players. Also, the administrator will be able to take away the rights issued by my plugin.

But my problem is that permissions are not fully granted and taken away and this happens absolutely randomly, and debugging in such cases does not give me any results!

Conditionally, I give the player 5 permissions, and the output of the command "lp user <user> permission info" shows me only 3 permissions. The same thing happens when I try to pick up permissions. As I said earlier, this happens completely randomly: rights can be issued and taken away in full or in part.

I tried to debug my plugin by outputting "DataMutateResult" while I issue permissions. And then I was surprised. When issuing 5 permissions, I got 5 "SUCCESS" outputs in the console, then I immediately entered "lp user <user> permission info" and there were only 3 permissions. Shock!

What am I doing wrong?

P.S. my code = https://pastebin.com/NfWriL8F

neon otter
#

Are you adding a group or specific permissions to a user? Like what is your permission parameter values

frosty laurel
#

I'm adding special perms, not a group. As an example, I add: test.perm.1, test.perm.2, test.perm.3, test.perm.4, some.third.perm

neon otter
#

I’m not sure without trying. I’d do bulk changes instead and see if that helps

frosty laurel
#

I don't understand what you mean when you say "bulk changes"

maiden isle
#

!bulk

frank driftBOT
frosty laurel
#

Is it possible to do this from the API without using dispatch commands?

hard wharf
#

Hi all, I'm looking for a method that checks the permissions of the player when he logs in and removes his permissions if they start a certain way, for example, there are permissions that look like this:
"permission.example.{string}"

I would like to remove all the permissions they contain
"permission.example" how can I do?

fast delta
#

@frosty laurel if you are adding many permissions consecutively, you might need to add them all in the same modifyUser call, so e.g. have a addPermissions that takes a Collection<String>, and inside the same modifyUser action add them all, rather than call modifyUser for each one

fast delta
hard wharf
fast delta
#

that is for every user

#

not a specific player on login

hard wharf
#

Yes, but I didn't believe that a similar function existed, I wanted to do it for all players and therefore I thought of doing it only when he enters but if this solves the problem, it's better

#

Thx for the help 👍🏻

frosty laurel
frosty laurel
#

any idea?

novel onyx
#

How to set a command that all can use

#

How to set a command that all can use @thorny echo

frank driftBOT
#

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

nocturne elbow
#

!usage

frank driftBOT
nocturne elbow
#

@novel onyx ^

frosty laurel
maiden isle
#

Dont ping.

frosty laurel
#

sry

silk star
#

Hey, how can I best query the remaining time of a rank? I can't use PlaceHolderAPI because I need the whole thing on BungeeCord.

fast delta
fast delta
silk star
#

When I find sure

frosty laurel
#

Now I noticed that some permissions are not taken even after executing the unset command in the game....

#

That is, it works once

frosty laurel
#

I noticed a strange feature: if I have these permissions and I remove them from the game using the unset command, and then give permissions again through the API through my plugin, they are not set...

silk star
# fast delta Take a look at how that placeholder fetches the expiry date, then you can do the...

I've found at https://github.com/LuckPerms/placeholders/blob/master/common/src/main/java/me/lucko/luckperms/placeholders/LPPlaceholderProvider.java#L376

But... Honestly I don't get it... There are too many variables unknown to me. For example, what is meant by the queryOptions?

GitHub

Placeholders integration for LuckPerms. Contribute to LuckPerms/placeholders development by creating an account on GitHub.

hybrid panther
#

QueryOptions is a filter

silk star
#

Which filter? How does it looks like?

frosty laurel
idle slate
#

Is it possible to load LuckPerms as a softdepend?

turbid solar
#

yes?

idle slate
#

The official documentation acquiring the API require that LuckPerms classes are present during runtime. In a setup where a plugin soft-depends on it and LuckPerms isn't present this fails because the classes are missing.

turbid solar
#

then you should check if LP is enabled and then do your stuff

idle slate
fast delta
frosty laurel
sweet lily
#

How can i get all useres that are stored inside my luckerms database?
'getUserManager().getLoadedUsers()' gives me only the users that are currently on the server

main dagger
#

because only users who are on the server will be loaded

#

not sure that getting all users is a good idea though. what are you trying to do with that

sweet lily
#

yeah, I know, but is there a way to get to useres that are not online

#

I want to get all users from one permission group

main dagger
#

and do what with those users

#

what are you actually trying to do

sweet lily
#

I need the list of useres inside a group to show some statistics in with the plugin I want to create.
But when a user get this permission group remove he should also disapear from this statistc system an new users from this group should be shown

turbid solar
#

getUniqueUsers or something

warped thistle
#

hello how can you query a permission group? and how can i go out the group the user has?

mellow iron
#
User user = luckPerms.getUserManager().getUser(event.getPlayer().getUniqueId());
String prefix = user.getCachedData().getMetaData().getPrefix();```
how can I get prefix of  highest player's group?
wild whale
frosty laurel
wild whale
#

are you ingame when you run the command when it doesn't work?

frosty laurel
# wild whale send code

Please note that this code may work fine, but sometimes it breaks. For example, as I described above, if you give yourself permissions (/tst give <nick>), try to take some of them with /lp user <nick> permission unset <given perm>, then take the rest with / tst take <nick> and try to give yourself permissions again /tst give <nick>, the plugin will not give you all rights or give them randomly

wild whale
#

and how are you determining if LP has/hasn't given the permissions?

frosty laurel
#

by performing command like "/lp user <nick> permission info"

wheat lake
#

You don't save the user after modifying it

fast delta
#

modifyUser saves the user already

frosty laurel
# fast delta intriguing

Have you checked this yourself? I am convinced that the problem is either in my code or in the lp api, because even on a clean server such a bug occurs. But like everyone else, I can be wrong.

fast delta
#

yeah i've been meaning to check it myself, haven't had the time yet but your code does look correct

fast delta
# frosty laurel https://pastebin.com/Utxt7E6v

I strongly suggest not doing this in either of the takePermission(s) methods

if (!mutateResult.wasSuccessful()) {
    takePermission(uuid, permission);
}

If the removal failed, it's most likely because the user didn't have the permission in the first place, and so that will be caught in an infinite loop and messing with saving the data
I suspect that is what's making things misbehave

frosty laurel
fast delta
#

can you show the new code?

#

Also, are the commands running in (very) rapid succession?

frosty laurel
warped thistle
#

hello how can you query a permission group? and how can i go out the group the user has?

warped thistle
#

hello how can i add a group a permission ?

wild whale
#

!cookbook

frank driftBOT
burnt sable
#

Hello can Fabric placeholderapi be found anywhere for 1.18 ?

main dagger
#

no

#

theres a few plugins that support PAPI-like placeholders, but there is no common standard like PAPI on bukkit

#

also entirely wrong channel

fast delta
frosty laurel
frank turtle
#

Hey guys, I have a short question:
My plan is to grant a user a group (vip) temporarily.
If the user isn't already in this group it should be added for 7 days but if the user is already in the vip group the 7 days should be added to the remaining time the player has the vip group

#

This is what I have until now to give the user 7 days of vip but I have no idea how I can increase the time for 7 days if the user is already in the group:

InheritanceNode node = InheritanceNode.builder(vipGroup).expiry(7, TimeUnit.DAYS).value(true).build();
turbid solar
#

check if they have the group, get the expiry and add 7 days to it

fast delta
#

no

#

there's an add method in the NodeMap that takes a... Temporal something.

#

it's an enum to specify that behaviour

wooden fable
#

How do I add a new permission via the API? I want it to be displayed in the list when using the command

turbid solar
#

!cookbook

frank driftBOT
turbid solar
#

!api

frank driftBOT
fast delta
#

it's explained in the usage page on the wiki, among a few other useful or common things

wooden fable
#

Already check the API usage page - it doesn't specify this anywhere

turbid solar
#

look again

fast delta
frank turtle
# turbid solar check if they have the group, get the expiry and add 7 days to it

You mean like this?

var existingVipGroupNodeOptional = user.getDistinctNodes()
        .stream()
        .filter(NodeType.INHERITANCE::matches)
        .map(NodeType.INHERITANCE::cast)
        .filter(node -> node.getGroupName().equals(VIP_GROUP_IDENTIFIER))
        .findAny();

if (existingVipGroupNodeOptional.isEmpty()) {
    var vipGroupNode = InheritanceNode
            .builder(vipGroup)
            .expiry(days, TimeUnit.DAYS)
            .value(true)
            .build();
    return user.data().add(vipGroupNode).wasSuccessful() ? PurchaseResult.SUCCESS : PurchaseResult.INTERNAL_ERROR;
}


var existingVipGroupNode = existingVipGroupNodeOptional.get();
if (!existingVipGroupNode.hasExpiry()) {
    return PurchaseResult.NOT_EXPIREABLE_RANK;
}

var vipGroupNode = InheritanceNode
        .builder(vipGroup)
        .expiry(existingVipGroupNode.getExpiryDuration().plusDays(7))
        .value(true)
        .build();
return user.data().add(vipGroupNode).wasSuccessful() ? PurchaseResult.SUCCESS : PurchaseResult.INTERNAL_ERROR;
wooden fable
# fast delta

That's not what I asked - I want to add it to LuckPerms' permissions registry, same thing as if I added a permission in a plugin's plugin.yml

turbid solar
#

check the permission using your platform stuff iirc

#

no way to add it to the list via api

fast delta
#

i mean there's the checkPermission in the api, that will trigger it, but it won't really make a difference when using the platform's permission check

frank turtle
#

ahh didn't saw it, thank you

wooden fable
#

Guess I'll just use Bukkit#getPluginManager#addPermission

#

Thx

fast delta
#

or.. check for- sure

frank turtle
# fast delta https://discord.com/channels/241667244927483904/420538367986499585/1083358956891...

So more like this, right?

var existingVipGroupNodeOptional = user.getDistinctNodes()
        .stream()
        .filter(NodeType.INHERITANCE::matches)
        .map(NodeType.INHERITANCE::cast)
        .filter(node -> node.getGroupName().equals(VIP_GROUP_IDENTIFIER))
        .findAny();

if (existingVipGroupNodeOptional.isPresent()) {
    if (!existingVipGroupNodeOptional.get().hasExpiry()) {
        return PurchaseResult.NOT_EXPIREABLE_RANK;
    }
}

var vipGroupNode = InheritanceNode.builder(vipGroup).expiry(days, TimeUnit.DAYS).build();
return user
        .getData(DataType.NORMAL)
        .add(vipGroupNode, TemporaryNodeMergeStrategy.ADD_NEW_DURATION_TO_EXISTING)
        .getResult()
        .wasSuccessful() ? PurchaseResult.SUCCESS : PurchaseResult.INTERNAL_ERROR;
fast delta
#

looks good

frank turtle
#

thank you for your help

slim orchid
#

Question: I am using this code to set/remove permissions https://pastebin.com/RMYKdY3f, but it doesn't seem to work since when I use the luckperms command /luckperms users <user> permission check <permission> it says the permission is undefined so if anyone already had this issue or knows how to fix it it would be helpful, also no errors in console and here is how i register luckperms in my main class https://pastebin.com/6zAk0WhD. Thanks in advance!

main dagger
#

if you open the editor, does the node appear there?

slim orchid
turbid solar
#

dont need to save the user there since modifiUser already does that, where are you doing this code?

#

is it on the same server?

slim orchid
turbid solar
#

okay not what i asked though

slim orchid
slim orchid
night pier
#

!api

frank driftBOT
night pier
#

(for me)

#

for getting the value of a meta key, i should be using Node#getMetaData, correct?

fast delta
#

no

#

this is in the wiki smh

night pier
#

i... is it?

night pier
#

i didn't read it

fast delta
#

yeah i can tell

night pier
#

well noone else does, why should i

#

thanks <3

fast delta
#

Node metadata != meta nodes

night pier
#

oh, so does metadata just refer to prefixes/suffixes then?

fast delta
#

meta(data) nodes are basically extra non-permission information you can store as a permission node
node meta(data) is volatile (doesn't get stored) information, arbitrary objects you can put in a Node object

#

prefixes and suffixes aren't really meta nodes, but Luck decided they'd fall under the same category lol

night pier
#

I'm back with more stupid questions!!
So, when i run my command /setprefix (https://pastes.dev/FcHBBPf8TK), i pass information to 2 methods - setTokens() (https://pastes.dev/kGolLd2bcp) and setPrefix() (https://pastes.dev/HNM5KEpvDo). setPrefix() then gets information from getTokens() (https://pastes.dev/yR80OPDuzi).
Here's where my issue comes in. 1. in the class where i process the command, the first thing i do is subtract 1 from the token amount. I used 2 different ways of doing this, both ended up with issues. First one MTMain.plugin.setTokens(player, --tokens); would be a hit or miss on whether or not it would actually remove the tokens. had multiple times that it would duplicate my meta key, despite clearing the key value, before adding a new one in setTokens(). the 2nd one (current code) sets back to 0 no matter what i do. (image for context)
is there something i'm actually missing? why is it failing to clear the node, and add a new one? should i be waiting for it to complete before continuing?

turbid solar
#

||skill issue||

night pier
#

you're probably not wrong. i worked all day yesterday on it, and got what i thought was completely done with it, at midnight. only to test and

this.luckPerms is null

turbid solar
#

is metatokens 0 after?

night pier
#

yeah, i did verify that it was actually set to 0

#

uhm, standby. it's acting different now.

#

doesn't update until i check meta info?

#
  • its not showing 0 at this moment
raven badge
#

i have a little issue in dev enviroment loading Luckperms in a Dedicated Server Dist
how can i solvet it?

turbid solar
#

you shouldn't depend on that jar

#

use the api

raven badge
raven badge
turbid solar
#

!api

frank driftBOT
raven badge
#

oh wait... i see

#

but what is the difference between using forge debof with the curseforge jar and using "the api"??? (technically it is the same)

turbid solar
#

it's not the same

raven badge
turbid solar
#

no

#

you also shoulnd't i nclude LP in your jar

raven badge
turbid solar
#

implmentation includes it into your jar

raven badge
#

After adding the dependency according to the wiki, it only lets me use it in the IDE but I can't run instances with it.

raven badge
#

After reading a bit I see that you do not have support for a modders test environment

#

that explains a lot, but since using the api is very simple I have no reason to complain

#

Thanks for the help

ornate willow
#

a

raven badge
#

Luckperms 1.18.2 is not longer supported (for Forge)?

raven badge
fast delta
#

no, those are not backported

raven badge
#

why? i mean... Forge still gives LTS to one of the most used versions (1.18.2)

fast delta
#

Forge maybe does, but for LP that means having to maintain several Forge LP platforms for different versions because they are incompatible, which isn't something that's in the project's best interest

harsh garden
#

Hey is there an easy way using luckperms to not have to struggle with int maxHomes = player.getEffectivePermissions() .stream() .filter(pai -> pai.getPermission().startsWith("athena.homes.")) .mapToInt(pai -> Integer.parseInt(pai.getPermission().substring(15))) .max() .orElse(0);
Aka catching the highest number found with athena.homes.x

turbid solar
#

use meta

nocturne elbow
#

Hi, if Im on server 1 can I get info about player's rank/permissions from server 2 with dev API?

turbid solar
#

yes

#

you'll want to load the user

#

!api

frank driftBOT
turbid solar
#

!cookbook has an example on how to load a user

frank driftBOT
nocturne elbow
#

ill try ty

nocturne elbow
nocturne elbow
#

?

rich nacelle
#

How can i get all the players in a track ?

rich nacelle
#
private PromotionResult promotePlayer(OfflinePlayer player) {
    LuckPerms luckPerms = RankManagement.getInstance().getLuckPerms();
    User user = luckPerms.getUserManager().loadUser(player.getUniqueId()).join();
    if (user == null) {
      Bukkit.getLogger().severe("Couldn't promote the player " + player.getName());
      return null;
    }
    Track track = luckPerms.getTrackManager().getTrack("police");
    if (track == null) {
      Bukkit.getLogger().severe("Track police doesn't exists");
      return null;
    }

    PromotionResult result = track.promote(
      user,
      luckPerms.getContextManager().getContext(player)
    );

    luckPerms.getUserManager().saveUser(user);

    return result;
  }

why this doesn't work after a player logs out and comes back ?

#

shouldn't this load the player ?

rich nacelle
wild whale
#

Well how have you determined it's not working?

rich nacelle
#

yes

#
 Bukkit.getOnlinePlayers().forEach(p -> {
      GuiItem skull = ItemBuilder.skull().owner(p).asGuiItem(event -> {
        SkullMeta skullMeta = (SkullMeta) event.getCurrentItem().getItemMeta();
        PromotionResult result = promotePlayer(skullMeta.getOwningPlayer());
        if (result == null || !result.wasSuccessful()) {
        player.sendMessage(Component.text("Couldn't promote the player").color(NamedTextColor.RED));
        } else {
          player.sendMessage(Component.text(p.getName() + " was promoted to " + result.getGroupTo().orElse("none")).color(NamedTextColor.GREEN));
        }
      });
      gui.addItem(skull);
    });
#

i also use this to make each player head in a gui to promote the suer

wild whale
#

again, how have you determined this isn't working?

#

Without knowing what's wrong, we can't help

rich nacelle
wild whale
#

I don't know what the behavior of loadUser when the backing player is already online is, that might be related

rich nacelle
#
User user;
    if (luckPerms.getUserManager().isLoaded(player.getUniqueId())) {
      user = luckPerms.getUserManager().getUser(player.getUniqueId());
    } else {
      user = luckPerms.getUserManager().loadUser(player.getUniqueId()).join();
    }

then should i do this ?>

turbid solar
#

culd use modifyUser

rich nacelle
#

well i just want to promote the player using the track not modify the user directly

turbid solar
#

modifyUser loads the user, does whatever u wnat to do wit huser object then saves it

rich nacelle
# turbid solar modifyUser loads the user, does whatever u wnat to do wit huser object then save...

so something like this ?

private void promotePlayer(OfflinePlayer player, Player sender) {
    LuckPerms luckPerms = RankManagement.getInstance().getLuckPerms();
    luckPerms.getUserManager().modifyUser(player.getUniqueId(), user -> {
      Track track = luckPerms.getTrackManager().getTrack("police");
      if (track == null) {
        Bukkit.getLogger().severe("Track police doesn't exists");
        return;
      }
      PromotionResult result = track.promote(
        user,
        luckPerms.getContextManager().getContext(player)
      );

      if (result == null || !result.wasSuccessful()) {
        sender.sendMessage(Component.text("Couldn't promote the player").color(NamedTextColor.RED));
      } else {
        sender.sendMessage(Component.text(p.getName() + " was promoted to " + result.getGroupTo().orElse("none")).color(NamedTextColor.GREEN));
      }
    });
  }
#

also is it ok if i pass null as the context parameter ?

wild whale
#

nullability annotations should be present everywhere to tell you whether or not that's ok

#

(on the LP api methods at least)

rich nacelle
rich nacelle
#

How could i remove someone from a track ? Like the command /lp user godofpro parent cleartrack staff

versed verge
#

Hello! I'm having a problem in IntelliJ IDEA. I'm trying to import the LuckPerms library, but I'm still getting an error saying that the library doesn't exist when importing "import net.luckperms.api" in my plugin. package net.luckperms does not exist

turbid solar
#

use gradle or maven

versed verge
turbid solar
#

!api

frank driftBOT
turbid solar
#

try restarting your ide

versed verge
turbid solar
versed verge
nocturne elbow
frank driftBOT
rich nacelle
foggy warren
fast delta
#

thinking_with_portals does the current build even work on 1.19.2?

foggy warren
nocturne elbow
#

The changes received from the web editor were not made in session started on this server! Are you sure you/re running in the right place?
To ignore this warning and apply the changes anyway run
This error comes out when launching luckperm, what should I do?

inland leaf
#

is it possible to get the luckperms object inside my paper plugin if i installed it in velocity?

#

i've tried LuckPerms api = LuckPermsProvider.get(); but that didn't seem to work

#

if i am just trying to get the prefix do i just use placeholderapi?

fast delta
#

you have to have LP installed on the servers too, velocity/bungee LP is not a replacement for the whole network

inland leaf
#

what does lp on velocity do then?

fast delta
#

perms on velocity, /send, /server, proxy plugins checking permissions etc

inland leaf
#

alright thanks

fast delta
#

!network usually it's suggested they be linked by storing permissions in a database like mariadb or mongo etc

frank driftBOT
stray path
#

is there a way to load user with player name?

unreal mantle
stray path
#

thank you!

peak basin
#

I am trying to register a placeholder that will print on parse all the prefixes of the groups a player belongs to, but it returns nothing on parse

    private LuckPerms luckPerms;

    public LuckPlaceholder() {
        this.luckPerms = LuckPermsProvider.get();
    }

    @Override
    public @NotNull String getIdentifier() {
        return "groupprefix";
    }

    @Override
    public @NotNull String getAuthor() {
        return "YourName";
    }

    @Override
    public @NotNull String getVersion() {
        return "1.0.0";
    }

    @Override
    public String onPlaceholderRequest(Player player, @NotNull String identifier) {
        if (player == null) {
            return "";
        }

        if (identifier.equalsIgnoreCase("allprefixes")) {
            return getAllGroupPrefixes(player);
        }

        return null;
    }

    private String getAllGroupPrefixes(Player player) {
        User user = luckPerms.getUserManager().getUser(player.getUniqueId());
        if (user == null) {
            System.out.println("User not found");
            return "";
        }

        ContextManager contextManager = luckPerms.getContextManager();
        ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
        QueryOptions queryOptions = QueryOptions.contextual(contextSet);
        StringBuilder prefixes = new StringBuilder();

        // Regex pattern to match prefix meta keys
        Pattern prefixPattern = Pattern.compile("^prefix\\.\\d+\\..+$");

        user.resolveInheritedNodes(queryOptions).stream()
                .filter(node -> node instanceof MetaNode)
                .map(node -> (MetaNode) node)
                .filter(node -> prefixPattern.matcher(node.getKey()).matches())
                .sorted(Comparator.comparingInt(node -> Integer.parseInt(node.getKey().split("\\.")[1])))
                .forEach(node -> {
                    System.out.println("Adding prefix: " + node.getMetaValue());
                    prefixes.append(node.getMetaValue()).append(" ");
                });

        return prefixes.toString().trim();
    }
}```
#

hopefully someone will have an idea as to why

nocturne elbow
#

How/Where can I learn to grab a members tempperm time left, then add say a day, and then update their permission?

main dagger
#

try looking at the source code for the command that adds a temp permission. there is an option for it to add time instead of replacing the time left

foggy warren
rain saffron
#

Hi! Did anyone use LuckPerms Forge version as api in other mods? Or i should use ForgePermissionsAPI to work with permissions?

main dagger
rain saffron
#

Do you have some usage examples for Forge Permissions API? Looks like it isn't compatible with 1.19.2, nothing in their docs

night pier
rain saffron
#

Thank you!

nocturne elbow
#

I am using the luckperms api, added this is my dependency's:

        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.4</version>
            <scope>provided</scope>
        </dependency>

But it drops the error:

Dependency 'net.luckperms:api:5.4' not found

After refreshing 😦

turbid solar
#

try restarting your ide

nocturne elbow
#

Hey, so i want to show the Players group prefix in the tablist with the LuckPerms API, but it doesn't work. here is my code for that

LuckPerms api = LuckPermsProvider.get();
String prefix = api.getGroupManager().getGroup(api.getUserManager().getUser(player.getUniqueId()).getPrimaryGroup()).getCachedData().getMetaData().getPrefix();
turbid solar
#

show more code

#

what exaclty isn't working

nocturne elbow
#

it says null

nocturne elbow
turbid solar
#

do you have a prefix set

nocturne elbow
#

yes

turbid solar
#

screenshot /lp user <user> info

#

also just get the prefix from the user insterad of their group

nocturne elbow
#

ahh wait

turbid solar
#
String prefix = api.getGroupManager().getGroup(api.getUserManager().getUser(player.getUniqueId()).getPrimaryGroup()).getCachedData().getMetaData().getPrefix();

if (prefix == null) prefix = "";
nocturne elbow
#

now it works.. thanks :)

oblique trench
#
getNodes(NodeType.PERMISSION)

Does this include inherited permission nodes, or is it a set of the nodes applied specifically to the player?

#

inherited nodes i presume

fast delta
#

that will give you the holder's own permissions, not inherited ones; what are you trying to do exactly? depending on that you might want to use one or another method

oblique trench
#

ive a string, and what i want to do is

#
if(player.haspermission(query)) return;
player.setPermission(query)
#

im not sure how the node internals work

#

so idk if resolveInheritedNodes(...).findFirst(PermissionNode.builder(query).build()) works

#

or contains IG

fast delta
#

to perform a check you usually want to do that against the cached data (getCachedData getPermissionData check.. or something), and to add a permission you do that through the NodeMap (data add(PermisisonNode.builder...))

oblique trench
#

whats a tristate

fast delta
#

the permission can be explicitly set to true, false, or it can not be defined at all

#

so the result is one of those three states

oblique trench
#

its annoying how undescriptive the method names are

turbid solar
#

there's javadocs

oblique trench
#

well i was looking at the api

turbid solar
#

your IDE should provide the jd

fast delta
oblique trench
oblique trench
fast delta
#

uh right

#

i mean there isn't really a better name for "result from one of three states"

main dagger
#

tristate is just Null<Bool>

oblique trench
#

honestly the biggest issue i have with the api now is that the jd isnt showing up

#

so i have to tab between my IDE and my webbrowser lol

main dagger
#

well that sounds like an issue with your ide

oblique trench
#

i mean ur not wrong

fast delta
#

what ide are you using

oblique trench
#

netbeans intelliJ

#

i mightve overlooked something

#

hm

#

theres no mention of an extra dependency for the jd

main dagger
#

netbeans? titanuYikes

oblique trench
#

company behind that

#

they made more than one ide

nocturne elbow
#

How do you have a group's colour set to something?
I'm using Meta Prefix in my code at the moment but I just want
a colour code instead of the entire prefix.

turbid solar
#

i set group-color for each group

nocturne elbow
turbid solar
#

get the meta value & parse it

nocturne elbow
abstract wraith
#

I have a small question. Is it possible to create a plugin with the base of LuckPerms? If so, how should I start to enable a simple /Join GROUP?

ancient smelt
#

LuckPerms .hasPermission() causes lag when player joins, how to fix? My database ping is pretty high

#

300ms

#

Looks like it takes time to load cache data and .hasPermission() happens before the cache data is loaded

#

Which causes lag

#

Is there anything I can do about this? Some of the plugins that do this are not open source

#

Maybe changing pool size can speed up the loading process

turbid solar
raven badge
#

whats the package name of Luckperms in Bukkit?. i see is quite different on forge

fast delta
#

huh

#

The API is the same in all platforms

dark robin
#

hallo

#

im kinda confused uh

#

does filtering through user.getNodes() only return player-specific perms?

#

or does it also go through their groups' permissions

#

I assume it doesn't, and if so, any way to get a list of player's permission that includes their personal perms + perms inherited from groups?

fast delta
#

there are a few methods that return different things, what do you need to do with it?

dark robin
#

specifically need to get all permission that start with "visitors."

#
                                        .filter(NodeType.PERMISSION::matches)
                                        .map(NodeType.PERMISSION::cast)
                                        .map(PermissionNode::getPermission)
                                        .filter(perm -> perm.startsWith("eprealms.visitors"))
                                        .map(perm -> perm.replace("eprealms.visitors.", ""))
                                        .map(Integer::valueOf)
                                        .toList();```
#

this is what i was doing

#

i can get all their groups and do that manually but I was just wondering if there's a way to do it directly from the api

fast delta
#

That sounds a whole lot like you should use meta nodes

#

Meta nodes are basically arbitrary key-value storage but the meta cache is designed for fast retrieval

dark robin
#

right

dark robin
#

danke

#

yeah, got it

#

thank you very much!

frank jewel
#

How do I get a list of perms from players starts with something?.

fast delta
#

Read the conversation right above