#luckperms-api

1 messages · Page 12 of 1

frank driftBOT
#

Hey Dockter! Please don't tag staff members.

proud crypt
gusty goblet
#

Anyone know why this reset node resets when the player relogs

            nodes[i] = luckPerms.buildNode(timedWEPermissions[i])
                    .setServer(server)
                    .setValue(true)
                    .build();
#

Assigning it, resets on logout when infinite is true:

            User user = plugin.getLuckPerms().getUser(target.getUniqueId());
            Node[] permissionNodes = infinite
                    ? group.getWEPermissionsAsNodes(plugin.getLuckPerms(), "creative")
                    : group.getWEPermissionsAsNodes(plugin.getLuckPerms(), "creative", System.currentTimeMillis() + time);
            
            for (Node node : permissionNodes) {
                user.setPermission(node);
            }
            
            user.getCachedData().recalculatePermissions();
jaunty pecan
#

you need to save the user

#

plugin.getLuckPerms().getUserManager().saveUser(user)

#

you also don't need to call user.getCachedData().recalculatePermissions();

gusty goblet
#

Thanks 😃

nocturne elbow
#

Hi, I need help with something, how to get the parent groups ? 😃

#

I need to know in which group is a player in a track

still lintel
#
    .filter(Node::isGroupNode)
    .map(Node::getGroupName)
    .collect(Collectors.toSet());

groups set will contain every group the user has
then search for the track that contains the group

Map<String, Track> h = new HashMap<>();

