#luckperms-api

1 messages · Page 31 of 1

azure latch
#

like this api.getUserManager().getUser(player.getUniqueId()).getPrimaryGroup() and this java (!api.getUserManager().isLoaded(player.getUniqueId())) { api.getUserManager().loadUser(player.getUniqueId()); }

#

For this style its a singular backtick around the contents

azure latch
#

UserManager#loadUser returns a CompletableFuture<User>, maybe try using that to get the player group if they aren't loaded?

hollow panther
#

hi there, could you please tell me what is the correct way to switch one's primary group via developer api

#
LuckPerms luckpermsApi = LuckPermsProvider.get();
User user = luckpermsApi.getUserManager().getUser(player.getName());
user.setPrimaryGroup(permissionGroup);
luckpermsApi.getUserManager().saveUser(user);
#

i tried this, but it doesn't work even when i set "primary-group-calculation" to stored

hollow panther
#

Problem solved, just use this as noted by RyanJH:

polar pagoda
neat jackal
#

What is your LuckPerms version?

polar pagoda
#

Bukkit-Legacy-5.1.75

neat jackal
#

Make sure your plugin loads after LuckPerms (depend or softdepend in plugin.yml)

polar pagoda
#

ahhh

#

that would explain it

#

thanks tobi ^^ hopefully that fixes it lol

tribal wave
#

i'm having a bit of trouble adding the luckperms API as a dependency through maven

#

when i hover over the dependency it says 'not found'

#

oop never mind xd

tribal wave
#

is anybody familiar with how to use the stream API to get all of a user's groups which are not inherited?

#

except i don't want inherited groups

#

nvm

#

i realize the error of my ways

crystal sonnet
#

What do you mean with groups that are not inherited?

tribal wave
#

brainstone dont roast me

crystal sonnet
#

Ok

tribal wave
#

;-;

#

i misinterpreted the wiki

real flint
#

i keep gettting this error ^

azure latch
#

Your plugin has to load after LP

#

Depend on it in your plugin.yml

real flint
#

it does load

#

after LP

#

oh

#

one second

rustic laurel
#

That's LP loading up

real flint
#

one second

neat jackal
#

That's another error tough

crystal sonnet
#

The LP plugin instance cannot be cast to an instance of the API

mental linden
crystal sonnet
#

@mental linden that looks like a plugin is depending on the old API of LP

#

Try installing the legacy API extension

#

!extension

frank driftBOT
#

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

real flint
crystal sonnet
#

One sec

mental linden
#

np

crystal sonnet
#

!downloads

frank driftBOT
crystal sonnet
#

Scroll down @mental linden

mental linden
#

i've got it

crystal sonnet
#

Also wrong channel

real flint
#

brainstone

#

i still have the error xD

crystal sonnet
#

I'm reading it

#

Chill

real flint
#

o gracias

#

sorry

crystal sonnet
#

I need that file: LuckPermsBridge

real flint
crystal sonnet
#

Make a bug report on GitHub

dawn saffron
#

does anyone know how I can get the display names to work as they are not working at the moment

crystal sonnet
#

Elaborate

dawn saffron
#

I have seen on another server everyone has their role appear next to their gamertag and in the TAB window I was wondering how I do this. I assume it is done with the display name

crystal sonnet
#

No it's not

#

Also not really LP related

#

Btw most of those plugins are open source

#

So why don't you just take a look?

dawn saffron
#

Oh ok thanks for your help

crystal sonnet
#

You're welcome

ripe hazel
#

So question im trying to get luck perms to work with Multiverse. it seems to work fine. but everyones prefix is either. [world] [world_nether], or [world_end] and lucks perms does not seem to over wright tho's prefixes with the groups and prefixes i made with luck perms

#

i dont know if that exsplained it, but idk

rustic laurel
#

Its a multiverse feature you can disable

#

prefix-chat-format I think

ripe hazel
#

is that under the plugin file for it? or in game

rustic laurel
#

It's in the multiverse config -also this is not the correct channel, please use #general for non-LP things

ripe hazel
#

my bad. i just want sure cause idk if it was multiverse or luckyperms

rustic laurel
#

Even LP things should go in #support-1 or #support-2 unless they're related to the developer API, in the future

tribal wave
#

larry, do you know if all it takes to assign a user to a different group / remove them from a group is

LuckPerms api = LuckPermsProvider.get();
        User user = api.getUserManager().getUser(uuid);
        user.data().add(Node.builder("group.my_group").build());
        user.data().remove(Node.builder("group.other_group").build());

rustic laurel
#

You need to save the user after but I do believe so

tribal wave
#

ahhhhhhhh that's what i'm missing then

#

thanks larry 😉

#

.... for some reason i'm getting a sense of deja vu here

rustic laurel
#

😂

#

Np 👍

tribal wave
#

hmm i'm having an issue where my bungee plugin might try and create a LuckPerms api object very soon after the server starts; and when that happens I get an illegalStateException saying that the LuckPerms API is not loaded

#

is there a way to detect when the API is loaded? or even better, wait until it is?

neat jackal
#

Make sure you depend or soft-depend on LuckPerms in your plugin.yml (or whatever that is for bungee)

tribal wave
#

ahh that's a good call 😅

#

thankya Tobi :3

tribal wave
#

hmm... I added LuckPerms as a dependency, but when I try to get the API in onEnable(), it still throws an error

#

actually now that i've added LuckPerms as a dependency, it throws an error EVERY time I try to get an instance of the API lol

neat jackal
#

Are you shading it in?

tribal wave
#

i was using the luckperms-bukkit jar as a dependency

#

which just might be why it isn't working with my bungee plugin.... xd

#

i'll try using the API jar from the maven site and see if i have better luck with that

#

though the bukkit jar did work for me before, for whatever reason.. hmm

#

using the api jar didn't help; and tobi i don't think i was shading it in - i was using the normal jar and not a shaded one

neat jackal
#

Can you open your built Jar file with something like WinRar?

tribal wave
#

my plugin one? sure

neat jackal
#

If you see a net/luckperms/api folder in there, then you have it shaded, that would be my last guess

tribal wave
#

ooh i do indeed have that folder

#

is having it shaded bad?

neat jackal
#

You shouldn't have the API shaded, because iirc you try to access your shaded API and not the one provided by the LuckPerms plugin. So it can't be loaded.

tribal wave
#

ah

#

so what do I do? just not export the api along with the other stuff?

#

(if i can figure out how to do that 😅 )

neat jackal
#

Do you use Maven?

tribal wave
#

i've been trying to, but i'm also using normal external jars dependencies alongside it

neat jackal
#

Do you have a pom.xml with something like

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

in it?

tribal wave
#

nope, nothing to do with shading

#

i only have

<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
#

so am i right in saying the api is throwing the error because I'm including the luckperms api as part of my plugin jar?

neat jackal
#

Yes

#
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artiactId>
  <version>3.2.4</version>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
         <goal>shade</goal>
      </goals>
      <configuration>
        <artifactSet>
          <excludes>
            <exclude>net.luckperms:api:jar</exlude>
          </excludes>
        </artifactSet>
      </configuration>
    <execution>
  </executions>
</plugin>

try add that, not sure if it works tho

#

Or wait, no, I messed something up

tribal wave
#

it might be because I'm also using the luckperms external jar

#

in my build alongside the maven dependency

#

but i was getting issues before when i was just using the maven dependencies

#

iirc

#

oh... i just removed that jar and it worked

#

i'm so sorry tobi XD

stray dock
#

Hello. Where i can find the maven of luckperms?

#

founded

#
<dependencies>
    <dependency>
        <groupId>net.luckperms</groupId>
        <artifactId>api</artifactId>
        <version>5.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
sour rock
#

What is the best way to get like a list with all groups the player inherits?

shy cypress
#

