#luckperms-api

1 messages · Page 23 of 1

cold panther
#

That will trigger whenever a permission is added to a user/group, you would then calculate whether the holder was a user or group, and then check if the node added was a group node.

Are you after the event for when a group is added/removed, or when a group becomes the user's primary parent?

warm ginkgo
#

either works honestly

#

I just need to track the command /lp user lazerpent parent set myGroup

#

I would say the second one

#

when a group becomes the parent

cold panther
#

Just to check, do you want to track what happens with the event, such as the permission changes, or do you want to track whether the command was actually used?

#

@warm ginkgo

warm ginkgo
#

what I am trying to do

#

is track if a user is given a role (in this case VIP), at which point I trigger an action somewhere else

cold panther
#

Ahh okay

#

After looking over the API, I'd have to say that the best method would be to listen for the NodeMutateEvent.

  1. You would first check that the target of the event is a user using NodeMutateEvent#isUser
  2. Then use NodeMutateEvent#getDataBefore and NodeMutateEvent#getDataAfter, comparing the two to determine what node was changed, storing the node is a var once it is found
  3. Check the isolated node to see whether the node is 'group.vip', or whatever your group node is.
#

It's long-winded, but it's the best solution I can find

warm ginkgo
#

alright

#

ya

#

thats getting into stuff I don't know lol

#

I literally started working with luckperms two days ago lol

cold panther
#

@warm ginkgo Just got home and decided to try it. All you really need is the following:

public class Listener {
    private VIPListener plugin;
    private LuckPerms luckperms;

    public Listener(VIPListener plugin) {
        this.plugin = plugin;
        luckperms = plugin.getLuckperms();

        EventBus eventBus = luckperms.getEventBus();
        eventBus.subscribe(NodeAddEvent.class, this::onVipSet);
    }

    private void onVipSet(NodeAddEvent event) {
        // Check if event is targeting a user.
        if (!event.isUser()) return;

        // Check if the node added is the group.vip node.
        // User is in the VIP group.
        if (event.getNode().getKey().contains("group.vip")) {
            Bukkit.getConsoleSender().sendMessage("[VIPListener] " + event.getTarget().getFriendlyName() + " is in group.vip");
        }
    }
}
#

ignore the console message, just debugging

warm ginkgo
#

ty @cold panther, thats much cleaner than my solution (it did not make use of the .getKey().contains)

frank driftBOT
#

Hey Lazerpent! Please don't tag staff members.

azure latch
#

@fresh blade apologies, I was on mobile at the time and must have missed the docs link. Either way, sorry about that. Unfortunately, there is no shortcut to adding permissions to a user. Do you have LuckPerms added as a dependency? If you are using a dependency manager like Maven or Gradle, ensure you have it set as a dependency. The luckPerms reference on the last line is an already defined variable, and can be retrieved by (from the docs) ```java
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();

}The `api` variable is now the same as the `luckPerms` variable on the last line. To get a user object, all you have to do is:java
User user = api.getUserManager().getUser(Your_Player_Object.getUniqueId());```

fresh blade
#

@azure latch THANK YOU.

azure latch
#

np, sorry about earlier

fresh blade
#

It's okay

karmic owl
#

Does anyone know if I'm not going to migrate from groupmanager to luckperms?

sour rock
#

why is this not working for me? (The Plugin loads and everything is fine, except the LuckPerms Event)

    
  @SuppressWarnings("deprecation")
    public void onEnable() {        
      new UserPromoteListener();
    }
}

public class UserPromoteListener {

    public UserPromoteListener() {        
        EventBus eventBus = LuckPerms.getApi().getEventBus();
        eventBus.subscribe(UserPromoteEvent.class, this::onUserPromote);
    }

    private void onUserPromote(UserPromoteEvent event) {
        System.out.println(event.getGroupFrom() + " to " + event.getGroupTo());
    }

}```
cold panther
#

if the API being loaded?
Also, are you an older version of LuckPerms, as that is the old method of getting an instance of the API. The newer implementation would be something along the lines of

LuckPerms api;

try {
  api = LuckPermsProvider.get();
}
catch (IllegalStateException e) {
  e.printStacktrace();
}
sour rock
#

Yeah i am using the older version and yes the API is being loaded because other functions are working

cold panther
#

Interesting, it is working for me but I've only got a bukkit test environment setup currently. Are you using the promote command in the bungee console?

#

or are you using the /lp prefix rather than /lpb?

sour rock
#

I was using /lp

cold panther
#

ahhh okay, does using /lpb fire the event?

sour rock
#

wait

cold panther
#

Wait, are you looking to listen for /lpb user <user> parent set/add <group> or /lpb user <user> promote <track>?

sour rock
#

I was looking for the first one

#

Which Event should I use for the first one?

polar cargo
#

Hello ! Is it possible to remove a Meta node without knowing his meta value ?
(Or better, replace a meta by a new one)

azure latch
#

How can I get a Player object from a User? java Player p = Bukkit.getPlayer(user.getUniqueID()); seems to result in an NPE, and the User isn't null since I use i before this line

wanton ibex
#

Well getPlayer returns null if the player is not online

nocturne elbow
#

LP] Permissions data for your user was not loaded during the pre-login stage - this is likely due to a conflict between CraftBukkit and the online-mode setting. Please check the server console for more information.

languid socket
#

@nocturne elbow please go to the right channel.

still girder
#

So I'm trying to download spongeforge and luckperms but Ender IO has a smaller Mixin version so when I update it to a better one, ender IO fucks it up and I can't use it

#

any ways to fix this?

languid socket
#

@still girder go to the right channel.

still girder
#

@languid socket wat channel

languid socket
lone falcon
lone falcon
#

Hum i'm find .join

crystal sonnet
#

!api

frank driftBOT
sleek cove
#

I can use lp in forge dev mods?

crystal sonnet
#

Well LP is a Sponge plugin

#

But what exactly do you need?

wicked kiln
#

how do i get the luckperms api into my code?

neat jackal
#

!api

frank driftBOT
wicked kiln
#

Do you know where dependencies are in intellij

#

i forgot

neat jackal
#

What do you mean exactly? Do you want to add the dependency manually?

wicked kiln
#

don't i have to

neat jackal
#

You can use a dependency manager like Maven or Gradle

wicked kiln
#

Yeah im useing maven i just don't know where in intellij i find dependencies i forgot

unreal mantle
#

They are usually kept in the pom.xml

wicked kiln
#

i get a error when i put in the dependencie

#

<project brings a error when i add your dependice

crystal sonnet
#

Then you're doing something wrong

wicked kiln
#

i copied it and pasted it in.

crystal sonnet
#

And it's kinda hard to help with errors if you don't tell us the errors

wicked kiln
#

Duplicated tag: 'dependencies'

crystal sonnet
#

Put the new dependencies in the existing dependencies tag

#

Can't be that hard

sleek cove
#

But what exactly do you need?
@crystal sonnet I need to get the installed metadata to the player in the forge environment on CatServer (Bukkit) 1.12
lp group default meta set custom-limit 10

frank driftBOT
#

Hey Prototype! Please don't tag staff members.

sleek cove
#

sorry

sleek maple
#

Isn't there a more efficent way to do that:

        final User user = luckPerms.getUserManager().getUser(uuid);
        ContextManager contextManager = luckPerms.getContextManager();
        ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
        user.getCachedData().getMetaData(QueryOptions.contextual(contextSet)).getPrefix();
languid socket
#

Not that im aware of

crystal sonnet
#

There actually is

#
        final User user = luckPerms.getUserManager().getUser(uuid);
        ContextManager contextManager = luckPerms.getContextManager();
        user.getCachedData().getMetaData(contextManager.getQueryOptions(user).orElseGet(contextManager::getStaticContext)).getPrefix();
#

@sleek maple

sleek maple
#

Do u have a example?

crystal sonnet
#

Right there

#

It's your code

#

But improved

sleek maple
#

oh ohh ok

#

With the old api there was a shorter way...

crystal sonnet
#

Not significantly

uncut onyx
#

I have one simple question. As luckperms v5 has different API, none of old plugins supporting v4 will work?

cold panther
#

LuckPerms v5 allows the creation of extensions, and one extension is the legacy-api extension, which allows some plugins developed using the v4 API to work on the newest version https://github.com/lucko/LuckPerms/wiki/Extensions

#

However, if you are the developer of the plugin(s), you really should update them to use the new API

wicked kiln
#

How do i give someone a permission

neat jackal
#

Get their CachedData, then add them a node and save the user/group

#

!api

frank driftBOT
wicked kiln
#

a node is a permission correct?

languid socket
#

Nodes are groups/permissions

wicked kiln
#

what you mean groups/permissions

wicked kiln
#

I don't understand that document'

neat jackal
#

Oh, I linked the wrong section, sorry

#

Using that you can do

User user = ...; // explained on the wiki
user.data().add(node); // Creating nodes too
userManager.saveUser(user);
nocturne elbow
#

Hello, I'm really new to LuckPerms. Is there an event that is fired when the parent rank of a player is changed?

urban verge
#

Can you get a users groups without having a list of possible groups?

#

Or can you get a list of possible groups without having to manually add them all into the code or a config, etc

crystal sonnet
#

To get the user's primary group, use .getPrmaryGroup() @urban verge

#

@urban verge yes there are events. I'm not sure which one is fired for that. But you can check out this:

#

!api

frank driftBOT
urban verge
#

Thanks

urban verge
#

What import is used for MetaData in the developer API thing on github? My IDE isnt finding any imports

crystal sonnet
#

Where?

urban verge
#

Here

#

I found CachedMetaData which seems to work tho

#

Maybe its an error on the docs?

crystal sonnet
#

Possible.

true rapids
#

Hi i want to ask how to get luckperms with bungeecord

brazen mason
#

I have a question! I am running Sponge with Pixelmon and Im trying to use Luck Perm prefixes inside of an Easyscoreboard plugin. Issue is I dont think I installed the Papi Luck Perms extention right
I have the Expansion Luck perms jar in a folder here: /config/placeholderapi/expansions
I tried to do the automatic install using the /papi command but it didnt recognize it

rustic laurel
brazen mason
#

@rustic laurel I have figured it out!

rustic laurel
#

kk !!

crystal sonnet
#

@true rapids elaborate

nocturne elbow
#

hello, I have a problem with luckperms and nucleus permissions

uncut onyx
#

Hello, I am rewriting code from LP v4 and after my changes, saving meta doesn't work, it run successfuly but meta is not saved. Can someone give me an advice what i am doing wrong? https://prnt.sc/rew83j

Lightshot

Captured with Lightshot

nocturne elbow
#

My luckperms prefixes does not show up in chat, I use nucleus as a chat vault

rustic laurel
novel nebula
#

Is there a more optimized way to do this : java @EventHandler (priority = EventPriority.NORMAL) public void onAsyncPlayerChat(AsyncPlayerChatEvent event){ Player player = event.getPlayer(); RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); if (provider != null) { LuckPerms api = provider.getProvider(); User user = api.getUserManager().getUser(player.getUniqueId()); ContextManager contextManager = api.getContextManager(); assert user != null; CachedMetaData metaData = user.getCachedData().getMetaData(contextManager.getQueryOptions(user).orElse(contextManager.getStaticQueryOptions())); String prefix = metaData.getPrefix() == null ? "" : metaData.getPrefix(); String suffix = metaData.getSuffix() == null ? "" : metaData.getSuffix(); event.setFormat(prefix + player.getName() + suffix + ChatColor.GRAY + " » " + ChatColor.WHITE + event.getMessage()); } }

crystal sonnet
#

No need to get the API instance and the ContextManager every method call

#

Store them in a member variable of the class

#

Besides there's not much you can do

novel nebula
#

@crystal sonnet Is there a method to get the display name ?

frank driftBOT
#

Hey Arnaud L. - ZeProf2Coding! Please don't tag staff members.

novel nebula
#

sorry

#

like prefix + name + suffix

#

in one

crystal sonnet
#

The displayname of what?

#

Of the player?

novel nebula
#

no with his rank

crystal sonnet
#

No

novel nebula
#

okay

crystal sonnet
#

That is how you do it with the API

#

Why does it matter how complicated the code is?

#

If you want it simpler, throw it into a helper function

novel nebula
#

okay thank you 😄

crystal sonnet
novel nebula
#

Okay thank you 😄

fierce halo
#

is there an api out there that will allow me to make time promotes and what not?

rustic laurel
#

there are plugins for it... idk many but try asking in #general

fierce halo
#

thank you

#

well i was looking at GroupCacheLoadEvent
GroupDataRecalculateEvent
NodeAddEvent
NodeClearEvent
NodeMutateEvent
NodeRemoveEvent
UserCacheLoadEvent
UserDataRecalculateEvent
UserDemoteEvent
UserFirstLoginEvent
UserLoadEvent
UserPromoteEvent
UserTrackEvent
and i was wonder on how to set up like a userpromoteevent using lp

fierce halo
#

okya so how would i make a userFirstLogianevent that would run userpromoteevent

crystal sonnet
#

@fierce halo Events are fired when something happens. You don’t fire them to make something happen

#

You use API calls to make changes

#

!api

frank driftBOT
narrow dune
#

I have a question, how can I query the weight of the group in order to find out that my group is larger than the one that wants to give me.

crystal sonnet
#

@narrow dune pretty sure there's a direct call on the group for that

#

@next orchid use meta

#

Up to you really

#

best to use a prefixed name though

#

like you do with permissions

#

myawesomeplugin.chatcolor

#

Instead of just chatcolor

#

To prevent collisions with other plugins

earnest zodiac
#

Hey,
I'm having trouble understanding how the API works
I want to check if a player (UUID i am in PreLogin event on Bungee) has a permission

crystal sonnet
#

Just check it as you would anywhere else

earnest zodiac
#

I don't have Player object

#

anywhere else i want to use player.hasPermission

frank driftBOT
crystal sonnet
#

That's because you haven't set a meta node

#

Prefix it with meta.

autumn niche
#

hey i have this code

    private static LuckPerms api = null;

    @Override
    public void onEnable() {
        setupChat();
        Bukkit.getPluginManager().registerEvents(new ChatEvent(), this);
    }

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

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

    public static LuckPerms getChat() {
        return api;
    }```