for(String g : groups){
  for( Track t : api.getTrackManager().getLoadedTracks()){
    if(t.getGroups().contains(g)){
        h.put(g,t);
  }
}

the h hashmap now should contain every group the player has and the corresponding track to each group

nocturne elbow
#

Thanks, i used another way 😃

grim crag
#

Quick question, is the API on version 4.1 or 4.2? I assume it is on 4.2 but the Wiki says 4.1 is the latest version.

crystal sonnet
#

@grim crag yeah. 4.2 is the current version

low siren
#

can someone help?

#
        Player player = e.getPlayer();
        UUID uuid = player.getUniqueId();
        String name = player.getName();
        String rank = this.plugin.playerRank.get(uuid.toString());
        ContextManager cm = this.plugin.luckPermsApi.getContextManager();
        Contexts contexts = cm.lookupApplicableContexts(this.plugin.luckPermsApi.getUser(uuid)).orElse(cm.getStaticContexts());
        MetaData metaData = plugin.luckPermsApi.getUser(uuid).getCachedData().getMetaData(contexts);
        String prefix = metaData.getPrefix();
        if (prefix.equals("default")) {
            player.setNameTag("§8[" + this.plugin.ranks.getString("ranks." + rank + ".prefix") + "§8] " + "§7 " + name );
        } else {
            player.setNameTag("§8[" + this.plugin.ranks.getString("ranks." + rank + ".prefix") + "§8] " + prefix + " | " + name);
       ```
#

the java if (prefix.equals("default")) { doesn't seem to work

#

java.lang.NullPointerException

#

@crystal sonnet

frank driftBOT
#

Hey fluorine! Please don't tag staff members.

low siren
#

roasterd

#

actually nevermind

crystal sonnet
#

getPrefix() can return null. So you should also do a null check

low siren
#

i didnt have "default" prefix xD

gaunt ocean
#

Not sure if this is a stupid question, but how would I use the API to get the color of a group and apply that color to another String?

#

Is it okay to tag people on a question?

acoustic sapphire
#

do you mean color as in like group prefix or something? i have no idea btw but it'd help clarify to someone who does

gaunt ocean
#

Yes.

#

Group Prefix, sorry for not specifying.

#

@acoustic sapphire ^^ Sorry if tagging isn't allowed.

acoustic sapphire
#

read my edited message lol sorry

gaunt ocean
#

Ah.

#

Not sure if this is a stupid question, but how would I use the API to get the color of a group prefix and apply that color to another String?

#

@proud crypt ^^ Sorry if tagging isn't allowed.

frank driftBOT
#

Hey ColtHale! Please don't tag staff members.

gaunt ocean
#

Oh, welp.

#

I was just told.

long moon
#

If you're attaching meta to the groups which define the color, you'd wanna use the meta stuff to grab that info

crystal sonnet
#

And getting the color from the group is easy. Just make sure the group prefixes all have a common format and then just extract it

gaunt ocean
#

Hm, alright. Not really understanding the Contexts. I'm not sure on how I would create or use a Contexts to get the players prefix.

crystal sonnet
#

There are two ways

#

Either get a users current prefix, or use the global context

gaunt ocean
#

How would I get the users current prefix? I'm assuming getting their current Contexts?

crystal sonnet
#

Yes

#

context

#

My bad

gaunt ocean
#

Never mind. Just had to add .get(); to the end of it. Thanks!

acoustic sapphire
#

Is there any event or something to listen to when player data gets updated?

#

Like from bungee message?

#

nevermind, found it

gaunt ocean
#

@crystal sonnet How would I go about getting the color of the prefix? It's so late right now, I swear I can't think straight rn...

frank driftBOT
#

Hey ColtHale! Please don't tag staff members.

crystal sonnet
#

As I said

#

Make sure the prefixes have a common format and use string manipulation to get it

gaunt ocean
#

Okay, what the crap. I've been looking everywhere for something like you're talking about. What darn "string manipulation" are you talking about? I'm so confused of this one little thing.

jaunty pecan
#

sup

#

is this still what you're trying to do

#

ColtHale - Today at 06:07
Not sure if this is a stupid question, but how would I use the API to get the color of a group and apply that color to another String?

gaunt ocean
#

Yes.

jaunty pecan
#

okay, my suggestion would be to use meta

#

e.g.

gaunt ocean
#

It's 5:39 AM in the morning and I have been looking for a solution for 4 hours now.

jaunty pecan
#

/lp group admin meta set color &c

#

Then, request the meta using the cached data API

#

so instead of "some-key", you'd use "color"

#

If you scroll up from that point, it explains how you get to that stage

gaunt ocean
#

Alright. Thank you. I'll try that. So, what about the "default-value"? Just leave it how it is I'm assuming?

jaunty pecan
#

well, what color value do you want to use if nothing is set for the group?

#

that's what you should use for default value

gaunt ocean
#

Okay. Thanks.

jaunty pecan
#

the result of metaData.getMeta() is just a Map<String, String>

lethal eagle
#

hm

#

I can't find the right event for when someone is getting a new rank

crystal sonnet
#

I know that there isn’t an explicit event

#

@lethal eagle

#

If you do the changes on the server, then there should be an event for changed nodes. However if the server only receives an update over the messaging service you need to use a different event

tropic jewel
#

I updated LP api but for some reason this method does no longer work in legacy version but in sponge it still does:

user.getCachedData().getMetaData(Contexts.allowAll()).getMetaMultimap().get(PermissionOptions.DAILY_TOKENS).stream().mapToInt(Integer::parseInt).max();

Any ideas?

jaunty pecan
#

do you get an error?

tropic jewel
#

no, it just doesn't execute any code below that line

#
LuckPerms.getApi().getUserManager().loadUser(player.getUniqueId()).thenAcceptAsync(user -> {
    System.out.println("User: " + user.getName());
    OptionalInt tokens = user.getCachedData().getMetaData(Contexts.allowAll()).getMetaMultimap().get(PermissionOptions.DAILY_TOKENS).stream().mapToInt(Integer::parseInt).max();
    System.out.println("Tokens: " + tokens.isPresent());
});    
#

user shows up, tokens doesn't

tropic jewel
#

@jaunty pecan ^

frank driftBOT
#

Hey SirWill! Please don't tag staff members.

jaunty pecan
#

i'm guessing that getMetaMultimap is throwing an exception

#

the legacy version of LP has to shade guava, and the shaded classes are relocated

#

when you call getMetaMultimap, your code expects to receive a com.google.common.collection.Multimap (or whatever it is) but it actually gets a me.lucko.luckperms.lib.guava.collection.Multimap

#

i've thought quite a bit about ways to solve it

#

but haven't really found a nice solution

tropic jewel
#

was that even changed? because I had the same method working before updating

jaunty pecan
#

you're using the 1.7 legacy version, right?

tropic jewel
#

yes

#

oh wait, do I need to compile my plugin on the legacy version instead of the normal one?

jaunty pecan
#

yes that would probably fix it

tropic jewel
#

yup, that was the issue, thanks

gaunt ocean
#

How would I get the Contexts of a Group?

solemn pebble
#

It's the members of the group that have a context

lethal eagle
#
@EventHandler
public void onGroup(UserPromoteEvent event) {
        LuckPerms.getApi(); 
        Bukkit.broadcastMessage("hey, thats pretty good!!");
} ```
#

what am I doing wrong(ikr im so dumb with this API, idk how 2 use it

still lintel
#

Luckperms' events aren't based on the bukkit event api
https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#listening-to-luckperms-events

eg you will need something like this (api is your LP api instance plugin is your plugin instance):

public class MyClass {
public MyClass(){
  EventBus eventBus = api.getEventBus();
  eventBus.subscribe(UserPromoteEvent.class, this::onUserPromote);
}

private void onUserPromote(UserPromoteEvent event) {
        Bukkit.getScheduler().runTask(plugin, () -> {
            Bukkit.broadcastMessage("hey, thats pretty good!");
        });
    }
}
lethal eagle
#

oh thank you

valid glen
#

Is there a way to resolve the displayname via API?

jaunty pecan
#

getFriendlyName

solemn pebble
#

Display names aren't friendly. )-:

#

They're just there to make it hard to message people.

nocturne elbow
#

Hello

#

How can I add a group to someone?

#
        Bukkit.getOnlinePlayers().forEach(player -> {
            User user = controller.getLuckPermsApi().getUser(player.getUniqueId());
            Group group = controller.getLuckPermsApi().getGroup("mitgliedplus");
            if(getPlaytime(player) >= 172800000L && !user.inheritsGroup(group))
            {
                // ADD GROUP HERE
            }
        });
jaunty pecan
#

explained here

nocturne elbow
#

Lol so I just need to add them the node "group.mitgliedplus"?

#

I'm not sure whats the best way. Players should get the memberplus rank after two day. Should I set it as primary or just add it with this node?

jaunty pecan
#

just add it with the node

nocturne elbow
#

Ok

#

So is there also a way to detect if they are in the group even if they inherit it?
So if I have a mod as example. He left team. I remove mod-group. He remains with mitgliedplus.

jaunty pecan
#

I don't understand your question

still lintel
#

@nocturne elbow
So you have a user something like this:
default -> mitgliedplus -> mod -> exampleuser
and you'd like to remove them from mod, while keeping him in mitgliedplus

nocturne elbow
#

Yes

#

And I want to add the mitgliedplus even if he is in mod

#

And mod inherits mitgliedplus. So I cant use user.inheritsGroup(group)

#

I've got this now:

            User user = controller.getLuckPermsApi().getUser(player.getUniqueId());
            Group group = controller.getLuckPermsApi().getGroup("mitgliedplus");
            if(getPlaytime(player) >= 172800000L && !user.inheritsGroup(group))
            {
                Node node = controller.getLuckPermsApi().getNodeFactory().makeGroupNode(group).build();
                user.setPermission(node);
                player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0F, 2.0F);
                player.sendTitle("§6Vielen Dank", "§eDu erhältst §a$500 §efür deinen Vote!", 20, 60, 20);
            }

But that will only apply if the user is not in a higher group (maybe temp).

still lintel
#

so essentially you want to check if the user has mitgliedplus directly inherited, if not it sets the inheritance

Set<String> groups = user.getAllNodes().stream()
    .filter(Node::isGroupNode)
    .map(Node::getGroupName)
    .collect(Collectors.toSet());

this code returns a set that contains every directly inherited group node, if that set contains mitgliedplus means mitgliedplus->user

nocturne elbow
#

Yeah, thats what I needed. Thank you 😃

still lintel
#

np

nocturne elbow
#

Btw, what is the primary group needed for?

#

Looks like everything works if I leave primary group on default and add groups with nodes only

still lintel
#

with default config, I don't really know a good usage

With prevent-primary-group-removal: true it can be used to prevent demoting out of a track

nocturne elbow
#

Hm okay

#

I now set all on default, works fine.

nocturne elbow
#

@jaunty pecan can i ask what is better?
Bungee messaging or SQL messaging?

frank driftBOT
#

Hey ! JohannesHQ! Please don't tag staff members.

jaunty pecan
#

sql is probably more reliable

nocturne elbow
#

alr

sullen karma
#

SQL as messaging, fancy

jaunty pecan
#

not very technically sensible (?!)

#

but it's pretty low throughput, and more reliable than the plugin messaging channels

long moon
#

it's bad

sullen karma
#

Welp

long moon
#

but not plugin messaging channel bad

sullen karma
#

Only argument 😂

long moon
#

messaging channel has many flaws, implementation wise and design wise

sullen karma
#

🤷‍♂️

vapid notch
#

Does anyone know the best way to get a group prefix? At least the 'highest' prefix it has?

#

this is what I use right now:

            MetaData data = group.getCachedData().getMetaData(Contexts.global());
            String prefix = data.getPrefix();
brave saffron
#

How to get a value from a node?

brave saffron
#

        for (Node permission : user.getPermissions()) {
            if (!permission.isGroupNode()) continue;
            if (from <= sk && sk < to) {
                String expiration;
                try {
                    expiration = permission.getExpiry().getDay()+"d. "+permission.getExpiry().getHours()+"h. "+permission.getExpiry().getMinutes()+"m.";
                } catch (Exception e) {
                    expiration = "Never";
                }
                
                String server;
                try {
                    server = permission.getServer().get();
                } catch (Exception e) {
                    server = "global";
                }
                
                String world;
                try {
                    world = permission.getWorld().get();
                } catch (Exception e) {
                    world = "global";
                }
                
                ItemStack item = Tools.button(Material.WOOL,
                        "&6"+permission.getGroupName(),
                        Arrays.asList(
                                "&cID: &e"+sk,
                                "&cExpires in: &e"+expiration,
                                "&cValue: &e"+permission.getValue(),
                                "&cServer: &e"+server,
                                "&cWorld: &e"+world,
                                "&eClick to remove"
                                ), 1, Tools.randInt(0, 15));
                myInventory.setItem(i, item);
                i++;
            }
            sk++;
        }
#

@crystal sonnet tagging just to get off from general to api

frank driftBOT
#

Hey AsVaidas! Please don't tag staff members.

brave saffron
#

Everything works till "&cValue: &e"+permission.getValue(),

crystal sonnet
#

What API version are you compiling against and what version of the plugin are you using?

brave saffron
#

plugin version - newest

crystal sonnet
#

Version numbers please

brave saffron
#

4.2.17

#

I'm getting the api with LuckPermsApi l = LuckPerms.getApi();

#

So don't know the api version

#

But I guess it should be correct

crystal sonnet
#

Well, it's not the latest, but your version and the latest use the same API version so it's fine

jaunty pecan
#

how is the api imported into your project

crystal sonnet
#

You must be using a jar when compiling your plugin

brave saffron
#

Yea

#

Build path

crystal sonnet
#

Either through a build system like maven or directly

jaunty pecan
#

what does the build path reference

crystal sonnet
#

the jar should contain the version number of the API

brave saffron
jaunty pecan
#

then make sure that LuckPerms.jar is the latest one

brave saffron
#

It is

jaunty pecan
#

well obviously not if you're getting that error

#

replace it with the one here

brave saffron
brave saffron
#

I don't have an error when compiling and eclipse shows everything is okay

jaunty pecan
#

the error you're getting seems to suggest it's looking for the primitive wrapper method

#

java.lang.NoSuchMethodError: me.lucko.luckperms.api.Node.getValue()Ljava/lang/Boolean;

brave saffron
#

But in server, my plkugin cant get the value

jaunty pecan
#

which only existed on older versions

brave saffron
#

So I need to replace

crystal sonnet
#

It doesn't show an error because you are using an old version

#

And as a recommendation, don't remove the versions from the file names

jaunty pecan
#

or even better use a proper system for managing dependencies

#

eg maven or gradle

brave saffron
#

Now it shows

#

Strange

#

Okay, it works

nocturne elbow
#

Hello, how do i add someone to a group? 🤔

jaunty pecan
#

with the api?

nocturne elbow
#

Yes

jaunty pecan
#

you have to create a group node and then set that

nocturne elbow
#

Ty

hushed sand
#

hello all

#

I am trying to work out how to set perms for world edit so I can let my admins do some world editing

strange elbow
#

Do you need the permission node?

nocturne elbow
#

Does lucky perms work for spongeforge 1.12.2 ?

polar hinge
#

Wrong channel for this question, but yes it does

nocturne elbow
#

uhm sorry x:

#

and thanks.

alpine mountain
#

Greetings. How may I programmatically set a prefix of a user?

crystal sonnet
#

The nodes for prefixes look like this prefix.<priority>.<prefix> @alpine mountain

#

So for example prefix.1000.&4Owner

alpine mountain
#

Ah, ok.

crystal sonnet
#

And I think the wiki explains how to add a node to a player

alpine mountain
#

I've got that far. I was confuused on how to add prefixes.

#

However, I didn't read the wiki properly 😃

crystal sonnet
#

Great you figured it out 😃

sweet thunder
crystal sonnet
#

Oh boy

#

I don’t want to sound rude, but you should probably start learning programming/Java, reading error messages and documentation (and English too for that matter).

#

Making plugins is not suited for beginners. Especially when using external APIs

#

But in essence the error is telling you to use a player object instead of a string

sweet thunder
#

Sorry, it's the first time I use the api of luck perms, actually I just met him.

crystal sonnet
#

That is ok. All I’m saying from what I see, you’re not familiar enough with Java to try working with plugins and other plugins’ APIs

sweet thunder
#

I tried to use the Player object too, since it returned this error, however it returned to null, despite the check whether it is null or not.

crystal sonnet
#

I recommend reading this page

#

Has loads of examples

sweet thunder
#

Oh, thanks

#

lol, if you don't have prefix, metada.getPrefix() return null value

crystal sonnet
#

That makes sense

#

That’s what null is for. To indicate no value.

mint sparrow
#

hi guys i keep getting these messages

#

[Server] INFO Caused by: java.lang.NoClassDefFoundError: me/lucko/luckperms/LuckPerms

#

[Server] INFO Caused by: java.lang.ClassNotFoundException: me.lucko.luckperms.LuckPerms

#

I'm just trying to give a player permissions

#

and remove them sometimes

jaunty pecan
#

is luckperms installed?

#

are you depending on it in your plugin.yml

mint sparrow
#

tell me more about the plugin.yml

#

im kinda new to plugin development

#

do I need to like reference it in there?

jaunty pecan
#
BukkitWiki

When Bukkit loads a plugin, it needs to know some basic information about it. It reads this information from a YAML file, 'plugin.yml'. This file consists of a set of attributes, each defined on a new line and with no indentation.

A command block starts with the command's n...

#

Yes, under "depend"

mint sparrow
#

yea I have like my commands in there and stuff

#

oh

#

alright thanks you just saved me

#

#

so whats the name thing of luckperms?

jaunty pecan
#

LuckPerms

mint sparrow
#

i need to do depend: [LuckPerms]

#

?

jaunty pecan
#

Yes

mint sparrow
#

youre a life saver

#

One more question which is stupid. I have the API thing in onEnable() but how can I access it outside of onEnable?

#

im also new to java lol

#

anyone?

#

Like I have RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
if (provider != null) {
LuckPermsApi api = provider.getProvider();

}

#

in my onEnable

#

but now I cant use the api var in other stuff thats outside of onEnable()

jaunty pecan
crystal sonnet
#

@mint sparrow not trying to be rude. But to self yourself from pointless struggle, learn Java before even trying yourself with plugins. Let alone working with other plugins’ APIs

burnt cliff
#

oof

crystal sonnet
#

I mean you're trying to fly fighter yet maneuvers, though you don't even know how to enter a plane (or fighter yet for that matter)

burnt cliff
#

LMAO

mint sparrow
#

this is the only problem ive had to ask help for tho lol

crystal sonnet
#

I didn't say it's impossible

#

Though you'll do yourself a massive favor first learning Java

solemn pebble
#

The problem is "how do I make my variable available" though, which is pretty basic Java /-:

mint sparrow
#

public Node makeNode(String permission) {
Node node = api.getNodeFactory().newBuilder(permission).build();

    return node;

}

#

whats wrong with this? I get a null pointer exception here

burnt cliff
#

@mint sparrow put you code in H E R Eto make it easier to read

mint sparrow
#
        Node node = api.getNodeFactory().newBuilder(permission).build();

        return node;
}```
#

soz

solemn pebble
crystal sonnet
#

And there we go again. Proofing my point.
Anyways without the NPE we can't help you

mint sparrow
#

imagine having a simple question about something. I'll figure it out without you damn

crystal sonnet
#

Sorry. You don't get to play the victim card here.

All we're saying is that you should learn Java first to avoid exactly these kinds of errors. Or at least to be able to fix them

#

While we/I still offer help

#

I still need the NPE, to be able to help you, as the code looks ok

#

👌 💯

#

Being told to learn something before using it and then storming off

solemn pebble
#

They left the Discord?

jaunty pecan
#

yeah

crystal sonnet
#

Yup

jaunty pecan
#

brainstone is right though, it's really important that you learn the basics before diving into more complicated stuff

#

otherwise you'll never make any progress

burnt cliff
#

lol damn

crystal sonnet
#

You gotta learn walking before you try to run. Else you're just gonna keep faceplanting the whole race track. But I'm guessing they enjoy smashing their face on the ground ¯_(ツ)_/¯

left pecan
#

just learn the entirety of java bro! the tutorial is so easy if you have a degree!

#

/s

crystal sonnet
#

?

#

Never said that

#

All I said was that they should at least know the basics of a language @Orbit49#3298

#

Joining and leaving again. What a coincidence 👍🏻💯

nocturne elbow
#

and you are a know-it-all always.

#

people are leaving because you must always be right. @crystal sonnet

frank driftBOT
#

Hey JohannesHQ! Please don't tag staff members.

jaunty pecan
#

what

#

he is right

#

😕

crystal sonnet
#

If the truth offends you, you’re in the wrong place here (not directed at anyone)

proud crypt
#

slightly rude ¯_(ツ)_/¯

crystal sonnet
#

@nocturne elbow I mean I could start talking bullshit instead. Or ignoring people

#

Though I don’t think that’s particularly nice

nocturne elbow
#

in the way you say it is also an important thing.

crystal sonnet
#

Not quite sure what you’re trying to say to be honest 🤔

nocturne elbow
#

Just nvm.

#

End discussion.

crystal sonnet
#

I mean I’ve been programming for 10 years and earn my living with it. So pardon me for pointing out the issue being the person.
And I do realize it’s at least slightly rude to point out things like that. Doesn’t make them any less true. I try my best to not be a dick about it

solemn pebble
#

I've been programming for over thirty years, and I agree with BrainStone's sentiment

nocturne elbow
#

I'm soo happy that you are doing this for 10 years. And like i said you need the last words again.

jaunty pecan
#

lol what are you talking about

#

you started the discussion

crystal sonnet
#

I’m at a complete loss too

nocturne elbow
#

And i end it right now.

jaunty pecan
#

that's not how discussion works

#

but okay

proud crypt
#

hey who likes APIs??

solemn pebble
#

I like well-written ones

jaunty pecan
#

😃

#

same

jolly hazel
#

I think everyone starts somewhere so no sense of putting anyone down about how bad they are when they first start. To some people saying"learn he basics" is definitely negative or a letdown.

bleak quarry
#

If one does not learn the fundamentals of somthing they will always struggle. Sure you can make somthing happen in java, but do you understand why it happens. Sure you can turn a light on with a microprocessor but do you know what is happening internally to switch it. If you know basic code structure the change between langs really just becomes syntax. Same in electronics, the fundamentals have never changed just the application has. In a world of instant gratification people don't take the time to learn the basics anymore.

chrome venture
#

Is there a luckperms api wrapper for nodejs?

proud crypt
#

probably not

#

what are you wanting to do with node?

chrome venture
#

display player their groups and meta data

crystal sonnet
#

If you’re using a database, you can just read that

fierce dew
#

how i need to get the group of player with luckperms?

pure loom
#

if (provider != null) {
LuckPermsApi api = provider.getProvider();
}
How am I suppose to use "api" outside the if statement?

ripe phoenix
#

cant you use it like a string define it at the top and once that code runs it will set the api to the provider? or am i being dumb

steady elk
#

Once the If statement is true you can use whats inside of it

unreal mantle
ripe phoenix
#

^^ not the best help lol

long moon
#

It's all about scope

pure loom
#

I tried this lol

#

public LuckPermsApi luck;

long moon
#

If you want to access something outside of the if statement, you need to store it outside of the if statement

pure loom
#

and then set api = luck;

steady elk
pure loom
#

I did try storeing it outside the if sattement

#

didnt work

#

so then I tried setting a global variable and then setting it equal to that and it didnt work lol

long moon
#

define "didn't work"

pure loom
#

It wont access the methods

#

when I do luck.

long moon
#

screenshot your code or something "luck." provides no context whatsoever to me

pure loom
long moon
#

And you have properly imported the luckperms api into your project?

pure loom
#

Yes, and I can confirm because inside the if statement it works fine

long moon
#

if it works fine inside of the if statement, then chances are you're writing the code improperly elsewhere; e.g. trying to write code outside of scope of that or in the class body itself

spring jacinth
#

and this is why i never want to learn code

pure loom
#

I didnt write the registerdServiceProvider part that ios from the api'

#

sI cant change that part

long moon
#

that part isn't wrong

pure loom
#

Then I am sorry to say I do not get it

#

I have tried declaring the api variable outside of the if statement but it still does not work

long moon
#

The api variable has nothing to do with it

#

You could literally remove that api variable creation and replace it with luck = provider...

pure loom
#

Thats basically what I did

long moon
#

Outside of that, we need to see where it's not working; as either you're doing something wrong, or your IDE has derp'd

pure loom
#

hm

#

so it works in the onEnable

#

now I need to get it to work outside of it

long moon
#

My guess here is that you're not writing code inside of a method declaration and are trying to type into the class itself

pure loom
#

I see

#

Sorry if I seem a bit dense

#

lol

#

still learning

crystal sonnet
#

And that’s why you learn Java first people

strong urchin
#

^

halcyon jewel
#

How do you query the primaryGroup() of a User in bungee?

crystal sonnet
#

The same as in any other software. The API is platform independent

#

@halcyon jewel

halcyon jewel
#

Got it

#

Thanks

late geode
long moon
#

is getString returning null?

crystal sonnet
#

@late geode you don’t need a plugin for that

#

You can do the exact same thing with default assignments

#

Details can be found on the wiki page “Default Group”

late geode
#

before default assignments were very limited

#

probably it is possible now

fringe yoke
#

maybe a stupid question but what is the permission node to not display /luckperms in the /help window

crystal sonnet
#

There is none

long moon
#

Depending on the software you're using and what's providing the help command, you can generally add plugins to the blacklist in there

fringe yoke
#

ah alright thanks

#

another question, i just set up a rank and want a higher rank to inherit the permissions but i also want to add permissions to the higher rank that the lower rank has not access to. However when i set a permission for the higher rank i can not use the permission because it says i do not have permission to this command, thinking that it still inherits the lower rank permission aswell?

crystal sonnet
#

Make the higher rank inherit the lower (aka the lower becomes a parent of the higher) and add more perms to the higher

fringe yoke
#

ah i see, now i am trying to do that but i stumbled upon a problem now. I have the admin rank and all of a sudden i cant use any commands anymore other than the luckyperms commands. What can be causing this?

fringe yoke
#

nevermind i got it, i added myself to default by accident

frigid radish
#

I need help

#

Trying to add prefixes to my server

#

How does it work with the pl_

frigid radish
#

Chat manager won't use the prefix from the plugin luckperms

#

is this possible

crystal sonnet
#

@frigid radish as long as it either directly supports LP or supports Vault

#

Though admittedly, if it doesn't support vault (assuming Platform is Bukkit/Spigot) it's a bad chat plugin

frigid radish
#

We use your recommanded chat plugins

crystal sonnet
#

Then it should support it

#

Though you'll likely also need vault

frigid radish
#

We use vault aswell

#

What do we change in order to get the prefix colored and working infront of yourname ?

#

We have vault and all the recommended plugins

crystal sonnet
#

You can use color codes the the prefixes

frigid radish
#

how ?

crystal sonnet
#

&1

frigid radish
#

and how to use the prefixes since I haven't managed to get one infrond of my name

crystal sonnet
#

For example

#

Also this question is better suited for #support-1. #luckperms-api is for plugin devs wishing to integrate with the LP API

frigid radish
#

Let continue there then

balmy fog
#

@jaunty pecan Hi Sir! How can I do Migretion for groupmanager is right?
Because I thing I have to do wrong command
my command is /lp migration groupmanager <worldname>
and command reply back to me is
"migration groupmanager" : starting
"migration groupmanager" : error -> was expecting true/false, but got Lobby instead.

crystal sonnet
#

The last parameter is whether you want the permissions to be global or not @balmy fog

thorny echo
#

Can I check for backend-side perms in a bungeecord plugin as long as they link to the same db?

thorny echo
#

Hey

#

I'm trying to get a player's rank bungee side

#

But even if I get the api in a command, well after the server has initialised, it still says Api isn't loaded

jaunty pecan
#

just to clarify

#

this is from within a bungee plugin?

thorny echo
#

Yeah @jaunty pecan

frank driftBOT
#

Hey VoidCrafted! Please don't tag staff members.

jaunty pecan
#

can you send me your proxies startup log?

thorny echo
#

Sure, it's kinda spammy

jaunty pecan
#

the only reason for that error being thrown is because the API just isn't registered

#

it's unlikely to be a bug in that code specifically

thorny echo
#

That is the log

#

Here's the code

#

It's kotlin, but that shouldn't make a difference

#

Ignore the line after val api, that's there for debugging

jaunty pecan
#

are you shading the API classes into your jar my mistake

#

or something like that

#

that's all I can think of really

thorny echo
#

Hmmmm I'm pretty sure I am

#

I'm not too great at gradle

#
plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.2.50'
}

group 'me.voidcrafted.bungeeplugins'
version '1.1-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
    maven {
        url "http://jcenter.bintray.com/"
    }
    maven {
        url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
}

apply plugin: "java"

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    compile 'khttp:khttp:0.1.0'
    compile files("libs/PremiumVanishAPI.jar")
    compile "org.java-websocket:Java-WebSocket:1.3.8"
    compile "me.lucko.luckperms:luckperms-api:4.2"
    compileOnly 'org.bukkit:bukkit:1.12.2-R0.1-SNAPSHOT'
    compileOnly 'net.md-5:bungeecord-api:1.12-SNAPSHOT'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

jar {
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
edgy nacelle
#

lol flood

jaunty pecan
#

you should be using compileOnly for dependencies which are provided at runtime

#

such as LuckPerms and PremiumVanishAPI

thorny echo
#

Ok that's my issue? I'm building now

#

The strange thing is, Java-Websocket worked fine during runtime

#

Oooooh I understand now

#

Yeah

#

makes sense

#

@jaunty pecan It works now, thank you for your time! Love the plugin btw

frank driftBOT
#

Hey VoidCrafted! Please don't tag staff members.

jaunty pecan
#

no worries, glad you like it 😃

acoustic sapphire
#

hey um so how can i use the api to check if a uuid has a permission? im struggling with this

#

hasPermission needs a node arguement and im struggling

crystal sonnet
#

@acoustic sapphire it’s recommended to use the platforms API for permission checks

#

Unless it’s for offline players

acoustic sapphire
#

it is for offline players

#

im checking on asyncpreplayerloginevent to see if they have permission to join a full server

crystal sonnet
#

I’m pretty sure the wiki has an example

#

Stop

acoustic sapphire
#

should i just listen on the bungeecord-side instead and cancel on the bungeecord side on serverconnectevent?

crystal sonnet
#

Use a login event where permissions are already loaded!

#

And do a regular permission check

acoustic sapphire
#

ugh

#

effort

#

ok

crystal sonnet
#

How’s that more effort???

acoustic sapphire
#

cause i have to change some other code for the thing

#

because i have asyncpreplayerlogin download custom user data from a mysql database, i have the preplayerlogin check if the user is banned and such

#

its fine

#

ty

crystal sonnet
#

Pick the right event (might have to ask luck) and run a simple hasPermission

acoustic sapphire
#

playerloginevent is the one that has the player object, asyncpreplayerlogin just gives a uuid and a username

crystal sonnet
#

In general, let the platform handle permission checks. Only revert to the API if necessary

acoustic sapphire
#

alright

crystal sonnet
#

And I mean LP loads their permissions very early. Maybe even during the same event

acoustic sapphire
#

yeah thats what im assuming

crystal sonnet
#

Meaning you could cause it to load while it’s already loading. That’s bad

acoustic sapphire
#

because it saves everything with uuids and the earliest possible event with uuids is asyncpreplayerlogin

#

alright yeah didnt think about that, thanks

#

I'll try playerloginevent but i honestly might just have bungeecord listen on serverconnectevent to check since luckperms is on bungee as well

crystal sonnet
#

In all honesty I think LP can handle something like that. It’s bad practice nonetheless

#

You can do the bungee thing too

acoustic sapphire
#

alright thanks!

crystal sonnet
#

Though again, wait for LP to finish loading and use platform checks

acoustic sapphire
#

yeah I'm going to use the bungeecord way, because im not going to have serverconnectevent listen if its any of the hub servers, because it's going to auto-balance servers, and they will never fill up, so LP info will load on bungeecord way ahead of time before a user even has time to switch servers

thorny echo
#
val api = LuckPerms.getApi()
        var groups = arrayOf(
                "mafia_don", "tech", "mcadmin", "capo", "evtorg"
        )
        var u = api.getUser(e.player.uniqueId)
        if (u == null) return
        u = u!!

        fun removePerm(node: Node) {
            u.clearMatching { it == node }
        }
        u.permissions.forEach { // Remove all group nodes that are admin groups
            println(it)
            println(it.permission)
            if (it.isGroupNode && (groups.map { "group.$it" }.contains(it.permission))) removePerm(it)
        }
        u.setPermission(api.nodeFactory.newBuilder("group.${auth.rank}").build()) // set the right group
#

Hey there

#

Every time a user joins, I fetch their rank from discord

#

And I'm trying to make it remove them from all groups that are in that groups array

#

and add them to the one they should be in

#

But nothing is happening to my groups

#

(bungee works fine in terms of lp, I can update my perms with a command and it syncs to bukkit)

#

Wait nevermind I need to save them.....

hearty fern
#

Hello, I would like to know how I can check the permission of a player?

stuck shard
#

@hearty fern /lp user (username) permission info

hearty fern
#

I need it with the API

long moon
hearty fern
#

Thanks

civic pollen
#
Player player = (Player) sender;
            try {
                if (vaultHandler.getEcon().getBalance(player) > priceHandler.getRankPrices().get(nextRank)) {
                    System.out.print("NEXT RANK: " + nextRank);
                    user.setPrimaryGroup(nextRank.toLowerCase());
                    luckPermsApi.getUserManager().saveUser(user);

        sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6&lSuccess! You've now been ranked up to " + nextRank));

Though this seems correct, nothing is printed to console nor appears to happen. Despite all of this, the "You've now been ranked up..." message gets sent, so the code is being executed. I've also been sure that there is a valid rank called "d" that it can access. On top of this, I've tested to see if anything's null, but my testing's shown that nothing is

#

It's essentially executing user.setPrimaryGroup("d"); with a valid rank it can access

#

I'd like to note that absolutely nothing appears in console besides my "NEXT RANK: " print

still lintel
#

so just to clarify
when a user fires the command and has money these things happen:
-Console shows NEXT RANK: withouth thr rank name
-The player also gets a message Success! You've now been ranked up to also withouth thr rank name

  • and the player doesn't gets the rank
civic pollen
#

No. For example, it sends "Success! You've been ranked up to D", but they don't get the rank

#

if an npe is your concern, nextRank isn't null

still lintel
#

sponge or bukkit server?

civic pollen
#

PaperSpigot 1.8.8

#

Using 1.8.8 Spigot API

#

And i think latest version of LuckPerms in-game and API

still lintel
#

I'd say instead of setting the primary group try building a group node and then set that node for the user

Node groupNode = luckPermsApi.getNodeFactory().makeGroupNode(nextRank.toLowerCase()).build();
user.setPermission(groupNode)
civic pollen
#

I need to do it by setting the primary group though

#

Well, that's how I've written my code

#

I just want to know why what I'm doing isn't working nor can I find proper documentation on it

still lintel
#

sry I have no other idea, Luck will have to answer that

long moon
#

you need to actually add them to the group iirc, setPrimaryGroup doesn't work for groups they don't have iirc

civic pollen
#

oh

#

I'll give that a try then

#

Ok real question now

#

How tf do I remove someone from a group through the API?

jaunty pecan
#

same way you'd remove a permission

#

except just with a group node instead

civic pollen
#

Ayyy got it to work

#

Thanks everyone who helped

proud crypt
#

No advertising other servers please @nocturne elbow

nocturne elbow
#

oh im sorry

#

]

#

[[[

young hazel
#

luckperms api for bungeecord?

#

@crystal sonnet

frank driftBOT
#

Hey SrFairyox! Please don't tag staff members.

crystal sonnet
#

@young hazel Same for all platforms

young hazel
#

and how do I get the rank that the player has?

long moon
#

I'd suggest referring to the wiki, it pretty much has examples for everything you could ever want

young hazel
#

help me

#

I still do not understand

jaunty pecan
astral vortex
#

How do I get all players in a group?

thorny echo
#

You can add the group as a parent of default @astral vortex

#

ah you mean online players?

astral vortex
#

Yea

thorny echo
#

oh wait this is api

astral vortex
#

xdd

thorny echo
#

so you'd get all online players (Bukkit.getOnlinePlayers iirc), get each of them from api.getUser, add the group node to each, save the user back to the backend storage

#

Or there might be a bulk update actually, I don't remember

#

but something like that

#

you know how to do each of those steps?

astral vortex
#

Why do i add player to node? 🤔

thorny echo
#

In LuckPerms groups are stored as permissions

#

so you give each player the group.moderator permission, for example

#

which is the same as adding them to the group

astral vortex
#

But I don't need that?

#

Did you understood my question?

thorny echo
#

wait I'm stupid

#

I red it as how do I get all players into a group

astral vortex
#

xd

thorny echo
#

sorry for being unhelpful 😂

astral vortex
#

np

thorny echo
#

You can use a for loop and go through Bukkit.getOnlinePlayers(), checking if player.hasPermission("group.moderator"), if so add them to another array of moderators

astral vortex
#

Well that's too much hassle

#

There would be an method for group.getMembers()

#

Why there's isn't one?

thorny echo
#

I'm not sure, you'd have to ask luck

astral vortex
#

Also I have to get them in a sorted way, so in list it's placed by their weight

thorny echo
#

Placed by what weight?

astral vortex
#

yea

#

I have to get groups by order

thorny echo
#

oh okay

#

This is why I love kotlin btw, makes stuff like that easier

#

I'm actually not sure how you get all groups

astral vortex
#

Well I'll wait for Luck, if he will come 🤔

thorny echo
#

I have a feeling he's here, he just came online and I'm pretty sure he has notifications on

#

aaaand he gone

jaunty pecan
#

There isnt a getMembers methof

#

Method

#

There is a method on the UserManager which lets you get all users with a certain permission

#

Which you can use with group.moderator

astral vortex
#

If you would add that method, cuz I can't hardcode what i'm doing

sharp topaz
#

I need help

#

I made a plugin that allows you to select any groups you have to be the displayed prefix

#

it works but randomly it wont work...

proud crypt
#

Might wanna show your code or something? "it works but randomly it wont work" isn't really much to go off of.

sharp topaz
#

Yea hold on I wanted to get a response first

proud crypt
#

Well I'm not going to be much help but someone else might, so post it :P

sharp topaz
#

trying to debug everything rn

thorny echo
#

@sharp topaz show the code, plop it in a hastebin

sharp topaz
#

I removed it all

#

I found a better alternative

#

I use console to switch primary groups

thorny echo
#

Sure

gusty goblet
#

Is there a method in LuckPerms for getting a player's groups (in order)? Or would I have to loop through the all groups checking if they have it

thorny echo
#

You can loop through the players permission nodes looking for group.something nodes @gusty goblet

#

Then fetch each group to get its priority

#

And sort it

gusty goblet
#

👍

gilded summit
#

how can i set player's primary group with temp?

#

/lp user <user> parent addtemp <group> adds group to parent group

#

I want to primary group

crystal sonnet
#

@gilded summit the primary group should be calculated automatically

#

It’s the group with the highest weight

jolly herald
#

Hello, I've got a question: How can I get the PrimaryGroup of a player who is offline?

#

got it: LuckPerms.getApi().getUserManager().loadUser

thorny echo
#

😎

indigo tangle
#

help ????
hey
I use Luckperm in my server.
Why can not I benefit from the player's region when I throw wg with Worldguard?
help
When I use the command "/ rg def test" in a specific area, can not the players do anything?
?
help

#

???

indigo tangle
#

HELPME MERJİLİN

young hazel
#

Hello!

#

How can i get rank name of a player?

plucky grove
#

Rank name, as in the prefix/suffix?

young hazel
#

no, just the rank name

proud crypt
vagrant cape
#

hi

#

guys a consultation, but first of all. they speak Spanish? Or does it only provide support in English?

crystal sonnet
#

English and German as far as I know

thorny echo
#

Is there a way to get the time remaining on a temp meta node?

#

I'm using them to track mutes

jaunty pecan
#

Yes, subtract the current time from the expiry time of the node

thorny echo
#

Ah cool thanks

karmic dew
#

Hey folks, having an issue trying to figure out what the API equivalent of /lp user Player parent set groupname is in the API

#

it's not setPrimaryGroup() I see

long moon
karmic dew
#

Yeah I'm using Node n = api.getNodeFactory().makeGroupNode(rank).build(); user.setPermission(n); userManager.saveUser(user); and I think it's not working

long moon
#

that's basically what I do here

#

I do call a "refreshCachedData" method after that, not sure if that's needed or not

karmic dew
#

let's see

#

oh i'm added to both groups

#

i need to unset the former

orchid canyon
#

Does anyone have an API to do the / timevip command?

young hazel
#

It is to obtain the rank that the player has (Bungeecord)

public static String getPlayerGroup(ProxiedPlayer player) {
        User user = MClass.lp.getUser(player.getUniqueId());
        return user.getPrimaryGroup();
}
still lintel
jade oracle
#

How would I use the given examples in kotlin?

#

I can't read any java, so it's kinda difficult for me to work with pretty much anything

long moon
#

The calls that they're doing are pretty trivial to work with, you'd basically need to find the kotlin equiv to work in some manner

jade oracle
#

Optional<ProviderRegistration<LuckPermsApi>> provider = Sponge.getServiceManager().getRegistration(LuckPermsApi.class); Best I can do here is Sponge.getServiceManager().getRegistration(LuckPermsApi::class.java)

#

not to mention not even knowing where I'm supposed to import LuckPermsAPI from because gradle sure isn't showing it

thorny echo
#

Hey

#

All my stuff is written in kotlin

#

I've got a working demo for bungeecord here if you like, gradle file should work with sponge with slight modification

spring reef
#

@thorny echo The way I though of doing it was by using my Discordbot which runs as a separate java process. But I guess I could do it kind of the same way you did, but by sending the the login events + luckperms groups retrieve via the bungee/spigot API to the discordbot I assume, which would than handle the updates

thorny echo
spring reef
#

and yes, I use Kotlin too. Come from Android, Kotlin > Java :p

thorny echo
#

I just prefer the syntax

#

My codes pretty messy, don't judge lol

spring reef
#

Haha, thanks for the example though! Appreciated!

thorny echo
#

It's cool!

jade oracle
#

@thorny echo how much would you charge to port this project to Sponge? Since mine is completely messed up and all

thorny echo
#

@jade oracle I mean it depends, I've never used sponge before. DM me ☺

iron pawn
#

Hey anyone know how to set this up? ```java
public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
for (String group : possibleGroups) {
if (player.hasPermission("group." + group)) {

            return group;
        }
    }
    return null;
}
thorny echo
#