General permissions checking question. If I check for, say, group.staff.*, would it return true for a player who has group.staff.admin?

river turret
#

hello i recently got luck perms and i got rankgrant+ too and i make a group i set its prefix and i put for me then the prefix doesn't have a space between the prefix and the player name help plz

uncut ice
#

Is there an event when group removed?

rustic laurel
#

NodeRemoveEvent I think

#

!API it's on the javadocs here

frank driftBOT
uncut ice
#

How can i use this in my code

#

How can i get the player?

rustic laurel
#

It's on the usage wiki, second link on the embed iirc

#

The target is a permissionholder, so user or group

uncut ice
#

I cant find it, please tell me the line

rustic laurel
#

My second sentence is me telling you

#

The target is a permissionholder, so user or group

uncut ice
#

Is the playername the friendlyName?

rustic laurel
#

???

uncut ice
#

getFriendlyName

rustic laurel
#

I know like basically zero java and I have a feeling you know less

#

Getfriendlyname is not from LP

#

Not as far as I know

uncut ice
#

i only want the playername or uuid, but im not a pro, sorry...

rustic laurel
#

A node can be removed from players or groups

#

getTarget will get the player or group

#

You can further limit it to just be a player after that afaik

#

The javadocs are linked here, read the ones for that which you need

#

!api

frank driftBOT
rustic laurel
#

First link

rustic laurel
#

@uncut timber in your code snippet, you do not save the user

#

You gotta save the user

#

!api

frank driftBOT
rustic laurel
#

Examples and explanation found on each of these two links

uncut timber
#

Ok thanks!

uncut ice
#

How can i load all users from the database?

nocturne elbow
#

getUserManager()

nocturne elbow
#

@uncut ice ^

#