but for some reason getChat throws null?
languid socket
#

I think because of:

private static LuckPerms api = null;

crystal sonnet
#

@autumn niche you never set the static variable api to anything

#

Where you try to set it you create a new variable instead

#

Remove the type before the assignment

autumn niche
#

ah i see

uncut onyx
#

Is there an easy way how to remove MetaNode from player with key as a parameter?

#

Now I have to compare all keySet from player with my key and also remove value from it.

wise flume
#

something else:
the perms of users dont get an update until I type /lp editor...
but i save everything

LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(UUID.fromString(spielerUUID));

InheritanceNode groupNode = InheritanceNode.builder(teamName).build();

user.data().add(groupNode);
api.getUserManager().saveUser(user);
api.runUpdateTask();
#

even if the Player rejoins, he has not the permissions...

wise flume
#

someone any idea how to update?

wicked kiln
#

what is the best way to give someone a rank

wise flume
#

set his primary group

unreal mantle
#

@wicked kiln either set the primary group, or apply the permission group.<groupname>

wise flume
#

no help?-.-

prime glacier
#
                            user.setPrimaryGroup(group.getName());
                            LuckPerms.getApi().getUserManager().saveUser(user);``` My parent group don't change why???
#

Please help.

wise flume
#

is he parent in teh lp editor?

prime glacier
#

No

prime glacier
#

And I have a problem with creating nodes??

#

How to?

wise flume
#

you can give him with

LuckPerms api = LuckPermsProvider.get();
CompletableFuture<User> userFuture = api.getUserManager().loadUser(UUID.fromString(spielerUUID));
InheritanceNode groupNode = InheritanceNode.builder(teamName).build();

userFuture.thenAcceptAsync(user -> {
        user.data().add(groupNode);
    api.getUserManager().saveUser(user);
    api.runUpdateTask();
});
#

an parent group

#

but then you have the same problem like me.. it will not updating until you typ /lp editor or /lp networksync

prime glacier
wise flume
#

version of your api?

prime glacier
#

How I can see? 😅

#

4.4.1@wise flume

wise flume
#

ah, my code is for version 5

prime glacier
#

Have you some of version 4.4.1

wise flume
#

no, sorry, i use the api since yesterday:D

prime glacier
#

Ok I found out

idle slate
#
            = LuckPermsProvider
                .get()
                .getUserManager()
                .getUser(target);

        user.setPrimaryGroup(Configuration.unlockGroup());

        LuckPermsProvider
            .get()
            .getUserManager()
            .saveUser(user);
        
        LuckPermsProvider.get().runUpdateTask();``` User#setPrimaryGroup(String) does not seem to work on BungeeCord can someone help me please? I want to change the parent group of a player.
wicked kiln
#

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user" + event.getPlayer().getDisplayName() + "parent add rank1");
addParent.put(player, g);

azure latch
#

Thats a horrible way of doing it and completely defeats the purpose of the API

long moon
#

setPrimaryGroup does not modify their groups

#

you actually need to add them to the group

idle slate
#

Then what is this method for?

#

User#getPrimaryGroup() even return the actual parent group

cold panther
#

people can be in multiple groups. Their parent group is the highest priority group they have available.

#
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(target);
user.data().add(Node.builder("group." + Configuration.unlockGroup).build());
api.getUserManager.saveUser(user);

#

Something like that may work if your config has groups in lowercase

idle slate
#

Node.builder throws an exception so i removed this specific Code. Migrating from 4.x to 5.x

#

Any chance that User#setParentGroup(String) will be available at some point?

cold panther
#

I'm pretty sure that method simply elevates a user's existing group to their parent group, rather that adds a new group. Do you recall what exception the code I gave was giving?

idle slate
#

Something like Inheritance problems when building this node

dire prawn
#

so the default rank on my server cant open chests can I make this true with luck perms

hardy badge
#

