#luckperms-api

1 messages Β· Page 30 of 1

hexed fiber
#

yml

tribal wave
#

!pastebin for files like that

frank driftBOT
#
Please use pastebin!

Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!

For console errors:

Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!

Other errors:

Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!

hexed fiber
#

sorry

tribal wave
#

it's ok

hexed fiber
#

and I have spigot and luckyperm

tribal wave
#

before you can use luckperms you need to include it's API as a dependency in your java project

#

oh as dependencies?

hexed fiber
#

look

tribal wave
#

you may be better off downloading the api jar specifically

hexed fiber
#

ok

#

api-5.1-javadoc.jar

#

this ?

tribal wave
#

no

#

the one that's just api-5.1.jar

#

you don't want the javadocs haha

hexed fiber
#

api-5.1.jar

tribal wave
#

yes

hexed fiber
#

ok

#

I reference it ?

tribal wave
#

yeah, add it as an external jar

hexed fiber
#

ok

#

it's done

tribal wave
#

okay

hexed fiber
#

I remove Luckperms ?

tribal wave
#

yeah

hexed fiber
#

done

tribal wave
#

okay

#

so you can read all about the luckperms API and what you can do with it on that wiki page

#

i'll give you the first, least confusing step and that is running LuckPerms api = LuckPermsProvider.get();

#

that'll give you an instance of the api which you can do all sorts of stuff with

hexed fiber
#

ok

#

but where do I put it?

#

in Main.java

#

or COmmand.java

tribal wave
#

well that depends on what you're trying to do i suppose

hexed fiber
#

ok

#

there is an error

tribal wave
#

what is it

hexed fiber
#

Syntax error on token '.'

tribal wave
#

...

hexed fiber
#

@expected after

tribal wave
#

can i see your code for a moment

hexed fiber
#

yeah

#
package fr.Phosphate.rankplus;

import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
import fr.Phosphate.rankplus.commands.CommandTest;
LuckPerms api = LuckPermsProvider.get();

//Plugin Rank+ by Phosphate_ for Radeon

/*Ce plugin a pour but de permettre au op (Admin, Dev) de pouvoir tout de mΓͺme jouer en tant que 
 * joueur sans perm.
 * Il permet de supprimer son rank, tout en gardant ou non son titre. Il permet de limiter l'abus de give
 * ou autre commande permettant de s'avantager en Γ©tant op.
 */

public class Main extends JavaPlugin {

    public void onEnable(){
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN+"Plugin Rank+ by Phosphate_ is now online");
        getCommand("test").setExecutor(new CommandTest());
        getCommand("alert").setExecutor(new CommandTest());
    }
    
    public void onDisable() {
        getServer().getConsoleSender().sendMessage(ChatColor.RED+"Plugin Rank+ by Phosphate_ is now offline");
    }
    

}
tribal wave
#

i see

#

erm

#

i think it'll be a good idea for you to find some simple tutorials on how to get started with java

hexed fiber
#

oh

tribal wave
#

i suggest you try making some simple standalone programs, it'll be much easier to jump into plugins after that

hexed fiber
#

I just don't understand the importation of dependancies

tribal wave
#

since plugins are a bit harder and slower to debug than a simpler program

#

you've already done that part haven't you?

hexed fiber
#

but just how am I supposed to import the api then?

#

yes

tribal wave
#

you already imported the code related to the api

hexed fiber
#

but I have an error

tribal wave
#

now all you need to do is use it (and of course import the proper classes)

#

yes you do

#

and the error is very, very simple

#

i'm scared for how long it will take you to put your plugin together if you can't find this error and fix it

#

but i believe in you

hexed fiber
#

xD

#

but please help me.

#

😦

#

plus I'm a shit in English.

tribal wave
#

i will help you if you have any questions with luckperms-api related stuff πŸ˜‰

hexed fiber
#

...

tribal wave
#

but what i think you should aim for right now

#

is a solid understanding of how code in java is structured

hexed fiber
#

Just can you tell me how to import the api?

tribal wave
#

what all the bits and bobs mean and where they belong

#

what do you mean by import? you've already done the grunt of the work regarding that

#

at least, that's what you've led me to believe xd

hexed fiber
#

I mean to be able to use the elements of the plugins.

tribal wave
#

alright

hexed fiber
#

without fail

tribal wave
#

basically

#

you put that line of code outside of the class

#

so of course the ide is going to complain

#

move that line inside of your main class

hexed fiber
#

Oh, yeah, that's right, but I thought it was the import line. There's no need to do an import...

#

.

#

?

tribal wave
#

also Main is a really unfortunate name for your class

#

the line of code i gave you is not an import

#

notice the distinct lack of the keyword import 😜

hexed fiber
#

Yes, but I'm trying to figure out exactly how to import it.

tribal wave
#

do you mean actually have a line like import java.utils.*

#

if you're on eclipse (which i think you are) you should just be able to hover your mouse over the LuckPermsword in that line

#

and it will give you an option to import it

hexed fiber
#

it's done

tribal wave
#

nice

hexed fiber
#

you are a god

tribal wave
#

that's quite a stretch

hexed fiber
#

I have another error

tribal wave
#

okay

hexed fiber
#

LuckPermPrvider cannot be solved

tribal wave
#

hover over it and import that as well

hexed fiber
#

it's done

tribal wave
#

oh nice

hexed fiber
#

😎

tribal wave
#

you're learning πŸ˜‰

hexed fiber
#

yeah

tribal wave
#

whenever you see an error you should hover over it

hexed fiber
#

so now i have a variable api

tribal wave
#

yes you do

#

!api

frank driftBOT
tribal wave
#

look at the second link for examples of all the stuff you can use it for

hexed fiber
#

but

#

for exemple

tribal wave
#

hm?

hexed fiber
#

Is there an api.Something to change the player's rank?

tribal wave
#

yes, you can use that very api to do that

hexed fiber
#

ok nice

#

thanks bro

tribal wave
#