Hey all, got this code:

    public void setCount(@Nonnull UUID uuid, @Nonnull Map<String, Integer> counterValues) {
        LuckPerms api = LuckPermsProvider.get();
        User user = api.getUserManager().getUser(uuid);
        if (user == null) {
            return;
        }
        for (String counter : counterValues.keySet()) {
            user.data().add(MetaNode.builder(counter, String.valueOf(counterValues.get(counter))).build());
        }
        api.getUserManager().saveUser(user);```
#

It works exactly how I intend except when it's called multiple times, it assigns multiple values to the same meta key

#

Is there any way I can make it so the key only ever has one value, the latest set?

#

Or so I can override the prev value as oppose to add another?

#

`Modifying existing nodes
Nodes are immutable - meaning their attributes cannot be changed. However, we can easily create a new node based upon the properties of an existing one.

e.g.

Node negated = node.toBuilder().value(false).build();`
I read this to mean we should just create a new node and add that instead - the same way as above, so this should work in theory?

#

Any ideas would be greatly appreciated

nocturne elbow
#

After looking at https://github.com/lucko/LuckPerms/blob/2ac7d3dfe6591200486f86700054a931f560def2/common/src/main/java/me/lucko/luckperms/common/commands/generic/meta/MetaSet.java#L89 - my solution is:

    public void setCount(@Nonnull UUID uuid, @Nonnull Map<String, Integer> counterValues) {
        LuckPerms api = LuckPermsProvider.get();
        User user = api.getUserManager().getUser(uuid);
        if (user == null) {
            return;
        }
        for (String counter : counterValues.keySet()) {
            MetaNode toSet = MetaNode.builder(counter, String.valueOf(counterValues.get(counter))).build();
            user.data().clear(node -> node instanceof MetaNode && ((MetaNode)node).getMetaKey().equalsIgnoreCase(toSet.getMetaKey()));
                user.data().add(toSet);
        }
        api.getUserManager().saveUser(user);```
tender iris
outer dock
#

How can I get a user and add a parent rank to them?

rustic laurel
#

!api

frank driftBOT
rustic laurel
#

these links, taken together, contain the sum total of all the knowledge you will need

outer dock
#

Excellent.

shy cypress
#

is there a way to retrieve all users who have a specific permission?

shy cypress
#
InheritanceNode staffNode = InheritanceNode.builder("group.staff").build();
NodeMatcher<InheritanceNode> matcher = NodeMatcher.equals(staffNode, NodeEqualityPredicate.ONLY_KEY);

CompletableFuture<Map<UUID, Collection<InheritanceNode>>> result = api.getUserManager().searchAll(matcher);
result.thenAcceptAsync(res -> { ... });
```trying this but it's not returning anything even if the player has group.staff inherited from a group :/
outer dock
#

I can't seem to init the API on Bungee since the example uses Bukkit
https://hastebin.com/qiwedizoqo.cs
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);

rustic laurel
#

Well shadowolf you are looking for Bukkit there, your first step should be to find what the bungee equivalent of the bukkit servicesmanager is

hardy sedge
#

Will the API 5.1 also work in an Bungee(Waterfall) plugin or do I need another one in this case

hardy sedge
#

Cool it looks like it does

#

nice

hardy sedge
#

Well if anyone knows how I could force changes I did to nodes (like a group change) appear directly to a user, a tip would be welcome. I guess I have to flush the permission cache somehow. At the moment the changes (add/remove) get saved to the database but only apply after a users logs out and in again. Thanks

nocturne elbow
#

hi

#

how do i add roles

#

to someone

#

is there a command?

rustic laurel
#

That doesn't seem related to the luckperms developer api

hardy sedge
#

Well meanwhile tryed a lot like
LuckPermsUser.getCachedData().invalidate();
LuckPermsApi.getMessagingService().get().pushUserUpdate(LuckPermsUser);
LuckPermsApi.getMessagingService().get().pushUpdate();

#

All does not solve the problem

rustic laurel
#

are you saving the user after you make the change, and that still doesn't update the player ingame @hardy sedge

hardy sedge
#

I wrote a plugin for bungee, means waterfall. When the user joins with the prefix * (will be changed later to Floodgate listener) it adds a group to the player. So in this case it adds the group in the MySql database as it should, but the player itself does not gets it applied.

#

Except if the player logs out and in again

#

I guess Luckperms checks the data on mysql again

rustic laurel
#

What are your database settings? Ideally i believe they should have watch-files to true

hardy sedge
#

I use the plugin message service

rustic laurel
#

Well that's probably the reason

hardy sedge
#

But is recommended for a proxy

rustic laurel
#

messaging service should be sql as stated in the config

#

not for MySQL

hardy sedge
#

did I overread that

#

one moment

rustic laurel
#

I mean, at least try using sql, so updates propagate correctly

hardy sedge
#

SQL will fix it indeed since it rechecks the databse periodically

rustic laurel
#

I mean, pluginmsg relies on online players to propagate changes

#

sql relies on online database

hardy sedge
#

Well actually let me check if it is indeed an online issuse, just wanna know if thats it. I will shedule the push message half a minute

rustic laurel
#

you could also, as i said earlier, set watch-files to true and don't schedule changes. That way when any change is detected it will automatically propagate

hardy sedge
#

This is activated at the moment, but according to config it only takes effect if you use fiule type storage engine

#

I will not keep the shedule, is just a test do uinderstand it

rustic laurel
#

Idk man pretty sure if you try it, it should work for the db? I'm not certain tbh

hardy sedge
#

Ya is actually really a problem with the connection, shedule works. I did'nt think about that since the player either is connected to bungee and not to a server or already on a server. It seems like luckperms ignores update pushes (global and per user) as long as the player is not etablished on a server. But I thought that in that case it would request the perms on server connection

#

Well for some reason it looks like it already got them

#

maybe because the perms get cached once

#

I can fix that now listening to other events

#

Thanks so far

#

Might really be the problem, that the local server plugin caches the whole perm list from mysql on startup anw will not update anymore (pluginmsg service) as long as no update push will come. But seems to ignore all pushes for offline players not processing the data again

#

Now I know

#

😛

rustic laurel
#

pluginmsg relies on having an online player on the target server or else it simply doesn't work

hardy sedge
#

Yes, thanks, I can fix it now easily since I know that

rustic laurel
#

awesome

hardy sedge
#

Thanks again!

rustic laurel
#

np!

woeful pilot
#

Hi

#

i have so much trouble to install LuckPermsApi i search while about 2 hours can someone helpme please

#

i can't find LuckPermsAPI

nocturne elbow
#

You just obtain a LuckPerms object instance, either through bukkit service manager or LuckPermsProvider

woeful pilot
#

Ahhh

#

So whats can i do to obtain LuckPermsAPI ?

pseudo bramble
#

what you have there

nocturne elbow
#

Correct me if I'm wrong but I don't think there's a LuckPermsAPI class? You just work with the LuckPerms provided object...

obtuse jolt
#

The root api instance is LuckPerms yea

dusk saffron
#

how do i check if someone has a group?

rustic laurel
#

!api that's explained fully on these two links (taken together)

frank driftBOT
dusk saffron
#

thx

nocturne elbow
#

you can use ```java
if(p.hasPermission("rank.vip"){
//do stuff
}

#

Theres probs an easier way

rustic laurel
#

that's only gonna work for fully online players, afaik

#

It is the easiest I've seen tho lol

nocturne elbow
#

Probs

crystal sonnet
#

No it works for all loaded players

#

And check for the permission group.<group>

nocturne elbow
#

So I was right

#

hooray

late fern
#

hooray

late fern
woeful pilot
#

Hi !
So i have a question
It's about LuckPerms i just try to access to the LuckPermsAPI
i download api, i write

#

but now that i have the instance what can i do for access to the API

crystal sonnet
#

That is the API @woeful pilot

woeful pilot
crystal sonnet
#

That is the API class @woeful pilot

#

There is no LuckPermsAPI class (anymore)

#

That’s the API instance

#

That’s what you want

woeful pilot
#

ahh.. ty i guess

crystal sonnet
#

How to use the API can be found here:

#

!api

frank driftBOT
woeful pilot
nocturne elbow
#

Do you know how to Java?

woeful pilot
#

not with api

#

i begun while 2 days bro

rustic laurel
#

It is my highest recommendation that you do not jump straight into making plugins without having however basic a grasp of Java first

crystal sonnet
#

I do not recommend jumping into plugins with anything short of a solid understanding of Java or at least OOP programming

#

Like around a year of solid experience

#

And that’s still not enough to use the LP API. It’s not made for beginners

nimble kelp
#

How i can get user metadata? prefix and suffix for example

nimble kelp
#

thx

nocturne elbow
#

how to then i add plugin server just goes off

crystal sonnet
#

What?

nocturne elbow
#

how to fix

#

then i add plugin to plugins folder server goes off

#

help

rustic laurel
#

Are you asking about the Luckperms developer API? If not, wrong channel

odd warren
#

does the developer api works with bungeecord?

nocturne elbow
#

Yes

odd warren
#

How do I use it? There are only examples for spigot and sponge on the wiki

nocturne elbow
#

As far as usage is concerned, I believe it's platform independent

odd warren
#

Okay thanks

atomic turtle
#

is and emerald or diamond EMERALD_INGOT or just EMERALD?

nocturne elbow
atomic turtle
#

thanks

snow willow
#

How can I check if a User (NOT the group) has any permission

rustic laurel
#

!api it's explained pretty well if you take the info on both of these links together

frank driftBOT
snow willow
#

I dont find any way to NOT include "Group Permissions"

rustic laurel
#

get a permissionholder which can be a user or group and then only give it users?

#

Oh do you mean directly inherited

#

Use that on the user permissionholder

nocturne elbow
#

Is there a !javadocs?

#

!javadocs

frank driftBOT
#

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

nocturne elbow
#

>:(

sullen yoke
#

!help

frank driftBOT
#
Available commands:

!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!cauldron
!chat
!colours
!commandequivalents
!commands
!config
!context
!default
!downloads
!editor
!errors
!essentials
!extensions
!extracontexts
!faq
!helpchat
!inheritance

!install
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!tracks
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki

sullen yoke
#

!whyluckperms

frank driftBOT
snow willow
#

Is this the way I'll get the permission from an User user.getNodes().stream() (and not from his group)

serene thunder
#

I want to make player being able to use "/gamemode spectator/survival" bot how do i do that, without them having permission to go into other gamemodes like creative

snow willow
#

then give them the permission

#

you also can give them the permission only when the type in the command and later you remove the permission

serene thunder
#

I dont know how to do that. And they should be able to go into spectator and survival everytime they want

late fern
#

do /lp group groupname permission set minecraft.command.gamemode.* true

#

if you use essentials..

#

/lp group groupname permission set essentials.gamemode.* true

#

also, wrong channel bro

serene thunder
#

okay sry, beacuse i saw people asking here...

#

sorry

late fern
#

np

snow willow
#

Okay I'll try it thanks

#

Ok so I dont really understand how to use it in my Code

#

@nocturne elbow

nocturne elbow
#

Alright give me a minute

snow willow
#

Okay thanks

#

Why do I need flags

#

I dont understand wich Flag/QueryOption do I need

#

Wich Flag should I use when I'll get all Player Specific Permissions? @nocturne elbow

nocturne elbow
#

You add the flags to the set you want to query for, and don't add the ones you don't want

snow willow
#

Yeah but I dont really understand wich do I need

nocturne elbow
#

You will definitely not want to add Flag.RESOLVE_INHERITANCE

snow willow
#

So should I add all the others

#

to the Flag List

nocturne elbow
#

You add the ones you want

snow willow
#

Thats the problem I dont know wich ones are the best for my "problem" so I want to get all Permissions from a user that arent from his group

nocturne elbow
#

3rd and 4th

#

It's not that hard to test either, you know

snow willow
#

So now I've another problem when I type in all this my IDE says that the method dont exist and I should remove the NodeType

#

The method resolveInheritedNodes(QueryOptions) in the type PermissionHolder is not applicable for the arguments (NodeType<PermissionNode>, QueryOptions)

nocturne elbow
#

Which API version are you compiling against?

#

Is this for v4 or v5 LP?

snow willow
#

5.0.88

#

Is the plugin version I added in the build path

nocturne elbow
#

You might want to switch to the 5.1 API

snow willow
#

Okay I'll try it

nocturne elbow
snow willow
#

Okay thanks

nocturne elbow
#

Either that or you can get all node types and filter them out yourself

#

That would work too

hardy sedge
#

Is not happening on any of my test systems so I have a hard time to repeat that error

nocturne elbow
hardy sedge
#

OMG I'm stupid

#

thank

verbal cape
#

How hard would it be to create a plugin that changes your spawn point when you die, and your /spawn point depending on what group(s) your in?

#

I'm new to plugin development

wild whale
#

Non-LP related dev in #general please and ty
(this channel is only for the Luckperms API)

verbal cape
#

I put it here because the group thing is related to the luckperms api 😛

wild whale
#

fair enough I guess it is related enough to stay here, ignore me

verbal cape
#

haha no worries

wild whale
#

To answer your question, that shouldn't be too difficult

crystal sonnet
#

@snow willow the code you originally posted user.getNodes() is already what you want

#

This does not include inherited nodes

#

I mean why didn’t you just give it a try?

#

There are like 4 different methods to get the nodes of a player. If one of those returns just the nodes assigned directly to the player it should be pretty easy to find within 4 attempts

#

Or one if you try all 4 at ones

#

And with try I mean just printing all the permissions that are in the lists

elfin tartan
#

Im not sure if this is the appropriate channel to ask questions about the editor, hopefully someone can help me. Im using a minehut server and prior to the 1.16 update i had had all my ranks setup. There were lots of issues with many plugins so i wiped all files to start over. Now the ingame commands tell me i have all the old groups and track but when i use lp editor only the tracks port over, the groups only show default.

hard oar
#

Is it possible to promote a user without a context? Or does it need the context?
luckPerms.getTrackManager().getTrack("ranks").promote(user, <Context>);

nocturne elbow
hard oar
nocturne elbow
#

np

hard oar
#

Is there a way to get a players current rank on a specific track via the api?

#

Currently trying something along the lines of:

List<Group> common = new ArrayList<Group>(ranksGroups);
common.retainAll(groupsPlayer);

To try and get a common group between the trackgroups and the players groups
Hitting the issue of tracks.getGroups returning a list of strings, and the user groups are of the Group type

crystal sonnet
#

Convert them using streams @hard oar

hard oar
#

Thanks!
Another small question, this code doesn't actually promote the player, how can I promote him?
PromotionResult promotionResult = ranksTrack.promote(user, ImmutableContextSet.empty());

crystal sonnet
#

Remove the old group assignment and add the new one

nocturne elbow
#

I need to make a sky block server and it won’t let anyone without op/* break or place or interact with permissions ex how do I fix

rustic laurel
#

please do not crosspost in several channels

slow path
#

Can someone please teach me how to edit luck perm permissions

verbal cape
#

/lp editor

#

and you can remove/add permissions to groups or players through there

slow path
#

aaah ok

slow path
#

I need help again 😦 , How do i activate the permissions from the /lp editor, I checked my default perms using /lp group default permissions info, but it says not are listed

nocturne elbow
#

Top right corner

#

Save button

#

It'll give you a command, you run that command on your server

slow path
#

Oh tysm I will see if it works

nocturne elbow
#

And please go to any of the general channels if it's not related to the developer API

slow path
#

oooh I thought this was for like developing servers sorry XD i just joined

ripe token
#

I would like to get the suffix of a group. For that I need to get the group meta ofc. For getting metadata you need queryOptions... how do I get the query options of a group?

#

I keep getting java.lang.ClassCastException: me.lucko.luckperms.common.api.implementation.ApiGroup cannot be cast to org.bukkit.entity.Player

#

When using this QueryOptions queryOptions = luckPermsApi.getContextManager().getQueryOptions(group);

#

Is there a different way of getting queryOptions for groups rather than players or users?

ripe token
#

And another question: if I get the suffix of a player and that player doesn't have a custom set one will the api return the inherited one from the group the user belongs too?

nocturne elbow
#

That will give you the nodes the group holds, it won't resolve inherited nodes
If you want that to happen you'll need to use #resolveInheritedNodes(NodeType<T>, QueryOptions), and you can create the QueryOptions you want with the QueryOptions.Builder class

ripe token
#

What do I do with the nodes the group holds?

nocturne elbow
#

Did you at least care to look at the doc?

wild whale
#

Just to ensure I'm not going crazy, this should check if a User has a given permission, correct?
(Having to do it this way because this is running in AsyncPlayerPreLoginEvent, and so have no Player#hasPermission to use)

boolean hasPerm = user.resolveInheritedNodes(NodeType.PERMISSION, QueryOptions.nonContextual()).stream().anyMatch(permissionNode -> 
permissionNode.getPermission().equalsIgnoreCase("<some node>") && permissionNode.getValue());
#

cough cough paper, a hasPermission method of some form on that event would be great, I can't be the only person doing this

nocturne elbow
#

I can't be the only person doing this
bet

#

People write strange software out there in the wild...

wild whale
#

What I'm doing isn't that special though, just a permission based whitelist-esque thing

#

I'm sure there's hundreds of other plugins that do that

rustic laurel
#

do u have vault too

#

easy way to do it through vault i know of

#

o luckperms too

#

during APPLE @wild whale

nocturne elbow
#

Or schedule a sync task for the next tick, check for the perm and kick then 👌 👌

wild whale
#

Then I'd have to deal with cancelling the join/leave messages as well, since my goal is for them to disconnect silently
(been having lots of problems with spambots using a VPN that our AntiVPN isn't catching, and spamming hate messages against prominent members of the community. Captcha plugin stopped the hurtful messages, but we still get join/leave spam)

rustic laurel
#

Offline mode 👀

wild whale
#

nope, it's online mode

#

hence why we've been really confused by the spambots

indigo violet
#

I use advanced bot protection

#

It defended all spam attacks

somber owl
#

does the old api still work or do I need to update the dependency to the latest one, if so do I just need to state the the api adress or is there a new "node", "contexts", "user" etc

#

nvm i'm dumb

nocturne elbow
#

lol

crystal sonnet
#

You can use the legacy API extension to make plugins with the old API work with the new version of the plugin @somber owl

rough chasm
#

Hi

#

I'm making a better chat format plugin , would it be possible using LuckPerms API to get all of the prefixes of a user (each group has a prefix) and display them in the chat? Also do I need Vault for this ( I hope not) 😮

crystal sonnet
#

Of course you can do that @rough chasm

#

!api

frank driftBOT
crystal sonnet
#

And no you don’t need to use Vault

rough chasm
#

Thank you this is all info I needed before start

crystal sonnet
#

Though generally speaking using it is better as that allows your plugin to work with pretty much any permissions plugin

rough chasm
#

But I will develop for my own Server

#

It's not something that will be publicly available so I know my environment and I will not use Vault, because we will have all custom plugins

crystal sonnet
#

If you insist

#

Though I mean you’re using LuckPerms

#

So it’s not all custom

rough chasm
#

Of course I use ONLY LuckPerms

#

Because it's the best

#

And I wouldn't really be able to replicate it myself

crystal sonnet
#

Let me tell you right now that holds true for most other plugins. Or at least the respective best of their kinds

rough chasm
#

Well for example I am replacing EssentialsX & EssentialsXChat with custom solution that will better suit my server

crystal sonnet
#

The same holds true for me. And I’m a professional (plugin) developer.
And if I could replicate it it would take a significant amount of work that’s typically just better spent configuring existing plugins

rough chasm
#

Well I'm not a professional developer, but I have now 2+ years of Java and Spigot development

#

Thanks for helping, now I go

crystal sonnet
#

You’re welcome

rough chasm
#

I love LuckPerms too much tbh

#

I've left like at least 2-3 5 stars review

crystal sonnet
#

Awesome

rough chasm
#

I still haven't got a clue of how the website system works 😔

#

I tried looking at source but I'm not used to huge projects such as this

crystal sonnet
#

Well LP uploads the data to a pastebin like server hosted by luck only for LuckPerms

#

Then the URL for the editor contains the ID of the paste and displays the data

rough chasm
#

Wouldn't having a dedicated server with users and databases be more efficient?

crystal sonnet
#

When you save the editor it saves the data back to the pastebin and creates the command that contains the new ID. Running that command makes the server load that data and apply the changes

#

Wouldn't having a dedicated server with users and databases be more efficient?
@rough chasm what do you mean?

rough chasm
#

Like a real website hosting where each user creates an account and manages his server , all servers and permissions and groups would be stored on a database on the website

crystal sonnet
#

Are you insane?

rough chasm
#

Well I'm not a web developer I don't know this kind of stuff

hushed oxide
#

hey BrainStone how are you!

crystal sonnet
#

Well take a guess. What kind of resources would it take just to run the database just for all users here in the discord (LP has waaaay more users)

rough chasm
#

yeah rip money

crystal sonnet
#

And then what do you do when someone doesn’t want to store their data centrally?

#

Or what happens to those people that have censored internet?

#

They then just can’t use the editor?

rough chasm
#

I mean it could be a cool "premium service" idea, in my opinion

crystal sonnet
#

So the servers run worse?

rough chasm
#

Ok nvm I realized this suggestion is not efficient

crystal sonnet
#

And we haven’t even touched the legal issues that arise from a service like that

#

@hushed oxide hi

hushed oxide
#

Hi dude

crystal sonnet
#

Is there anything you want from me?

boreal edge
#

^

hushed oxide
#

i am Blue_Tree remember me?

crystal sonnet
#

No

#

And why are you writing in code blocks?

hushed oxide
#

you helped me in a lot of stuff

crystal sonnet
#

I help a lot of people

hushed oxide
#

I dont know just for fun

#

I help a lot of people
@crystal sonnet I know

frank driftBOT
#

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

hushed oxide
#

i didnt tag i just quoted

crystal sonnet
#

With a tag

hushed oxide
#

ok lol

#

remember when i told you to tell the owner i like luckperms?

crystal sonnet
#

No

hushed oxide
#

😭😭😭😭😭😭😭😭😭

crystal sonnet
#

I mean I’m sure I did. Because I always do that

#

But as mentioned: I don’t remember you

hushed oxide
#

```:(````

crystal sonnet
#

And if I did that wouldn’t be a good thing. Because I typically only remember the bad cases so I know not to respond. Gotta keep my sanity somehow

hushed oxide
#

ok

#

remember when i thought you are a lp develepor?

crystal sonnet
#

I must be speaking Chinese or something...

#

I mean what part of “I don’t remember you” is hard to understand?

hushed oxide
#

i am trying to make you remember me

crystal sonnet
#

Which frankly is rather pointless

hushed oxide
#

nvm

crystal sonnet
#

And again. Why are you wrapping your messages in code blocks?

#

That is so irritating

hushed oxide
#

I have fun using the code blocks

wild whale
#

can you not please

#

code blocks are for code

#

if you aren't doing code, it just irritates everyone

hushed oxide
#

lol

remote sky
#

Smh yea always see ppl overuse code blocks

#

It’s not just for code tho that’s a fact

#

You could also use to for console output etc

#

Configs

wild whale
#

well yeah. Just please not for chat.

hushed oxide
#

code blocks for system.out.printIn("Yea that is how to use code blocks");

hard oar
#

Heya guys, 2 questions here with api version 5.1:

1- In the below codeblock, I have a previous instance of user, can I use that one instead of creating a new one (user1)
2- The below code doesn't seem to fully update the user to the group like /lp user <user> promote <track> would. It deletes the currentgroup, adds the new group node but other plugins do not pick up on the permissions of the new group (For example: Tab prefix doesn't update using the below code)

What am I missing here? Added a paste to the full class under the block.
Any other tips are appreciated!

this.luckPerms.getUserManager().modifyUser(player.getUniqueId(), (User user1 /*Can I use my user here?*/) -> {
    Node node = InheritanceNode.builder(promotionResult.getGroupFrom().get()).build();
    Node node2 = InheritanceNode.builder(promotionResult.getGroupTo().get()).build();
    user1.data().remove(node);
    user1.data().add(node2);
});

https://paste.ofcode.org/PSEDmGSNT8HT3bdNHYVnj3

rustic laurel
#

1- probably, but you should test that
2- tab plugin may not update on change but rather just be scheduling an update. Also be sure to save the user at the end of that codeblock, always have to save the user

hard oar
#

I changed the 2nd param of modifyUser to my previous instance and couldn't get it to work, it doesn't accept it and gives errors.
The tab plugin updates almost instantly on a manual /lp user <user> promote <track>. According to the API docs modifyUser should auto load and save the user after the actions. Nevertheless I tried saving the user agan after the block with no luck

rustic laurel
#

get the user again if it doesn't work for #1, and as for the save, yeah pretty sure you save in the block, as the last action

hard oar
#

Mhm, saving the the user didn't do much.

this.luckPerms.getUserManager().modifyUser(player.getUniqueId(), (User user1) -> {
            Node node = InheritanceNode.builder(promotionResult.getGroupFrom().get()).build();
            Node node2 = InheritanceNode.builder(promotionResult.getGroupTo().get()).build();
            user.data().remove(node);
            user.data().add(node2);
            luckPerms.getUserManager().saveUser(user1);
            luckPerms.getUserManager().saveUser(user);
        });
nocturne elbow
#

Loads a user from the plugin's storage provider, applies the given action, then saves the user's data back to storage.

hard oar
#

Yea that's exactly the player that's supposed to be saved

#

But for some reason it isn't.

#

Maybe there's an underlying reason i'm not aware of in the other parts of the class?

nocturne elbow
#

you're modifying user, not the provided user1 tho

#

why have your own instance of user somewhere else if you're gonna call that method anyway?

hard oar
#

I need to get the PromotionResult, which takes user as a parameter

#
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
        if(user == null){
            plugin.getLogger().severe("User is null!");
            return true;
        }

        PromotionResult promotionResult = ranksTrack.promote(user, ImmutableContextSet.empty());

This part

nocturne elbow
#

then why call modifyUser?

hard oar
#

Because the promotionResult doesn't actually do anything on its own

nocturne elbow
#

??

hard oar
#

Or am I not understanding the concept behind the promotionResult?

nocturne elbow
#

mind showing the whole code snippet?

hard oar
#

This is the full class I'm working in

nocturne elbow
#

Wait so, you're promoting a player and then applying the promotion changes manually?
Doesn't #promote do that for you...?

#

Try saving the user after calling #promote instead of calling #modifyUser (and doing the changes by yourself)

hard oar
#

I'll try that, thanks

nocturne elbow
#

Is the promotion successful tho?

hard oar
#

Yes, it goes to the manual part

nocturne elbow
#

You're not the first person I read saying that #promotion doesn't work as expected... so that's odd

hard oar
#

That seemed to work great, thanks!
One problem I'm experiencing on my dev server (a copy of my live server) is that the String currentGroup always returns to the first group, no matter what group I'm in.
This does not happen in my testserver and I have no idea why. This is how I'm getting the group:

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

Found the issue, thanks for the help !

nocturne elbow
#

oi I was reading :(

#

xd

hard oar
#

Sorry :)

#

Ok nevermind, I did not manage to find the issue yet oO

#

@nocturne elbow Mind if I dm you ?

nocturne elbow
#

yea sure, I don't mind

hard oar
#

So after some more debugging, the promotionResult#promote combined with luckPerms.getUserManager().saveUser(user); doesn't actually seem to save the user.
Other plugins still see the user with their previous rank as its group.
When invoking /lpb user <name> info it does update the user and every other plugin gets the correct group and its info.

Is this a bug with the API or is whatever happens when doing /lp user <name> info something I have to do in my code as well to actually save the user?

tacit roost
#

Many times when I use this method to pull the player's prefix it ends up giving incompatibility in certain APIs of other plugins when determining the player in String, is there another method that is more efficient and effective in the prefix that is?

        Player player = Bukkit.getPlayer(prefix);
        User user = LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId());
        prefix = user.getCachedData().getMetaData(LuckPermsProvider.get().getContextManager().getQueryOptions(player)).getPrefix();
        return prefix.replace("&", "§");
    }```
rustic laurel
#

this may have something that you could take a look at

tacit roost
#

Public use I loved it

lone atlas
#

Does LP have a single event that triggers on a permission update? I've looked at UserDataRecalculateEvent but that triggers multiple times on every single update and I've yet to find a way to tell each event apart.
I'm looking for an event that triggers once when the player joins, and again each time the players permissions are updated, ie changes world, single event. Add a permission, single event.

#

Add a block of permissions, single event.

#

I tested it with a single plugin that that event fired 413 times when a player joined.

jaunty pecan
#

UserDataRecalculateEvent is what you're looking for, it will trigger on every update and doesn't buffer

#

if you want a buffer, then you'll need to implement that yourself

nocturne elbow
#

:0

lone atlas
#

Thanks, but not really what I'm looking for.

#

I was really after somethign that didn;t spam events. Only triggered upon completion of an update

#

Like GM has a GMUserEvent which triggers any time it performs a player.recalc on the permissions

nocturne elbow
#

UserDataRecalculateEvent is what you're looking for
if you want a buffer, then you'll need to implement that yourself
isn't that the answer?

lone atlas
#

Not really Fefo. LP handles perms differently to GM and Bukkit so its behavior is different

nocturne elbow
#

Okay, and what is it you need exactly?

jaunty pecan
#

internally UserDataRecalculateEvent is actually just a cache invalidation, permission (re)calculation happens sometime after when the permissions are actually needed

nocturne elbow
lone atlas
#

Thats what I was afraid of. I'll likely just have to go for a timed check for LP and be less accurate.

nocturne elbow
#

Okay, and what is it you need exactly?

lone atlas
#

unless. Is there a simple way in the userDataRecalculateEvent to see what permission was added/removed?

nocturne elbow
#

NodeMutateEvent?

lone atlas
#

I'm looking for specific permissions being added/removed from a player

nocturne elbow
#

....

jaunty pecan
#

that will cover that - however it won't be called when their effective permissions change

#

e.g. after a world change

#

(there's not any event that will cover that, though)

lone atlas
#

I can alwasy listen on the bukkit events for a world change if LP won;t trigger on that

jaunty pecan
lone atlas
#

Last probable question - will the NodeMutateEvent trigger for a player even if the change is to a group node?

jaunty pecan
#

it will trigger for the group only

lone atlas
#

bum

#

so I'd have to check every group change to see if the player inherits that group

jaunty pecan
#

is there a reason why you need to detect/react to effective permission changes, as opposed to just querying when you need to query?

lone atlas
#

I'm writing a plugin that can issue commands upon nodes being granted or removed

jaunty pecan
#

a repeating task is your best bet imo

lone atlas
#

ie, if someone had a permission node to fly, when the perm expires this plugin can issue a command to switch the player out of that mode

jaunty pecan
#

i've written such a plugin -- timer or just react to the event works fine

lone atlas
#

yep, I already have a repeating task for other permission plugins. GroupManager has an event I can listen on and I was attemptign to implement somethgin similar for LP

jaunty pecan
#

unfortunately the contextual nature of the way LP handles permission queries makes it tricky to react to changes in effective permissions reliably, also not viable for me to provide an event beyond what the DataRecalculate event does already -- so yeah, repeating task is your best bet with LP anyway

lone atlas
#

k, thanks for your help. I'll have a play and see if I can do something with what you have given me.

#

um, silly question. Is that contextUpdateEvent in the release build? I see it on github but I'm not seeing it in 5.1 that I'm building against

#

Yep, I checked in teh 5.1.26 jar and its not in the API

nocturne elbow
jaunty pecan
#

it's due to be added in 5.2

lone atlas
#

ah ok, that explains it 🙂

jaunty pecan
#

but the latest 5.1 builds include it already 🙂

lone atlas
#

I thought my old age was really gettign to me

#

seems its not on maven though

nocturne elbow
#

Is it in the api jar? 🤔 cause I can't find it (I should update my local repo too lol)

jaunty pecan
#

it's not in Maven yet, no

lone atlas
#

ok

nocturne elbow
#

Aa

lone atlas
#

Question, would this code be correct to check if a group is in an inheritanceuser.getInheritedGroups(QueryOptions.builder(QueryMode.NON_CONTEXTUAL).build()).contains(group) And a second question would the returned groups also contain the users main group?

nocturne elbow
#

Yea it brings every group the user inherits directly or indirectly

nocturne elbow
#

!cookbook not for me, don't mind me

frank driftBOT
#

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

nocturne elbow
#

WHAT

#

!help

frank driftBOT
#
Available commands:

!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!cauldron
!chat
!colours
!commandequivalents
!commands
!config
!context
!default
!downloads
!editor
!errors
!essentials
!extensions
!extracontexts
!faq
!helpchat
!inheritance

!install
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!tracks
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki

nocturne elbow
#

unbelievable

#

:i

#

!api

frank driftBOT
nocturne elbow
#

meh..

dim saddle
#

!permissions

frank driftBOT
short fossil
#

Not an api question

snow willow
#

Can I set multiple Groups for players

#

Or why is the GroupSet Methods Name setPrimaryGroup and not setGroup

nocturne elbow
#

@snow willow is there an addGroup

sturdy niche
#

Is it possible to do stuff with the LOG thingy? so i have JDA in my plugin and its connected to a bot. So i want to do so when u create a group it logs to discord.

#

is there an event for logging

#

this log ^^

#

Wow i just explained that so bad xD

wild whale
#

from my very quick looks at the api recently, yes, there is a log event that you can listen to

nocturne elbow
#

Why so many questions in one of the least used channels all of a sudden? .-.

snow willow
#

@snow willow is there an addGroup
@nocturne elbow No

dusky wagon
#

!meta

frank driftBOT
rapid trout
#

Hi! Which event should I listen when a player gets added/removed from a group?

rustic laurel
#

NodeAddEvent I believe

rapid trout
#

Thanks, I'll check it

rustic laurel
#

!api

frank driftBOT
rustic laurel
#

These two pages should have all the info I need (including the link to the javadoc ofc 😄 )

rapid trout
#

I was between using the node add/remove/clear event and the user promote/demote event, I just wanted a second opinion :P

nocturne elbow
#

Promote and DemoteEvent are for tracks, so your application wouldn't, well... apply, if you don't use them.

sturdy niche
#

Okay is it
LogPublish
LogReceive
or logNotify Event.
I want the event that when something is changed (look picture below)
it sends message to discord. The discord thing i know how, but idk the event.

rustic laurel
#

print all three and see which one does what you want when you want

nocturne elbow
sturdy niche
#

Fefo thanks for the video

#

was about to ask

#

xD

#

I have never been into the listener system Luckperms uses

#

so i am trying to learn it :)

#

didnt work :/

#

Something to do with the api thingy

#

i've done smth wrong

#
        at crazynetworkcore.Main.onEnable(Main.java:96) ~[?:?]```