is it possible to change the server's name that LP uses via the API

crystal sonnet
#

@idle slate no exception, no help

#

Or more elaborate: If code we give you causes exceptions/crashes and you say "it caused an exception" without giving us that exception we cannot help you

idle slate
crystal sonnet
#

The first line literally says what's wrong

#

Did you read it?

idle slate
#

people can be in multiple groups. Their parent group is the highest priority group they have available.
@cold panther Yes, thats why i didn't use his code

frank driftBOT
#

Hey joestr! Please don't tag staff members.

idle slate
#

oh! i meant to cite the code

crystal sonnet
#

I mean the error message

cold panther
#

In that error, you're using PermissionNode.builder() when a group node isn't a permission node, it's an InheritanceNode

#

You'd either use the generic Node.builder() or InheritanceNode.builder()

crystal sonnet
#

The generic Node.builder throws that error message @cold panther

#

And what was that about spoon feeding? 😛

cold panther
#

I'm in a decent mood, sush you 😉

idle slate
#

Ah I see it what I've been doing wrong ... PermissionNode worked in 4.x

#

But LuckPermsProvider#runUpdateTask() is like /lpb networksync or are changed user groups propagated automatically?

crystal sonnet
#

No you need to do that

idle slate
#

Finally it works! Thanks again!

crystal sonnet
#

👍🏼

wicked kiln
#

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user" + event.getPlayer().getDisplayName() + "parent add rank1");
addParent.put(player, g);

#

what's a better way of doing something like taht

frank silo
#

..

#

hello

#

how can i display the group of the player on the scoreboard?

rigid ridge
#

You use placeholders.

frank silo
#

how??

rigid ridge
frank silo
#

can u help me in DM?

rigid ridge
#

Just read that article.

frank silo
#

dude u dont understand me

#
        o.setDisplayName(Main.color("  &9&lLobby  "));
        o.getScore(Main.color("&2 &7")).setScore(8);
        o.getScore(Main.color("&cName &9» " + p.getName())).setScore(7);
        o.getScore(Main.color("&7 &a")).setScore(6);
        o.getScore(Main.color("&cRank &9» default")).setScore(5);
        o.getScore(Main.color("&7 &8")).setScore(4);
        o.getScore(Main.color("&cOnline &9»" + Bukkit.getOnlinePlayers())).setScore(3);
        o.getScore(Main.color("&7 &7")).setScore(2);
        o.getScore(Main.color("&7")).setScore(1);
#

how can i display the group here...

rigid ridge
frank silo
#

i will see it

novel nebula
#
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            LuckPerms api = provider.getProvider();
            User user = api.getUserManager().getUser(p.getUniqueId());
            assert user != null;
            String group = user.getPrimaryGroup();
            String groupDisplayName = Objects.requireNonNull(api.getGroupManager().getGroup(group)).getDisplayName();

        o.setDisplayName(Main.color("  &9&lLobby  "));
        o.getScore(Main.color("&2 &7")).setScore(8);
        o.getScore(Main.color("&cName &9» " + p.getName())).setScore(7);
        o.getScore(Main.color("&7 &a")).setScore(6);
        o.getScore(Main.color("&cRank &9» " + groupDisplayName)).setScore(5);
        o.getScore(Main.color("&7 &8")).setScore(4);
        o.getScore(Main.color("&cOnline &9»" + Bukkit.getOnlinePlayers())).setScore(3);
        o.getScore(Main.color("&7 &7")).setScore(2);
        o.getScore(Main.color("&7")).setScore(1);
}```
frank silo
#

thanks i will try it.

#
            User user = api.getUserManager().getUser(p.getUniqueId());

its not working.

#

oh

#

i fixed it

#

nvm

crystal sonnet
#

@wicked kiln

LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(target);
user.data().add(Inheritance.builder(gropup).build());
api.getUserManager.saveUser(user);
prime glacier
#

How can I get every User which is registered?

#

Via Luckperm api

wicked kiln
#

What would i put for target

crystal sonnet
#

@prime glacier what for

#

@wicked kiln the target (user)

prime glacier
#

I'll loop every user to see their groups

crystal sonnet
#

What for?

prime glacier
#

To see how much players are in Team groups eg. Sup, Mod

prime glacier
#

#getLoadedUsers don't return every Users

crystal sonnet
#

That's not the method I linked

prime glacier
#

Only that which was online since the last restart

crystal sonnet
#

I linked the right method

prime glacier
#

getWithPermission

crystal sonnet
#

yes

prime glacier
#

But I need a UserList

crystal sonnet
#

Use streams

prime glacier
#

???

crystal sonnet
#

What type of user objects do you need?

#

And you should really look into streams

#

@prime glacier

prime glacier
#

I need the LuckPerms User class

crystal sonnet
#

One sec

prime glacier
#

Every User which have set a special prefix in their group

crystal sonnet
#

You need to find those groups seperately

#

But to get User objects for all users in a specific group:

    UserManager userManager = api.getUserManager();
    userManager
        .getWithPermission("group." + group)
        .join()
        .parallelStream()
        .map(HeldNode::getHolder)
        .map(userManager::loadUser)
        .map(CompletableFuture::join)
        .collect(Collectors.toList());
prime glacier
#

thx

crystal sonnet
#

You're welcome

prime glacier
#

@crystal sonnet

frank driftBOT
#

Hey Forumat! Please don't tag staff members.

prime glacier
#

Sry

crystal sonnet
#

Is the permissions applied directly to the users?

#

The getWithPermission method doesn't respect inheritance

#

And what's the issue with the screenshot?

prime glacier
crystal sonnet
#

Then import it

prime glacier
#

So with this method I won't get the user which is in gorup Supporter (supporter has set the suffix) ?

crystal sonnet
#

Yes

prime glacier
#

So i have to give the player the suffix

crystal sonnet
#

As I said you need find the groups with the permission first

prime glacier
#

Mhh I think I've found another way 🙂

crystal sonnet
#

And that would be?

prime glacier
#

Loop every group and check suffixes there

crystal sonnet
#

That's what I was getting at

prime glacier
#

and then get every member of the group

#

Is there a method to get all members of a group?

crystal sonnet
#

...

#

Look

#

My example is literally that

prime glacier
#

i dont have HeldNode in my API

crystal sonnet
#

What version of the API are you using?

wicked kiln
#

@wicked kiln

LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(target);
user.data().add(Inheritance.builder(gropup).build());
api.getUserManager.saveUser(user);

@wicked kiln the target (user)
So i got 2 issue what do i put for target. I mean like i tried to put user and it didn't work. Also what do i put for Groupup

crystal sonnet
#

Oops. It has a typo. I mean group

#

Put the name of the group there

#

And the target needs to be an UUID

#

@prime glacier

prime glacier
#

4.4.1

crystal sonnet
#

Well, then that can't work because it's for API 5

#

And if you're not interested in my help you can just tell me. No need to make wait 20 minutes+

prime glacier
#

Of course I'm interested in your help

#

Why I shouldn't

crystal sonnet
#

Your behavior clearly says otherwise

prime glacier
#

Oh I'm sorry

#

I had to go afk for a minute

crystal sonnet
#

Would be nice telling

#

In any case API 4 is outdated and at the very least I don't provide support for it

prime glacier
#

Okey

#

I'll find out by myselg

#

myself*

crystal sonnet
#

The code shouldn't be too different

#

Here would be the complete code btw xD

    final String permission = "test";
    final QueryOptions queryOptions = api.getContextManager().getStaticQueryOptions();

    GroupManager groupManager = api.getGroupManager();
    UserManager userManager = api.getUserManager();

    Stream.concat(
            groupManager.getLoadedGroups().stream()
                .filter(
                    group ->
                        group
                            .getCachedData()
                            .getPermissionData(queryOptions)
                            .checkPermission(permission)
                            .asBoolean())
                .map(Group::getIdentifier)
                .map(Identifier::getName)
                .map(groupName -> "group." + groupName),
            Stream.of(permission))
        .parallel()
        .map(userManager::getWithPermission)
        .map(CompletableFuture::join)
        .flatMap(List::stream)
        .map(HeldNode::getHolder)
        .distinct()
        .parallel()
        .map(userManager::loadUser)
        .map(CompletableFuture::join)
        .collect(Collectors.toList());
prime glacier
#

thx

dim leaf
#

this is prob a stupid question but does wieght do and what should i set it as

languid socket
#

@dim leaf if it's about the developer api, ask it here otherwise please ask it in #support-1

polar cargo
#

Hello im not sure to understand, how i can get all meta, even if there is context or not ?

crystal sonnet
#

Use there should be a getter for noncontextual query options on the ContextManager. Noncontextual means that it allows all contexts

polar cargo
#

actually i do this :

QueryOptions options;
if (getApi().getContextManager().getQueryOptions(user).isPresent()){
options = getApi().getContextManager().getQueryOptions(user).get();
}else{
options = getApi().getContextManager().getStaticQueryOptions();
}```
crystal sonnet
#

That’s respecting the contexts

#

Which according to your initial question is not what you want

#

