#luckperms-api

1 messages · Page 28 of 1

cold panther
#

What's your current code?

polar walrus
#

this is now the main thing under need there will be createt a scoreboard

#

well sorry for bad spelling

cold panther
#

It's all good. Move this into either your createBoard method or a separate method

polar walrus
#

now you say no

#

well this is all new for me so don't judge me plzz 😩

cold panther
#

It's fine 😛 In the code I gave, this.luckperms is your API instance

#

It should be in your onEnable method

polar walrus
#

so were do I need to paste that bukkit sinstance

#

well now I get this error

cold panther
polar walrus
#

man you are the best if this works

cold panther
#

That is only the luckperms stuff, none of your scoreboard stuff

polar walrus
#

I see

#

only I get one error

#

CachedMetaData metaData = this.luckperms.getPlayerAdapter(Player.class).getMetaData(player);
String prefix = metaData.getPrefix();

#

on the underlind thing I get a error

cold panther
#

Are you using gradle or maven?

polar walrus
#

as a plugin maker eclipse

#

if that is what you mean

cold panther
#

yeah, does your plugin have a build.gradle or a pom.xml file?

polar walrus
#

I need to be fear I don't know XD 😅

#

lol fear fair

cold panther
#

Can you screenshot your file explorer in eclipse? Should be on the right and show all of your plugin files

#

That error means you're using an outdated version of the API, so we need to change it wherever you're downloading the dependency

polar walrus
cold panther
#

Oh okay, did you manually download the API jar?

polar walrus
#

yes the api-5.o.jar l

#

we are running luckperms v 5.0.27

cold panther
#

Ah, is there anyway you can update to the latest? API 5.1 is better in terms of functionality

polar walrus
#

well than I will donwoald that one

cold panther
#

It is possible with API 5, it's just a lot more work

polar walrus
#

well downloaded the 5.1

#

and error is gone

#

now to set the prefix of a player just do + prefix

#

in the score

#

It does not work 😂

#

somone help 🙀

cold panther
#

What's it not doing exactly?

polar walrus
#

well that doesn't load

#

I have insert the api in the server

cold panther
#

Did you insert the API or are the actual LuckPerms-Bukkit jar?

polar walrus
#

both

cold panther
#

Can you show me a screenshot of your LuckPerms jar in your plugins folder? Also remove the API jar, it does nothing on the server

polar walrus
#

ok

cold panther
polar walrus
#

well that I need to discuse with the server team but when I replace it will al config's stay?

#

lil groups and that

cold panther
#

everything will stay

polar walrus
#

ok

cold panther
#

No storage and configs are ever wiped by updates, we simply overhaul some internal to make it more performant

polar walrus
#

ok well I discustet it with the team and it is good only befor I can insert the new verion I need to wait a little they are busy making a MySQL for a plugin

#

it works man thanks 👍

#

3 days of self trying and losing a headset

cold panther
#

Oooof, no problemo 🙂

polar walrus
#

I have a other question

#

how can i make a time and date display in the scoreboard

cold panther
polar walrus
#

I found that one to but don’t know how to import that to a score and not as title

timid hearth
#

Is there a maven where you can grab the LP sponge/spigot/velocity artifacts or is that published on central?

polar walrus
azure latch
crystal sonnet
#

@timid hearth why do you need those artifacts

boreal eagle
#

How I do temporarily give someone a group through the API?

neat jackal
#

Add an InheritanceNode and add an expiry time

cold panther
boreal eagle
#

@cold panther Thank you

frank driftBOT
#

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

timid hearth
#

The idea was I could have the impl artifacts so I can test in dev

#

But only as runtime

#

I'd still depend on api for compile

jaunty pecan
#

sorry, they aren't published anywhere

#

you can get them into your maven local tho ofc with gradle install

wicked kiln
#

how do i check what permissions there in

crystal sonnet
#

What?

cold panther
#

Yeah, what exactly do you mean by 'what permissions there in'?

wicked kiln
#

how do i check what permissions they have

crystal sonnet
#

Who?

#

What do you want to do?

wicked kiln
#

im trying to check if they don't got any permissions i setup then they open a gui. It's bungee

crystal sonnet
#

Are you trying to do that with the LP API?

wicked kiln
#

yes

crystal sonnet
#

And if you manage to open a GUI on the bungee, let me know how you do it

#

I haven't found a way except using a bridge

#

But in any case check their nodes

#

There should always be one: the default group inheritance node

#

So you need to account for that

#

!api

frank driftBOT
wicked kiln
#

What is it under?

wicked kiln
#
public boolean hasPermission(User user, String permission) {
    ContextManager contextManager = api.getContextManager();
    ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);

    CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
    return permissionData.checkPermission(permission).asBoolean();
}``` Where do i put the permissions at
neat jackal
#

It is a method

midnight cape
#

Hey can some one help me out? i made my own plugin, a custom join plugin, But LP is doing something weird to the custom plugin, (If some one joins it takes a couple of seconds to load their prefix idk why, but that ruines my custom plugin idea, because i have it like

"welcome back "displayed name"

but if they join they get "welcome back jeffry"
and if they leave its "good bye Owner Jeffry" so? Idk why the leave works but the welcome not ? if they join, Can i do something about this or ?

wild whale
#

Not an expert, but I suspect display name isn't being calculated before it fires the join event. Try sticking some delay before getting the display name, and see if that works

midnight cape
#

but i search and search but no one or nothin lead me to the my destany, so. does some one know a code to let the welcome message later ?

neat jackal
#

Do you use displayname from the Spigot APi?

midnight cape
#

i use just from LP, with placeholder and vault, (ess also)

#

This is my code of the welcome message, But idk how to let the message com 5 seconds later, or something, or let LP think faster ?


public class PlayerJoin implements Listener{


    @EventHandler (priority = EventPriority.LOWEST)
    void onPlayerJoin(PlayerJoinEvent e){
        Player player = e.getPlayer();
        e.setJoinMessage(ChatColor.GOLD + "" + ChatColor.BOLD + " Welcome to our Skyblock Comunity ! " + ChatColor.WHITE + " " + ChatColor.BOLD  + player.getDisplayName());
    }


}

neat jackal
#

Maybe try the LuckPerms API directly?

midnight cape
#

ohw do you mean ?

cold panther
#

What makes you think this is happening because of LuckPerms? LuckPerms loads the player data before the PlayerJoinEvent is fired, meaning that whenever any plugin attempts to query a user's data, data is always ready

wicked kiln
#

What you mean it's a method? ```java
public boolean hasPermission(User user, String permission) {
ContextManager contextManager = api.getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);

CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
return permissionData.checkPermission(permission).asBoolean();

}```

midnight cape
#

What makes you think this is happening because of LuckPerms? LuckPerms loads the player data before the PlayerJoinEvent is fired, meaning that whenever any plugin attempts to query a user's data, data is always ready
@cold panther Ahh dev. forum wat i am waiting for 2 days, they told me that it might be this, but idk ?

frank driftBOT
#

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

neat jackal
near oracle
#

Trying to use the luckperms api using kotlin

azure latch
#

Why use the LP API for permissions checks when player.hasPermission("permission.node"): exists?

near oracle
#

but running into an issue

#
val provider: RegisteredServiceProvider<LuckPerms> = Bukkit.getServicesManager().getRegistration(LuckPerms.class));
wicked kiln
#

katsumag

near oracle
#

Anyone know how to fix this?

wicked kiln
#

mainly bc errors

#

like bungee

#

and stuff

azure latch
#

Well yeah, that's not going to work on bungee. Though I'm fairly sure their ProxiedPlayer has a similar method. If not then yeah use the API, it's just simpler not to on Bukkit servers at least

wicked kiln
#

what you mean proxiedplayer?

azure latch
#

Its Bungeecords version of the Player class

#

It has a hasPermission method

wicked kiln
#

well yeah but its a spigot plugin

azure latch
#

🤦 so why mention Bungeecord then?

wicked kiln
#

well ill send you the error if you want me to

azure latch
#

Just use Player.hasPermission on bukkit/spigot/paper, and ProxiedPlayer or another one of Connection's child classes .hasPermission on Bungee. No, if you're making a spigot plugin, why do I want to see a Bungeecord error?

wicked kiln
#

well i it's null and i heard that it was because of permissions so i assuemed that was because of luckperms being bungeecord

#

it's null in spigot

azure latch
#

Uh how

wicked kiln
#

¯_(ツ)_/¯

azure latch
#

The only way a hasPermission check can throw an NPE is if your player object is null

#

Which is very hard to achieve

#

Show me your code

wicked kiln
#
    @EventHandler
    public void join(PlayerJoinEvent event) {

        Player player = event.getPlayer();
        boolean Europe = !player.hasPermission("Continent.Europe");
        boolean Asia = !player.hasPermission("Continent.Asia");
        boolean Africa = !player.hasPermission("Continent.Africa");
        boolean Australia = !player.hasPermission("Continent.Australia");
        boolean NorthAmerica = !player.hasPermission("Continent.NorthAmerica");
        boolean SouthAmerica = !player.hasPermission("Continent.SouthAmerica");
        boolean Antarctica = !player.hasPermission("Continent.Antarctica");
        if (Europe && Asia && Africa && Australia && NorthAmerica && SouthAmerica && Antarctica) {
            player.openInventory(gui);
        } else player.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You already picked a contienect");
    }```