So put a collection of strings that you want to check if they have the permission for @candid gorge

iron pawn
#

Like this

#

Collection<String> possibleGroups = new ArrayList<>(); possibleGroups.add("owner");

candid gorge
#

why me? 😄

iron pawn
#

Wait is what i done right?

#

?

candid gorge
#

why are you writing me @thorny echo ?

thorny echo
#

@candid gorge sorry, I type @ and hit the top option which is normally the last person to message the channel but it wasn't this time, for some reason

#

@iron pawn I think so, that'd be correct if you wanted to check if they had owner

#

But i don't know java, only kotlin

iron pawn
#

Ok ive got it now

candid gorge
#

ah, okay 😄 thakns

iron pawn
#

Ive used the api

orchid canyon
#

How do I create a gui menu showing the time it takes to finish the group the player is in?

solemn pebble
#

Oooh, that's an interesting question (:

cursive ravine
#

Use something like deluxemenu with placeholdersapi

autumn spear
#

So I'm used to PEX, and i'm working on it to migrate toLuckPerms. I've had a change prefix plugin for permissionsex hooked into it's api. Is it possible with the LuckPerms API? And can I get a push in the right direction? 👼

jaunty pecan
#

Yea it's possible

#

all covered on the API usage wiki page

thorny echo
#