#

Error ^^

#

Line Main: Bukkit.getPluginManager().registerEvents(new LuckPermsLogListener(this, luckPerms), this);

#

Line 15 in logListener: EventBus eventBus = api.getEventBus();

#

Anyone know why it wont work?

#

i most likely did something wrong

#

but i am new to that type of event

crystal sonnet
#

Well hard to say what’s going on when you leave out the most important part of a stacktrace: the exception

sturdy niche
rustic laurel
#

😂

sturdy niche
#

shhhh

crystal sonnet
#

Still missing the exception

sturdy niche
#

its nothing more

crystal sonnet
#

Yes there’s more above it

sturdy niche
#

NullPointer

#

its null

#

uh

#

i probably have done smth

#

wrong

crystal sonnet
#

The first at is on the second line of the stack trace. The first contains the exception

#

I’d say so

sturdy niche
#

NullPointerException

#

it came

#

java.lang.NullPointerException: null

#

but

#

this is correct:

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

Well, when are you calling that?

#

During the onEnable?

sturdy niche
#

no

#

i think i made a mistake

#

since he takes so long

#

xd

crystal sonnet
#

What?

sturdy niche
#

xd

#

is it wrong?

crystal sonnet
#

I don’t know

#

You haven’t answered my question

sturdy niche
#