no problem :3

hexed fiber
#

@tribal wave

#

just

#

how to import Collection ?

tribal wave
#

? the same way you imported the other two

hexed fiber
#

no

#

it don't want

tribal wave
#

?

hexed fiber
#

I can click on it

#

he's not offering to import it.

tribal wave
#

what does the error say

hexed fiber
#

Collection cannot be solved to a type

#

juste how import ?

tribal wave
#

press ctrl+s

hexed fiber
#

java.utils ?

tribal wave
#

press ctrl+s and hover over it again

#

it should suggest an import

hexed fiber
#

no

#

yes

#

thx

#

xD

tribal wave
#

xd no problem

hexed fiber
#

it doesn't work

#

didn't*

tribal wave
#

???

#

the import?

hexed fiber
#

What's the point of Override

tribal wave
#

it doesn't really affect the code itself

hexed fiber
#
package fr.Phosphate.rankplus.commands;

import java.util.Collection;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.Player;

import net.luckperms.api.LuckPerms;
import net.luckperms.api.LuckPermsProvider;



public class CommandTest implements CommandExecutor {

    LuckPerms api = LuckPermsProvider.get();
    @Override
    
    public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
        for (String group : possibleGroups) {
            if (player.hasPermission("group." + group)) {
                return group;
            }
        }
        return null;
    }
    
    public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
        
        if (sender instanceof Player)
        {
            api.getUserManager().
            Player player = (Player)sender;
            player.sendMessage(ChatColor.RED+player.getDisplayName()+"is now player");
        
        }
        
        return false;
    }

} ```
tribal wave
#

it's just to remind you that you are overriding the function

hexed fiber
#

the error is here

tribal wave
#

where

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

first line

tribal wave
#

oh the collection

hexed fiber
#

3 errors

tribal wave
#

...

hexed fiber
#

xD

tribal wave
#

okay

#

well hover over each of them

#

see what they each say

hexed fiber
#

ok

#

I'm going to get my phone and take a picture. I'll be right back.

tribal wave
#

wait

#

sir

#

press your windows key

#

and type snipping tool

hexed fiber
#

Oh

#

Too late

tribal wave
#

use it instead of your phone i beg of you

tribal wave
#

use the snipping tool please πŸ™ XD

hexed fiber
#

OK lol

#

But i cant

tribal wave
#

why's that?

hexed fiber
#

I can snipping and click on error

tribal wave
#

ah i see

#

fine i'll allow it xd

#

first things first

#

you really should not have that @override there

hexed fiber
#

ok

tribal wave
#

after you get rid of it press crtl+x

#

sorry

#

ctrl+s

hexed fiber
#

ok

tribal wave
#

how many errors are there now

hexed fiber
#

0

#

but

tribal wave
#

but?

hexed fiber
#

but

#

I have an icon

#

a weird icon

tribal wave
#

you mean the blue thing

hexed fiber
#

yep

tribal wave
#

it doesn't mean anything

#

just ignore it

#

it's basically just there to make reading the code a tiny bit easier

hexed fiber
#

ok

tribal wave
#

now if you have any other questions that are not specifically about the LP api

#

you should turn to other sources

#

like a tutorial for java

#

because that will make what you are doing go like 20 times faster

hexed fiber
#

and here ?

tribal wave
#

?

hexed fiber
#

merci

#

thx

tribal wave
#

no problem lol

hexed fiber
#

white thing

tribal wave
#

ignore it

hexed fiber
#

ok

#

@tribal wave

tribal wave
#

is it an LP API question?

hexed fiber
#

any last words of help?

#

no

#

😦

#

pleassssssssse

#

im a little shit

#

and u are a god

#

helpp meeee

#

πŸ‘€

tribal wave
#

i don't know why you think you're magically going to not run into any more issues

#

you are so much better off learning at least the basics, and reaping the rewards

hexed fiber
#
    Collection<String> coll = new ArrayList<String>();
    
    coll.add("developpeur") ;
    coll.add("administrateur") ; ```
tribal wave
#

?

hexed fiber
tribal wave
#

review your code

hexed fiber
#

ok

crystal sonnet
#

If you get a bunch of syntax errors from the same file always check the first error. The following ones typically are just the compiler tripping up.

#

@hexed fiber

hexed fiber
#

Hum

#

I dont understand

#

But ok

crystal sonnet
#

And I can only agree with Ivan8or. Learn Java first. MC is not the place to learn Java or programming

hexed fiber
#

Ok

crystal sonnet
#

And what don’t you understand?

hexed fiber
#

All

#

Im not English

crystal sonnet
#

Then use a translator

#

This is plain English

hexed fiber
#

Ok

hexed fiber
#

@tribal wave

#

@crystal sonnet

frank driftBOT
#

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

hexed fiber
#

I looked everywhere but I really couldn't find it.

#

c bon

#

merci le net

#

j'ai rΓ©ussi

crystal sonnet
#

Look for the first syntax error in the file @hexed fiber

hexed fiber
#

@crystal sonnet

frank driftBOT
#

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

hexed fiber
#

it's done

#

but

#

I have a new question

#

I don't find command to add player to category

nocturne elbow
hexed fiber
#

thanks

hexed fiber
#

@nocturne elbow

#
DataMutateResult result = user.data().add(Node.builder("your.node.here").build()); ```
#

in need to replace "your.node.here" by what ?

#

the category ? or a permission ?

obtuse jolt
#

its a permission node

hexed fiber
#

so for exemple

obtuse jolt
#

to add player to a group, the perm node is group.GROUPNAME

hexed fiber
#
DataMutateResult result = user.data().add(Node.builder("*").build()); ```
#

for give admin permission

obtuse jolt
#

that gives permissions to everything

hexed fiber
#

oh

obtuse jolt
#

you can do that but take note

#

!nwc