@autumn spear have a look at me.voidcrafted.bungeeplugins.CustomPrefixCommands on this repo:

#

It’s kotlin but it shows the base api calls etc

#

I actually set a meta node not a prefix node but you can change that easily enough

autumn spear
#

Thnx! I'm familiar with kotlin, so that won't be an issue

wild cedar
#

Luck, I tried to search for this in the old conversations(7 months ago), but what method would you use for making a Permission assigned by another plugin, output to false in Luckperms? Please and thank you. This is in regard to that negative permission inquiry I had a long time ago, where JobsReborn wouldn't do this naturally, and it would output to true when giving the player the permission. You had mentioned a method where you would need/to use to make the plugin output a permission flagged as false.

I appreciate the response and have a wonderful day!

jaunty pecan
#

I don't know what you mean

wild cedar
#

JobsReborn. Gives Permissions.

#

It acts like PEX in the sense you have to use a negative permission to deny the permission from JobsReborn.

#

-permissionhere.here.perm

#

It still outputs it to LuckPerms.

#

However, it puts it in Luckperms as a "True" permission, with the -negative, ignoring it altogether. (I know this, as LuckPerms doesn't recognize it because LP doesn't use the deprecated feature of PEX.)

#

So I am trying to figure out how to make his permissions output it to Luckperms as a "False" permission, thus denying the permission to the player.