yes?

#

I have

rustic laurel
#

Well, when are you calling that?

sturdy niche
#

After my onEnable

#

wait wait wait wait

#

WAIT

#

is it supposed to be before onEnable

#

xd

crystal sonnet
#

No

#

During or after

#

Never before

sturdy niche
#

its after

crystal sonnet
#

Which line throws the NPE?

neat jackal
#

Not any Java expert or something, but if the method above gets called, I think nothing happens, you don't set any variables outside the method (or am I blind?)

crystal sonnet
#

That also

sturdy niche
#
        at crazynetworkcore.Events.LuckPermsLogListener.<init>(LuckPermsLogListener.java:15) ~[?:?]
        at crazynetworkcore.Main.onEnable(Main.java:96) ~[?:?]```
#

i have this

#

private LuckPerms luckPerms;

#

LMFAO

sudden pelican
#

you don't set luckperms to anything

crystal sonnet
#

Initialized by magic then I suppose

sturdy niche
#

^^

#

I was hoping for magic to come

crystal sonnet
#

Then you’re frankly doing the wrong thing

sturdy niche
#

my brain is damage and then its called braindead

#

xD

crystal sonnet
#

I think we’re past that

sturdy niche
#

I dont wanna sound like an idiot also

#

so i am trying not to ask to stupid things xd

crystal sonnet
#

I dont wanna sound like an idiot also
@sturdy niche too late

sturdy niche
#

sh**

#

but uh

crystal sonnet
#

Just alone not being able to properly copy a stacktrace was more than enough tbh.

sturdy niche
#

bruh

#

why does this keep happening to me

#

im i so stupid

#

when u get banned from 1 discord then get a meme on another and what next

#

bruh

nocturne elbow
#

I have never been into the listener system Luckperms uses
@sturdy niche the best ways to learn are:

  1. read the damn docs lmao
  2. listen to shit and start printing whatever lol

you'll start learning when and how some things get called

sturdy niche
#

I am reading the docs

#

OKAYT

#

just dont care

#

i guess the api is for advanced for me :/

crystal sonnet
#

why does this keep happening to me
@sturdy niche if this is a regular occurrence, I’d start worrying if I were you

#

And don’t worry

#

You’d have to be several levels stupider before we even consider a ban.

#

To this date I only ever banned one person for being stupid

sturdy niche
#

literally i dont know how i can do stuff

crystal sonnet
#

And oh boy. I could feel my brain cells dying

#

!api

frank driftBOT
sturdy niche
#

i literally made a bot that i can change chatformat from the discord server through the bot

crystal sonnet
#

There’s also the API cookbook with plenty of examples

sturdy niche
#

literally i dont know how i can do stuff
This is for the other message

crystal sonnet
#

Does someone have the link handy?

sturdy niche
#

cookbook

rustic laurel
#

ye

sturdy niche
#

i like cookbooks

#

O.o

rustic laurel
sturdy niche
sudden pelican
#

is the prefix command in the cookbook outdated

crystal sonnet
#

I don’t think so. Why are you asking?

rustic laurel
#

iirc the cookbook was originally written in 5.1

sturdy niche
#

Larry

#

is the discord bot good?

#

like what i did with it

#

that i can change chatformat through the bot

rustic laurel
#

It is indeed a neat idea

sturdy niche
#

i also have a GUI to it ingame

#

with disabling custom commands and enabling or disabling that it sends messages to discord that it disabled or enabled a command.

#

will it work?

#

Will the events work

#

after days

#

of reading cookbook

#

no errors

#

in console

nocturne elbow
#

I say

#

Make !cookbook a thing

sturdy niche
#

cookbook dont work

#

lol

#

new PlayerUsernameChangeListener(this, this.luckPerms).register();

#

thats not working

#

lul

#

or

nocturne elbow
#

Define "not working"

#

!nw

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

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

For Console Errors:
nocturne elbow
#

Lmfao

sturdy niche
#

it gets Null

#

But i did what i was supposed to do

#

EventBus eventBus = this.luckPerms.getEventBus();

#

This gets null

sudden pelican
#

did you define luckperms yet

sturdy niche
#

new LuckPermsLogListener(this, this.luckPerms).register();

#

private LuckPerms luckPerms;

nocturne elbow
#

Send the whole onEnable method

#

Or the LuckPerms parts of it, but as a whole

sturdy niche
#

sorry

#

its long af

#
    private void setupLuckPerms(){
        RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
        if(provider !=null) {
            LuckPerms api = provider.getProvider();
        }
    }```