azure latch
#

Why are you inversing every permission check?

#

Also read the error, which line of that throws the NPE

wicked kiln
#

Hold on let me boot back up the server and delete the other code to check

#

Why im inversing ever permission check is because i want to check if they don't got any permission that i setup. Then they need to pick a Continent

azure latch
#

Yeah but you could just inverse the check, not each individual permission.

oak badger
#

you could also nitpick on the fact that he's capitalising java variable names rather than camel casing

#

or the second else not having brackets even though the if does

#

😛

wicked kiln
#

my pc is so laggy rn lol

#

opening the gui is the null part

misty hinge
#

@wicked kiln why is ur line so weird

#

} else player.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You already picked a contienect");

#

shouldnt be like that

#

at all

#
    @EventHandler
    public void join(PlayerJoinEvent event) {

        Player player = event.getPlayer();
        boolean Europe = !player.hasPermission("Continent.Europe");
        boolean Asia = !player.hasPermission("Continent.Asia");
        boolean Africa = !player.hasPermission("Continent.Africa");
        boolean Australia = !player.hasPermission("Continent.Australia");
        boolean NorthAmerica = !player.hasPermission("Continent.NorthAmerica");
        boolean SouthAmerica = !player.hasPermission("Continent.SouthAmerica");
        boolean Antarctica = !player.hasPermission("Continent.Antarctica");
        if (Europe && Asia && Africa && Australia && NorthAmerica && SouthAmerica && Antarctica) {
            player.openInventory(gui);
        } else {
            player.sendMessage("" + ChatColor.RED + ChatColor.BOLD + "You already picked a contienect");
        }
    }

this is how it should be

wicked kiln
#

what is the issue with it?

#

why does it matter?

misty hinge
#

that line wouldnt make any sense

#

bc it doesnt close ur else statement

oak badger
#

it's valid syntax but no one writes java code that way so it's just confusing that's all

misty hinge
#

everyone uses that

#

lol

oak badger
#

i meant not using brackets

neat jackal
#

that's confusing?

oak badger
#

blocks are required there if there is more than one line of code

#

maybe not confusing, just unorthodox lol

#

you can easily read over it but it's not standard java formatting

#

especially having a mix of brackets / no brackets

strange igloo
#

Hello. I have a problem with newest version of LuckPerms. This plugin crashed my server. I'm from Russia. Sorry for my English...
Please, help!!!

#

My server on 1.12.2

rustic laurel
#

not a devapi question right

slim willow
#

This is the 3/4 time i ask and I couldn’t find a fix or a way around it ..

#

How to give player a rank for sepcfic time with command ( in my plugin ) or using api ..

slim willow
#

Really helped thx!

slim willow
#

using latest ver api

#

.-.

#

any help?

#

...

neat jackal
#

Add a ); at the end

slim willow
#

my whole code

#

is broken

#

thx allot for who ever told me to upgrade 😄

#

to latest api

#

this error

#

this error

#
  • iam not that good with the new api
#

:L

#

anyone help me pls ?

#

i must open my network today

#

anyone could give me an example for this?

#

but 4.4.1 ?

#

i tried make it with 4.4.1 ver but didnt have any luck ..

#

And luck is here 😐

slim willow
#

Still waiting for help ..

cold panther
#

This is an example for how to add a temp group on 4.4. However, you need to get your code to work on 5.1 eventually. 4.4, and the legacy extension, will not be around forever.

quick python
#

Hi, I'm trying to change players prefix color with a command and I was wondering if there's a function that allows me to change the prefix.

neat jackal
quick python
#

Thanks! one more question, is it possible to save it on restart?

cold panther
#