#

You gave me a formula to use in the past, to output a false perm to LPs, but I could not find it in the chat logs.

jaunty pecan
#

/lp user <you> permission set permissionhere.here.perm false

civic pollen
#

When I use

Set<String> groups = userManager.getUser(uuid).getAllNodes().stream()
                    .filter(Node::isGroupNode)
                    .map(Node::getGroupName)
                    .collect(Collectors.toSet());

there's an error on Set<String> groups = userManager.getUser(uuid).getAllNodes().stream()
even tho the user has groups

wild cedar
#

Sadly that is a command, Luck. The permissions do not have the option to execute a command. I'm trying to make it where his permissions handler, makes LP recognize the permission as false. Because any permission granted by the plugin itself is output to true. He does not have a :true or :false feature.

#

(ie a hook of JB, more less.) Since he neglects to address the issue first, or make his permission handler execute first.(Which would fix the issue.)

#

Pretty much need the means for JB to communicate with LP, to output a false permission, instead of making even negative permissions output to true.

jaunty pecan
#

Oh right

#

Well it depends on what API that plugin is using to set the permission

#

But both Vault and Bukkit itself allow you to specify the "value" of the permission as a Boolean when you set it

#

There's not really anything I can to do help, you just need to speak to the plugin author

#

@civic pollen maybe User is null? What error are you getting exactly