Also there is a utility method on Optional that provides a fallback if the optional is not present

sonic snow
#

Is there an event that is fired when any data relating to a user is modified? For instance, if /lp user bob7l set bukkit.permission is executed, will an event then be forwarded?

#

I'm seeing "UserDataRecalculateEvent" and "UserTrackEvent" that may be useful for this

sonic snow
#

Eh, I'm just going to use ServerCommandEvent from Bukkit

jaunty pecan
#

UserDataRecalculateEvent is probably what you want

tulip agate
#

That's my code : I create a command : "farmoney" and I want to player to remove the permission to use it. How can I do that with Luckperms ?

dusky shell
#

@tulip agate What do you mean the player to remove permission?

#

You want to add a permission to use the command?

tulip agate
#

yes excatly !! @dusky shell

dusky shell
#

Oh ok so

#

Do

#
        your code here.
}```
tulip agate
#

ok and after that can I add/remove this permission with LuckPerms ?

dusky shell
#

Yes

#

You can also do

        your code here.
} else {
Code when the player doesn't have the permission```
tulip agate
#

Alright and then I can go on Luckperms to remove the permission ?

dusky shell
#

Yep

#

remove / add to the player

tulip agate
#

I'll try and get you a feedback

dusky shell
#

if you want players to use it, add it

tulip agate
#

ok /

#

!

dusky shell
#

Also please add return true

tulip agate
#

after the return false ?

dusky shell
#

Instead of

tulip agate
#

ok....

tulip agate
#

@dusky shell thx very much it works ! In love with Luckperms ❤️ xD

dusky shell
#

You are welcome.

viscid coyote
#

How do I get the prefix of a group using the API?

polar cargo
viscid coyote
#

The thing is I don't want the prefix of a player but the prefix of some group by its name

frank silo
#

@viscid coyote

#

i will give you the code

#

1m

#
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if (provider != null) {
            LuckPerms api = provider.getProvider();
            net.luckperms.api.model.user.User user = api.getUserManager().getUser(p.getUniqueId());
            assert user != null;
            String group = user.getPrimaryGroup();
            String playergroup = Objects.requireNonNull(api.getGroupManager().getGroup(group)).getName();
#

PlayerGroup = getting group name

elfin smelt
#

I'm trying to get an offline user to get his primary group so I can get a colored username based on the group he is. When the player is online, it works great, but when the player is offline the user is null. Can someone tell me what do to in order to fix that?

LuckPermsApi api = Happia.getInstance().getLuckPermsApi();
User user = api.getUser(this.uuid);
#

This is how I get the user ^^

cold panther
#

From that snippet, are you not on the latest API?

elfin smelt
#

uhm, I'm using the extension for the v4 of the API for some reason I can't get it to work with the Bukkit version of the plugin.

#

Is there something else that I have to do in order to get the V5 to work with the plugin?

cold panther
#

If you don't need to update, you should be fine. You should have a loadUser(UUID) method available to you. That will load the user into memory from your storage on request

elfin smelt
#

I actually have V5 implemented into the plugin, but V4 in-game because when I try to start the server without having the extension for the V4 I get "no class found".

cold panther
#

I suppose you may be using a plugin which depends on the V4 API then

elfin smelt
#

No, you don't understand. I'm saying that my plugin has V5 API implemented. But when I put my plugin into the server and just run it, it says that it didn't find a class for the API, but I actually have Luckperms-Bukkit 5.0.72 into the server.

#

And to get it to work I installed the V4 extension API to Luckperms

cold panther
#

Oh strange, do you have the error on hand, or can get the error?

elfin smelt
#

I can get it wait a min

cold panther
#

sure

elfin smelt
#

This is running Luckperms-Bukkit 5.0.72 without extension-legacy-api-1.0.0

cold panther
#

Ah, that package doesn't exist in the V5 API. the base package for the V5 API is net.luckperms.api rather than me.lucko.luckperms.api

#

In order to get an instance of the API (using the singleton), you'd use LuckPerms api = LuckPermsProvider.get();

elfin smelt
#

Oh this might be it because I copied it from another plugin that I've made for older versions

#

Ok, thank you for your time :)

cold panther
#

No problemo 🙂

elfin smelt
#

nvm, I used loaduser() and everything worked :)

viral igloo
#

user.setPrimaryGroup("smth"); Why does it return FAIL?

#

I tried to do that with thenAcceptAsync, but still returned FAIL

crystal sonnet
#

What do you think this does?

viral igloo
#

Sets a player group?

#

I want to do something like /lp user nick group set smth

#

but with api

crystal sonnet
#

I mean just the method name already says that it does something different

crystal sonnet
#

@viral igloo

steep shadow
#

how to get tempparent expire date with API

jaunty pecan
#

Node.getExpiry

dusky wagon
#

How i can get all users from a group?

crystal sonnet
#

Considering inheritance or not?

dusky wagon
#

yes

crystal sonnet
#
    final String permission = "group.<group>";
    final QueryOptions queryOptions = api.getContextManager().getStaticQueryOptions();

    GroupManager groupManager = api.getGroupManager();
    UserManager userManager = api.getUserManager();

    Stream.concat(
            groupManager.getLoadedGroups().stream()
                .filter(
                    group ->
                        group
                            .getCachedData()
                            .getPermissionData(queryOptions)
                            .checkPermission(permission)
                            .asBoolean())
                .map(Group::getIdentifier)
                .map(Identifier::getName)
                .map(groupName -> "group." + groupName),
            Stream.of(permission))
        .parallel()
        .map(userManager::getWithPermission)
        .map(CompletableFuture::join)
        .flatMap(List::stream)
        .map(HeldNode::getHolder)
        .distinct()
        .parallel()
        .map(userManager::loadUser)
        .map(CompletableFuture::join)
        .collect(Collectors.toList());
#

unless you just want online players

dusky wagon
#

no

crystal sonnet
#

Only issue this code has is that it ignores contexts on groups assigned to players directly

wicked kiln
#

Can someone exsplain to me how to add a player to a group bc i got no idea

#

this is what i got.

#

public class Rank1 implements Listener {

    public static Map<Player, User> addParent = new HashMap<>();
    private String rank1;

    @EventHandler
    public void RightClick(PlayerInteractEvent event){
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        LuckPerms api = LuckPermsProvider.get();
        User user = api.getUserManager().getUser(uuid);
        final ItemStack itemStack = player.getItemInHand();
        ItemMeta meta = itemStack.getItemMeta();
        if (player.getItemInHand().getType() == Material.PAPER){
            if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
                if (stripColor(String.valueOf(equals("Rank: <I>")))){
                    if (player.hasPermission("trainee")) {
                        if (player.getItemInHand().getAmount() == 1){
                            player.setItemInHand(new ItemStack(Material.AIR));
                        } else {
                            player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1);
                        }
                        player.sendMessage("You got rank 1!");
                        user.data().add(InheritanceNode.builder().build());
                    } else if (player.hasPermission("rank.1") || player.hasPermission("rank.2") || player.hasPermission("rank.3") || player.hasPermission("rank.4") || player.hasPermission("rank.5")) {
                        player.sendMessage("You got a better rank already or equal to it.");
                    }
                }
            }
        }
    }

    private boolean stripColor(String s) {
        return true;
    }
}
steep shadow
#

how to get prefix and sufix with API

unreal mantle
steep shadow
#

ok

nocturne elbow
#

dont really understand the api xD

crystal sonnet
#

What do you want to know about?

limpid escarp
#

Hallo, I have some question about the Luck Perms API.
So I wona know, how i can request, in what group the Player is

crystal sonnet
#

!api

frank driftBOT
silver dirge
#

hey how can i do so all players that join have normal permssions?

warm hazel
crystal sonnet
#

@silver dirge are you referring to making a plugin yourself?

#

@warm hazel don't shade the API in

warm hazel
#

huh ?

crystal sonnet
#

Don't shade the LP API in your plugin

silver dirge
#

yeah the luckperms, i have EssentialsX on my server but dont have permissions, so installed luckperms

#

so just want to do so all new players have normal permissions

crystal sonnet
#

@silver dirge are you referring to making a plugin yourself?

silver dirge
#

ups wrong chat i think

crystal sonnet
#

In any case, based on context I'd say no, so please use #support-1

#

Or 2

warm hazel
#

so how do you want me to get player groups without using LP API ?

crystal sonnet
#

I never said you're not supposed to be using the LP API

#

All I'm saying is that you're not supposed to shade the LP API classes into your plugin

#

In other words your plugin jar must not contain the LP API classes

#

Also don't put the API jar in the plugins folder

violet tendon
#

is this a help chat

crystal sonnet
#

Take a guess based on the channel name and description

violet tendon
#

idk but im having issues with something

#

is it okay to discuss it here

crystal sonnet
#

If you can't even figure it out based on some very simple observation, I'm afraid you're lacking the mental capabilities to run a server

warm hazel
#

my jar does not contain any LP classes

violet tendon
#

wtf is wrong with you?

crystal sonnet
#

I just strongly dislike people that refuse to use their own brain and expect to be spoon fed

#