frank driftBOT
hexed fiber
#
DataMutateResult result = user.data().add(Node.builder("dev.'*'").build()); ```
#

and that ?

obtuse jolt
#

that doesnt nothing unless you have a plugin named dev

hexed fiber
#

I have a category named dev

obtuse jolt
#

to add player to a group, the perm node is group.GROUPNAME

hexed fiber
#

and another name admin

#

DataMutateResult result = user.data().add(Node.builder("group.dev'").build());

#

that ?

obtuse jolt
#

yea but im very sure you need more code to like first load the user data and then save the userdata afterwards

hexed fiber
#

ok

autumn herald
#

Hi

#

a dude

#

doubt*

rustic laurel
#

How can we help

obtuse jolt
#

what doubt do you have?

autumn herald
#

I want to know if, in some way, MySql can synchronize everything, but only some ranges cannot.
Example: i want the vip to sync, but the "Boss" rank does not. :i

rustic laurel
#

!context you can use this system, called contexts, to limit things so they only apply in certain servers

frank driftBOT
autumn herald
#

:o

#

Okey, thanks... Eh, in the data base eh...

#

works?

#

ah ok, yes.

warm garnet
#

is it possible to add time to a temporary permission? obviously i will check if they have it with hasPerm("...")

rustic laurel
#

I think you just reconstruct the node

warm garnet
#

or at least indirectly, by getting the time left then setting a new time

rustic laurel
#

You do mean with the devapi right

warm garnet
#

yes

rustic laurel
#

Basically run the permission settemp command with the accumulate modifier, but in your program

#

So don't run the command but find out how to use accumulate so it adds

warm garnet
#

sorry i dont understand what you mean

high yoke
#

do the command more times?

warm garnet
#

"do the command"

#

it's the api

rustic laurel
#

Find out how the command does it, and do that :p

warm garnet
#

alright

#

what am i meant to use in place of LuckPermsPlugin plugin?

#
String LPCommand = String.format("lp group pothead permission settemp boosters.secretden true 1h accumulate");
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), LPCommand);
```wow this is truly beautiful code
rustic laurel
#

hrmm

warm garnet
#

i mean using the "api" makes no sense to me

#

and this is no worse really

rustic laurel
#

un moment por favor

#

!api

frank driftBOT
obtuse jolt
#

that isnt using the lp api lol, arrent you just running a luckperms command in console?

warm garnet
#

i meant "api" in terms of it's not really using the api, just copying your code

#

of course what i sent is not using the api

rustic laurel
#

Those two should be sufficient to explain how to do it? I hope?

#

basically set the node again with the intended amount of duration to extend and use the second link

warm garnet
#

absolutely not lol, but thanks

rustic laurel
#

the second link will allow you specify that the node should be added to the existing one

warm garnet
#

how do i even get the existing one

#

i really dont know what you're talking about tbh

rustic laurel
#

I think you've just pulled a classic X/Y on me and I missed it

#

what are you trying to do, specifically?

obtuse jolt
warm garnet
#

PermissionNode node = PermissionNode.builder("boosters.secretden").build();

#

great

obtuse jolt
#

PermissionNode node = PermissionNode.builder("boosters.secretden").expiry(Duration.ofHours(1)).build(); i think its like this for expiry time?

warm garnet
#

how do i make it accumulate

#

or do i do that later

warm garnet
#

uhhh

#

idk what Enum Constant Detail means

rustic laurel
#

it's like a word that fills in for a constant so it can be used in several places easily

#

so TemporaryNodeMergeStrategy.valueOf(ADD_NEW_DURATION_TO_EXISTING) will do just that

#

it'll get you that merge strategy

warm garnet
#

do i need something like

api.getGroupManager().modifyGroup("pothead", (Group group) -> {
    PermissionNode node = PermissionNode.builder("boosters.secretden").expiry(Duration.ofHours(1)).build();
    // modify node to make accumulate, add existing duration
    group.data().add(node);
});
rustic laurel
#

i think so, yeah,and then you save the group πŸ˜‰

warm garnet
#

what do i actually do with TemporaryNodeMergeStrategy.valueOf("ADD_NEW_DURATION_TO_EXISTING");?

hexed fiber
#

hi

obtuse jolt
#

uh i think that will only return the value

hexed fiber
#

how I can check the permission of a player ?

obtuse jolt
rustic laurel
obtuse jolt
#

just change "group." + group to a perm node

warm garnet
#

i need to find out what a nodemap is

rustic laurel
#

that's probably on the wiki :p

warm garnet
#

indeed

rustic laurel
#

ayy nice ben

#

i liked the fist link too :p

rustic laurel
#

thanks ben

warm garnet
#
api.getGroupManager().modifyGroup("pothead", (Group group) -> {
    PermissionNode node = PermissionNode.builder("boosters.secretden").expiry(Duration.ofHours(1)).build();
    group.data().add(node, TemporaryNodeMergeStrategy.valueOf("ADD_NEW_DURATION_TO_EXISTING"));
});
rustic laurel
#

does mr ide say that will work

warm garnet
#

no errors

#

what did you mean by "save the group"?

rustic laurel
#

like with every api change, you need to call a save

#

also on the wiki hehe

warm garnet
#

you helped me before and we didnt do a save

#

and it works

#

well i shall try

rustic laurel
#

maybe not every api change πŸ˜›

#

but when you add/remove a node, as the wiki says, save to storage provider

obtuse jolt
#

some day i should learn java haha

rustic laurel
#

you're probably about as far along as I am at this point if not further

#

never too late to dedicate!

obtuse jolt
#

did you code clippy v2 with java lol

rustic laurel
#

yeeaaahhh

warm garnet
#

is this the best way to check if a group has a permission?

Group group = api.getGroupManager().getGroup("pothead");
PermissionNode secretDenNode = PermissionNode.builder("boosters.secretden").build();
Collection<Node> groupNodes = group.getNodes();
if (groupNodes.contains(secretDenNode)) {
            
}
obtuse jolt
#

i think you can use hasPermission?

rustic laurel
#