civic pollen
#
Player player = (Player) sender;
            String uuid = player.getUniqueId().toString();
#

The player has no reason to be null

jaunty pecan
#

Yes it does

#

The method you're using is doing a lookup by username

#

But you are passing it a UUID

#

Remove the toString call, and pass the actual UUID object

civic pollen
#

That seems odd, but I'll try

#

oh well xd that worked

#

And I get what you mean now, sorry for being a moron xd - thanks

thorn ember
#

Hey, the weight of admin should be 1 or something like 999?

midnight escarp
#

999

#

Higher priority comes first

#

Lower priority comes last

#

@thorn ember

thorn ember
#

thx ❤

midnight escarp
#

Np

thorn ember
#

/lp group admin permission set minecraft.command.op true

#

I have the admin permission but when I try to op someone

#

(!) Sorry, command could not be executed

#

anyone know what the problem is

crystal sonnet
#

@thorn ember first of all #support-1 and second by default LP disables the OP system for security reasons

thorn ember
#

ohh makes sense.

#

sorry for the dumb questions

#

never had a server before or programmed and now trying to learn permissions on day 2 is a bit confusing, but your program is awesome and very intuitive.

crystal sonnet
#

Glad to hear. And be prepared that a proper permissions setup can take days

thorn ember
#

It's fun thought

#

hahaha

tribal kelp
#

@here hello! help me please!
I need Permissions for SecurityCraft mod?
I need add permissions for this mod in LuckPerms

crystal sonnet
#

@tribal kelp you can use the LP verbose feature to figure them out. See our wiki for details

molten sentinel
#

your mod help pages should list its permissions in whatever help/doc they provide. use those permissions verbatim, such as if the plugin's perms look like

SecurityCraft.doThis SecurityCratt.doThat SecurityCraft.doSomethingElse

then you can do

`/lp group default permission set SecurityCraft.doThis

/lp group member permission set SecurityCraft.doThat

/lp group moderator permission set SecurityCraft.doSomethingElse

/lp group owner permission set SecurityCraft.*`

#

and if you have your groups set up to inherit from the prior parent correctly, this means that "members" will have perm for 'doThis' and 'doThat', and that "moderator" will have all three permissions, while "owner" has errythang possible including permissions not explicitly mentioned in the prior 3 groups

deep forge
#

Hi lads, where can I find the permissions for the commands?

crystal sonnet
#

@deep forge on the wiki. Also #support-1 is the better place to ask. #luckperms-api is for plugin devs wishing to integrate into LP

deep forge
#

my apologies, and thank you

molten sentinel
#

yeah i missed that too, in my last response

wraith prawn
#

When i've setup LuckPerms like this

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

Can i just call LuckPermsAPI in each class like this LuckPerms.getApi() or my var in my code as to be in static and called ?

#

And event UserJoinGroupEvent do not exist ? 🤔

dense harbor
#

Hi, it's the first time I use LuckPerms and the plugins and the api are really good but after I had a look in the wiki I would know what is the best Event to call when we set the parent to an User ? For the moment I use UserDataRecalculateEvent

wraith prawn
#

@dense harbor do u know whats the event when a user has his roles updated ?

dense harbor
#

For me UserDataRecalculateEvent is called 3 times when I change the parent of the user so I think this event can works for you

wraith prawn
#

Oh ok nice

#

Ty

polar hinge
#

I would've thought that event was fired when luckperms needs to recalculate their primary group.

Another way to go is to use the NodeAddEvent and filter out group.*

still lintel
#

I'd say NodeMutate event could also work, depending on what you want to do, it might be more useful
The recalculate event should fire multiple times if you set a parent, if I'm interpreting the code right setting a parent causes at least 2 recalculations in the background (removing then adding)

rain lodge
#

Hey? Is it possible to use the .inheritsGroup for groups that are parented?

#

So lets say the ladder is like this:

#

Gold Silver Bronze

#

So Bronze is a parent of Silver, Silver is a parent of Gold etc

#

If the user has Gold, It'll also do the functions of Silver, And Bronze

#

This is what I have:

#

It only seems to use the group if it's a direct parent of the user

#

Instead of an indirect parent

#

Any solutions?

jaunty pecan
#

Just use a permission check instead

rain lodge
#

Ah, That should work

thorny echo
#

We need a wiki bot 🤔

rain lodge
#

I forgot that parents have a group-permission set to them

#

Derp

#

Thanks

thorny echo
#

Most everything in luckperms is actually stored as a permission

crystal sonnet
#

In fact I don’t know about a single group or player setting that isn’t a permission

wraith prawn
wraith prawn
#

... ?

jaunty pecan
#

do you ever call the constructor?

#

as in, new GroupeChange(...)

high yoke
#

Hi guys ! I have in server.properties exposed gamemode 2 . After installing luckPerms , players began to be issued gamemode 1 . Who knows what the reason is ? And yet , how to solve to open chests, etc.?
Server core :SpongeForge

tropic cipher
#

Is there a way to sort a group Node by weight?

#

I want to get a player's group ordered in terms of weight

short hill
#

Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

someone ideas?

ebon ether
#

hm?

crystal sonnet
#

This channel is for devs having issues or questions about the API (code stuffs)

gusty goblet
#

Nodes don't have weight @tropic cipher

#

(at least there is no method in the Node interface)

crystal sonnet
#

@tropic cipher you can iterate over all effective permissions the user has and filter for group.<group> (like check if the node starts with group.) nodes and then determine the weight of the group and sort by that

#

Should all be possible with streams fairly easy

short hill
#

@crystal sonnet thank you very much this works great 😃

frank driftBOT
#

Hey Thund3rst0rm89! Please don't tag staff members.

tender iris
#

that time when you type out a very long question with a detailed explaination only to get to the end of typing it to find the issue you were asking about.....

thorny echo
#