sudden pelican
nocturne elbow
#

Aaa I see the issue

#

You have a LuckPerms object somewhere in your class
But you assign provider.getProvider() to a local variable, not to the other object

sturdy niche
#

oh

#

wait a second

#

why do i have private void in the starts?

#

is that normal?

nocturne elbow
#

3 things:

#
  1. private means that only an instance of your class is able to see that method
sturdy niche
#

yeah

#

ik

nocturne elbow
#
  1. void means it does t return anything
sturdy niche
#

I literally have no clue why its around there

nocturne elbow
#
  1. I suggest you learn at least the basics of Java (and a bit more won't hurt) before diving deep into the LuckPerms API, since it is just a tad bit advanced
sturdy niche
#

wdym by java

nocturne elbow
#

I-

#

.-.

#

The language

sturdy niche
#

yeah

#

i know

#

but why do you mean by learn the basics?

#

i know java

#

lmfao

rustic laurel
#

That is not exactly apparent by the mistakes you're making

#

Also, please stop spamming, use the space bar instead of enter 😛

sturdy niche
#

im sorry im just used to type like that xd

nocturne elbow
#

Do you? No offense, for real, but seems to me that you don't know it that much.

sturdy niche
#

bye

nocturne elbow
#

👋

rustic laurel
#

Start with this -
https://docs.oracle.com/javase/tutorial/java/concepts/index.html
Breeze through this skipping stuff that doesn't seem relevant like bitwise operators-
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html
and then hit this
https://docs.oracle.com/javase/tutorial/java/javaOO/index.html

They're the first three from this larger thing - https://docs.oracle.com/javase/tutorial/java/index.html
Which you should definitely go through overall. But those three should be enough for slightly better understanding of wtf is happening here without feeling like a huge time sink
That one is a small part of this larger site - https://docs.oracle.com/javase/tutorial/index.html
wherein "Essential Java Classes" and "Collections" also have good useful stuff
along with anything else you'd want of course

nocturne elbow
#

oh god the embeds

rustic laurel
#

@sturdy niche those resources were given to me by mbax, and they've helped a lot. I recommend reading them, you'll probably spot some problems that are easily resolvable

sturdy niche
#

so read all the three links

rustic laurel
#

there are 5

sturdy niche
#

oh

#

i thought the 2 last

#

uhm

#

shhhh

#

im tired

#

its 6 am

rustic laurel
#

They're 'umbrella links' but generally the first three first yes

sturdy niche
#

i'mma take a look through them now

#

and have a look tommorow too when i am more awake :)