that's vault, no?

#

this agrees with finn

warm garnet
#

i mean i guess i can do it with vault but this should be fine?

rustic laurel
#

yes, but why are you checking if the group has the node?

warm garnet
#

the plugin im making is a custom "boosters" plugin that adds temporary permissions to every player when someone buys the package on buycraft. so in my onEnable(), i was going to check if they have the permission, and if they do then i add 1minute to it

#

in order to make up for the lost time due to restart

rustic laurel
#

so you want practically ingame-time instead of realtime rewards?

warm garnet
#

yes

rustic laurel
#

I don't know if that's really the way to do it, but I cant think of a better way so I can't really criticize lol

warm garnet
#

indeed

opal chasm
#

alright, so i'm working on a plugin that disallows players to pay (using a vault-hooked economy plugin) other players who are a lower rank than them in a luckperms track. i have it working so far, but i recently realised that my economy plugin allows the paying of offline players. so instead of using Player#hasPermission to check for permissions (to check which group a player is in), i've hooked into vault to allow me to check the permissions of offline players. but now i've encountered this problem - luckperms seems to be warning me that it's unsafe to check for permissions of a player who has not joined the server in the current session:

#

i don't really want to enable the property it suggests if it can cause lag, but i have no idea how to do things asynchronously, i'm still pretty new to plugin development

#

any help is appreciated :)

rustic laurel
#

So either you do the vault check async, which is a bit too much to just type out, you'd have to do some research/learning , or you load the user and check with LP. Up to you, but either way explaining the entirety of async processing is kinda hard. I'd suggest taking a look at other plugins and see if they already do it.

opal chasm
#

i can check permissions with lpapi?

opal chasm
#

ah i assumed not since where it says to check if a player is in a group, it says to use Player#hasPermission

#

i'll look into doing that then, thanks :)

hexed fiber
#

hi

#

how I can add a prefix to a player ?

obtuse jolt
hexed fiber
#

mrc

hexed fiber
#

hi

#
PrefixNode node = PrefixNode.builder(100, "[Some Prefix]").build(); ```
#

in this, oh to change color of prefix ?

#

@obtuse jolt

frank driftBOT
#

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

hexed fiber
#

@warm garnet

warm garnet
#

yes?

obtuse jolt
#

!color

frank driftBOT
#

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

obtuse jolt
#

!colour

frank driftBOT
#

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

obtuse jolt
#

!colours

frank driftBOT
obtuse jolt
#

ah yea ^^

hexed fiber
#

PrefixNode node = PrefixNode.builder(100, "[Some Prefix]").build();

obtuse jolt
#

just add the colour code

hexed fiber
#

there are no arg for that

obtuse jolt
#

no

#

in the prefix itself

hexed fiber
#

oh

#

ok

#

thx

warm garnet
#
api.getUserManager().modifyUser(uuid, (User user) -> {
    user.data().clear(NodeType.PREFIX::matches); // if you want to clear old prefixes
    Node node = PrefixNode.builder(finalNewRankPrefix, finalNewRankPrefixWeight).build();
    user.data().add(node);
    api.getUserManager().saveUser(user);
});
#

i think

hexed fiber
#

it's done

warm garnet
#

excellent

#

how can i retrieve the remaining duration on a temp perm?

neat jackal
#

There's a getExpiryTime method iirc

obtuse jolt
warm garnet
#

yeah i don't really understand how to get the node for a permission for a specific group

hexed fiber
#

I have a problem with save data of player

#

i have a variable for my player called player

#

but I need a User type of variable

#

but my player variable is a Player type

#

@obtuse jolt

frank driftBOT
#

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

rustic laurel
#

@hexed fiber that's a warning, you've been told by the bot several times to follow the rules and continue to disregard them

hexed fiber
#

sry

#

someone ?

#

@warm garnet

warm garnet
#

dude

#

chill out

hexed fiber
#

sry xD

warm garnet
#

send your code fuck

hexed fiber
frank driftBOT
warm garnet
#

^^

hexed fiber
#
        Player player = (Player)sender;
        api.getUserManager().saveUser(User player);    
        Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_BLUE+"TEST"); ```
rustic laurel
#

Isn't getPlayerGroup from vault?

#

Also, can't you just get user from the uuid

hexed fiber
#

oh

#

so how ?

rustic laurel
#

Idk it was just a suggestion to look into

hexed fiber
#

I don't know how to have a User type variable from Player variable

#

it just that

obtuse jolt
#

tbh you should just loadUser once lol

#

as in for your onCommand method

hexed fiber
#

LoadUser ?

#

there isn't

obtuse jolt
#

on way to do it i guess is to save after every time you do user.data() method to modify perms

hexed fiber
#