Rubber duck debugging:D

tender iris
#

Well seems I spoke too soon. @jaunty pecan @rapid egret Zidane and I are attempting to get GP and LP loaded into our intellij developer environments for Almura. We have a coremod dependency on SpongeForge which is loading properly. We have nucleus and economy lite working too. When I logged into the single player world LP/GP generated this error: https://gist.github.com/Dockter/8560b27cc49802a0fb592093c18e6905 We have dependencies on LP and GP API's in our gradle configs AND we have LP and GP jars in our /run/mod directories. LP's API = 4.2, jar = 4.2.40, GP's is both 1.12.2-4.3.0.646. Our SpongeForge version is 3353

frank driftBOT
#

Hey Dockter! Please don't tag staff members.

jaunty pecan
#

that's a GP error

tender iris
#

That was our initial thought but wasn't sure since lp was generating the stack trace

jaunty pecan
#

ya, that's because it's calling griefpreventions context calculator

#

instead of propagating the exception back to the permission check call, LP just prints the exception and continues

tender iris
#

Oh I'll bet I know whats going on, this is likely bloods silly SF build check

#

nope, not that, wtf.

jaunty pecan
#

latest version of GP?

tender iris
#

LuckPerms-Sponge-4.2.40

jaunty pecan
#

can guarantee that's the first thing he'll ask you :p

tender iris
#

Oh, yeah, GP, yes latest

#

dead latest

jaunty pecan
#

hm well

#

something is null here

#

ClaimContextCalculator.java:43

tender iris
#

Yeah, GP is only half registered

#

trying to debug that part atm

jaunty pecan
#

player.getworld

#

could be there, since the perm check is async

tender iris
#

I wonder if this will only run in a dedicated server environment

thorny echo
#

Shouldn’t affect things, that’s what the jvm was designed to counteract

tender iris
#

I mean no one in their right mind would run GP on a single player world and it wouldn't be the first time we have seen issues with SF in a SSP enviro

jaunty pecan
#

Void, "dedicated server" means running as a standalone minecraft server in this instance

#

not the "server" code that runs as part of the client

thorny echo
#

Oh sorry, wasn’t reading the convo

#

I thought he meant dedicated box vs shared hosting etc

jaunty pecan
#

yep

#

got me the first time too :p

tender iris
#

nah this is all in an local intelliJ enviro

#

Nothing in the log makes me believe that GP isn't registered properly except that non of the commands work.

#

lp seems to be working as expected.

#

Interesting, this.permissionService = Sponge.getServiceManager().provide(PermissionService.class).orElse(null);

#

thats returning null

#

class load order not respected in-dev I wonder?

#

It saying LP 4.2 was designed for API 8

jaunty pecan
#

it's compiled against API 8, but works with API 5-8

tender iris
#

we use a similar lookup for PermissionService.class, trying to figure out why GP would be having an issue with the same call.

tender iris
#

well Im getting further. He does a client check too.

#

Ok, got it, had to remove his client checks and the hard-coded SF checks

trail oar
#

How to check if a name exists in user data base?

#

plugin.luckPermsApi.getUser(name) in try and catch NullPointException?

#

Someone?

jaunty pecan
#

nope, try to load the user from the usermanager

#

check for a null result

trail oar
#

thanks, one question

#

is there a way to know what group the player was before he was promoted or sth

trail oar
#

I'm using:
user.setPrimaryGroup("admin");
plugin.luckPermsApi.getUserManager().saveUser(user);
but it stills have mod rank, not assign to admin, why?

long moon
#

You need to actually give them the group, setPrimaryGroup just points towards an existing group they've got assigned that should be considered their main group

alpine sphinx
#

hi electronicboy

#

i see you on spigot chat

trail oar
#

thank you

trail oar
#

How to add a player to a group? cant find the method in the api

long moon
#

The wiki is a glorious thing

trail oar
#

I read it, i suppose there is no setGroup or addGroup

long moon
#

No

crystal sonnet
#

Groups are assigned through permission nodes. Nodes in the format group.<group>

trail oar
#

Adding that permission will set a group for that user? What about the other permission they have, like group.premoderator, if i add group.moderator they will still be in premoderator group, i have to remove it manually?

thorny echo
#

@trail oar Yes a user can have multiple groups so you have to remove the old group

#

Gimme a sec

#

@trail oar See an example here

fickle viper
#

I believe there's a problem with updating ranks w/ the API and storing the ranks through a database. Meaning, when using LuckPerms to store the ranks in a database and then using the API to promote a player. If the server is to restart for example the player is reverted back to the original rank that they had before using the external plugin to promote them to the next rank. This however doesn't happen when using LP to store ranks on a local file. Here's the code being used to promote a player to a rank, let me know if I'm doing something wrong here.
public void inheritNewGroup(Group group){ Node node = LuckPerms.getApi().getNodeFactory().makeGroupNode(group).build(); LuckPerms.getApi().getUser(player.getUniqueId()).setPermission(node); update(); }

jaunty pecan
#

you need to save the user afterwards

fickle viper
#

Onto the database, like what do you mean by saving the player?

#

Unless there's something I don't understand, if I'm suppose to have my plugin store the player's rank/data etc. the same way your plugin does onto the database then I'd need to understand how your plugin likes to save the data so that it can read it, however this doesn't make sense to me since why couldn't your plugin just do it? I would assume the method used to promote the player to another rank would use the same method your plugin would handle promotional/parent set commands to promote the player and save the changes. I'm using the API to promote players, the plugin registers the changes when I debug however it apparently doesn't save it which is what confuses me.

jaunty pecan
#

just a second, I'll link you to the method you need

#

you need to call this method after you make your changes

#

explained here

fickle viper
#

Ah alright thanks. I'll take a look in the morning.

lucid lodge
#

Is there a evet that gets called when a player changes from group?

jaunty pecan
#

Yes

#

NodeMutateEvent

trail oar
#

How to check if a player is in a group temporarely of if its permanent?

jaunty pecan
#

check if the node is temporary

trail oar
#

and to detect if a player group changed? i check NodeAddEvent and check if the permission starts with group. ?

jaunty pecan
#

You can call node.isGroupNode

#

and then if that's true, call node.getGroupName

#

i assume you're looking to listen for when a temporary group expires?

trail oar
#

i want to check if someone is added to a group and check if it's temporal or permanent

#

I want to add Discord support for my bungeecord plugin

#

and for that i need to know when a player is added to a group, and when a player is removed from it because of it expires

jaunty pecan
#

okay

#

here's some code you can look at / use

#

i'm not quite sure how you want to handle things, but I'm sure you'll be able to work out the rest 😃

trail oar
#

ehmm i got lost xD I understand what you sent a bit, but not how to properly use

#