@warm hazel ok. Also don't put the API jar in the mods folder

violet tendon
#

you sound like a douche bag

#

cant believe he put you as a mod

crystal sonnet
#

No

#

I'm just being honest

violet tendon
#

why the hell does oberserving which chat room to speak in determine my mental capacity of running a server?

warm hazel
#

there doesn't seem to be a luckperms api jar in the folder

violet tendon
#

i just saw this one active and choose to get help and lead me to the right direction

#

but instead you attacked me

crystal sonnet
#

@violet tendon because it shows a clear lack of willingness to put any effort in finding out info on your own

#

Not quite

violet tendon
#

theres LITERALLY no chat

#

that says "help"

#

so i went to something that look like it had higher ups speaking

#

and choose to went here

crystal sonnet
#

I asked you a simple question, which you failed to answer

#

Which lead me to my conclusion

violet tendon
#

that im brainless?

#

get a life dude learn how to treat people

crystal sonnet
#

If you are now kind enough to read the description of #support-1, you might get somewhere

#

And no

#

That you're lazy

#

@warm hazel what jars do you have in the plugins folder?

warm hazel
crystal sonnet
#

Can you reproduce it with only LP and your plugin?

warm hazel
#

appears to still be happening

crystal sonnet
#

Could you send the plugin jar?

warm hazel
#

my plugin, right ?

crystal sonnet
#

Yes

sleek maple
#

Is there an Liberty for non Minecraft use? Just for accessing the DB...

crystal sonnet
#

No

steel arch
#

do someone know how to change the 127.0.0.1 ip to 0.0.0.0 on mysql what i have installed on my vps? I want to connect to it from an other vps

#

i found

crystal sonnet
silk grotto
#

hey everyone! i have a question regarding the luckperms api for bungee.
Everytime i try to get the API, I'll get the following exception:
java.lang.IllegalStateException: The LuckPerms API is not loaded.
My code is:
LuckPerms api = LuckPermsProvider.get(); (called when a User joins the Server)
Can anyone help me out?

#

is the dev API even usable in a bungee plugin?

crystal sonnet
#

Yes it is

#

The issue here is that you most likely call that code when initializing your class

silk grotto
#

Actually not. It's only called when a User joins the server (when everything is already loaded)

crystal sonnet
#

Double check

#

And make sure you're not shading in the API

silk grotto
#

What do you mean by shading?

crystal sonnet
#

Copying the LP API classes into your own jar

silk grotto
#

that was it 2221_ani_facepalm i used "compile" in my gradle. replaced it with compileOnly. were already curious that the docs are saying that u should use "compile"

#

thank you!

crystal sonnet
#

It always depends on how the project is setup

#

And what gradle version, etc

stable sandal
#

have a ask I make a scoreboard and wants to let the rank display my question is how do I do this quasi how do I bind luckperms

azure latch
#

Are you making a plugin?

stable sandal
#

yes

unreal mantle
long wyvern
#

Hello

#

I have a question

#

is there's any way I can listen to this?

crystal sonnet
#

What for exactly @long wyvern

long wyvern
#

because I want to listen to any call that any plugin made on Player#hasPermission(String)

#

is it possible to listen into that event?. Because I looks like that event can only be called by the Verbose handler

crystal sonnet
#

The event you showed has nothing to do with the Player#hasPermission(String) method

long wyvern
crystal sonnet
#

What exactly do you want to do with the actual PermissionCheck event?

long wyvern
#

I want to make my own verbose handler for my lpgui plugin

crystal sonnet
#

I don't think the API supports that

long wyvern
#

or a gui that will show a permission check that has been made

#

oo rip

crystal sonnet
#

Pretty sure you'll have to rely on internals

long wyvern
#

alright then, thanks

crystal sonnet
#

You're welcome

#

@long wyvern one thing comes to mind

#

You can try to see if the event ends up in the LP event bus

#

LP uses its own event bus for events it fires

long wyvern
#

hmmm I didn't found any event that can related to permission check

#

but I do have another way, but I'm not sure if its good or not xd

#

lp inject their custom permissible into the player

#

so after that injection I can override it with my custom permissible which also extends lp's default permissible

#

not sure if that would work but I'll try lol

crystal sonnet
#

I mean make an event listener on the event bus that listens to objects and see if they are the right type

jaunty pecan
#

so after that injection I can override it with my custom permissible which also extends lp's default permissible
please don't do that

#

why do you need to reimplement the verbose handler?

#

what's wrong with the way it is at the moment? if you have ideas for improvements why not just contribute them to LP itself

crystal sonnet
#

From what I understood they want to implement their own verbose frontend

nocturne elbow
#

anyone can help me transition from api v4 to v5?

crystal sonnet
#

What do you need help with?

long wyvern
#

well the verbose handler is perfect already, but I didn't see any method to actually access it from luckperms api thats why I did that. But well my custom injection also need to use internal api from luckperms that will require reflection to access it, I'll try to use verbose handler then since you said not to inject custom permissible

#

also I do not think a custom injection is a bad idea, because I extended the default one with super call so luckperms will actually still works plus I only overrides 2 methods, hasPermission with Permission param and String param, then after that method executed I called my custom callback which didn't take too much of resources it stills runs fine (below 2-3 ms)

tight kiln
#

Is there a way to get the offline and online users of a group? (Bungee Version)

rustic laurel
midnight cape
#

i am sorry

rustic laurel
#

no worries

somber sage
#