If you're saving changes, or you're using a method which automatically saves changes (Such as UserManager#modifyUser), there should be no risk of data being reverted on restart

quick python
#

Alright thanks!

acoustic dome
#

I don't know where to ask this, so I'll just ask here. I am working on a plugin and want to change the way I store data. I want to move from multiple .json files to a single .db file. I have seen a couple of plugins using such files but haven't found any tutorial about it anywhere, but I know Luck Perms uses this data storage system. It would be quite cool if anyone could help me learn how to create such a data storage system/tell me how Luck Perms did it. Ty =D

dull rover
#

So just change from JSON to SQLite?

acoustic dome
#

yeah, but what I've seen so far always required a web part and where the data would be stored online, or it would require something else downloaded.

dull rover
#

O.o

acoustic dome
#

maybe I just didn't find the right sources, but I would be interested in how luck perms did solve this.

dull rover
#

Well the web stuff you might see in LP is probably due to the Web Editor.

#

If you're trying to just change JSON stuff to MySQL, load in the objects in JSON and then serialize what you need to SQL

acoustic dome
#

I have to work out how the SQL things work first before I move the data over from JSON, which is my problem rn.

neat jackal
#

No idea how SQLite works, but if speaking about SQL in general, it are all just tables with columns and rows.

{
      "some_table": {
            "key": "value"
      }
}

Could be a table called some_table with column key and a row with value value

SQL even has a JSON datatype.

dull rover
#

It does, yes. I use it.

acoustic dome
#

I've heard about the basic layout of SQL and I'm sure I'll be able to find tutorials about all of it, but I'm not that far yet sadly.

dull rover
#

As long as you don't need to pull the data from another location at the same time, you should be able to use that.

quick python
#

I'm trying to change the prefix color with a GUI I made but for some reason it doesn't change the prefix color and removes it from the tab list. Any of you might know why?

            User user = luckPerms.getUserManager().getUser(uuid);
            CachedDataManager cachedData = user.getCachedData();
            CachedMetaData metaData = cachedData.getMetaData();
            String prefix = metaData.getPrefix();
            if (prefix == null) {
                sendMsg(p, "errors.noPrefix");
            }
            String newPrefix = "";
            String[] validColorCodes = {"&f", "&6", "&d", "&b", "&e", "&7", "&3", "&9", "&a", "&c", "&8", "&6", "&5", "&4", "&2", "&1"};
            for (String s : validColorCodes) {
                if (prefix.contains(s)) {
                    UserManager userManager = luckPerms.getUserManager();
                    newPrefix = prefix.replaceAll(s, rankColor);
                    user.data().clear(NodeType.PREFIX::matches);
                    Map<Integer, String> inheritedPrefixes = user.getCachedData().getMetaData(QueryOptions.nonContextual()).getPrefixes();
                    int priority = inheritedPrefixes.keySet().stream().mapToInt(i -> i + 10).max().orElse(10);
                    Node node = PrefixNode.builder(newPrefix, priority).build();
                    user.data().add(node);
                    userManager.saveUser(user);
                    break;
                }
            }
            sendMsg(p, "rankColor.messages.done", "%rank%", newPrefix);
polar walrus
#

Hi there I am making a scoreboard that shows rank and money and a date and time But this scoreboard need to update every sec how can I do thath
https://paste.md-5.net/lisepugitu.java this is the link to my code

stuck slate
#

this is not for help with developing plugins

#

this is for help with working with LuckPerms Developer API©

polar walrus
#

ok sorry man I only trying to make a plugin

heavy elk
#

Hi, i try to get a user permission from a user but only from the group it is in and without the parent groups.

#

someone an idea

neat jackal
#

User#data and then NodeMap#toMap maybe?

mighty axle
#

hey

#

so I have the vanish plugin on my server...how could i give the /gmsp command for staff members?

#

(Please mention me if you need me/if you need my attention) I dont mind

polar walrus
#

I have a question what database manager would you prefer MySQL or mariaDB ?

#

For a bungeeCord server 1.15.2

#

Spigot

tacit roost
#

MongoDB

#

but answering your MySQL question

jaunty pecan
#

@polar walrus If you have a choice on which package to install go with mariadb

#

but if not don't worry, either is fine

polar walrus
#

Well I am jusing amp to run my server

#

and if I am right it juses mariaDB

lilac mountain
#

Is there anyway of setting a prefix/suffix. I can get it but I want to set it now through the api because right now I'm just making console run the command in my plugin

cold panther
opal temple
#

Hello there 🙂 i have a Question how can i add a player do a group?

#

this is what i tried so far

#
    public void addGroup(LuckPerms luckPerms, Player p){
        Group verified =  luckPerms.getGroupManager().getGroup("bürger");
        UUID id = p.getUniqueId();
        User u = luckPerms.getUserManager().getUser(id);
        Bukkit.getServer().broadcastMessage("1");
        DataMutateResult r = u.data().add(Node.builder("group.bürger").build());
        Bukkit.getServer().broadcastMessage("a");
        luckPerms.getGroupManager().saveGroup(verified);
        Bukkit.getServer().broadcastMessage(luckPerms.getGroupManager().getGroup("bürger").getWeight().toString());
    }
lilac mountain
#

Thank you @cold panther :D

frank driftBOT
#

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

cold panther
#

@opal temple you aren't saving the user with luckperms.getUserManager().saveUser(u);

#

Also, remove all your group stuff. You don't need to mess with actual groups when adding a group to a user

opal temple
#

I tried this but this dosent work too

#

i swear xD

#
    public void addGroup(LuckPerms luckPerms, Player p){
        Group verified =  luckPerms.getGroupManager().getGroup("bürger");
        UUID id = p.getUniqueId();
        User u = luckPerms.getUserManager().getUser(id);
        Bukkit.getServer().broadcastMessage(luckPerms.getGroupManager().getGroup("bürger").getWeight().toString());
        DataMutateResult r = u.data().add(Node.builder("group.bürger").build());
        Bukkit.getServer().broadcastMessage(luckPerms.getGroupManager().getGroup("bürger").getWeight().toString());
        luckPerms.getUserManager().saveUser(u);
        luckPerms.getGroupManager().saveGroup(verified);
        Bukkit.getServer().broadcastMessage(luckPerms.getGroupManager().getGroup("bürger").getWeight().toString());
    }
crystal sonnet
#
Bukkit.getServer().broadcastMessage(luckPerms.getGroupManager().getGroup("bürger").getWeight().toString());
#

That's what's printing that

#

And you should use an InheritanceNode to add a group

opal temple
#

i know what is printing that 😄

#

Okey thank you so much

crystal sonnet
#

The question is why are you printing it?

#

And why are you printing it thrice?

#

And as mentioned before you're not modifying the group so don't save it

opal temple
#

i dont really know why

crystal sonnet
#

Me neither

opal temple
#

🙂

lilac mountain
#

Is there a new api update or something because looking at the cookbooks setprefixCommand has java api.getUserManager().modifyUser(player.getUniqueId(), (User user) -> {
but modifyUser doesn't exist? I'm using maven with the api version 5.0 if that matters

cold panther
#

Yeah, API 5.1 now exists

lilac mountain
#

oh ok well that wiki page is out of date xD

polar walrus
#

!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

polar walrus
#

!bungee

frank driftBOT
sharp birch
#

!api

frank driftBOT
edgy onyx
#

hello. so i'm using luck perms in a global way, and I was wondering if it is possible to get a player's group who is in a different server to the one that is requesting the group?

crystal sonnet
#

Just load the user instance with the user mananger

edgy onyx
#

that's what im doing

#

user instance then using cachedmetadata

#

unless i shouldn't use cachedmetadata?

crystal sonnet
#

That's fine

edgy onyx
#

yeah but its throws an error when the player aint in the server saying there is no value present

crystal sonnet
#

What error

#

And what's your code?

#

And why do I have to ask?

edgy onyx
#

i told you the error

#

and the code is

#
    public static String getPlayerPrefix(UUID player) {
        User u = getLuckPermsUser(player);
        CachedMetaData metaData = u.getCachedData().getMetaData(LuckPermsProvider.get().getContextManager().getQueryOptions(u).get());
        return (metaData.getPrefix() == null ? "§7" : ChatColor.translateAlternateColorCodes('&', metaData.getPrefix()));
    }
crystal sonnet
#

I mean the full error message

edgy onyx
crystal sonnet
#

I need that method getLuckPermsUser(player);

edgy onyx
#

LuckPermsProvider.get().getUserManager().getUser(player);

#

player being a UUID

#

in this case

crystal sonnet
#

I said you need to load the user

#

Not get it

edgy onyx
#

and you would do that how?

crystal sonnet
#

getUser(player); -> loadUser(player);

edgy onyx
#

thank you

crystal sonnet
#

Which line is 113 in that file btw?

edgy onyx
#

CachedMetaData metaData = u.getCachedData().getMetaData(LuckPermsProvider.get().getContextManager().getQueryOptions(u).get());

#

i know i should use the orelse methid

#

instead of get

#

but ¯_(ツ)_/¯

crystal sonnet
#

That's throwing your error btw

#

Just saying

edgy onyx
#

yeah i know

crystal sonnet
#

If you're using the v5.1 API there's a better method to get the query options

edgy onyx
#

oh yeah?

crystal sonnet
#

And if you know why are you asking then?

edgy onyx
#

no i dont mean it like that

#

i mean it as in no please tell me

crystal sonnet
#

The User object should have a getter for query options

#

yeah i know
and
no please tell me
Are polar opposites

edgy onyx
#

...

#

i said yeah i know too why my error was being thrown

#

and no please tell me to the better method

crystal sonnet
#

The User object should have a getter for query options

#

I see

edgy onyx
#

and i read that

#

thank you

crystal sonnet
#

You're welcome

neat jackal
#

@crystal sonnet

crystal sonnet
#

?

neat jackal
#

Nothing. Just my phone again, I apologize

crystal sonnet
#

kills phone

neat jackal
#

It's a new one, and bigger than my last one. So where on my last one was so called air, is now the send button

near oracle
#

I'm trying to use the luckperms api:

//onEnable:
val perms: LuckPerms? = getRegistration()
        if (perms != null) {
            Bukkit.getPluginManager().registerEvents(OnMessageHandler(perms), this)//Register async chat event.
        }

//getRegistration:
    private inline fun <reified T> getRegistration(): T? {
        return Bukkit.getServicesManager().getRegistration(T::class.java)?.provider
    }
#

it's never registering the chat event.

#

so somehow the api is null

#
import me.minideathstriker.plugin.handlers.OnJoinHandler;
import me.minideathstriker.plugin.handlers.OnMessageHandler;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import me.minideathstriker.plugin.commands.cmd.*
import net.luckperms.api.LuckPerms```
#

imports

#

I'm hard depending on LuckPerms

#

if you know a solution, please @ me. I'm off to bed

obtuse jolt
#

with LP dev api or?

rustic laurel
thorny harbor
#

oow sowwy

near oracle
#

with LP dev api or?
@obtuse jolt yes

frank driftBOT
#

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

near oracle
#

ohh

#

my b

#

it just always seems to return null

rustic laurel
#

@near oracle sorry about the confusion; the person ben was talking to very strangely deleted their messages

near oracle
#

ohh, all good

#

still confused why the api is null

#

even tho it's in knownServices

rustic laurel
#

if i knew id tell ya

near oracle
#

Yeh 😄

#

no one seems to know 😂

rustic laurel
#

BrainStone might, when he comes online. We'll see

soft harbor
#

I believe luckperms is being transitively included in the output jar.

#

If luckperms is present in the plugin jar I believe the class loader will prefer the local copy rather than checking the parent classloader

#

Solved

near oracle
#

Solved indeed.

native dawn
#
        PermissionNode node = PermissionNode.builder("group.skyblock-islandcreated").withContext(DefaultContextKeys.SERVER_KEY, "skyblock").build();
        User user = api.getUserManager().getUser(String.valueOf(event.getPlayer()));
        user.data().add(node);
        api.getUserManager().saveUser(user);```

Is this the correct way to add a permission node to someone?
crystal sonnet
#

screams
getUser(String.valueOf(event.getPlayer()))

#

This is wrong on so many levels!

#

Alright. First of all use the InheritanceNode, not the normal PermissionNode

#

Second, load the user by their UUID, not their name

#

Not only is that faster but also more reliable.

tropic walrus
#

Hey can someone help me? Im extremly new and I have no clue what Im doing

#

Im trying to make a server for a couple friends so we can play survival but I need to know how to give their groups permissions to do certain things

turbid solar
azure latch
#

screams
BrainStone I remember you used to be so serious, like absolutely unbreakable. Sometimes I really do think you're on something in these rare glimpses of emotion

rustic laurel
#

Can confirm

#

High doses of whale tranquilizer

oak badger
#

being serious isn't a bad thing, in fact the thing that i probably most like about brainstone is that he can be taken so seriously

#

you gotta remember that he's also a person though like anyone else lol (not a 🤖 )

#

discord differentiates between the two with the BOT tag

jaunty pecan
#

sometimes*

#

those darn irc bridge bots

oak badger
#

i thought webhooks are still labeled as bots

#

also let's not discuss selfbots lol

jaunty pecan
#

they do!

#

i'm referring to discord bots (like the ones in Paper etc) which send messages between discord and an irc channel

oak badger
#

oh i see what you're saying

#

you think that there are people who actually use IRC?

#

no thats just the bot

#

(jk of course lol)

neat jackal
#

Did you know that... LuckPerms has it's own IRC channel?

oak badger
#

let me be clear that i dont hate irc i just like making dumb jokes

azure latch
#

Larry where can I get your finest whale tranquilizer

#

Also a wild Luck

#

A rare sight

#

What have we done to deserve this honour

crystal sonnet
#

@azure latch I try to be serious when necessary. But I joke around quite a lot

#

I mean I almost typed

THE ONLY EMOTION I KNOW IS FEAR

#

But wasn't quite in the mood for that

azure latch
#

Oh come on, like the PAPI server has clips and cubes pings, we need BrianStone and Lucks pings

#

I'd sub to that

crystal sonnet
#

Additonally I have a very very German sense of humor. Which consists of lots of sarcasm. Issue with sarcasm is that it often doesn't come across online

#

Which makes me seem even more serious xD

azure latch
#

True

#

We still need a dedicated channel for you to release your feelings while your on Larry's whale tranquilizer ( I'm sticking with this ok), it can be quite a ride

crystal sonnet
#

This is as close as it gets

#

Or well

#

Which we should use to be fair

rustic laurel
#

Geez guys

azure latch
#

Did you just tell me to use that channel and make a point at the same time? Omg, his admin side is truly growing

crystal sonnet
#

👌🏼

toxic marlin
#

How can I check if a player is in the group "abc"?

rustic laurel
#

!API should have what you need- if you try what is there and cannot figure it out, please provide what you tried and what you want it to do

frank driftBOT
toxic marlin
#

Man, I feel dump now. Its legit the first entry in the wiki....

#

Thx for bringing that up 👍

tacit roost
nocturne elbow
#

hi

crystal sonnet
#

!ask @nocturne elbow

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Why shouldn't I ask to ask?
bright badger
#

How to make luckperms know about sub command permissions? They might be created dynamically like warps (warp.hub or warp.house)

crystal sonnet
#

Just check them

bright badger
#

How?

crystal sonnet
#

By performing normal permission checks

oak badger
#

luckperms indexes them as they are used, you can pre-register any static ones by listing them in plugin.yml

dapper jetty
#

Is this the right way to add roles? I didn't found more simple way to do this.

user.data().add(Node.builder("group." + group.getName()).build());
api.getUserManager().saveUser(user);
api.getGroupManager().saveGroup(group);
manic kraken
#

Hi,

#

I used Jobs plugins and Luckperms for add and remove permission, a friend have created a plugin but when i add a permission i have world context, sorry for my language i am french

#

I need to post a pastebin with the class inside ?

crystal sonnet
#

@dapper jetty you don’t need to save the group and use an InheritanceNode (just put the group name in the builder)

#

@manic kraken I mean yes. How else are we gonna help you?
We’re not psychic

manic kraken
#

Hi, thx for your help i post pastebin now

#

So when i leave a jobs they can't delete permission of Luckperms

#

If i join, the create a permission with a context: world=world

#

Like that

#

So, i can delete perm only with context world: world

#

@crystal sonnet Thx for you help

frank driftBOT
#

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

crystal sonnet
#

I’ll take a look shorty

manic kraken
#

Thx ^^

crystal sonnet
#

@manic kraken so you are asking how to implement perms.playerRemove(p, s);?

manic kraken
#

I want to add perm yes but it's was automaticly add the context of the world

#

Add and remove perm

crystal sonnet
#

Did you check here?

#

!api

frank driftBOT
manic kraken
#

I am not a developer so i can learn little

crystal sonnet
#

So you were expecting me to write the code for you?

manic kraken
#

Can you ? ^^
If you could it would be really cool

crystal sonnet
#

That's not how this works

manic kraken
#

I know but i am not a developer :/ Not a good

crystal sonnet
#

Doesn't mean you can just go to support Discords expecting people to code the stuff you need for you

manic kraken
#

I know, so for the context i need to see the api ?

crystal sonnet
#

Yes

swift sand
#

!api

frank driftBOT
swift sand
#

Hello guys, I am looking for something. I just updated my luckperms from really old api to the v5 api. and I am trying to get my old methods to work. I was wondering how I can check if user is in a track.

My old method was


    @Override
    public boolean isStaff(UUID uuid) {
        User user = this.getPermissionUser(uuid);
        if (user == null || user.getAllNodes().isEmpty()) {
            return false;
        }
        return user.getAllNodes().stream()
                .filter(Node::isGroupNode).anyMatch(node -> getLuckPermsApi().getTrackManager().getTrack(node.getGroupName()).getName().equalsIgnoreCase("staff"));
    }

    @Override
    public boolean isDonator(UUID uuid) {
        User user = this.getPermissionUser(uuid);
        if (user == null || user.getAllNodes().isEmpty()) {
            return false;
        }
        return this.getPermissionUser(uuid).getAllNodes().stream()
                .filter(Node::isGroupNode).anyMatch(node -> getLuckPermsApi().getTrackManager().getTrack(node.getGroupName()).getName().equalsIgnoreCase("donator"));
    }

this is what I have now but doesn work.

public static Boolean isDonator(UUID uuid) {
        LuckPerms plugin = LuckPermsProvider.get();
        User user = plugin.getUserManager().getUser(uuid);
        Objects.requireNonNull(uuid, "uuid");
        Set<String> groups = user.getNodes().stream()
                .filter(NodeType.INHERITANCE::matches)
                .map(NodeType.INHERITANCE::cast)
                .map(InheritanceNode::getGroupName)
                .collect(Collectors.toSet());
        return groups.contains("donator");
    }```
crystal sonnet
#

@swift sand what doesn't work about this?

swift sand
#

Somehow its not getting the the track donator

#

I am trying to check if user is in track donator or not

crystal sonnet
#

InheritanceNodes are group assignments

#

So why would checking if a user has a group called "donator" be checking if they are in a certain track?

#

In any case if you can use API v5.1, then there are better methods to get the groups of a player

swift sand
#

Can you give me an example? I am not really a dev. I am just fixing some issues on a plugin of mine

#

That a dev made for me once

crystal sonnet
#

Get the groups in the track and see if any of the groups a player has are in that list

wind token
#

One message removed from a suspended account.

#

One message removed from a suspended account.

cold panther
#

That's the old API. For API 5+, it's LuckPermsProvider.get();

wind token
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

cold panther
#

You just need to use getGroupManager().getGroup(name); instead. Similar to using the UserManager when dealing with users

wind token
#

One message removed from a suspended account.

#

One message removed from a suspended account.

cold panther
#
LuckPerms luckperms = LuckPermsProvider.get();
final Group group = luckperms.getGroupManager().getGroup(luckperms.getUserManager().getUser(player.getUniqueId()).getPrimaryGroup());

Or something similar to that

wind token
#

One message removed from a suspended account.

cedar palm
#

yall where can I find the Java Docs?

neat jackal
#

Pinned

cedar palm
#

yup

#

sorry

nocturne elbow
#

Is there a way to give a player a certain permission?

#

Something like api.Addpermission(player, "Permission"); ?

cold panther
nocturne elbow
#

is "this" the main class? @cold panther

frank driftBOT
#

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

cold panther
#

?

nocturne elbow
crystal sonnet
#

You kinda should know what this means in Java

wild whale
#

^

nocturne elbow
#

Yeah ik it's a really stupid question, but i just can't really fix the problem.

wild whale
#

if you don't understand basic java, don't dive straight into a bukkit plugin right away

crystal sonnet
#

I really don't want to be rude, but MC plugins are not the place to learn Java

#

And using the LP API requires an even better understanding

#

Though in any case if you explain the issue we can try to help

wild whale
#

^
Start with basic java and OOP tutorials, once you understand that, then work your way up to using bukkit and eventually LP's api

crystal sonnet
#

Else it's gonna be hard

nocturne elbow
#

I do know the basics, but i just got a little bit frustrated and asked it out of certainty.

crystal sonnet
#

this always refers to the current class instance

#

So if you're trying to figure out how the variable was initialized, check either the declaration or the constructor

nocturne elbow
#

Because im working in a other class than the main-class, I tried main.luckPerms. but it was no succes.

#

nor plugin.luckPerms

crystal sonnet
#

Then either access the API statically or do the same: Add a variable to the class you're working in and initialize it in the constructor

nocturne elbow
#

Can't i just do like main.getPermissions().getUserManager()?

crystal sonnet
#

It depends on your code

#

Like c'mon

#

That stuff is basic Java

#

How you get the objects is irrelevant

#

As long as you get them somehow

nocturne elbow
#

No getUserManager :l

crystal sonnet
#

There's no helping you, sorry.
You're clearly lacking basic Java knowledge and experience

#

The best way I can explain this is that you've just recently started walking and now you want to run a marathon.
I mean you can do it. But you'll either need significant assitance or it's going to take forever

nocturne elbow
#

Is it possible to do this with vault?

nocturne elbow
#

Nvm i already fixed it with vault.

rain lodge
#

Hey! So I'm using the API on a Bungee instance, and I'm trying to see if a player has a permission, whilst respecting server contexts

#

(i.e. if the player is loaded on the server, and has permissions through a group set with the server= context)

#

Currently, it's only passing if the player has the group/permission globally, not given with a server context

#

However that's using player#hasPermission, I was wondering if it's possible to use the LuckPerms API to instead work with the contexts set

#

There is CachedPermissionData#.checkPermission, but would that check if the player is on the server with the server context?

crystal sonnet
#

You need to construct the context yourself

#

I did something similar a little while ago:

#

@rain lodge

rain lodge
#

Alright, thank you.

crystal sonnet
rain lodge
#

Oh, so it does take contexts into account, but it just has the wrong ones for what we need?

#

Does player.getPermission also take those contexts into account?

crystal sonnet
#

Yes.

#

Of course

#

Per server contexts are just per world contexts on the bungee

rain lodge
#

Alright

#

Thank you

#

Although the contexts are set via server= and are specified in each LP server's config

#

Not necessarily the server inside Bungee itself, but the server that LP uses

#

And then the permissions are set with:
/lpb user <user> permission set <node> server=rlcraft

#

But when I'm using player.hasPermission(node) through Bungee, it doesn't seem to think they have the permission, even if they're online on RLCraft

#

@crystal sonnet Is that the same?

frank driftBOT
#

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

crystal sonnet
#

@rain lodge that’s because for the bungee those are world permissions. Determined by the server names in the bungee config.yml

#

Check the contexts when running /lpb user <user> info

rain lodge
#

server= is the world context that doesn't use the server set in LP?

#

Interesting

#

When checking if the player has the permission, it doesn't seem to pass, even though they have the permission applied through the server context that is set in the luckperms configuration (and online, through bungee, on that server)

#

Running it on that server, the contexts is server=rlcraft

#

And all their permissions are fine on there, in that group with the context.

#

It's just when checking through Bungee

queen linden
#

hh

rain lodge
#

Any ideas?

obtuse jolt
#

@rain lodge bcu bungee context is server=bungee and world=servername

rain lodge
#

@obtuse jolt Is that servername specified in the LP config, or in the config.yml of Bungee?

frank driftBOT
#

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

rustic laurel
#

lp config, always

obtuse jolt
#

LP config ofc

rain lodge
#

Great, thank you. ❤️

crystal sonnet
#

@rain lodge @obtuse jolt @rustic laurel no!!
The world context on the bungee is derived from the config.yml of the bungee!

#

Not the LP configs on the backend

rustic laurel
#

?!

crystal sonnet
#

And Ally I meant you should do the command on an online player.

#

@rustic laurel if you don't believe me, try it

rustic laurel
#

i believe you lol

#

just didnt know

crystal sonnet
#

I'm appalled at how little most people know about LPB

#

You're by far not the only one that gets most things wrong routinely

#

I've hardly seen anyone that gets it right

obtuse jolt
#

I mean there isnt much documentation on it tbh

#

at least on the wiki

crystal sonnet
#

Sure

#

But the confidence in the wrong answers...

rustic laurel
#

yeah man

#

gotta go all out

crystal sonnet
#

Don't get me wrong

rustic laurel
#

no, me wrong 😛

crystal sonnet
#

I'm neither calling you out, nor blaming you for not knowing

#

I just find it shocking that so many people just spout out wrong info about bungee with 100% certainty

rustic laurel
#

for me at least, it's that LP checks the server name based on the LP config when checking per-server perms

crystal sonnet
#

That is correct

rustic laurel
#

just thought that would be universal behaviour

#

i was wrong lol

crystal sonnet
#

Well the LP instances don't communicate with eachother

rustic laurel
#

no they check the same db

#

and base that off their own config

crystal sonnet
#

So how could bungee know what the backend servers have in their configs

#

Yes but the database contains no info about the connected servers

rustic laurel
#

indeed

#

you're making perfect sense lol

crystal sonnet
#

It's just a storage for nodes, groups and users

rustic laurel
#

It just didn't cross my mind

crystal sonnet
#

Now it did

rustic laurel
#

yep

upbeat berry
#

How do I get a player group in a specific track?

#

The new API is super confusing

swift sand
#

I agree.

#

I am stuck here.

swift sand
#

@crystal sonnet can you maybe help me out with that part. Like the anymatch line

frank driftBOT
#

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

swift sand
#

Oh sorry

crystal sonnet
#

Do you still want to check tracks?

swift sand
#

yes

tribal wave
#

hello humans

#

i've been having fun learning the luckperms api, but I'm having a hard time understanding something

#

I add a node meta.example.RED to a player, but when the player leaves and reconnects to the spigot server it seems to disappear

#

additionally as soon as I run /lp user example meta info, the meta in question also seems to vanish into thin air and the plugin which relies on it immediately stops working

#

I was thinking that I'm somehow only temporarily saving the meta or something, is that the case?

#

the line i'm using to apply the meta is User.data().Node.builder("meta.example.RED").build());

wild whale
#

(wink wink nudge nudge ```java
code here
``` for a nice code block i.e. java if (this.bored()) { this.program(); }
)

tribal wave
#

ooooooooo i'll keep that in mind :3

#

but yeah it's really strange; i have a task which prints out once a second the value of the meta I set, and as soon as i run a command like /lp user Ivan8or info the meta immediately changes and begins printing null

rustic laurel
#

i know so little about this that I hesitate to say anything but I'm pretty sure you have to save it deliberately to the user (?) or something

tribal wave
#

oooh that's what I was suspicious of, do you know how to do that? 😮

#

ah wait i think i just found it in the wiki

#

i thank you for your services 😄

rustic laurel
#

holy crap did I actually just help in #luckperms-api wtf no problem! ❤️

wild whale
#

lol larry

nocturne elbow
#

larry is evolving

short fossil
#

lmao 99% of problems are not saving

#

its a good go-to

rustic laurel
#

with the luckperms developer api? you can't. Another plugin must handle that

#

#general please, this is not related to the luckperms developer api

solid marlin
#

can i get some help>

turbid solar
#

!ask

frank driftBOT
#
Please ask your question!

Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!

Why shouldn't I ask to ask?
solid marlin
#

its not a big help

turbid solar
#

Gotta ask your question before anyone can help you

mellow shadow
#

Hello!

#

I need help implementing the luckperms prefixes before player names in a tab plugin

tribal wave
#

are you making this tab plugin yourself?

mellow shadow
tribal wave
#

i recently used this feature of the api to get prefixes myself 🙂

#

i have to say the api is very well documented

mellow shadow
#

Okay, so the String prefix = metaData.getPrefix(); does works, but I've got 0 ide how to put this before the player names....

tribal wave
#

well that really depends on the code of that plugin you're modifying

mellow shadow
#

Can you please take a look? 👀

tribal wave
#

i'll take a small peek but i can't say i'll be able to figure anything out lol

mellow shadow
#

Thank you

tribal wave
#

i think i found something

mellow shadow
#

Oh, I'm all ears.

tribal wave
#

@mellow shadow in the GlobalTabListHandler17, theree's a function private PlayerListItem.Item createBasicItem(ProxiedPlayer player) {

#

it grabs the player's display name and assigns it to an item

#

there are also more spots where getName() is called on the player within the plugin

#

i suggest trying to insert the prefix before the text returned by getName() in all of those instances and see which one works

mellow shadow
#

All right! I'll try that!

#

Thank you!

tribal wave
#

sure thing

mellow shadow
#

I'm a little bit worried because I'm not an expert

tribal wave
#

if you want an easy alternative, i can suggest the TAB plugin which has an API that lets you show / edit the player's prefix and suffix in the tab menu while keeping the tab menu minimal

#

i don't know if you have full customization of the tab menu there though

mellow shadow
#

I've tryed it today but it has a lot features that I don't need, and some of them was very hard to disable.

#

I just need a bungee plugin that only displays prefixes before player names in the tab. That's it. No collision, priopirty, header, footer stb

tribal wave
#

you can pretty easily disable all the extra features for TAB in the config, though in a roundabout way

#

you can add your world names to the 'disabled worlds' sections of all the features you don't want

regal silo
#

Hey I need help with automatically setting a Default role/rank to a new and existing players that join the server, I can't find any information about this.

rustic laurel
#

No need to ask in several channels. Already answered in g1

jolly egret
#

can someone send me a PaperLib?

obtuse jolt
#

this is for luckpermsAPI not paperLIB

charred cloud
#

Can you add multiple permissions in 1 permission node? Or do I need to make separate

obtuse jolt
#

you can do shorthand like test.{a,b,c} but not completely different nodes

#

!advanced

frank driftBOT
charred cloud
#

So PermissionNode node = PermissionNode.builder("test.{a,b,c}").build();

obtuse jolt
#

i think so?but dont take my word, never really used the lpAPI before

charred cloud
#

it works 😛

obtuse jolt
#

oh nice

#

i helped in dev api smh

charred cloud
#

haha thx!

charred cloud
#

Got a new problem now:

When I create a group with
api.getGroupManager().createAndLoadGroup("test");
and directly after that
Group group = api.getGroupManager().getGroup("test"); this one will return null (it doesn't exist) but if I run the code again it exists?
Any idea's to do this?

#

I found this way:

try {
            g = api.getGroupManager().createAndLoadGroup("test").get();
            g.data().add(node);
            api.getGroupManager().saveGroup(g);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

But if there is a better way would love too hear

tribal wave
#

i think that's the correct way to do it 👍

crystal sonnet
#

That’s how you do it

charred cloud
#

Okay great 👍

final orbit
#

hey, i've been having trouble refering to LP via java nashorn.
here's a simple error java.lang.RuntimeException: java.lang.ClassNotFoundException: net.luckperms.api
and how i refer to it var lp = Java.type("net.luckperms.api"); same with var lp = Java.type("net.luckperms.api.LuckPermsProvider").get();
For referance some other classess that work:

var JURL = Java.type("java.net.URL");
var Channels = Java.type("java.nio.channels.Channels");
var rbc = Java.type("java.nio.channels.ReadableByteChannel");
var API = Java.type("noppes.npcs.api.NpcAPI").Instance();

prbbly my dumb ass deosn't get something...
Any idea how to rewrite it?

crystal sonnet
#

What are you trying to do in the first place?

#

And how are you including the API

final orbit
crystal sonnet
#

Do you have LP installed?

final orbit
#

yes, it's included as a plugin.

crystal sonnet
#

Alright

#

In that case reach out to the dev of the plugin that let's you run the scripts

#

They are most likely usinging their own classloader for the scripts and that's why you can't access the LP classes

#

Btw net.luckperms.api is a package, not a class

final orbit
#

well as i wrote above typying Java.type("full.class.here") was enough so kinda lost here
though it's mostly mods and java classes

crystal sonnet
#

Again, this has nothing to do with LP itself

#

If the class is there or not doesn't depend on LP, but rather the script plugin

#

Now make sure you have a LP version that's 5.x.x

#

Else you don't have the new API available @final orbit

ornate flume
#

hey, with the api how would i go about getting a users prefix?

crystal sonnet
#

!api

frank driftBOT
neat jackal
#

Cookbook has a good example too (repo is linked in the pins)

lofty star
#

Is there a simple way to check if a player has permissions in another context to what the server is running?

rustic laurel
#

There's the command to check

lofty star
#

Api wise

#

Sorry should of mentioned that

rustic laurel
#

Nah you're fine, most people just ignore channels and today I'm apparently guilty of it haha

#

Have you had a look at the javadocs/wiki combo?

#

!api

frank driftBOT
lofty star
#

Having a look through it now

#

Just wondering if I was being blind

rustic laurel
#

I don't know exactly how, but I know it's almost definitely possible because the plugin itself has that function

neat jackal
#

There's a section called "performing a permission check" or something like that on the wiki, cookbook may also have something

chrome whale
#

How can I see what groups there are?

obtuse jolt
#

!commands

frank driftBOT
obtuse jolt
#

Oh whoops it’s devapi

#

!api

frank driftBOT
chrome whale
#

thanks

rocky compass
#

Is there an equivalent in the api for /lp user <user> meta clear prefix

rustic laurel
#

yes

#

check out the javadocs and the usage guide

#

linked riiight above your message

rocky compass
#

I've got them pulled up already sorry but the lp api is pretty confusing to me, can I get a point in the right direction? Should I use clearMeta(Context) from User?

#

I see in the usage api how to retrieve user meta but not how to act on it.

neat jackal
#

Meta is generally stored as a node

#

You can do something like user.data().clear(NodeType.META::matches)

rocky compass
#

ok great! so just for my understanding, why does this only clear meta inherited from self and not groups?

#

hopefully that question makes sense, let me know if not

stuck slate
#

Because you are acting with user not group

neat jackal
#

User#data is the data the user has directly, not inherited nodes.

#

Same with Group#data as they share (some) things

rocky compass
#

ah great that makes perfect sense

#

thanks for the help

misty roost
#

why when im trying to add bukkit/minecraft perms it does not work but with other plugins it works fine ?

#

?

#

?

neat jackal
#

I mean perms are just perms there is no difference between built-in perms and added perms.

dull rover
#

Why do you guys provide a fake method in the API to check if a user is in a group or not?

#

How is that helpful?

jaunty pecan
#

What are you referring to??

dull rover
#

Idk, maybe I'm dumb but I could've sworn on the wiki there's an example method that's commented saying it doesn't actually exist

#

Nvm ignore me

#

Apologies

#

I can't read a wiki properly at 6 am. ( I totally didn't see the "in an ideal world" comment above the example )

jaunty pecan
#

Ah right yeah

#

Example could be better tbf 😉

nocturne elbow
#

how to show the prefix of a group in the scoreboard like what is the placeholder for it

rustic laurel
#

Ohaiglare

dull rover
#

Sup

#

And yeah Luck, it could be.

#

At least he sees where I was coming from with that.

#

If you miss that small comment there, it's easy to think that's just in there for whatever reason.

fervent reef
#

Hey,
how do I set a player's PrimaryGroup with the API?

rustic laurel
#

Do you mean specifically the primary group in the database?

fervent reef
#

I mean the PrimaryGroup...

rustic laurel
#

Usually it's just their highest weighted group

#

In-game at least

fervent reef
#

I want to set this group of the player from default to prime

rustic laurel
#

Unless you change that

#

Then just set their group, and make prime have a higher weight

#

Manually setting a primary group is only useful if you need to read that value from the database for a non-LP function

#

!API has some info on setting groups

frank driftBOT
hollow surge
#

Hi can i use Luck Perms with Essentials?

rustic laurel
#

Yes, but please use #support-1 or 2 for non-devapi stuff

hollow surge
#

okay thank you

fervent reef
#

DataMutateResult result = user.data().add(Node.builder("group.prime").build());
Is this the right usage to set the group?

rustic laurel
#

Think so, best to give it a shot too though ;)

fervent reef
#

I want to do it with a method, beacuse I don't like it to use a command is executed...

#

I got a problem: The group the player got is just temporary. So after he has reconnected the group is the old...
in my case: default

neat jackal
#

You can use InheritanceNode.builder("prime").build() too. Shouldn't make any big difference, but just saying.

And you have to save the user, using UserManager#saveUser

fervent reef
#

Thanks. But do I still have to remove the user's group default after or before the user got the prime group?

fervent reef
#

You can use InheritanceNode.builder("prime").build() too. Shouldn't make any big difference, but just saying.

And you have to save the user, using UserManager#saveUser
And, is it possible to remove the parent group default after the user got the group prime?

frank driftBOT
#

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

neat jackal
#

Yes, you can do user.data().remove(/*...*/) the same way

noble girder
#

hey is this where i ask questions?

turbid solar
#

Depends, is it a question about the API?

noble girder
#

api?

tribal wave
#

programmy stuff

turbid solar
noble girder
#

okey thank you 😄

stuck pier
#

@obtuse jolt

frank driftBOT
#

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

obtuse jolt
#

wot

sleek viper
#

Are you not able to edit the ranks of offline players?

rustic laurel
#

you can

sleek viper
#

How would I go about that? My user object is null

rustic laurel
#

Not familiar with the specifics but I'm pretty sure you have to load the user first

#

because offline players don't need to be loaded usually, so load em up and then do the thing, then save the user and unload them basically

obtuse jolt
#

also i think you need to/should use the player UUID instead if playername

rustic laurel
#

with the api? either afaik, so long as they're consistent (I could be wrong though so if you're less unsure than me ben, I trust you)

obtuse jolt
#

im prob as unsure as you, but i think usually UUID is more reliable (assume its an online-mode=true server haha)

sleek viper
#

I was able to do it with names, since that is all I have access to

#

Thanks!

#

Also, just for future reference make sure you use .get() after you load the user instead of loading and then getting since that messed me up a bit before.

pallid pendant
#

Anyone know how to fix "An internal error occurred when trying to perform this command" when doing /papi ecloud luckperms then /papi reload.

rustic laurel
#

that's a question for #general i will help ya there 😄

pallid pendant
#

Cheers Larry

nocturne elbow
#

what plugins is needed for luckperms?

obtuse jolt
#

you dont need other plugins for lp to work

nocturne elbow
#

okay thx

rustic laurel
#

API? if not the dev-api please discuss in #support-1 (read the channel topics)

nocturne elbow
#

i reading topics but my english is bad

short fossil
#

Also, just for future reference make sure you use .get() after you load the user instead of loading and then getting since that messed me up a bit before.
get turns the async method into sync, and should be avoided unless absolutely necessary

crystal sonnet
#

Or make sure you're running the code async in the first place

#

Then it doesn't matter

stray current
#

Hey, I am trying to understand exactly how contexts works(I did read this https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#important-classes about contexts) and how to add your own contexts.
So I made a ContextCalculator but as far as I know you can only do those for online players? I would like to me able to set some context for a uuid maybe? isnt that possible ? I did try to make a class that would implement it like this implements ContextCalculator<UUID> however it tried to cast the uuid to a craftplayer, ofcause without success, is there anyway to achieve this within luckperms ?

rustic laurel
#

I believe you need to load the user and and then do things to them

#

(and then save them)

#

So things that only work for online players should work if the user is loaded first

stray current
#

hm so load and then immediately save before getting the context? in my test i already loaded the user

#

Ill try

rustic laurel
#

Load, get the context, do the things, save

stray current
#

nah it still returns an empty set

rustic laurel
#

hm, I'm not sure then. Leave your question here for sure and when luck or someone else knows they'll answer ya!

#

Also, code snippets would be useful

#

Especially to show what you're trying to do

stray current
#

So I should note that I am using a pretty old build of luckperms - we currently cant update as we have quite a few plugins that depend on that API version I think - we are using version 4.3.17
here is the code snippet of trying to get the context of both an online player and offline player

            Player p = (Player) sender;
            OfflinePlayer p1 = Bukkit.getOfflinePlayer(args[0]);
            User offlineUser = LPUtils.getLuckPermsApi().getUserManager().loadUser(p1.getUniqueId()).get();
            LPUtils.getLuckPermsApi().getUserManager().saveUser(offlineUser);
            User u2 = LPUtils.getLuckPermsApi().getUserManager().loadUser(p.getUniqueId()).get();
            Contexts offlineContext = LPUtils.getLuckPermsApi().getContextManager().lookupApplicableContexts(offlineUser).orElse(LPUtils.getLuckPermsApi().getContextManager().getStaticContexts());
            Contexts onlineContext = LPUtils.getLuckPermsApi().getContextManager().lookupApplicableContexts(u2).orElse(LPUtils.getLuckPermsApi().getContextManager().getStaticContexts());

and the registering of the Calculator

    public class BandeCalculator implements ContextCalculator<Player> {
        @Override
        public MutableContextSet giveApplicableContext(@NotNull Player player, @NotNull MutableContextSet mutableContextSet) {
            Bande b = bandeCache.getBande(player.getUniqueId());
            mutableContextSet.add("bande", "" + b.getId());
            return mutableContextSet;
        }
    }
    public void init() {
        LPUtils.getLuckPermsApi().getContextManager().registerCalculator(new BandeCalculator());
    }
rustic laurel
#

Well I can tell you the v5API javadocs aren't gonna work for v4 😛

stray current
#

yea I looked up the old commits

rustic laurel
#

also, you can still update and use the legacy API extension

#

!upgrade

frank driftBOT
rustic laurel
#

You can find instructions on that here

stray current
#

alright however the wiki says the same thing back then and now about online players, so before upgrading I would like to know if it is possible to do what I am trying to do

#

to add a bit more context to what i want to do: I am trying to make all who is member of a group(in my case called "bande") to have the ContextSet with the key "bande" and value <id of group>. This is because I want to remove all of the permissions nodes from a user(player) when he leaves/gets kicked from a group(bande) but only those nodes that is in the context with the key called "bande"
If i could get the contextset I would be able to use the User#clearNodes to remove all the permissions in that context after i filtered it.

short fossil
#

sorry, what are you trying to do?

#

From what I can understand, you want to, when a player is removed from a group, you want to remove all user nodes that match a ContextSet?

stray current
#

not a permission group but its like a team of players

#

but otherwise yes thats what I want to do

short fossil
#

What is the broad purpose you are trying to fulfill?

#

Just so I can understand the situation a bit better

stray current
#

so the server has a lot of different teams(what I called group before - for the players those teams are called "bande"), when you are added to a team you get some permissions depending on what the team have unlocked so far. When you leave the team or get kicked from the team I need to remove those permissions. I could just remove each node depending on the what the team has unlocked but I thought that if I add each team permission in the context (key = team, value = id of team) I could just use User#clearNodes(ContextSet) instead to clear all of them without going through each node added

#

I hope that makes sence @short fossil

short fossil
#

Why don't you just create a parent given to the group? Are there different tiers of permissions given to the groups?

#

But yes you can stream through a user's nodes and filter them according to your specifications and remove them at a will, so you are able to do what you wish.

stray current
#

what do you mean by different tiers ?

#

and no I cant just stream through the nodes, since the context isnt loaded and thats what i want to filter on

#

I just tried to check if the offline player had any nodes with a context and he didnt

short fossil
#

oh just load the user

#

once you have the user object you can get their nodes

stray current
#

look at the code above

#

I already did

#

I get the nodes just fine

short fossil
#

Are you sure context is being filtered correctly?

stray current
#

oh nvm yea you are right I could actually do that, though the User#clearNodes(ContextSet) seems like a bit cleaner way to do it

short fossil
#

Yeah I honestly haven't had the need to mess around with ContextSets that much as most of my projects/requests don't require it, so not the most knowledgeable on it

#

I have always just had a parent I could apply / remove from a user

stray current
#

yea I cant really do that in this case though

short fossil
#

Do groups differ depending on player?

stray current
#

yep

short fossil
#

yeah then context sets may be your best bet

#

!API

frank driftBOT
short fossil
#

^ (for myself)

stray current
#

Yea I hope Luck has some ideas 🙂

short fossil
#

When you register the Calculator, is it on version 4?

stray current
#

yea

cedar palm
#

The luckperms API can allow you to add perms directly to players right?

#

Oh found it

crystal sonnet
#

Yes it can

crude drum
#

So pretty new to bukkit mods/java. Recompiled LuckPerms ExtraContexts to target api-version 1.15 with mvn and adoptopenjdk 11 hotspot. Seems like it worked okay, just making sure I'm not doing something insane.

jaunty pecan
#

seems reasonable

#

but why?

#

you don't need to compile against newer versions in order to use the plugin

#

the api doesn't change that much

#

especially the bits used by extracontexts

crude drum
#

Spigot was complaining, let me find the log message.

#

It was just a warning, but figured it'd be easy to squash.

#

Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
Legacy plugin ExtraContexts v2.0-SNAPSHOT does not specify an api-version.

jaunty pecan
#

hm that should be fixed already

#

have just triggered a new build on jenkins

crude drum
#

I don't know why the second error, because master shows 1.13

jaunty pecan
#

yea

#

try this one

crude drum
#

Okay, checking logs one sec.

#

Yeah completely gone

jaunty pecan
#

cool cool

crude drum
#

Looks like the commit that fixed it was 25 days ago, but build 13 was 30ish days ago.

#

Or maybe I'm wrong

jaunty pecan
#

I believe that's correct

#

the webhooks that trigger the builds break sometimes

crude drum
#

Ah gotcha

#

Thanks for both the answer and the fix.

stray current
#

bump for my previous question

rustic laurel
#

Just reask?

stray current
#

alright

#

ill copy the latest message and add a bit

#

Here is what im trying to do
so the server has a lot of different teams(for the players those teams are called "bande"), when you are added to a team you get some permissions depending on what the team have unlocked so far. When you leave the team or get kicked from the team I need to remove those permissions. I could just remove each node depending on the what the team has unlocked but I thought that if I add each team permission in the context (key = team, value = id of team) I could just use User#clearNodes(ContextSet) instead to clear all of them without going through each node added but when I try to get the context for an offline player it doenst work? Im not sure why though because each node does have the context so it should be able to get it for the offline player too no ?

#

feels like im spamming if i copy paste the code too so if you need code examples scroll up a bit

pure badger
#

Hi,

I started learning Spigot not that long ago, and the Luckperms API is a pain for me to understand, but is it possible to get the metadata of a offline player?

rustic laurel
#

yeah you just need to load the user first

pure badger
#

would it work like this? I don't rly understand the API:

UserManager userManager = api.getUserManager();
            CompletableFuture<User> userFuture = userManager.loadUser(player.getUniqueId());
            userFuture.thenAcceptAsync(user -> {
                return user.getCachedData().getMetaData(getQueryOptions(Optional.ofNullable(api.getUserManager().getUser(user.getUniqueId())))).getMetaValue("color");


            });
rustic laurel
#

did you try? 😄

#

it looks like it should to me, but i don't know for sure honestly

pure badger
rustic laurel
#

i'm not sure, leave your question here and when someone who knows can answer, they will 😄

fading nebula
#

can i change prefix of a user with api

rustic laurel
#

yes

#

!api

frank driftBOT
fading nebula
rustic laurel
#

follow this example pretty much but for suffixes

fading nebula
#

Thanks 🙂

fading nebula
#
    public void onVanish(PlayerHideEvent e) {
        Player p = e.getPlayer();
        String oldname = p.getDisplayName();
        UUID aydi = p.getUniqueId();
        myMap.put(aydi, oldname);
        p.setCustomName(ChatColor.GRAY + "[V]" + p.getName());
        p.setCustomNameVisible(true);
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) {
            Node node = SuffixNode.builder("[V]", 150 ).build();
            user.data().add(node);
        });    
    }```
#

what is the problem here

turbid solar
#

Dont you have to save the user?

rustic laurel
#

Yep

fading nebula
#

so ?

rustic laurel
#

save the user

neat jackal
#

No, you don't have to

#

Or you have to, but not when using modfiyUser

#

Maybe use SuffixNode node = SuffixNode.builder("V", 150).build(); instead

turbid solar
#

Node.builder(permission).value(thing).build(); is the value wether the permission is true or false? Nvm, found it

fading nebula
turbid solar
#

Did you import User?

fading nebula
#

it is not import thing

turbid solar
#

What API version are you using?

fading nebula
#

5.1

rustic laurel
#

Try each of those and see when the red line goes away. User doesn't exist in that class or something like that so u gotta make it

turbid solar
#

try this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {

fading nebula
#

try this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
@turbid solar xd

rustic laurel
#

Check your brackets and semicolons

fading nebula
#

and do i need to do Map thingh

#

i didnt add any suffixes to any group or person so ?

rustic laurel
#

I'm unsure at this point

fading nebula
#

it is uncessary okay

turbid solar
#

why are you getting the prefixes but setting a suffix btw?

fading nebula
#

i deleted that section

#
    public void onVanish(PlayerHideEvent e) {
        Player p = e.getPlayer();
        String oldname = p.getDisplayName();
        UUID aydi = p.getUniqueId();
        myMap.put(aydi, oldname);
        p.setCustomName(ChatColor.GRAY + "[V]" + p.getName());
        p.setCustomNameVisible(true);
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
            SuffixNode node = SuffixNode.builder("[V]", 150 ).build();
            user.data().add(node);
        });    
    }```
#

my code is this now

#
    public void onVanish(PlayerHideEvent e) {
        Player p = e.getPlayer();
        String oldname = p.getDisplayName();
        UUID aydi = p.getUniqueId();
        myMap.put(aydi, oldname);
        p.setCustomName(ChatColor.GRAY + "[V]" + p.getName());
        p.setCustomNameVisible(true);
        SuffixNode node = SuffixNode.builder("[V]", 150 ).build();
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
            user.data().add(node);
        });    
    }```
#

i did smt

#

okay i did it

#

thank you to all for helping

#

i didn't do it xd

#

any others to help pls

turbid solar
#

Remove the , so (User user)

fading nebula
turbid solar
#

Just to double check, is it the right User import?

#

Did you import net.luckperms.api.model.user.User?

fading nebula
neat jackal
#

That's the wrong on

fading nebula
#

ok

#

i did it

#

thanks

fading nebula
#

how i clear suffixes

neat jackal
fading nebula
#
    public void onVanish(PlayerHideEvent e) {
        Player p = e.getPlayer();
        String oldname = p.getDisplayName();
        UUID aydi = p.getUniqueId();
        myMap.put(aydi, oldname);
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
            SuffixNode node = SuffixNode.builder("&7[V]", 150 ).build();
            user.data().add(node);
        });
    } 
    
    @EventHandler
    public void onReappear(PlayerShowEvent event) {
        Player p = event.getPlayer();
        String oldName = myMap.get(p.getUniqueId());
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
            user.data().clear(NodeType.SUFFIX::matches);
        });                
    }```
#

ok one last thing

#

it works sometimes

#

but it doesn't work sometimes

solemn moss
#

How can I send a player command from a spigot plugin, that will run a bungee cord luck perms command?

#

I'm wanting to run "lpb user <name> parent add <rank>" when a player joins the server using a player join event

#

Wondering if I can just do that through luckperms and luckpermsbungee

#

or I will need to make my own bridge

obtuse jolt
#

@solemn moss If your permission data is the synced to a common sql database correctly, either will be fine

solemn moss
#

They're not xD

#

It doesn't matter I'll make a bridge

obtuse jolt
#

you are prob better off syncing your perm data @solemn moss

solemn moss
#

Here's my issue.
Had a server for a year. Not bungee. Has loads of local ranks. Lots of people with different perms etc.
Now I need to make a bungee network. I installed BungeeChat, which only reads "LuckPermsBungee" config / perms etc.

The main issue is, I have multiple servers with the same rank names like, take "King".
But a player may be a lower rank on one server, "Lord", but "King" on another.
And so I need to add the player to a rank on LuckPermsBungee called "KingSurvival" but also "LordCreative". So when they talk, depending on the server they will get a different prefix in BungeeChat format.

Issue is, all my players are in "King" and "Lord" on Survival Spigot LuckPerms. And I wanna shift them over to "KingSurvival" on LuckPerms Bungee.

#

Can you explain how syncing would work for this situation?

#

@obtuse jolt

frank driftBOT
#

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

solemn moss
#

Sorry to ping.

rustic laurel
#

With the dev api!?

solemn moss
#

I'm not sure

#

What would be best?

stuck slate
#

Read the channel topic

solemn moss
#

We were talking about the API

#

I was asking how to use the API to send a packet to Luck Perms Bungee

#

The conversation then moved on

fading nebula
#
    public void onVanish(PlayerHideEvent e) {
        Player p = e.getPlayer();
        String oldname = p.getDisplayName();
        UUID aydi = p.getUniqueId();
        myMap.put(aydi, oldname);
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
            SuffixNode node = SuffixNode.builder("&7[V]", 150 ).build();
            user.data().add(node);
        });
    } 
    
    @EventHandler
    public void onReappear(PlayerShowEvent event) {
        Player p = event.getPlayer();
        String oldName = myMap.get(p.getUniqueId());
        this.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
            user.data().clear(NodeType.SUFFIX::matches);
        });                
    }```