can i use NodeRemoveEvent
and then if(e.getNode().isGroupNode()){

#

and then if(e.getNode().isPermanent()){

#

?

jaunty pecan
#

Yes

trail oar
#

Fine! 😄

trail oar
#

oh yes! I just saw it

#

Whats "TemporaryGroupListener {"

#

Its not a event

jaunty pecan
#

the name of the class

trail oar
#

so its just a class

#

which contains an event

#

?

jaunty pecan
#

yes

#

an event listener

trail oar
#

if NodeRemoveEvent is called for users and groups, how do i check

jaunty pecan
#

instanceof

trail oar
#

getTarget?

jaunty pecan
#

yes

#

read my example

trail oar
#

oh i read it

#

thanks

trail oar
#

Sorry Luck, how to register luckperms events? Tries as normal but i think its not being called

trail oar
#

Currently using in constructor

        EventBus eventBus = luckPermsApi.getEventBus();
        eventBus.subscribe(NodeAddEvent.class, this::onNodeAdded);
        eventBus.subscribe(NodeRemoveEvent.class, this::onNodeRemoved);

and for the class

    private  void onNodeAdded(NodeAddEvent e){
        plugin.console.sendMessage("NodeAddEvent fired!");
   }
    private  void onNodeRemoved(NodeRemoveEvent e) {
        plugin.console.sendMessage("NodeRemoveEvent fired!");
   }

console is my ConsoleSender (Bungeecord) Tag me when you read it
Update: It register only when group is removed, why? Or i can register only one event per class? Edit: I can register more than one.
Update2: NodeAddEvent is not called when using /lp user {USER} parent set {GROUP} or addtemp {GROUP}. Only when setting group permission using the api. Why?
Update3: Currently using "LuckPerms-Bungee-4.1.16" in Bungeecord. Dunno if newer versions supports bungee?

jaunty pecan
#

yea, try updating

trail oar
#

Luck

hard veldt
#

Greetings,
recently I've decided to migrate our liveserver to LuckPerms from PermissionsEx.
However I've run into a problem with temporary permissions.
When the command is run ingame to manually add the permission it works as expected:
/lp user ostylk permission settemp my.sick.permission true 2d

However when I try to do the same in a plugin by using the LuckPerms API things get weird.
The permission gets added, however it is not shown under /lp user ostylk permission info and magically disappears when I reconnect.

This is the code I use to set the permission.

                Optional<User> user = RoninHome.LUCK_PERMS.getUserSafe(target.getUniqueId());
                Node permission = RoninHome.LUCK_PERMS.buildNode("my.sick.permission")
                        .setExpiry(2, TimeUnit.DAYS)
                        .setValue(true)
                        .build();
                
                user.ifPresent(u -> {
                    u.setPermission(permission);
                    sender.sendMessage("\u00a7aThe player was granted a temporary permission");
                });

Did I forget to set some flag?
Any help is appreciated.

trail oar
#

Not sure, but maybe plugin.luckPermsApi.getUserManager().saveUser(user) is needed

hard veldt
#

Yeah, you're right. Well, that was simple.

Thank you very much!

trail oar
#

np, glad to help.
Luck i have a problem here, i try to set primary group with command, an it doesnt work at all. Do i need sth else?
EDIT: nvm, just set weight for each rank

trail oar
#

Luck, /lp user {USER} parent set/add/remove {GROUP} doesnt call NodeAddEvent in latest version? I need that to check when player are assigned to a group

#

Difference between NodeMutateEvent and NodeRemoveEvent?? Y tried with NodeMutateEvent to check data before and after but there is no difference in nodes, so result is empty list of Nodes.

trail oar
#

@hard veldt srry to tag you but .setExpiry(2, TimeUnit.DAYS) working for you? i can only use long

hard veldt
#

No I changed that code up. I had a variable of type int there. There was probably an implicit conversion.

trail oar
#

but it says that it supports it

hard veldt
#

Well, I now I tried to put .setExpiry(2, TimeUnit.DAYS). No error.

#

No idea whats up with your ide

trail oar
#

nvm, i fix it xD

hard veldt
#

what happened? 😄

trail oar
#

was using lastest version on server, but not in the project xD

hard veldt
#

oufff ^^

trail oar
#

If i use:
if(user.unsetPermission(plugin.luckPermsApi.buildNode("group."+group1).setServer(servertoremove).setValue(true).build().wasSuccess()){
user.unsetPermission(plugin.luckPermsApi.buildNode("group."+group2).setServer(servertoremove).setValue(true).build();
plugin.luckPermsApi.getUserManager().saveUser(user);
}
it means that the group 1 was removed?? or only group 2?

fickle viper
#

Your code shows that you are calling the same methods in both cases (the one in the logical statement is calling just a tad more). Just because it is in a logical statement (if) doesn't mean the methods aren't run. You're not writing out the location of where to call the method that is last written on the line. You are calling each individual method that each return a class value. Therefore the method that set's the value to true does it and then returns a class that contains the method build which you call that returns wasSuccess() which returns a Boolean to determine if everything was successful. So yes you're removing group 1 and group 2 if the method wasSuccess is returning true. Perhaps I totally misunderstood the question?

trail oar
#

I solved that already, the main issue is that /lp user {USER} parent add {GROUP} doesnt fire NodeAddEvent

fickle viper
#

Yeah I can't help you there 😛 I myself have also recently just started out with the API.

trail oar
#

xDDDD thanks >w<

fickle viper
#

So you have listened for the event and debugged to see when it fires if at all?

trail oar
#

yes, its fired when i use the api in my plugin, not with the command in game.

fickle viper
#

mmm yeah sounds like either there's a more specific one then for the commands or Luck forgot to fire the event when one of those commands are run.

trail oar
#

to be specific, system works. But my listeners are in bungeecord plugins, and the command is performed in a bukkit plugin

#

i suppose if i add a permission and all data is connected by mysql

#

and bungee messaging system, should also be fired in bungeecord

#

or sth like that

fickle viper
#

Worst case scenario, register a listener for the AsyncPlayerCommandEvent event or whatever it is called and read the command/parameters to see if a player is running the command you're listening for.

trail oar
#

I had that idea. I just made a command for bungeecord called /rank which works the same way /lp does add/addtemp/remove

#

anyways, i hope this gets implemented in futures updates maybe with an option:
Listen-bungeecord-events: true

#

or similar

fickle viper
#

So wait your bungeecord doesn't pick up on any of the LuckPerm's events?

trail oar
#

it does, only if the events are fired using the api from a plugin in bungeecord

#

but if i use a command to add a node to an user or group in bukkit using bungee messaging channel

#

event is not fired in bungeecord, even if it IS a NodeAddEvent

#

it has logic, but i think it should fire those events

trail oar
#

Can i get the name of the player with lower and upper case?

crystal sonnet
#

Capitalization only works for online players iirc

#

What you could do as well is access the player name cache of the server. I’m fairly certain you can access it in both Spigot and Sponge

trail oar
#

No if its in bungeecord :,c

#

i just saved name in my db 😛

gusty goblet
#

Anyone know why this doesn't work

    public Node[] getWEPermissionsAsNodes(LuckPermsApi luckPerms, String server, long expirationTime) {
        Node[] nodes = new Node[timedWEPermissions.length];
        
        for (int i = 0; i < nodes.length; i++) {
            nodes[i] = luckPerms.buildNode(timedWEPermissions[i])
                    .setServer(server)
                    .setExpiry(expirationTime)
                    .setValue(true)
                    .build();
        }
        
        return nodes;
    }

but this one does work

    public Node[] getWEPermissionsAsNodes(LuckPermsApi luckPerms, String server) {
        Node[] nodes = new Node[timedWEPermissions.length];
        
        for (int i = 0; i < nodes.length; i++) {
            nodes[i] = luckPerms.buildNode(timedWEPermissions[i])
                    .setServer(server)
                    .setValue(true)
                    .build();
        }
        
        return nodes;
    }
#

Only difference is the setExpiry

jaunty pecan
#

define: doesn't work

merry widget
#

hey, i cant quite figure out how to get a user's prefix and suffix using the api. i have looked through all methods that look right but still cant figure out. can anyone help

icy tinsel
#

@merry widget do you use bukkit or spigot?

merry widget
#

spigot

icy tinsel
#

Okay, try using the vault api

merry widget
#

oh god havent used that in ages

halcyon pebble
#

Ok so...

If I wanted to get a List<String> of every group that a player has, how would I go about doing that?

#

I tried doing the vault hook "getPlayerGroups()" but it always returns empty

#

I'm using spigot and OfflinePlayer btw

crystal sonnet
#

@halcyon pebble you can get a list of all active permissions of the player and filter that for all nodes starting with group.

alpine mountain
#

How might I ascertain all the groups a player is in?

jaunty pecan
#

in directly

#

or inherited?

alpine mountain
#

Directly.

jaunty pecan
alpine mountain
#

Ah. Thank you old boy.

gusty goblet
#

Sorry should have been more specific, when I try apply a temporary permission node it doesn't apply (doesn't show up in /lp user <name> permission info) but when I assign a permanent permission it works just fine

jaunty pecan
#

what's the value of expirationTime

halcyon pebble
#

So ranks are perms....

Literally every other perms plugin has a working Vault hook....

I guess I'll use a filter then

ebon ether
jaunty pecan
#

@halcyon pebble the luckperms vault implementation doesn't support offline players

#

that's why it's not working

halcyon pebble
#

Ah, any chance you could update it in the future? I'm creating a prison top plugin and it would have been easier to just use vault api 1.6 instead of separate apis for each plugin

jaunty pecan
#

the reasoning is explained here

#

i'm open to suggestions about better approaches to the issue

halcyon pebble
#

thnx for the info, I'll forward this to the person that requested it

if I want to use offline players I can just use your API instead of vault, correct?

jaunty pecan
#

indeed, but you still have to take the considerations about being main thread friendly into account

#

the difference with the LP API is that it forces you to make that decision

#

by returning futures

halcyon pebble
#

kk, so, for example, if I want to calculate prison top values for every offline player?

#

would I be allowed to do that async?

jaunty pecan
#

That's the ideal outcome, yes

halcyon pebble
#

kk, thnx for being so helpful 😃

#

I'm still learning a bunch of stuff about java and plugins

jaunty pecan
#

no worries

#

let me know if you have any other questions

#

i'm happy to help 😃

halcyon pebble
#

I just want to be 100% sure

#

would this be correct?

#
permissions.stream().filter(node -> node.getPermission().startsWith("group.")).forEach(node -> list.add(node.getPermission().substring(6)));

or would that be better?

jaunty pecan
#

you can use node.isGroupNode and node.getGroupName

#

also, if they're offline, you need to use api.getUserManager().loadUser(...)

#

relevant wiki pages are:

halcyon pebble
#

thnx

zenith linden
#

so what exactly do i compile?

thorny echo
#

Run those 3 commands in order 😃

zenith linden
#

i only want it for bukkit

#

will the code detect what server i'm putting it on?

thorny echo
#

You just compile them all, and there will be multiple jars

zenith linden
#

my spigot server

#

oh

thorny echo
#

So once you've done that, the target/ folder should have the jars in

zenith linden
#

alright

#

Thank you!

thorny echo
#

Yw!

zenith linden
#

what's Java 8 JDK

#

i kinda feel like an idiot

halcyon pebble
#

Java 8 - Java Development Kit

zenith linden
#

is that this?

halcyon pebble
#

no idea what that is since I use windows and just use the installer, but probably

zenith linden
#

oh

#

could i have a link to Java JDK installer?

#

nvm

#

how do i download maven