Hello. I don't know if this fits the subject, but.
I'd like to know how you guys planned the project to make it multiple-API. Like you can use Sponge Bukkit or anything "on the go" and I have to say, I'm pretty impressed. I kinda want to do the same thing for my next projects. So far I'm mostly doing ports of plugins from Spigot to Sponge, thus why i'm highly interested.
Not asking for a tutorial (tho if you have ressources I'm completly ok with that) just, the process behind it. What questions did you asked yourself for this or this part of the code. Did you made two different project first, check for redundancy, and then made the "mixed" project based off this. I never did anything like that because I felt like Sponge and Bukkit API were a bit too different to be mixed toghether, and I never thought such a thing was possible for API like that. But it's the most simple and long-term solution imo. So yeah, if you have any tips, how to start, etc, I'll greatly take it. Thanks.

raven pelican
#

Is there an Event that triggers once a users group gets changed

crystal sonnet
#

@somber sage the process works as follows:
You create a common core. That's where all your plugin logic happens. The API only ever talks with the core.

#

Then you create implementations for each platform

#

Like say you need to be able to set a block

#

In the common core you define an abstract class that has a method to set a block. And in all platform implementations you create a class that actually sets the block

#

@raven pelican not one specifically for that

#

But I think there's the UserDataRecalculateEvent

#

Try that

raven pelican
#

@crystal sonnet How would i go ahead in using that? aka. how do i check if user has a new group and what that group is

frank driftBOT
#

Hey Johni! Please don't tag staff members.

crystal sonnet
#

Listen to it and inspect the event data (like print it to console)

raven pelican
#

but how do i get the Groups out of the event data?

raven pelican
#

Also how to get all members of a group?

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

That won’t answer all questions but gives you access to the docs

ancient sierra
#

can i get support here ow where?

#

i have a few questions

rustic laurel
#

@ancient sierra ask and ye shall receive

ancient sierra
#

ight

#

so im on sponge

#

everything works except other plugins permissions

rustic laurel
#

ight so to keep things clean, please move the convo to #support-1 or #support-2 - you'll notice the channel topics specify this as well

ancient sierra
#

ight

raven pelican
#

Hey can anybody give me a quick way of getting all members of a group?

raven pelican
#

Why does this not work? user.setPrimaryGroup(getGroup(user.getUniqueId()))

#

getGroup returns a String from SQL

#

when i add .wasSuccessfull to the setPrimaryGroup it returns false

#

but i dont see a reason

#

i just did a sout and getGroup returns "test" which is a valid group

limber token
#

Hey. How would I set a players parent group (and how do I add one) (v5 API)?

#

How do I set a permission User#setPermission from v4 is no more?

raven pelican
#

I am still waiting for a bit of help up there?

#

user.setPrimaryGroup returns always FAIL

#

Please anyone...

raven pelican
#

@crystal sonnet i know i am not allowed to ping staff, but i am really frustrated, i don't know what todo and google isn't helping

frank driftBOT
#

Hey Johni! Please don't tag staff members.

crystal sonnet
#

Searching this channel in regards to setPrimaryGroup should answer your question

#

Also check out

#

!api

frank driftBOT
crystal sonnet
#

@raven pelican

raven pelican
#

i checked it out 20 times

#

it isnt helping

crystal sonnet
#

All you need is on that page

raven pelican
#
User user
                = LuckPermsProvider
                .get()
                .getUserManager()
                .getUser(uuid);

        user.setPrimaryGroup(group);

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

        LuckPermsProvider.get().runUpdateTask();``` this doesnt work, i found that during the search you suggested
crystal sonnet
#

You're supposed to read what's being said

#

Not just blindly copy what you come across

#

No wonder you're not finding what you're "looking" for

raven pelican
#

i am sorry its pretty late for me, and i am trying to fix that for 4 hours now

#

Ohh now i get it

#

i have to add a group to the user

#

and set it as primary using the method

#

user.data().add(Node.builder("group." + Configuration.unlockGroup).build()); can i replace Configuration.unlockGroup with the specific Group?

crystal sonnet
#

Almost

#

You need an inheritance node builder

#

How it works is explained clearly on the API usage page

raven pelican
#

Okay adding the Group wasnt a problem at all

#

but the setPrimaryGroup still no result, i guess i need to try even more

crystal sonnet
#

By default the primary group is calculated automatically

#

That’s why setting it fails

#

And using the node builder will fail

raven pelican
#

You mean Node Builder the code i sent above?

crystal sonnet
#

You need the inheritance node builder

raven pelican
#

By default the primary group is calculated automatically
@crystal sonnet Ok thats why it always returns fail

frank driftBOT
#

Hey Johni! Please don't tag staff members.

crystal sonnet
#

Yes I’m talking about the example

#

If you’re writing a public plugin it’s a good idea to set the primary group. But don’t bother for a private plugin

raven pelican
#

Another thing, i am doing this Plugin for a Friend he doesn't want to use the LuckPerms Network Synching (for some reason idk) he wants to have an extra Plugin for that, how should i go at this, its supposed todo it via SQL

crystal sonnet
#

Use the SQL storage method in LuckPerms

raven pelican
#

he doesn't want to use LuckPerms for synching

crystal sonnet
#

Everything else is not just stupid, but straight up insane

#

Especially if he wants it synced over SQL, it’s actually insane trying to do that through an external plugin

raven pelican
#

I know, i don't know why he wants it like that

#

but he made an order via Fiverr so i cant just cancel it for no reason, so i need to just do it

crystal sonnet
#

There’s no easy way to do it

#

It’d be around 10h of work for someone that knows the plugin in and out.

#

And considering you’re struggling setting a group I frankly don’t think you’ll be able to do that in any reasonable time frame

#

I’m afraid you have to cancel or renegotiate due to it not being possible to do in any reasonable time frame

raven pelican
#

Good advice, thank you. And sorry for wasting your Time!

crystal sonnet
#

Next time make sure to check the amount of work before you agree on a price

#

If you need help convincing him to use built in LP stuff, send him here (to #support-1 or 2)

raven pelican
#

I Just quoted you, he understood and sayd he would look into SQL Storage

#

lost a bit of Money but hey, atleast i tried

#

Thanks again @crystal sonnet Good night! and Clippy dont kick me pls

frank driftBOT
#

Hey Johni! Please don't tag staff members.

crystal sonnet
#

/ban

raven pelican
#

no

#

pleas

#

e

#

😦

crystal sonnet
#

😜

#

Anyways. Glad I could help

visual wadi
#

How can I check if a user has a certain permission and if it's true/false ?

#

I want to check if someone has * and if it's true (I want to ignore those players in my event).

crystal sonnet
#

Use the normal permission check

limber token
#

So you can detect a player's group/parent update using NodeAddEvent/UserDataRecalculateEvent.. How would I get the previous parent group(s)?

crystal sonnet
#

There should be a getter for the previous data

tardy eagle
#

Hey, I just moved from Pex over to LuckyPerms is it hard to get used to the change or? I also need to hook into the api as well 😄

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

If you just want prefixes and basic stuff, use the vault API

tardy eagle
#

Can vault handle that?

crystal sonnet
#

And yes it's a huge difference

tardy eagle
#

I feel like the commands are strange with the clicking on things in the chat. Pex is straight forward just type the command etc.

crystal sonnet
#

What clicking things in chat?

tardy eagle
crystal sonnet
#

You can do that

#

You don't have to

tardy eagle
#

No I mean, pex doesn't have that so it's strange for me.

crystal sonnet
#

OMG an additonal feature

tardy eagle
#

?

crystal sonnet
#

I mean you don't have to use it

#

It's just there in addition

#

YOu can type the commands out just like that

tardy eagle
#

?

crystal sonnet
#

?

tardy eagle
crystal sonnet
#

This discussion doesn't belong in this channel. Move it to #support-1 or #support-2 if you want to continue

tardy eagle
#

so i'm asking how to do something via the api isn't for this channel??

crystal sonnet
#

That's for this channel

#

But you were asking about general plugin usage and features

tardy eagle
#

i dont know how to create a group to test with the code

crystal sonnet
#

!usage

frank driftBOT
crystal sonnet
#

The wiki is a magical place

visual wadi
#

Use the normal permission check
@crystal sonnet doesn't really help me... This is what I'm trying to do.

for (Player players : Bukkit.getOnlinePlayers()) {
  if (!players.hasPermission("*") && (players.hasPermission("permission1") || players.hasPermission("permission2")) {
    players.sendMessage(...);
  }
}```
frank driftBOT
#

Hey Neon! Please don't tag staff members.

visual wadi
#

But what I did is negated * for default group.

#

So with that code everyone will get the message.

#

I want to check if * is true or false and thus want to use LuckPermsAPI.

gloomy osprey
#

how do I get the prefix of a rank via the API

opaque coral
#

how can i get the prefix of a player with the LuckPerms API? i have looked in the dev api but i find nothing whick works can you help me?

frank driftBOT
#

Hey 🌴uS1x | Basti 🌴! Please don't tag staff members.

deep cairn
#

Hello! So I'm currently making a plugin for my own use in order to try and open a Command Shop. I would like to integrate LuckPerms into my code in order to make the permissions a lot nicer and more organized. So far it seems that I have almost everything figured out, and I was really hesitant to post anything here, but I've been trying to figure this out for hours. I'm not sure if I'm just exhausted because it's 5 am, or something, but I have no idea what the provider is, seen in this code here
api = provider.getProvider();

Keep in mind I am very new to Bukkit programming, so I could just be completely overlooking something, and if this isn't the place to ask, I'm so sorry, and I'd be fine with getting redirected somewhere else, though my main problem is I do not know why the provider is null. I've done tests to test to see if it is in fact, null, and I know for a fact that it is. I'm sorry if this is a dumb question. If it is, please feel free to tell me, thank you!

#

Also, feel free to mention me, or even DM if you would need to for any reason, to respond. Thank you!

crystal sonnet
#

@deep cairn when are you initializing the provider?

celest crow
#

hello can you help me please?

crystal sonnet
#

If you let me know with what I can answer if I can help you

celest crow
#

yes please, first I'm french and my english is not good, and I can't arrived to go in group's but I arrived tu create group's

deep cairn
#

I think he's saying that be can't go to groups, but he can create them?

celest crow
#

yes

crystal sonnet
#

Through the plugin API (if you don't know what that is, the answer is no) @celest crow

deep cairn
#

Also I'm not sure if I should interrupt or not

crystal sonnet
#

Feel free

#

I'm fairly busy

deep cairn
#

Oh alright, and well the answer is, I have no idea what the provider even is. And I completely understand that you're busy, so take all the time you need. And if it would be easier, and you're able to link me to a page, that'd be amazing, though if you're not able to help me for whatever reason then that's completely fine, and I'm sure I can figure it out eventually, I'm just really not sure where to start

crystal sonnet
#

!api

frank driftBOT
deep cairn
#

Oh does it mention it in there? I might've missed it then. I'll take another look!

crystal sonnet
celest crow
#

I look and I say

deep cairn
#

Oh! I completely missed that! Thank you! Sorry for the inconvenience!

crystal sonnet
#

You're welcome

#

@celest crow no idea what you mean

celest crow
#

how to put a user in a group?

#

I use google trad

#

is good I find

neat jackal
celest crow
#

thanks

jolly jewel
#

Hello, I try to upgrade from v4 to v5 api, but i have some problems. I want to get a group what is temporary
Old code:
Set<Node> groupNodes = this.getNodes().stream()
.filter(Node::isGroupNode)
.filter(Node::isTemporary)
.collect(Collectors.toSet());
Does somebody know how to migrate it to v5?

jaunty pecan
#
Set<InheritanceNode> groupNodes = this.getNodes().stream()
        .filter(NodeType.INHERITANCE::matches)
        .map(NodeType.INHERITANCE::cast)
        .filter(Node::hasExpiry)
        .collect(Collectors.toSet());
#

Something like that

jolly jewel
#

Thank you

deep cairn
#

Hmm. I think I asked my initial question extremely weirdly. Sorry about that! So I actually had the provider, but for whatever reason, which I am drawing a complete blank on, it's null. I made sure I had this code in mine https://github.com/lucko/LuckPerms/wiki/Developer-API#obtaining-an-instance-of-the-api
Would you have any idea why it would be null? I am very confused, and, again, if this isn't the place to ask I'm fine with being redirected, if even to another Discord or website entirely. Thank you in advance :)

crystal sonnet
#

Again, when do you initialize your provider @deep cairn

#

I understood your initial question just like that

deep cairn
#

Oh! Umm I initialize it inside of an event, which I'm realizing isn't the smartest decision. Should it be inside of onEnable() method?

crystal sonnet
#

That's odd

#

Can I see the code?

#

And I mean either should work

deep cairn
#

Certainly! Would you like to see all of the code? Or just parts?

crystal sonnet
#

Getting the instance of the API once and storing it is typically better

#

The event for now

deep cairn
#

Well I moved it into the onEnable() method to test, do you want me to move it back, or do you want the onEnable method?

#

Wait

crystal sonnet
#

I'd like to see it how it was

deep cairn
#

And now it's working???

#

Okay I can get it how it was

crystal sonnet
#

Hm. Strange

#

But as long as it works in the onenable

deep cairn
#

I'm pretty sure it was a random piece of code earlier on the onEnable method that I had only seen after all this time. I'm so sorry for the trouble!

crystal sonnet
#

It’s a possibility

gloomy osprey
#

how do I get the prefix of a rank via the API?

neat jackal
#

!api

frank driftBOT
gentle geode
#

Hi, can i talk about helper here ?

rustic laurel
#

@gentle geode ask and ye shall receive, but #luckperms-api is for help with the LuckPerms developer API, #support-1 and 2 are for general support

gentle geode
#

ok, so my question is : is there any command completition on helper ?

neat jackal
#

You mean the library Luck has developed? He made another Discord for his projects not related to LuckPerms, link is pinned in #general

gentle geode
#

Ok thx

polar cargo
#

i get some issue with my plugin compiled with api 5.0 and the error come for here mariothinking

crystal sonnet
#

Pretty sure he meant 4.1. There's no 5.1 version/API so that must be a typo

polar cargo
#

yeah okay

crystal sonnet
#

And the question of all questions

#

What error?

#

And more importantly why do I have to ask for it?

polar cargo
#

i ask twice in general support but since i get no anwser, i try to ask somes little things to find my issue

crystal sonnet
#

What LP version are you using?

polar cargo
#

latest V5

#

(build 108)

#

And i also tried the extension thing

crystal sonnet
#

When someone asks for a version number, don't say "latest"

#

Give a version number

polar cargo
#

i say the build 108 😦 a bit late

crystal sonnet
#

Because what you think is latest may not be the actual latest

#

I saw

#

You still said latest

polar cargo
#

yeah, true, just cause its the actual latest atm, but i added the build in case <w<

#

but, yeah, any V5 version i get this, i think it come from one of my plugin which use LP api 5.0 so i'm trying to figure what is it and how to fix it actually

crystal sonnet
#

Try redownloading the API

#

There might have been a change

polar cargo
#

i use compile 'net.luckperms:api:5.0' so it should be fine ?
also, just see that one of my plugin use shadow instead of compile, might be the bug mariothinking

crystal sonnet
#

But that error is so weird

#

Has nothing to do with the API being used in a plugin

#

I'd report than on GitHub to be honest

#

Oh

polar cargo
#

okay, i'll do just some more test to be sure

crystal sonnet
#

Then yeah

#

Don't ever! shadow in the API

polar cargo
#

yeah pretty sure its the bug

crystal sonnet
#

And clear the gradle cache for the file so it downloads it again

polar cargo
#

thanks, i dont know at all why i shadowed it

crystal sonnet
#

If you shadow it in that's your issue

#

Because then you likely have a slightly outdated version of the API and are shading it in

polar cargo
#

yep, i have like 4-5 plugins with lp api and 2 are usings shadow

#

yeah i'll remove that rn

#

thanks for the help

crystal sonnet
#

You're welcome

old onyx
#

Can someone help me with worldguard on my minecraft server?

crystal sonnet
mild hound
#

how do I get someone's prefix
I've seen this metaData being thrown around but it doesn't exist

unreal mantle
mild hound
#

metaData doesn't exist

unreal mantle
mild hound
#

what imports am I missing here

azure latch
#

In the V5 version of the API, MetaData has been renamed to CachedMetaData iirc, although the wiki has not been updated. I ran into the same problem @Foulest#1955

#

oof

#

he gone

jaunty pecan
#

I've updated the wiki to fix that now btw

wanton ginkgo
#

Heey i was wondering if i can make my lucky perms ranks showup in my tab list?

spring helm
#

Hey, how can I use the LuckPerms API to query whether a player has a certain permission?

wanton ginkgo
#

anyone here that knows if this is possible and how to do it?

spring helm
#

idk

wanton ginkgo
#

domi cant u just check the editor for that?

spring helm
#

no xD My question is how can I query how a user has permission

#

Hey, how can I use the LuckPerms API to query whether a player has a certain permission? @thorny echo @neat jackal

frank driftBOT
#

Hey Domi<3! Please don't tag staff members.

wanton ginkgo
#

jeez Domi

#

have some patience. not everyone is here for you

#

find it out yourself or be patient ...

spring helm
#

I'm trying to find out, but unfortunately I can't find out I just don't understand this API, which is why I'm asking here. And I felt like 20min no one gives an answer.

heavy frigate
neat jackal
#

Because some people are doing other stuff when they are online...

wanton ginkgo
#

20 min- has been 2minutes XD

neat jackal
#

Anyways, the wiki should explain that.

wanton ginkgo
#

solid 😛

neat jackal
#

!api

frank driftBOT
wanton ginkgo
#

what bout the tab list?

spring helm
#

Can you please just tell me exactly where I find that and not this wiki. Thank you.

crystal sonnet
#

Just use the platform’s permission check @spring helm

#

You don’t need the API for that

#

And don’t ask to be spoonfed

spring helm
#

I need the API because I work with MultiProxy

crystal sonnet
#

Take docs we give you and read them

spring helm
#

proxiedPlayer#hasPermission brings me little

crystal sonnet
#

Why?

spring helm
#

Because I heard MultiProxy and the standard permission does not go there

crystal sonnet
#

Did you check?

spring helm
#

no

crystal sonnet
#

As long as LP is on the bungee (which it needs to be for the API to be accessible in the first place) that method will work for online players

spring helm
#

Which method

#

proxiedPlayer#hasPermission?

crystal sonnet
#

Yes

spring helm
#

I'll explain it to you again: I want to query (with LuckPerms) from Bungee-1 whether the person on Bungee-2 has the permission "teamchat.access". How do I do this?

wanton ginkgo
#

Bruh....

#

think about it yourself....

crystal sonnet
#

If there’s a decent multiproxy plugin in place, then I don’t think you need the API

candid pewter
#

@wanton ginkgo you are not a Mod!

crystal sonnet
#

@wanton ginkgo he was talking about another server

#

Not another plugin

wanton ginkgo
#

srry Im getting triggered by his additude -_-

crystal sonnet
#

Very much possible

wanton ginkgo
#

so cocky and rude

spring helm
#

I don't use a MultiProxy plugin, I do it differently. But I would like to know how I can make a permission query via the API.

crystal sonnet
#

!api

frank driftBOT
crystal sonnet
#

Pretty sure there’s an example there

spring helm
#

I just don't use LuckPerms anymore, that's too stupid for me.

candid pewter
#

That support is supid!

heavy frigate
#

This guy xD

crystal sonnet
#

If you insist @candid pewter. You are free to go and find better support

#

But in terms of free support you’ll never get spoonfed

candid pewter
#

Always send the same link where there is not what is required!

crystal sonnet
#

Then you’re not explaining yourself properly

#

@spring helm in order to use the LP API you need a decent understanding of LP itself, of programming and be able to read docs

#

If you want to go beyond the examples provided on the wiki

candid pewter
#

How to make a query with multiproxy whether he has a certain permissions

heavy frigate
#

That's not his problem that is a bungee thing so it does not even belong here

crystal sonnet
#

Check the API docs

#

We’re not here to poop out code on demand

#

If you have some code that’s not working we’re happy to help you fix it

candid pewter
#

@heavy frigate But because it goes over the Luckperms aip so if you have no idea then be quiet

crystal sonnet
#

You could’ve said that nicer. But yes. It’s appropriate here

heavy frigate
#

My apologies

tender iris
#

Question from you folks, do you know of an event that I can listen to that is similar to UserTrackEvent that will trigger when /lp user USERNAME set parent GROUP is ran?

thorny echo
#

@tender iris Just listen for a permission node change and check if the node#isGroupNode() is true

woeful oyster
#

hi everyone i have this erreur on every server i put luckperms on .... on the website they say this :
````Note that slf4j-api versions 2.0.x and later use the ServiceLoader mechanism. Backends such as logback 1.3 and later which target slf4j-api 2.x, do not ship with org.slf4j.impl.StaticLoggerBinder. If you place a logging backend which targets slf4j-api 2.0.x, you need slf4j-api-2.x.jar on the classpath```

do i need to upgrade the slf4j api file in the luckperms lib files or not ?

#

@someone ^^ :p

slender bough
#

any help? An exception was thrown by me.lucko.luckperms.bukkit.context.WorldCalculator whilst calculating the context of subject CraftPlayer{name=TheHumdrum}

jaunty pecan
#

ermm

#

one of your worlds doesn't have a name it seems

crystal sonnet
#

I've seen this error one tome before

woeful oyster
#

anyone for me lol ?

slender bough
#

How can I fix it

#

@jaunty pecan

frank driftBOT
#

Hey Beelzebub! Please don't tag staff members.

slender bough
#

Oops

#

Didn't know you were staff, my b

jaunty pecan
#

update to the latest version

slender bough
#

It is the latest version

#

Think I fixed it by changing world name in server properties

dreamy jasper
#

Hi. I've wrote some code in a command to edit some permission nodes on a user and I want to know if I've done this right without blocking the main server thread. Also, if loading the user fails or editing permission nodes fails, how would I be able to catch this and inform the user? https://pastebin.com/h9Md9j53

dreamy jasper
#

Can anyone help?

dreamy jasper
#

Anyone at all?

dreamy jasper
#

Can anyone help me please? I really need help.

rustic laurel
#

As soon as somebody with the right knowledge comes on and reads your messages, I'm sure they'll help! 😄 I'm sorry but I can't help cause I don't have the knowledge, but with patience I'm sure you'll get the help you need!

onyx linden
#

hi

#

please, how to add group to user?

rustic laurel
jaunty pecan
#

@dreamy jasper , remove the second call to loadUser on line 45, you don't need to do it twice :p

#

and also throw in a call to getUserManager().saveUser() after you've removed/added your nodes

#

once you've done that, then yep looks good!

#

to answer your questions:

#

line 48: yep it is

#

line 60: it's not super easy, but have a look at CompletableFuture.exceptionally()

neat jackal
dreamy jasper
frank driftBOT
#

Hey Riley The Fox! Please don't tag staff members.

dreamy jasper
#

Also I've been trying to grab the user prefix asynchronously without blocking but haven't really got anywhere and had to settle with a blocking method to get it working for now.

public static String getChatMeta(UUID uuid) {
        CompletableFuture<User> user = luckPerms.getUserManager().loadUser(uuid);

        if (user == null) {
            // user not loaded, even after requesting data from storage
            return null;
        }

        //Retreive user metadata
        MetaData metaData = null;
        try {
            // Blocking :(
            metaData = user.get().getCachedData().getMetaData(Contexts.allowAll());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return metaData.getPrefix();
    }
#

And I'm not sure on how to do this without blocking the main thread :/ (this is on Bungee this time if it makes a difference)

jaunty pecan
#

with the first link, not quite - hard to explain how to improve though

#

I'm on mobile atm but can have a look tomorrow when I'm at my computer

#

about getting chat meta on bungee: where are you doing it?

#

in an event?

#

and is it always for an online user?

dreamy jasper
#

Not always

#

The chat meta is grabbed in a ChatEvent and some message/reply commands

#

But for a friends list too, which shows offline friends and their prefixes

#
/*
These 2 methods are called from a Message/Reply command
 */
public static String messagePlayer(ProxiedPlayer sender, String msg) {
    String temp = ChatColor.translateAlternateColorCodes('&', BungeeCore.getConfig().getString("messages.msgreceive"));
    temp = temp.replace("%player%", ServerUtils.getChatMeta(sender.getUniqueId()) + sender.getName());
    temp = temp.replace("%msg%", msg);

    return temp;
}

public static String messageSender(ProxiedPlayer reciever, String msg) {
    String temp = ChatColor.translateAlternateColorCodes('&', BungeeCore.getConfig().getString("messages.msgsend"));
    temp = temp.replaceAll("%player%", ServerUtils.getChatMeta(reciever.getUniqueId()) + reciever.getName());
    temp = temp.replaceAll("%msg%", msg);

    return temp;
}```
#

An example of where the chat meta function is used

#

And those functions are called from a command

#

Thank you for all your help so far as well 😄

jaunty pecan
#

friends list is a little more complicated, but here's some example code

#
public class Example {
    private LuckPerms luckPerms;
    
    public CompletableFuture<List<String>> getUsernamesWithPrefix(Set<UUID> uuids) {
        return CompletableFuture.supplyAsync(() -> uuids.stream()
                .map(uuid -> luckPerms.getUserManager().loadUser(uuid))
                .parallel()
                .map(CompletableFuture::join)
                .map(user -> {
                    CachedMetaData metaData = user.getCachedData().getMetaData(QueryOptions.nonContextual());
                    return metaData.getPrefix() + user.getUsername();
                })
                .collect(Collectors.toList())
        );
    }
    
    public void displayFriendList() {
        /* this is the code that would go in your command */
        ProxiedPlayer player = ...;
        Set<UUID> friends = getFriends(player);
        
        getUsernamesWithPrefix(friends).thenAccept(friendList -> {
            for (String friendUsername : friendList) {
                player.sendMessage(friendUsername);
            } 
        });
    }
}
#

I highly suggest reading as much as you can about CompletableFutures if you want to go down that route, there's lots of resources available online

#

the alternative is just wrapping your whole command in a call to the Bungee scheduler (run an async task) - then everytime you encounter a future, just call .join() on it

dreamy jasper
#

Alright, I will try this tomorrow. Thank you!

nocturne elbow
#

@unreal mantle Pls help

frank driftBOT
#

Hey Manni! Please don't tag staff members.

nocturne elbow
#

Plss help

#

@jaunty pecan

frank driftBOT
#

Hey Manni! Please don't tag staff members.

nocturne elbow
#

Pls help

#

OmegaWeapon_ pls help

unreal mantle
#

@nocturne elbow No I will not help. Because you are impatient and tagging everyone. I don't feel like helping now.

nocturne elbow
#

sorry

#

so sorry

rustic laurel
#

and on top of it, you aren't even asking a question

nocturne elbow
#

Sorry, my question is: How can I put two prefixes and 2 ranges to the same user? I already saw the github page but when I try to the finals I ended up deleting the plugins folder, please help me I'm desperate

rustic laurel
#

!stacking

frank driftBOT
nocturne elbow
#

I already read that page but as I said I ended up deleting the plugins folder because all my luckperms was buggy or something like that please help me

#

I speak Spanish

rustic laurel
#

If you delete the folder, your progress will not save and you need to start again, or get it back from your deleted folder

nocturne elbow
#

I already have all my progress now what I need is for you to tell me please how to set 2 ranges and 2 prefixes to a single user please help me

rustic laurel
#

Translate the wiki page and use #support-2 this is the wrong channel

nocturne elbow
#

Pls help me

rustic laurel
#

Translate the wiki page and use #support-2 this is the wrong channel

nocturne elbow
#

You

rustic laurel
onyx linden
#

@rustic laurel i think how to add group to user with dev api ...

frank driftBOT
#

Hey Speedy11CZ! Please don't tag staff members.

onyx linden
#

Ah, sorry ._.

rustic laurel
#

Aight, Tobi has your answer

onyx linden
#

Ah, okey. Thanks

fleet halo
#

Hey whenever I try to transfer my luckperms perms this error pops up

#

can someone please help me?

crystal sonnet
fleet halo
#

brainstone can you help me?

red meteor
#

Hello i create a group called Admin. But when i say something its looking [world]Mustafa: hello

#

İ Want to like this
Admin : Hello

#

How can i Fix it

neat jackal
#

Hmm, not sure. Probably use a chat listener and use it to override the other formats? Nothing you can do in the LuckPerms Developer API yourself.

#

As LP doesn't manages chat

red meteor
#

İ use for permissions

#

İ have a kit pvp plugin . Whatever peoples need permission for get kit.

neat jackal
#

To learn how to set permissions using the dev api see the usage examples page

#

!api

frank driftBOT
neat jackal
#

And if you don't want to use the dev API. You have to configure the format in your chat plugin. The [world] in front may also came from MultiverseCore

red meteor
#

When he write testing

#

{Guest}=testing

#

But when i say testing

#

{world}=testinh

#

Yes dude i use multiverse core

#

This plugin no support ?

frank driftBOT
#

Hey Mustafa Esad TEMEL! Please don't tag staff members.

neat jackal
#

Wait you're talking about using the plugin? Not the developer API?

red meteor
#

Yes i just use lucksperm

neat jackal
#

Why are you asking in this channel then

red meteor
#

Sorry my english bad

#

Where can i write

neat jackal
#

And for multiverse it is a setting, there should be tons of help threads on forums for that. Something like /mv set prefixchat false

red meteor
#

Oh thank you very much

rustic laurel
velvet oriole
#

oh sorry

polar cargo
#

Hey guys lpapi.getUserManager().lookupUsername(UUID.fromString(uuid)).get() return the name without check the case of the name (example, Flashback083 become flashback083), any way to fix this ?

azure latch
#

You could always just use java Bukkit.getPlayer/getOfflinePlayer(UUID.fromString(uuid)).getName();

uneven torrent
#

Hello

#

i need help with API

unreal mantle
#

Explain what you need help with

uneven torrent
#

The problem is when i check the permission for example VIP like:

#

if (player.hasPermission("group.vip")){ // do something }

#

Player has 2 permission

#

like group.vip and group.default

#

i'd like they have only group.vip

unreal mantle
#

So you're wanting to check if they are in the vip group only

uneven torrent
#

no, because by defualt all players had group "default"

#

and when i set a vip for 7 days

#

after this 7 days player have to had "default" permission