@fading nebula

#

it works but not everytime

#

i tested event it works

#

but suffix is not working to good

#

there could be problem with bungee i guess

solemn moss
#

Make a string list of all the group names. Make it so the highest is first.
check if player.haspermission("nameFromList"+".group");

lavish chasm
#

I got it now cheers

wispy yoke
#

how can i use luckyperms for bungee

#

???

rustic laurel
#

!bungee

frank driftBOT
obtuse jolt
#

for devapi or ?

wispy yoke
#

gays i have a vps and i cant use mysql for luckyperms bungee

rustic laurel
#

Does this relate to the developer API for LP

nocturne elbow
#

"gays"

#

does he think dev api is gay?

rustic laurel
#

think it was a typo 😂

wispy yoke
#

im sry

raven nebula
#

Hi there, I'm trying to find the permission group "admins" in my plugin, is this code correct? ("plugin" is my main class):

Group adminGroup = new Group("admins", (LuckPermsPlugin) plugin);

And if yes, how can I get all the users in that group?

stoic bough
#

Use the search function of Discord

gritty ice
#

have a problem, i created an owner rank, assigned it, then i couldn't get it away and when i uninstall the plugin the ranks are still visible

#

can anyone help me? my English is very bad

cedar palm
#

!api

frank driftBOT
short fossil
#

@raven nebula use bukkit#hasPermission

#

Permission nodes for groups are (groupname).group

#

Or maybe group.(groupname)

#

Check wiki

#

@gritty ice if you didn’t make the plugin go to general help

raven nebula
#

@short fossil Thank you, I got that to work. I have another question though: if I want anything to work, I need to obtain an instance of LuckPermsApiProvider, right? The problem is that I don't know which argument to pass in its constructor, I tried passing in a LuckPermsPlugin-cast of my main file (which extends JavaPlugin), but that didn't work (got an error "cannot be cast to LuckPermsPlugin)

#

And I may be blind, but I did not find any javadocs on LuckPermsPlugin, did I just miss those or aren't they out (yet)?

short fossil
#

What are you trying to do @raven nebula ?

#

!api