api.getUserManager().saveUser((api.getUserManager().loadUser(player.getUniqueId()));

#

why it doesn't work

obtuse jolt
#

try api.getUserManager().saveUser(api.getUserManager().loadUser(player.getUniqueId()));

#

i think you added one too many (

#

maybe

hexed fiber
#

The method saveUser(User) in the type UserManager is not applicable for the arguments (CompletableFuture<User>)

obtuse jolt
#

hmm why not just save the data after every user.data() method

hexed fiber
#

user.data().add(PrefixNode.builder(groupname,prefixplace).build());

#

here ?

neat jackal
#

You can also use modify user in 5.1:

user.modifyUser((User user) -> {
// saves automatically
});
hexed fiber
#
        userFuture.thenAcceptAsync(user -> {
            user.data().add(Node.builder("group."+groupname).build())
        });```
#

for exemple

#

I want to save the change

#

how I do this ?

obtuse jolt
#

either try what tobi said or uh try add api.getUserManager().saveUser(user) after the user.data() line

hexed fiber
#

nice !

#

thanks

obtuse jolt
#

does it work?

hexed fiber
#

I am running the server

obtuse jolt
#

bcu i am also not very familar with the api lol

hexed fiber
#

no problem thx a lot

#

oh

#

I can't remove prefix

frank driftBOT
#

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

turbid solar
#

Btw you shouldnt ghost ping people

hexed fiber
#

i know

rustic laurel
#

Antoine I'm feeling kind today, but if you keep pinging staff/helpers you're out of here, k?

hexed fiber
#

ok

#

help ?

#

user.data().remove(PrefixNode.builder().build());

#

it doesn't work

rustic laurel
#

are you saving

hexed fiber
#

yeah

rustic laurel
#

So you should send your code again, using either pastebin or just discord's feature to send your method:
format like this if using discord:

```java
<code goes here>
```

hexed fiber
rustic laurel
#

so which prefix are you trying to remove?

#

pretty sure you need to specify that

#

instead of add, use remove

hexed fiber
#

what ?

#

i don't understand

#

ligne 40

rustic laurel
#

You're asking LP to remove a prefix but it doesn't know which

hexed fiber
#

for exemple

#

line 40

#

I try to remove preffix

rustic laurel
#

here right?

hexed fiber
#

yeah

rustic laurel
#

players can have several prefixes

#

you need to either get their highest weighted or loop through them all afaik

#

or lowest weighted i suppose, but by weight or by name or by all

hexed fiber
#

oh ok

#

I'll try this

#

how I can remove all preffix ?

rustic laurel
#

loop through them all

hexed fiber
#

but how ?

rustic laurel
hexed fiber
#

oh I can remove my suffic IN game ?

rustic laurel
#

you can use commands to do anything LP-wise ingame

hexed fiber
#

yeah but I don't know how to remove my preffix

rustic laurel
#

lp user <name> meta removesuffix [weight]/[prefix]

hexed fiber
#

thx

#

but

#

it doesn't work

#

it doesn't find the preffix

rustic laurel
#

You need to specify the prefix's weight, or the prefix

hexed fiber
#

so how can I find all preffix

rustic laurel
#

loop antoine

#

if you want to do it in code

#

you need to loop through all of a user's prefix nodes

#

i think there's even a node filter you can use

#

!api

frank driftBOT
rustic laurel
#

look at the javadocs for that one

hexed fiber
#

not in the code

#

in minecraft

rustic laurel
#

!commands

frank driftBOT
hexed fiber
#

thx

rustic laurel
#

I don't think there's a single command to clear all of one user's prefixes in one go

#

an easy fix is to use meta setprefix and then remove the one you just set. setprefix will remove all prefixes and replace them with just the one prefix

hexed fiber
#

I don't find how to remove player from a group

#

it's done !!!!!!

#

Larry

#

is a preffix linked with group ?

rustic laurel
#

it's a node in a group

#

or in a user

#

depending where you set it

hexed fiber
#

Larry

#

i have a problem

#

I can't deop me

remote sky
#

Use the console

hexed fiber
#

yeah I can't

#

when I write deop Pseudo

#

deop Phosphate_

#

Could not de-op Phosphate_

#

like if I was already deoped

gusty hull
#

did you give yourself a rank?

#

and gave * perms?

hexed fiber
#

how I can view it ?

#

beacause Im not sure

gusty hull
#

what rank/group are you in?

hexed fiber
#

it's done

#

thx u

gusty hull
#

np

hexed fiber
#

thx for help

gusty hull
#

np

#

if you need a developer dm me

hexed fiber
#

developer for what ?

gusty hull
#

for the server

#

to like help you do the plugins

hexed fiber
#

oh im the developer xD

#

for another server

#

xD

gusty hull
#

oh lmao

#

xd

hexed fiber
#

@gusty hull

#

or Larry

gusty hull
#

?

hexed fiber
#

how I can check if a player as a permission ?

rustic laurel
#

helps to ask before you start pinging ppl

hexed fiber
#

srx

#

sry

gusty hull
#

do /lp user (username) permission info

rustic laurel
#

oh yeah Doug maybe don't offer DM services like a back alley kinda ad kek

hexed fiber
#

no

#

in api

gusty hull
#

back alley lmao

hexed fiber
#

xD

gusty hull
#

wdym in api

hexed fiber
#

wdym ?

#

Larry

#

do you know ?

gusty hull
#

what do you mean in api

hexed fiber
#

i want to check if a player have a permission in my plugin

rustic laurel
#

!api

frank driftBOT
rustic laurel
#

it's on the second link here

hexed fiber
#

I don't find

rustic laurel
#

you just have to read it

gusty hull
#

red

#

i love the colour red

rustic laurel
gusty hull
#

lmao

#

who is that man?

rustic laurel
#

It's literally its own category

hexed fiber
#

oh

#

xD

rustic laurel
#

@gusty hull ? the gh avatar?

gusty hull
#

ye

rustic laurel
#

That's Luck, the guy who made LP

gusty hull
#

ohhhh

rustic laurel
#

:p

gusty hull
#

lmao thats a guy

#

um

rustic laurel
#

just... click on it lol it gets bigger

gusty hull
#

shhhh

wind slate
#

I need help

pseudo bramble
#

If you want a faster answer, start with the problem rather than saying you need help

wind slate
#

I need help my servers dont sync fast with perms but work alitle and is synced

pseudo bramble
#

This is not the channel for that

wind slate
#

what is

pseudo bramble
#

The general channels I presume

wind slate
#

ok

hexed fiber
#

hi

#

I can't add prefix in the api

#

i don't have error but I don't see any prefix

viscid flint
#

Did you do the command /lp <group> meta addprefix <weight> β€˜prefix β€˜

hexed fiber
#

no

#

in the api

viscid flint
#

Ok well try in game

hexed fiber
#

in my plugin

#

try what ?

viscid flint
#

Oh well idk how to help you then sorry

hexed fiber
#

no problem

#

any help please ?

viscid flint
#

ping larry

hexed fiber
#

@rustic laurel

frank driftBOT
#

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

viscid flint
#

sorry

#

i didnt know

hexed fiber
#

sry for pink Larry

rustic laurel
#

Hehh you knew better

viscid flint
#

me?

rustic laurel
#

You do too yes

#

Don't ping staff, rule 1

viscid flint
#

okie yea sorry i havent been on this server in a while 😦

hexed fiber
#

...

#

@viscid flint

viscid flint
#

yea?

hexed fiber
#

why you ask me to ping Larry

#

he kick me

viscid flint
#

i forgot im rly sorry

hexed fiber
#

np

rustic laurel
#

You know better, you can think for yourself

hexed fiber
#

yeah ...

#

someone for help ?

#

please

rustic laurel
#

You say you have an error? Which error

hexed fiber
#

no I don't have error

#

juste i don't have the suffix

#
    //function to set Preffix (dev, admin), (ex : /todev true => need to set an additional preffix because permission is removed) :
    public void setPrefix(UUID uniqueId, Integer prefixplace,String groupname) {
        //Get User variable for changes :
        UserManager userManager = api.getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);

        userFuture.thenAcceptAsync(user -> {
            //Add prefix to player when his perm is removed and he want to keep preffix :
            user.data().add(PrefixNode.builder(groupname,prefixplace).build());
            api.getUserManager().saveUser(user);
        });
    } ```
#

Larry ?

rustic laurel
#

That's snippet doesn't really tell me much

hexed fiber
#

I cant send u the entire code

rustic laurel
#

I know

hexed fiber
#

I will send u tomorrow

rustic laurel
#

What you need to do is look at the javadocs and see what the problem is

hexed fiber
#

Because i go to bed

rustic laurel
#

I can't look at / test / fix the entire code either so I'm not really sure what to say

tribal wave
#

oh larry

#

i made the switch πŸ˜‰

rustic laurel
#

IDEA?!

hexed fiber
#

I did exactly what it says on the documentation but the prefix just doesn't show up.

tribal wave
#

and everything magically works now

#

yeh XD

rustic laurel
#

Yep sounds about right

hexed fiber
#

Hello ivan

tribal wave
#

i wish i knew enough about maven to be able to figure out exactly why it wasn't working before

#

hi Antoine

hexed fiber
#

I've solved a lot of problems

rustic laurel
#

You're adding a prefix that is made up of groupname and prefixplace

hexed fiber
#

No

#

Groupname is the prefix name

#

Prefix place is the rank : 100,50,20 ...

#

And it is (prefix name, place)

rustic laurel
#

The weight?

hexed fiber
#

Yeah

rustic laurel
#

Hmm I'm not at my PC rn tbh so can't be searching the javadocs ( @neat jackal pls bb) but I'll take a look when I can

hexed fiber
#

Ok

#

See you tomorrow.

obtuse jolt
#

Just saying you quite misleading to name your variables that doesn’t correspond to its actual thing they store lol.

open vortex
#

Does user.getPrimaryGroup() get the highest ranking group the user is in or the first one on the track?

obtuse jolt
#

getPrimaryGroup is usually teh group with highest wieght

#

!weight

frank driftBOT
open vortex
#

Ok, cool

hexed fiber
#

Hi

#

I need help if u can

#

Please

hexed fiber
#

in the api, I can't set preffix

#

idk why

plain hill
tribal wave
#

@plain hill this doesn't really belong in #luckperms-api but you need to get rid of that &b for a &f

#

unless wait

#

oh you know it's probably actually your chat plugin; you should check wherever it makes you set up how the name looks and how the prefix is separated

hexed fiber
#

@tribal wave

#

Hi

#

I have a problem

#

with luckperm

tribal wave
#

what's the problem?

hexed fiber
#

Hum

#

I can't display prefix

#

I don't have error but dont have preffix

#
    //function to set Preffix (dev, admin), (ex : /todev true => need to set an additional preffix because permission is removed) :
    public void setPrefix(UUID uniqueId, Integer prefixplace,String groupname) {
        //Get User variable for changes :
        UserManager userManager = api.getUserManager();
        CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);

        userFuture.thenAcceptAsync(user -> {
            //Add prefix to player when his perm is removed and he want to keep preffix :
            user.data().add(PrefixNode.builder(groupname,prefixplace).build());
            api.getUserManager().saveUser(user);
        });
    } ```
obtuse jolt
#

When you do lp user USER info does it show?

#

Or the prefix is completely not set?

hexed fiber
#

Yeah i had do lp user user info

#

And i had no preffix

#

Nothing

tribal wave
#

what string value are you passing into groupname

neat jackal
#

Do you use Bungeecord or Velocity or smth like that?

hexed fiber
#

Idk

#

@tribal wave

tribal wave
#

?

hexed fiber
#

I ll tell u wait 2 sec

#
setPrefix(player.getUniqueId(),10,"Β§4[Administrateur] PREFIX SET"); ```
#

@tribal wave

#

"PREFIX SET" is juste for dΓ©bugging

tribal wave
#

that'll be why your code isn't working i bet

#

at least partially

#

did you read the api wiki at all?

hexed fiber
#

yeah

tribal wave
#

i will once again recommend you do so

hexed fiber
#

not all

#

what do you think it is?

tribal wave
#

okay so take a look at your code

hexed fiber
#

yep

tribal wave
#

see that user.data.add(... line near the bottom of what you pasted

#

do you understand what that line does

hexed fiber
#

yeah

#

yeah

#

we take the user's data, and we add a node

#

with add

tribal wave
#

correct

hexed fiber
#

nice 🀩

tribal wave
#

now - what is a node? what does it look like?

hexed fiber
#

hum ...

#

wait a sec

#

The Node interface is the core data class in LuckPerms.

Most simply, it represents a "permission node". However, it actually encapsulates far more than just permission assignments. Nodes are used to store data about inherited groups, as well as assigned prefixes, suffixes and meta values.

Combining these various states into one object (a "node") means that a holder only has to have one type of data set (a set of nodes) in order to take on various properties.

The Node interface provides a number of methods to read the attributes of the node, as well as methods to query and extract additional state and properties from these settings.

#

tadam

tribal wave
#

show me an example of a node

hexed fiber
#

ok

#

PrefixNode.builder(10,"exemple")

#

PrefixNode

tribal wave
#

that is not a node

hexed fiber
#

PrefixNode

tribal wave
#

that is a line of code

hexed fiber
#

πŸ€”

tribal wave
#

show me an actual node string which you would feed into that line of code

#

a realistic one

#

don't just use exemple

hexed fiber
#

user.data().add(PrefixNode.builder(10,&4[admin]).build());

tribal wave
#

that is also not a node

#

that is once again, a line of code

hexed fiber
#

oh ..

tribal wave
#

i am not asking you to show me any code; just show me a permission node

hexed fiber
#

import net.luckperms.api.node.Node;

tribal wave
#

that is also a line of code

hexed fiber
#

this

#

oh

#

i now

#

know

#

group.developpeur

tribal wave
#

correct

#

good job

hexed fiber
#

nice

#

πŸ™‚

tribal wave
#

that is what a node is; it is a permission string that takes the form of some.words.a.plugin.cares.about

hexed fiber
#

oh ok ..

tribal wave
#

do you remember how you set up prefixes in the luckperms editor for the first time

#

or did you use a command for that

hexed fiber
#

lp editor ?

tribal wave
#

yeah

hexed fiber
#

hum ..

#

yeah

tribal wave
#

yeah?

hexed fiber
#

i remenber

#

remember

tribal wave
#

okay; what does a prefix permission node look like?

obtuse jolt
#

It’s prefix.<weight>.<prefix>

hexed fiber
#

here

tribal wave
#

very nice

hexed fiber
#

ben it was not a qauestion

#

but

#

what is difference between two ?

obtuse jolt
#

displayname is an alias name for groupname

hexed fiber
#

what ?

obtuse jolt
#

prefix is usually the thing that is displayed in chat

hexed fiber
#

and preffix ?

#

ok

tribal wave
#

Antoine do you now understand why your code from earlier did not work

hexed fiber
#

so displayname.dev = groupname.dev in the code

tribal wave
#

no...

hexed fiber
#

@tribal wave Let me think for two minutes.

obtuse jolt
#

No

hexed fiber
#

oh

#

I KNOWWWW

#

@tribal wave

#

I need to write :

#
user.data().add(PrefixNode.builder(prefix.20.Β§4[dev]).build()); ```
obtuse jolt
#

Uh...

tribal wave
#

not quite but you get the idea

hexed fiber
#

oh ...

tribal wave
#

once again i STRONGLY recommend taking a tutorial on java

hexed fiber
#

user.data().add(PrefixNode.builder("prefix.20.Β§4[dev]").build());

#

I forget ""

tribal wave
#

yep, that should maybe work now

#

i'm honestly not sure if the fancy & character works correctly but it might

hexed fiber
#

You know, I've been coding for four years. It was just a mistake of inattention.

tribal wave
#

have you been coding in java for 4 years?

hexed fiber
#

no

#

python C++ C#

remote sky
#

He’s been doing Pascal

hexed fiber
#

xD

remote sky
#

Just kidding hahaha

hexed fiber
#

thx for all @tribal wave

tribal wave
#

well i guess if you've just started with java it's fine

#

no problemo πŸ‘

hexed fiber
#

πŸ™‚

#

@tribal wave

tribal wave
#

hmm

hexed fiber
#

Description Resource Path Location Type
The method builder() in the type PrefixNode is not applicable for the arguments (String)

#

πŸ€”

tribal wave
#

are you sure you worked with python, C++, and C# for 4 years?

hexed fiber
#

yeah xD

tribal wave
#

what you're dealing with right now is not a problem unique to java

#

it is a very simple mistake that people can make in any language

hexed fiber
#

builder take PrefixNode value

obtuse jolt
#

I think use PermissionNode instead of PrefixNode

#

Bcu PrefixNode takes in 2 parameter, weight number and prefix string iirc

hexed fiber
#

@tribal wave don't tell me that

#

he tell me Prefixnode take a string arg

tribal wave
#

i said that a node was a string

hexed fiber
#

yeah

#

so ?

tribal wave
#

so... i never told you that prefix node only takes a single argument? o.o

hexed fiber
#

yeah ..

#

so you have to fill in the weight twice?

obtuse jolt
#

Actually now I confused myself as well rip

tribal wave
#

same xd

hexed fiber
#

xD

#

user.data().add(PrefixNode.builder("prefix."+prefixplace+"."+groupname)).build();

#

how I can resolve error ?

tribal wave
#

you still only have one parameter

#

remember how ben said the prefixnode builder takes 2? our lengthy discussion about that no less than a few minutes ago

#

πŸ˜‰

hexed fiber
#

user.data().add(PrefixNode.builder("prefix."+prefixplace+"."+groupname, prefixplace)).build();

#

so ?

tribal wave
#

so..? try it

hexed fiber
#

Description Resource Path Location Type
The method add(Node) in the type NodeMap is not applicable for the arguments (NodeBuilder<capture#9-of ?,capture#10-of ?>)

tribal wave
#

sigh

#

that happened because you deleted more of your code from before than you needed to

hexed fiber
#

"prefix."+prefixplace+"."+groupname

#

user.data().add(PrefixNode.builder(groupname,prefixplace).build());

#

I juste replace groupname by

tribal wave
#

you changed something else

#

i would hope that with your 4 years of experience you'd be able to find what πŸ˜‰

hexed fiber
#

I work in python all the time with a better editor.

#

it's more easy

tribal wave
#

well you're not wrong

hexed fiber
#

user.data().add(PrefixNode.builder("prefix."+prefixplace+"."+groupname,prefixplace).build());

#

user.data().add(PrefixNode.builder("prefix."+prefixplace+"."+groupname, prefixplace)).build();

#

here

#

it's done

tribal wave
#

if it's done you should run it

#

you really should be going through this debugging process on your own

#

i'd imagine you can deal with errors on your own when you work in python

hexed fiber
#

I work in deep learning

#

so there isn't many debuging ..

tribal wave
#

so you have never had to debug your own code?

hexed fiber
#

so of course, but java is pretty far away from python

tribal wave
#

you said you work in c++ and c#

#

those have like 99% of the same syntax as java

#

or i guess it's the other way around really

hexed fiber
#

in fact I don't do much C++ and C# is only for unity and it's still different.

tribal wave
#

have you ever had to debug your code for unity

hexed fiber
#

and in C#, it's unity that manages the classes.

#

yeah

tribal wave
#

so why can't you do that with java

#

what's holding you back

hexed fiber
#

idk

#

wtf

tribal wave
#

you need to attach a &f to the end of the prefix you are setting

#

also wait

#

i guess PrefixNode doesn't actually take a node as a parameter

#

that makes sense.... oof

hexed fiber
#

wtf

#

I xon't understand

tribal wave
#

in that case you can just put the prefix you want instead of the entire node

obtuse jolt
#

yea it doesnt @tribal wave

#

for taht is PermissionNode

tribal wave
#

yeah ;-;

obtuse jolt
#

i kinda try to explain but i confused myself jn oop

tribal wave
#

XD well no harm done

hexed fiber
#

you need to attach a &f to the end of the prefix you are setting
@tribal wave what

tribal wave
#

?

hexed fiber
#

?

#

user.data().add(PrefixNode.builder("prefix."+prefixplace+"."+groupname&f,prefixplace).build());

#

like this ?

tribal wave
#

i mean append the &f as a string... to the end of the prefix

obtuse jolt
#

as in if you dont want the colour of the prefix to be in your playname, put &f at the back of your prefix

hexed fiber
#

oh

#

ok

tribal wave
#

and also get rid of the "prefix."+prefixplace+"."+ portion of that line of code

#

since we have now realized the prefixnode builder doesn't need that

hexed fiber
#

like that ?

#

user.data().add(PrefixNode.builder(groupname+"&f",prefixplace).build());

tribal wave
#

try running it

hexed fiber
#

it's done

#

u save me my god

tribal wave
#

you need to debug your own code in the future

hexed fiber
#

ye

tribal wave
#

for my sanity as well as everyone elses

hexed fiber
#

you will debug my code for me in the future

#

no ?

tribal wave
#

i refuse without a shred of guilt

obtuse jolt
#

haha

hexed fiber
#

xD it's a chocke

#

joke

#

prank !!

obtuse jolt
#

debugging alway make me drop a ton of hair

#

me debugging for an hour to realise i miss a +1 somewhere

tribal wave
#

real talk though; +1's are actually some of the hardest things to catch

obtuse jolt
#

yea it is

rustic laurel
#

!api

frank driftBOT
rustic laurel
#

With the dev-api?

#

Read the channel topics πŸ˜›

nocturne elbow
#

could i change like /lp user [user] parent set [group]

rustic laurel
#

wdymmm

nocturne elbow
#

oops

#

wait

#

could i change like /lp user [user] parent set [group] to /setrank [player] [group]

#

in the configs

obtuse jolt
#

either create an alias to map the lp command to what to want it to be, or use a rankup plugin

nocturne elbow
#

k

#

so rankup supports luck perks?

obtuse jolt
#

also it should be in #support-1 or #support-2 unless you are refering to coding out a plugin with such a feature use LPAPI

nocturne elbow
#

oh k srry

autumn herald
#

Hi

#

I need Help.
Please

rustic laurel
#

It doesn't really deal with the developer api, but that's a mysql error.

#

!errors try the solutions here

frank driftBOT
autumn herald
#

Oh, xd, well, to the next trip to another channel, thanks.

polar pagoda
#

is there a chance I could talk to someone about how luckperms handles permission nodes for a plugin?

obtuse jolt
#

using Luckperms API?

rustic laurel
#

I mean yes formguy but if you have a q it's always good to ask straight up

polar pagoda
#

yeah, just saw Player for hasPermission or isplayer in group, but just curious what kind of player

#

I'm assuming when you capture a command event, luckperms captures the person who sent the command as that kind of player?

#

or am I able to create a player object via a uuid

rustic laurel
#

You can once the player is loaded, anytime during or after PlayerLoginEvent, though that's a bukkit thing and not an LP thing if I am correct in understanding you

polar pagoda
#

it uses the bukkit player Player?

rustic laurel
#

I think so? Not certain but I believe it does. You'd be able to find it easily by looking at the javadocs here

#

First link

#

!api

frank driftBOT
polar pagoda
#

just found loadUser, so I think that's what I'm looking for? cause hasPermission takes a User not a Player, my mistake ^^

rustic laurel
#

Try the second link as well tbh, just read both of those pages they'll serve you well

obtuse jolt
rustic laurel
#

I'm not sure what you need cause I can't read your mind :p

polar pagoda
#

Hehe, just trying to do a simple permissions check

#

taking a player who I have the uuid for and checking the luckperms database and seeing if they have the permission

rustic laurel
#

Then the two wiki pages I linked and maayybbe a little bit of javadocs is all you need

polar pagoda
#

alrighty, I think I see what I need from the wiki page, thanks Larry and ben ^^

rustic laurel
#

np!

nocturne elbow
#

is there a primarygroup-change event?

obtuse jolt
#

You there should be a SetPrimaryGroup method, but it will only work if you set parent-group-calculation to stored on lp config. Else primary group will b edge group of highest weight and we usually just use this

dim saddle
crystal sonnet
#

@dim saddle have you tried debugging with verbose ?

dim saddle
#

no

crystal sonnet
#

Then try that

dim saddle
#

everything is already working, but you need to disable the operator and only permission

azure latch
#

@fossil adder You have to know how awful that is to read right?

#

Put your code in little blocks