rustic laurel
#

there's quite a bit, make sure you're mentally prepared or it's wasted time

sturdy niche
#

wdym by mentally prepared?

rustic laurel
#

have the brain power and not be too tired to understand

sturdy niche
#

oh

#

what timezone are u in Larry

nocturne elbow
#

That's a secret no man should know

sturdy niche
#

xd

#

can u send me the 5 links on dm, Larry? So its easy to find when i wake up :)

rustic laurel
#

better idea: copy paste them and DM them to dyno

#

dyno can be your personal bookmarks collection

sturdy niche
#

or my custom bot

rustic laurel
#

that too

sturdy niche
#

Okay my google home will scream to me tmr

#

😂

#

But do you think i can fix the problem by going through the pages

wild whale
#

Once you understand java basics, the problem should be obvious, and so should the solution

crude blaze
#

I'm having a problem in my server where any member can literally promote theirself to owner or whatever they want. Can someone help me not make them able to do that :P

wild whale
#

!argumentbased

frank driftBOT
crude blaze
#

Found my problem thanks :D

sturdy niche
#

why are u guys using this

#
        if(provider !=null) {
            LuckPerms api = provider.getProvider();
        }```
#

Its something to do with this ^^

#

I think

#

but i am to braindead

#

for coding eitherway

#

so

sturdy niche
#

is the problem easy to see

crystal sonnet
#

Yes the problem is easy to see

sturdy niche
#

im i that stupid

#

can u give me a small hint Brain?

crystal sonnet
#

3rd line

sturdy niche
#

yeah

crystal sonnet
#

What do you do with that variable?

sturdy niche
#

i know its something to do with that

#

Nothing

#

i know

#

but idk what to do with it

#

thats the problem

#

xD

#

I know its not being used

crystal sonnet
#

You're trying to get the instance of the API

#

Here you get the instance of the API but store it in a variable and do nothing with it

sturdy niche
#

but i cannot do something with "api"

crystal sonnet
#

You're not supposed to

#

But maybe you could intialize something else in that spot

#

idk

sturdy niche
#

OH

#

the new thing

#

is going in there too?

#

uhnm

crystal sonnet
#

What new thing?

sturdy niche
#

new LuckpermsListener bla bla bla

crystal sonnet
#

No

sturdy niche
#

oh

#

api.getEventBus

crystal sonnet
#

I thought you have a private LuckPerms luckPerms variable

sturdy niche
#

yes

#

i have

crystal sonnet
#

where is it initialized?

sturdy niche
#

no where?

#

xd

crystal sonnet
#

Ok

lavish chasm
#

Soz for butting in but how would one go about getting a groups parent group?
Since getting the users InheritanceNodes and then getting the groups from them do not display parent groups

sturdy niche
#

i think

#

xD

crystal sonnet
#

So now you have a LuckPerms variable that you want to be initialized that doesn't get initialized and a useless local LuckPerms variable that does get initialized

sturdy niche
#

mhm

crystal sonnet
#

I wonder what you could do about your class variable not being initalized...

#

@lavish chasm API 5.0 or 5.1?

lavish chasm
#

5.1

crystal sonnet
#

Get the group instance and the it has a method to get the parent groups

lavish chasm
#

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

#

wouldn't this work in his case

#

or is my brain dead

crystal sonnet
#

No. You're declaring the variable twice

nocturne elbow
#

It would compile, but wouldn't work as expected

lavish chasm
#

ahh soz yeah

nocturne elbow
#

There we go

crystal sonnet
#

It would compile, but wouldn't work as expected
@nocturne elbow No it wouldn't

lavish chasm
#

yeah it wouldn't I edited it now

lime rune
#

The variable is also null by default

nocturne elbow
#

Yes it would, variable shadowing is a thing

crystal sonnet
#

Yes but not within the same method

lime rune
#

^

crystal sonnet
#

It would compile in C++ iirc

nocturne elbow
#

Well, that api object would still need to be a member variable for you to use it elsewhere 😛 (for some reason) I assumed it already was lol

crystal sonnet
#

Of course

#

If api was also a member variable, that would be shadowing

#

And that would compile

sturdy niche
#

im done with this api 😛

lavish chasm
#

Get the group instance and the it has a method to get the parent groups

            LuckPerms luckPermsAPI = Sponge.getServiceManager().getRegistration(LuckPerms.class).get().getProvider();
            User LPUser = Objects.requireNonNull(luckPermsAPI.getUserManager().getUser(((Player) src).getUniqueId()));
            List<InheritanceNode> groups = LPUser.getNodes().stream()
                    .filter(NodeType.INHERITANCE::matches)
                    .map(NodeType.INHERITANCE::cast).collect(Collectors.toList());
            for (InheritanceNode groupName : groups) {
                Group group = luckPermsAPI.getGroupManager().getGroup(groupName.getGroupName());
}

Something like this then?

lime rune
#

Objects.requireNonNull ?

lavish chasm
#

ignore that xD

lime rune
#

That would still throw NPE

sturdy niche
#

i cannot do shit either way

crystal sonnet
#

im done with this api 😛
@sturdy niche I mean this basic programming. This has nothing to do with the API

sturdy niche
#

i know i know

#

ban me

#

ur prob losing braincells

lavish chasm
#

Yeah I just saw that @crystal sonnet
Group group = luckPermsAPI.getGroupManager().getGroup(groupName.getGroupName());
String primary = group.getCachedData().getMetaData().getPrimaryGroup();

frank driftBOT
#

Hey kristi71111 | BacoNetworks! Please don't tag helpful/staff members directly.

nocturne elbow
#

That would still throw NPE
@lime rune that's the whole point of rnn lol

lavish chasm
#

this should work

#

right or am I drunk

sturdy niche
#

is codecademy good?

lavish chasm
#

I'll do it the docs way nvm

crystal sonnet
#

Yes but I don't quite know what you're trying to do @lavish chasm

lavish chasm
#

Basically I'm making a prefix selector.
So I need to know all groups the player has and then get the prefixnode if it exists

crystal sonnet
#

Ok. In that case get the groups

lavish chasm
#

getInheritedGroups would return all the groups the person has?

crystal sonnet
#

Yes

lavish chasm
#

Thanks for the help 🙂

crystal sonnet
#

And you pass user.getQueryOptions() as the parameter

#

You're welcome

sturdy niche
#

Brainstone

crystal sonnet
#

Yes?

sturdy niche
#

is codecademy good?

crystal sonnet
#

I don't know

sturdy niche
crystal sonnet
#

Looks ok

#

You can skip the XML stuff btw

sturdy niche
#

so this part:
5 50 27 - XML using DOM, SAX, and StAX parser
in Java
5:56:15 - Introduction to XML
5:57:44 - Demo - To Read From and Write To a File
6:17:51 - Reading and Writing File Objects
6:21:40 - Demo - XML File
6:25:33 - XML File Tree Structure

lavish chasm
#

I got it all working now. Thanks again 😄

lime rune
#

@nocturne elbow yes Ik although it felt out of context to have it there.

crystal sonnet
#

Yes Stilau

sturdy niche
#

is it nessecary to look through all 10 hours?

crystal sonnet
#

You're welcome @lavish chasm

lime rune
#

Consider a normal null check would probably be better as far as I can see it

nocturne elbow
#

rnn doesn't magically de-nullify your object lol that'd be awesome, it's mostly used for when writing interface code.

#

Doesn't stop you from using anywhere else tho

#

¯_(ツ)_/¯

crystal sonnet
#

I mean the most important thing is practice anyways @sturdy niche

sturdy niche
#

how can i practice when i am stupid?

lime rune
#

Fefo I don’t really see your point but that’s correct

crystal sonnet
#

By just programming

lime rune
#

Read others code

obtuse jolt
#

and read documentation lol

wild whale
#

Don't just read code though, try experimenting i.e. could download a simple, public plugin (something like supervanish comes to mind). Try tweaking some lines and see how it responds

lime rune
#

Yes reading code purely out of context isn’t smart but it’s generally good to see how other people is structuring code and solving problems.

#

It can give inspiration and also more knowledge.

wild whale
#

Plus if you don't understand it you're just overwhelming yourself without learning anything

stiff crystal
#

anyone here know how to take away an rank for an set ammount of time

rigid void
#

whats the replink to use in gradle

#

the rep

wild whale
#

!api should be here

frank driftBOT
rigid void
#

should add the repo and depencie

lime rune
#

Plus if you don't understand it you're just overwhelming yourself without learning anything
@wild whale you know that you can ask and Google stuff you don’t understand right?

frank driftBOT
#

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

rigid void
#

uh oh

#

I smell a ban

wild whale
#

In this case since they didn't understand even basic programming concepts, don't think that would help

#

and no, you don't get banned for pinging helpful people provided you aren't spamming it

#

(I usually don't mind anyways)

rigid void
#

wait don't I need a repo for this

lime rune
#

That’s true although I don’t think someone would read advanced code if they don’t understand the basics atleast. Well my point wasn’t really that you should go straight away to nasas open source and try to learn everything from it.

wild whale
#

I mean if you don't understand something as basic as variable scope, you probably shouldn't be using the LP api (or spigot for that matter), yet here we are