#luckperms-api

1 messages ¡ Page 13 of 1

zenith linden
#

do i just click one of the links

#

and open the zip

thorny echo
#

Kinda

zenith linden
#

..

#

:/

thorny echo
#

Unzip the zip, and add the bin folder to your path

zenith linden
#

i'm on the installation tips thing

zenith linden
#

I need Jdk then don't i

thorny echo
#

See here, ignore the first bit and look at the To add a path to the PATH

zenith linden
#

alright

thorny echo
#

You'll want to add the full folder location to it, like C:\Users\Insqnity\Downloads\apache-maven-3.5.4\bin

zenith linden
#

i have windows 10

thorny echo
#

and?

zenith linden
#

"On the Start menu, right-click Computer."

thorny echo
#

oh, just open up file explorer and right click this pc

zenith linden
#

I'm actually kind of glad i'm learning this stuff

thorny echo
#

Ah good

zenith linden
#

In the Edit System Variable dialog box, scroll to the end of the string in the Variable value box and add a semicolon (;).

thorny echo
#

ah yeah outdated

#

Click new

#

and add the path

zenith linden
#

what path

#

oh

#

C:\Users\Insqnity\Downloads\apache-maven-3.5.4\bin?

thorny echo
#

[17:15] Void: You'll want to add the full folder location to it, like C:\Users\Insqnity\Downloads\apache-maven-3.5.4\bin

#

If that's where it's located

zenith linden
#

yeah

#

i did that

thorny echo
#

ok

#

now close cmd and open it again

#

And type mvn

zenith linden
#

cmd was never opened

thorny echo
#

and if something happens, you've installed it correctly

#

well open it

zenith linden
#

where do i add a semicolon

#

hmph

thorny echo
#

You don't need to

#

also hmm

#

show me your path

#

wait

zenith linden
thorny echo
#

Is it in Downloads?

zenith linden
#

yes

thorny echo
#

"C:\Users\Tyler Chaky\Downloads\apache-maven-3.5.4\bin\mvn.cmd"

#

can you run that, with the quotes, please

zenith linden
#

C:\Users\Tyler Chaky\Downloads\apache-maven-3.5.4-bin\apache-maven-3.5.4\bin

#

it's in a folder of a folder

thorny echo
#

ah

#

so put that path in, instead

zenith linden
#

asdha

#

didn't make it any better

thorny echo
#

did you reopen cmd?

#

also this is why I use linux

zenith linden
#

yes

#

lol

thorny echo
#

okay

#

and your path

zenith linden
#

i copied that

thorny echo
#

Show me your path variable

zenith linden
thorny echo
#

okay

zenith linden
#

wait

thorny echo
#

Now click the ok save etc buttons

zenith linden
#

i had to press ok on the computer thing

thorny echo
#

if you haven't already

zenith linden
#

yeah

thorny echo
#

🤦

#

Ok reopen cmd and try now

zenith linden
thorny echo
#

Yayyay

#

that's good

zenith linden
#

i saw build failure

#

lol

thorny echo
#

Now do you have git?

zenith linden
#

yeah

thorny echo
#

Ok, so you should be good to build

#

Just run the three commands from the wiki

zenith linden
#

i need jdk?

#

this 203mb file

thorny echo
#

Probably

#

I ❤ linux/solus

zenith linden
#

can i compile like this for anything?

#

does it have to be a github?

thorny echo
#

Depends, it's probably about 50/50 whether a plugin uses gradle or maven

#

It doesn't matter where you got the source from, github is just file storage at the end of the day

zenith linden
#

can i get the source from a folder in my pc?

thorny echo
#

but yeah lots of plugins will compile like that with maven

#

Yeah

zenith linden
#

alright

thorny echo
#

just cd into it and mvn package

zenith linden
#

and it has to include maven or gradle?

#

what if the plugin doesn't include maven or gradle

#

how would i compile it

thorny echo
#

... you can't

zenith linden
#

oh so every plugin has maven or gradle?

thorny echo
#

Or at least you have to make one yourself

fickle viper
#

Is there a method in the API for promoting a player to the next rank in a track or do I need to get all the groups in a track, order them from least to greatest based on their weights and then compare their current rank's weight to the rest and then choose the rank with the next highest weight? I'm hoping there is already a method that does this already :3 Also anything to set the player's rank for a certain track or should that be done manually?

thorny echo
#

Yes, but not every plugin publishes the source code @zenith linden

zenith linden
#

right

#

i have a source code of something my friend made

thorny echo
#

Does it have a file named build.gradle or pom.xml?

zenith linden
#

let me see

#

it has pom.xml

thorny echo
#

ok, then it's made with maven

zenith linden
#

awesome

#

thanks for that

thorny echo
#

Dwdw

zenith linden
#

i didn't know what pom.xml meant

thorny echo
#

Yeah, it's a strange name

zenith linden
#

lol

#

there are so many folders in this

#

559 files, 127 folders

thorny echo
#

Yeah tends to happen with java apps

zenith linden
#

i can only make something kill a player and send a message

#

that's all i know

#

i don't know how to make something with maven or whatever

#

to compile it

#

so uhm

#

i'm editing the code a bit to change the colors of messages and stuff

#

where do i change the command

#

Use &a/{} help &3to view available commands.

#

/{}

#

i want the command to be /gp

jaunty pecan
#

firstly, why?

#

secondly, those values are configured in the main plugin class, and also in the plugin.yml file

zenith linden
#

my manager

#

wants me to change the command

#

plus i want it to look like my server colors for fun

jaunty pecan
#

you can configure the colours and general appearance of the plugin without needing to change the code

thorny echo
#

hmm how?

zenith linden
#

the manager of my server wants me to change the command so people don't know what perm plugin we use to take our custom way of using ezrankspro

#

yeah, how?

jaunty pecan
#

just block the command then for regular players?

zenith linden
#

they can still do the command /lp and see that it's blocked

#

knowing we have luckperms

jaunty pecan
#

also just to point out that using a permissions plugin with ezrankspro definitely isn't custom

#

that's like, the only way to use it

#

and your players knowing you use luckperms somehow gives them all of this information too?

zenith linden
#

people are smart

#

they can figure it out

#

idk how people do it but they do

#

probably because of things like i said in this chat

#

god damnit

jaunty pecan
#

sounds like you need to rethink your server if just using a (now quite popular) permission plugin is the only thing competitors need to replicate your gamemode.

#

anyhow

#

the documentation for customising the appearance of luckperms is here

zenith linden
#

that's editing the code

#

...

#

same thing Void sent me

thorny echo
#

skins luckperms to look like permissionsex

#

?

jaunty pecan
#

no it's not, it's editing a configuration file

zenith linden
#

can i edit this config file without having to recompile it?

jaunty pecan
#

yes

thorny echo
#

Yes

#

It goes in plugins/LuckPerms

zenith linden
thorny echo
#

yeah

zenith linden
#

i need to add lang.yml?

thorny echo
#

put a file named lang.yml there

zenith linden
#

oh ok

thorny echo
#

With the content from the wiki

zenith linden
#

i was going at this the wrong way

#

...

#

now i need some way to block the command /lp to say Unknown Command! Please use '/help'

#

something like that

thorny echo
#

Write a plugin

zenith linden
#

yeah i'm not that good

#

wait

trail oar
#

Ask your developer

zenith linden
#

don't have one

thorny echo
#

lmao

trail oar
#

Lol

zenith linden
#

lmao

#

Void

#

i do know how

#

just use the command /lp to send a message

#

i know how to make something send a message

#

with java

trail oar
#

Just search on spigot

#

Command blocker

zenith linden
#

i already know how

#

it's good

gusty goblet
#

Sorry this is a bit late, I’m applying the temporary permission node with an expirationTime of System.currentTimeMillis + 3h in milliseconds (have confirmed that this parsed correctly). Sorry would send full code but on my iPad rn

crystal sonnet
#

Do you also save after applying the permissions?

#

@jaunty pecan regarding the Vault stuff, how about checking if it’s the main thread and if it is, either doing nothing or throwing an exception (I’d go with that. And with local storage a main thread friendly implementation could be used) and if it isn’t, just loading the player

gusty goblet
#

Yes I do save them, they work fine when they don’t have an expiration

crystal sonnet
#

The exception should be something like an IllegalStateException with a message pointing out that this call would freeze the main thread due to database interactions and that it should be called async

#

@gusty goblet I think the code would be helpful

#

Back to vault: The exception could also be skipped if the offline player is already loaded

gusty goblet
#

I posted it above, let me paste it in again

crystal sonnet
#

In other words trying as hard as possible to make it work and if it doesn’t, failing with a useful exception

halcyon pebble
#

Would this be correct:

@Override
public void onEnable() {
  LuckPermsUtil.getAPI().getEventBus().subscribe(NodeAddEvent.class, this::onGetRank);
}

public void onGetRank(NodeAddEvent e) {
        Node node = e.getNode();
        if(node.isGroupNode()) {
            String rank = node.getGroupName();
            double value = ConfigOptions.getRankValue(rank);
            if(value > 0) {
                PermissionHolder ph = e.getTarget();
                if(ph instanceof User) {
                    User user = (User) ph;
                    UUID uuid = user.getUuid();
                    OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
                    if(op != null) {
                        long millis = System.currentTimeMillis();
                        ConfigData.force(op, millis);
                    }
                }
            }
        }
    }

to save dates when a player's rank changes?

crystal sonnet
#

Looks good

halcyon pebble
#

k thnx 😃

gusty goblet
#

The timedWEPermissions array is just a string array of world edit permissions

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

Looks good to me. So not sure what’s the issue here

gusty goblet
#

I’ll take a look over it again tomorrow try find the issue

trail oar
#

I'm trying to use the api, but when i use !getUser(UUID); It returns null, unless i connect to the server at least once, after restart.

#

IS there another way to get user? getSafeUser?

fierce lynx
#

Just to be sure, API should work for bungee as well, right?

#

Taking a small example from the wiki and modifying like so:

  return p.hasPermission("group." + group); 
}```
trail oar
#

I suppose, i'm using it for a bungee server

#

Where do you use the api in that code?

fierce lynx
#

You don't, the point is to clarify if subtle changes to fit bungee variables into the API should still work (such as ProxiedPlayer vs Player)

trail oar
#

I didn't get you point

#

But yes, bungeecord is the same as bukkit. You just use proxiedpkyer

fierce lynx
#

I'll just test it and find out for myself.

#

In short, I was trying to be lazy and gave a bad example.

crystal sonnet
#

@trail oar you can load a player through the API

#

@fierce lynx yes the API works on any platform. And any method expecting a native player object accepts the platform’s player object(s)

trail oar
#

So, i should load the player just before i try to get the user and it will not. Return null? I'll have to unload after use it?

crystal sonnet
#

Yes and no

#

Unloading is done automatically

#

And loading the player when it’s already loaded will just do nothing

#

So in other words before you work with a player, load it

#

And the instance stays active for a while. And every time you access it again, you reset the timeout

trail oar
#

Oh, thank you. I was worry about it 😉

crude oak
#

Hello! How can I get user prefix and suffix using LuckPerms API?

candid ermine
crude oak
#

thank you very much!

candid ermine
#

np

crude oak
#

sorry, but I don't understand what user is on user.getCacheData().getMetaData(contexts);

candid ermine
#

somewhere up

#

there should be how to get user

#

everything is in the github

#

User user = luckPermsApi.getUserManager().loadUser(uuid);

#

there u go

crude oak
#

ok thanks

nocturne elbow
#

Hi! I want to ask at the luckperms how do i add a prefix to a permission without writting it as a global?

crystal sonnet
nocturne elbow
#

oh sh*t sorry

tropic cipher
#
            for (Rank r : Rank.values()) {
                if (r.getName().equals(player.getPrimaryGroup())) {
                    if (r.getPriority() >= rank.getPriority()) {
                        return true;
                    }
                }
            }

            return false;
        });

Is it possible to return a different value within a completeable future? Like above

crystal sonnet
#

What do you mean with different value? @tropic cipher

gloomy saffron
#

How would you (using the API) find out if a permission node is temporary and get the time remaining?

crystal sonnet
#

@gloomy saffron check the examples on the wiki. Iirc there’s an example that does just that

gloomy saffron
#

I looked on the wiki and couldn't see anything mentioning timed permissions

crystal sonnet
#

@jaunty pecan

#

That’s a case for you ;P

jaunty pecan
#

Node.isTemporary

crystal sonnet
#

That’s a case for you ;P

nocturne elbow
frank driftBOT
#

Hey Milburn! Please don't tag staff members.

candid ermine
#

@nocturne elbow UUID uuid = <player>.getUniqueID();

jaunty pecan
#

they don't have a player instance there

candid ermine
#

ohhhh

#

cant they get user and then get the uuid ?

jaunty pecan
#

milburn, check the javadocs for the deprecated method, it will tell you what the new alternative is

candid ermine
#

how can you check javadocs ,

#

?

#

in ide

jaunty pecan
#

yes, or online

candid ermine
#

oh

#

can i get link for web ?

#

oh i got it im so dumb

#

i've seen these a lot and used a lot

#

lmao i can google UserManager.lookupUuid(String)

#

b1g boy

heady solar
#

Luck

nocturne elbow
#

luck work

nocturne elbow
#

@jaunty pecan how to create bungeecord subcommand's manager?

frank driftBOT
#

Hey sbyte! Please don't tag staff members.

jaunty pecan
#

i don't understand the question

nocturne elbow
#

How to create abstract subcommand class?

jaunty pecan
#

create a class that extends from it

#

either way, this is a channel for the LP API, not just general java development

#

there are more appropriate places to ask programming questions, such as the spigot forums, or on stackoverflow

nocturne elbow
#

ok, sorry

gusty goblet
#
            for (Node node : permissionNodes) {
                DataMutateResult result = user.setPermission(node);
                System.out.println("result: " + result.wasSuccess());
            }
            
            plugin.getLuckPerms().getUserManager().saveUser(user);

Anyone happen to know why this doesn't persist? The result comes back as successful and works fine until I relog

crystal sonnet
#

@gusty goblet does saveUser return something? If so you could check that too

candid ermine
#

@gusty goblet It would be nice to send the whole code on pastebin

jaunty pecan
#

is it's not persisting and there's no obvious errors, it's possible another server or process is overriding the save with old data

#

other than that, i'm not sure

deep gazelle
#

How I add expiry to a command on Luckperms?

candid ermine
#

depends on what command

candid ermine
#

oh its api channel my bad

thorny echo
#

@deep gazelle There's an example for exactly that in the Developer API wiki page

deep gazelle
#

Okay

atomic sapphire
#

How can I set the duration of a temp-parent using the api? My server is configured to append time in case the player already has a temp-parent.
And is it possible to get the current days left for example or just get the time a parent will expire?

(It would be way better to do this without using Spigot/BungeeCord on a standalone .jar - If it is possible? [LuckPerms is storing everything in MySQL])

crystal sonnet
#

@atomic sapphire first of all the storage method is irrelevant when working with the API.
Second the wiki has a billion examples on the API, including temp nodes

atomic sapphire
#

Okay.. So I should set/unset get expiry using Permission-Nodes like group.admin ? In that case how is the expiry saved? If I use a online website to 'translate' it into a date and time it returns me a time shifted by hours. Is it using the servers timezone for it?

crystal sonnet
#

It should be using UTC

#

Java has methods to work with so called unix timestamps

#

@atomic sapphire

atomic sapphire
#

Okay I'll try it - Thanks!

nocturne elbow
#

Ok

#

I have question

#

So 90% interface use for api?

thorny echo
#

?

junior crag
#
UserDemoteEvent eventoDemotado = (UserDemoteEvent) e.getWinner();           
if ( eventoDemotado.getGroupTo().equals("Bronze3"))  {
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "broadcast Was demoted.");
}
#

On part e.getWinner() return the player name.

#

Its is correct? If you want help me, please tag me. Thank you.

trail oar
#

Why you cast a playername to an event? ._.

crystal sonnet
#

I see a huge issue in your code. Mixed languages!

Use
One
Language
Only

junior crag
#

So @trail oar how i say if players was demoted?

trail oar
#

if e.getWinner() returns the player name that was demoted, then load it using the UserManager from luckperm api

junior crag
#

Luck, is possible to have one event called UserPromoteEvent only happens in one server and not from all network? Like this /lp user 0rangeFox promote rank server.

crystal sonnet
#

@junior crag yes you can promote with contexts

junior crag
#

How?

#

I want only event works when i promote only on server called server understand?

crystal sonnet
#

You’re command is correct

#

And in regards to the event, the event should contain the context somewhere so you can check for that

junior crag
#

hmmm okay, thanks, i will see it.

nocturne elbow
#

if i use interface for all methods

#

i use bad code?

long moon
#

Generally sounds like you're going somewhat crazy with them, but interfaces are a really good tool when used in the right place, and just pointless bloat in others

crystal sonnet
#

If you don’t have at least two classes implement an interface and use that interface somewhere, then you shouldn’t use it. Else it can be ok. Though still depends on a lot of other stuff

nocturne elbow
#

I use default void for different class.
Example:
public class Settings extends FileUtil implements messages_intf, exec

idle nymph
#

how can i give a player a rank for a time with the api?

crystal sonnet
#

@idle nymph by checking the examples on the wiki

idle nymph
#

but where?

#

in the wiki

crystal sonnet
#

Check the very bottom of the nav bar on the right (or bottom on mobile)

nocturne elbow
#

can Main.api.getUserManager().lookupUuid(realName).join(); be used in ASYNC?

thorny echo
#

@nocturne elbow yeah

junior crag
#

Someone can help me about this,

        Bukkit.getScheduler().runTask(plugin, () -> {
            Bukkit.broadcastMessage(event.getUser().getName() + " | Promote | " + event.getGroupFrom().get() + " | 1");
            Bukkit.broadcastMessage(event.getUser().getName() + " | Promote | " + event.getGroupTo().get() + " | 2");
        });
    }```
Im testing about this code, and when i promote one user from one track, the messages will be sent, but if i do ``lp user 0rangeFox group set rankX server=serverX``, and the messages not will be sent, but the rank ``rankX`` is on track.
crystal sonnet
#

@nocturne elbow in fact it should be used async!

#

Every call that loads something shouldn’t be called on a main thread

thorny echo
#

@junior crag that event is sent when the promote command is used

junior crag
#

i know it, but dont have other way to identify it?

junior crag
#

This code is not correct? ``` @Override
public String getReplacement(Player player) {

    User user = (User) player;
    MetaData metaData = user.getCachedData().getMetaData(Contexts.allowAll());
    
    String prefix = metaData.getPrefix();
    return prefix;
}```
crystal sonnet
#

@junior crag if user is a LP user, then it’s incorrect

#

You need to load the user instance. You can’t just magically cast it

#

They’re completely different things

junior crag
#

Latest code, is correct now?


import codecrafter47.bungeetablistplus.api.bukkit.Variable;
import me.lucko.luckperms.api.Contexts;
import me.lucko.luckperms.api.LuckPermsApi;
import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.caching.MetaData;

public class BungeeTabListPlusPlaceholders extends Variable {
    
    LuckPermsApi luckPermsApi;
    
    public User loadUser(Player player) {
        // assert that the player is online
        if (!player.isOnline()) {
            throw new IllegalStateException("Player is offline");
        }
        
        return luckPermsApi.getUserManager().getUser(player.getUniqueId());
    }
    
    public BungeeTabListPlusPlaceholders() {
        super("test");
    }

    @Override
    public String getReplacement(Player player) {
        
        MetaData metaData = loadUser(player).getCachedData().getMetaData(Contexts.global());
        
        String prefix = metaData.getPrefix();
        return prefix;
    }
}
crystal sonnet
#

Looks good

junior crag
#

But im receiving errors

#
java.lang.NullPointerException
        at pt.Saphirex.Placeholders.BungeeTabListPlusPlaceholders.loadUser(BungeeTabListPlusPlaceholders.java:21) ~[?:?]
        at pt.Saphirex.Placeholders.BungeeTabListPlusPlaceholders.getReplacement(BungeeTabListPlusPlaceholders.java:33) ~[?:?]
        at codecrafter47.bungeetablistplus.bukkitbridge.BukkitBridge$ThirdPartyVariablesAccess.resolveVariable(BukkitBridge.java:278) ~[?:?]
        at de.codecrafter47.data.api.AbstractDataAccess.get(AbstractDataAccess.java:44) ~[?:?]
        at de.codecrafter47.data.bukkit.AbstractBukkitDataAccess.get(AbstractBukkitDataAccess.java:43) ~[?:?]
        at de.codecrafter47.data.api.JoinedDataAccess.get(JoinedDataAccess.java:40) ~[?:?]
        at de.codecrafter47.bungeetablistplus.bridge.AbstractBridge.updatePlayerData(AbstractBridge.java:369) ~[?:?]
        at de.codecrafter47.bungeetablistplus.bridge.AbstractBridge.updateData(AbstractBridge.java:304) ~[?:?]
        at codecrafter47.bungeetablistplus.bukkitbridge.BukkitBridge.lambda$onEnable$3(BukkitBridge.java:128) ~[?:?]
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) [server.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) [server.jar:git-PaperSpigot-"4c7641d"]
        at org.github.paperspigot.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:23) [server.jar:git-PaperSpigot-"4c7641d"]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
crystal sonnet
#

You have a null on line 21

#

Says it straight out in the exception

junior crag
#

return luckPermsApi.getUserManager().getUser(player.getUniqueId());

#

Hmmm, 🤔

crystal sonnet
#

Probably your LP API instance is uninitialized

junior crag
#

O to initialize? Is not like put LuckPermsApi luckPermsApi; on class and done?

crystal sonnet
#

No

junior crag
#

So, how?

crystal sonnet
#

That’s how you create a variable

#

It has no value

#

It needs to get the instance somewhere

junior crag
#

So, you can help me about it please?

crystal sonnet
#

But let me tell you something

junior crag
#

Yes please, say me.

crystal sonnet
#

Stop what you are doing and learn Java first

junior crag
#

ahm, again?

crystal sonnet
#

And no. Don’t learn Java by writing plugins

junior crag
#

First, i learned Java when i was programming on program in Java on school.

#

I learned something.

#

but not all.

crystal sonnet
#

You can’t read errors and don’t know how to initialize variables. Nor what initialization is

#

Clearly you haven’t learned Java

#

And that’s not supposed to be offensive

#

It’s a fact and it’ll get in your way every other line of code

junior crag
#

Done.

#

You are bad for me lel, is hard to explain?

#

Final code for people who want know:


import codecrafter47.bungeetablistplus.api.bukkit.Variable;
import me.lucko.luckperms.LuckPerms;
import me.lucko.luckperms.api.Contexts;
import me.lucko.luckperms.api.LuckPermsApi;
import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.caching.MetaData;

public class BungeeTabListPlusPlaceholders extends Variable {
    
    LuckPermsApi api = LuckPerms.getApi();
    
    public User loadUser(Player player) {
        if (!player.isOnline()) {
            throw new IllegalStateException("Player is offline");
        }
        return api.getUserManager().getUser(player.getUniqueId());
    }
    
    public BungeeTabListPlusPlaceholders() {
        super("test");
    }

    @Override
    public String getReplacement(Player player) {
       
        MetaData metaData = loadUser(player).getCachedData().getMetaData(Contexts.global());
        
        String prefix = metaData.getPrefix();
        return prefix;
    }
}```
#

What i said, i know Java, but i easily nevermind the importants things.

crystal sonnet
#

@junior crag you’re missing my point here

junior crag
#

Which is?

crystal sonnet
#

The issues you’re bringing here are really basic. And there’s nothing wrong with running into those. I do all the time. But you need to be able to solve these tiny issues by yourself if you want to be able to create anything that is bigger than 5 classes of that size you have right now

#

You might have learned Java. But never to code and to help yourself

#

And these two skills are infinitely more important than the actual language

#

And Minecraft plugins aren’t the place to learn that.

#

I know that’s harsh. But that’s the sad reality

#

And I’m shocked that beginners never get taught that important knowledge and skills

#

And that’s not your fault btw

junior crag
#

Okay, thanks for your opinion.

#

How i can say like, on track.

crystal sonnet
#

Contexts have nothing to do with tracks

junior crag
#

I want like, only pick prefix if player is on track x

crystal sonnet
#

Then you need to get track x, get all groups of said track and check if the user is any of that groups

#

Can be done relatively easy with streams

junior crag
#

Is possible you send me a snippet of code?

crystal sonnet
#

This is exactly what I’m talking about

#

No. I won’t. I’m not here to spoon feed you

#

If you want to make a plugin, be sure you know the basics

#

And even without streams what you need to do is trivial

random fossil
#

Why are you bashing down on 0rangeFox instead of helping him? He is clearly new to java, just tell him what he did was declaration and not initialization instead of telling him to relearn/learn to code.

#

People that has an attitude like you against new coders makes me really tired.

ebon ether
#

Methods that worked for me to learn programming were:

  • Analysing code of others and changing stuff until I understood what I did
  • Watch YouTube tutorials ( look at the upvotes, there are a lot of bad tutorials out there which dont teach you the importance of code efficency )
  • Take a class in programming ( for this case: Java )
#

@junior crag

junior crag
#

Thank for your opinion @ebon ether

random fossil
#

Yeah, nice one dash.

ebon ether
#

Just tryin to help, if you have further questions regarding programming ( not specific help with code ) you can always dm me

crystal sonnet
#

@random fossil quite simple. I never spoon feed. I’m here to help people solve their problems themselves. And I have 0 pity with new devs that haven’t learned their language yet and try to tackle the advanced stuff.
It’s like a person learning to cook and trying meals that take several hours to cook and their struggling with turning on the stove. It may be rude to tell them off and tell them to learn the basics first. But it’s the only sensible thing for me and them

#

I’ve said it a billion times and I’ll say it again. Minecraft is not the place to learn Java.

ebon ether
#

thats true :3

random fossil
#

I have no problem with people telling other people to start from the beginning, but the way you did it was just awful.

crystal sonnet
#

And solving a single issue directly will result in the person coming back 5 minuets later because they’ve put the pan the wrong side up on the stove and can’t put anything inside, etc

#

If you can tell me how to express it better while still getting the point across and making sure that someone that’s an English learner will understand it too, then go ahead. I’m open to suggestions

random fossil
#

You said, "but let me tell you something", "Stop what you are doing and learn Java first". You could've said something like "but hey, if you don't know what initializing is I don't believe you should be coding java plugins because it's very advanced."

#

Just a suggestion

crystal sonnet
#

Yeah. Just not who I am. I don’t sugar coat things. And I’m down to point direct.

#

Might be because I’m German XD

#

I also consider sugar coating to be dishonest. And dishonesty is the most offensive thing you can do to a person.
At least that’s my ideology

proud crypt
#

Honesty is best policy!

ebon ether
#

Wieviele deutsche brauch man um eine glĂźhbirne zu wechseln?
Einen. Denn deutsche arbeiten effizent und verstehen keinen spaß
:3

How much Germans do you need to change a lightbulp?
One. Because Germans work efficent and dont understand fun.

crystal sonnet
#

That’s a good one 😂

random fossil
#

I call it being encouraging to your fellow coders

#

not sugar coating

crystal sonnet
#

I get that.

#

Just not how I deal with these kind of things

random fossil
#

Yeah, no worries about that, just didn't like the fact you call my way of telling people to start easier is sugar coating.

crystal sonnet
#

And here comes the German in me: Also being nice is waste of efficiency

#

Depending on how nice you go it eventually becomes sugar coating XD

#

Didn’t mean offense by that

random fossil
#

Well of course if you keep going, but that's not my intention.

proud crypt
#

You just gotta remember that people from different cultures have different ways of expressing themselves and may come across as offensive to you but it's really nothing.

crystal sonnet
#

That’s mostly what it is for me

#

Like there’s nothing more encouraging than straight up direct facts and advice. No need for nice wording.

#

I really need to pay attention to that in order not to do that. So I usually come across harsher than I intend to

ebon ether
#

I always say the exact same thing when I explain someone something and notice he does not understand the language

Hey before we continue, you should learn a bit more about <language>. You can do that by

  • analyzing the code of others ( for example on GitHub )
  • Watch YouTube tutorials ( but be carefull, as much tutorials are not very good and dont explain some important things about programming
  • Go to classes for <language> you can search for local classes on Google or use online lessons as example: codeacademy

When you did that we can continue.

I could copy and paste that from now on XD

crystal sonnet
#

It’s hard to explain. Not sure if anyone can follow me 😂

#

Also in hindsight I’m deeply offended by your joke about the efficiency of Germans @ebon ether. The correct answer is that a German can change two at the same time, practically only needing half a German to change a lightbulb

#

😂😂

ebon ether
#

XD

proud crypt
#

.5 germans

ebon ether
#

exactly, who needs the 0? everyone knows what t means and you saved .001 second typing it ( this was written after considering that 10x10^-4 would be longer then typing .001 )

random fossil
#

I would say that the best way to learn to code by far is to read a really good book

#

a book that doesn't only show you how, also explains the why!

ebon ether
#

Well if that works for you, I learned that my best way to learn is by practice and not by reading it off a sheet of paper

crystal sonnet
#

A course with a good teacher is better. But also more expensive

random fossil
#

Well I do both, when I get the hang of a concept, I play around with it in java.

crystal sonnet
#

Though as I mentioned I’m utterly shocked how little of programming course go further than “here’s the syntax. Congrats you now know X”

random fossil
#

That's my problem with youtube tutorials and courses

crystal sonnet
#

Like the exact same thing happened with our guy here. Never learned to read stacktraces and solve issues

#

Only the syntax. Which is less than 10% of a language

random fossil
#

1%*

crystal sonnet
#

Depends on the language ;)
But you’re rügte

#

*right

ebon ether
#

I started with java but never continues. I was going more for the web languages and C++

random fossil
#

Javascript was fun for a while, tho I believe it was too lightweight for me.

crystal sonnet
#

@ebon ether let me give you one tip: Don’t bother learning the pre C++11 ways. At least for the beginning. Start with the easier to use and saver C++11 or newer stuff

ebon ether
#

I learned php, html, js, css, lua, c++, c# ( still at it thought ), sql

crystal sonnet
#

JS is cancer. It’s like the king of type mangling

ebon ether
#

I already speak C++ XD

crystal sonnet
#

There’s always stuff to learn

#

Not a single person has or ever will master C++

#

Not even Bjarne Stoustrup

random fossil
#

I just really fell for the JVM

#

makes everything so much simpler

ebon ether
#

Yes I agree to that, but I understand the syntax and how to read the error trace of c++

crystal sonnet
#

And there aren’t many people that surpass his skill and knowledge

#

@random fossil yes and no

#

You sacrifice functionality and speed for compatibility

random fossil
#

Yeah, really does it for me. lol.

ebon ether
#

The language I started with was Lua, it is not a programming language but still awesome. I fell in love with it and could go teach one or 2 things about lua that people might not know

crystal sonnet
#

It is a programming language

proud crypt
#

i'm thinking about trying Rust

crystal sonnet
#

Rust is overhyped

ebon ether
#

Well, more a script language

crystal sonnet
#

Still a programming language

#

Anyways what makes me dislike Java is the “big daddy” way of doing things. They take away so many choices and possibilities

ebon ether
#

I made much GMod addons for server admins and also wrote a bot in lua, using a Lib as I was to lazy to write the full backend XD

crystal sonnet
#

Of shit

#

2 am

#

I need to sleep

#

Good night

ebon ether
#

Good night

#

I also should propably go to bed

random fossil
#

Good night

proud blade
#

@crystal sonnet Where do u live?

frank driftBOT
#

Hey HnoDYy250! Please don't tag staff members.

crystal sonnet
#

@proud blade Germany

proud blade
#

Ohh xD

crystal sonnet
#

Why are you asking? @proud blade

proud blade
#

No cuz i thought that you r Asian/KSA xD

crystal sonnet
#

Not even close XD

random fossil
#

What's up with this bot telling people not to --> @crystal sonnet <-- , lol

frank driftBOT
#

Hey Albert! Please don't tag staff members.

proud crypt
#

yet you still do it...

random fossil
#

Yep!

#

The question is why you don't just remove the feature lol

#

makes me wonder

proud crypt
#

you can't

#

you can disable @ here and @ everyone but not individual user tags

random fossil
#

Well you are coders after all

crystal sonnet
#

Luck is

#

(And me too. But I code for other stuff)

#

Though that’s nothing you can code. Discord just doesn’t provide that functionality

sullen mango
#

Actually it can, it just chooses not to lol

proud crypt
#

yeah just not anything we can restrict with the API unfortunately. we could auto-delete any message where a staff member is tagged, but a) that's a shit thing to do and b) ghost notifications are still a thing thanks discord

sullen mango
#

whered my message go? :C

proud crypt
#

what message? no one has deleted any messages

stray dock
#
error: cannot access Component
class file for me.lucko.luckperms.lib.text.Component not found```
#

Why when i try compile i got that error?

karmic void
#

how are you trying to compile?

#

I got 0 errors

#

you're probably not compiling a dependency

#

try and build from the root of the project, not only the api @stray dock

#

(offtopic, is it bad that I thought your name was Jim? I'm tired)

stray dock
#

Ok

wispy totem
#

Hey there ...
How can i use the api to put a player in a speciall group ?

crystal sonnet
#

@wispy totem wiki

wispy totem
#

BrainStone Wehre ? 😅

crystal sonnet
#

Where it says API

bright crown
#

hello! Is this the best room for LuckPerms support?

#

mine is causing all sorts of trouble

thorny echo
#

Hey, it's the official, best, and only room 😁

bright crown
#

Marvelous!

thorny echo
#

What troubles are you having?

bright crown
#

so I am using the web editor

#

and trying to add some EssentialsX perms

thorny echo
#

I thought you meant the server in general 😝

bright crown
#

but many such as essentials.balance are not working

thorny echo
bright crown
#

ah!

gusty goblet
#

Does anyone have an example of setting a temporary permission node w/ the API?

crystal sonnet
#

@gusty goblet there are plenty of examples on the wiki @gusty goblet

#

Including one of exactly that

nocturne elbow
#

I have null exception error

nocturne elbow
#

ok

#

@crystal sonnet how get all configuration selections?

frank driftBOT
#

Hey sbyte! Please don't tag staff members.

crystal sonnet
#

@nocturne elbow you want to access the LP config through the API?

nocturne elbow
#

No, this offtopic, sorry

crystal sonnet
#

I have no idea what you’re talking about...

wispy totem
#

BrainStone ... the setPrimaryGroup function isn't working

long moon
#

setPrimaryGroup won't add them to the group if that's what you're expecting, you'll need to add and then set that

grave cedar
#

how do I add a limit on a groups claim blocks for GriefPrevention?!

grave cedar
#

anyone?

grave cedar
#

@crystal sonnet

frank driftBOT
#

Hey Louie! Please don't tag staff members.

crystal sonnet
#

Through meta

#

It’s documented on GP wiki (which values) and on the LP wiki how to add them

grim pier
#

Story of today.

#

i tried looking into Luckperms.conf

#

i received a headache and i still dont know how to put a group like group.juniortrainer into a default group

#

Someone help me pls

proud crypt
#

you can add it as a parent to default

#

/lp group default parent add juniortrainer

grim pier
#

@proud crypt You are a magician

frank driftBOT
#

Hey gappy! Please don't tag staff members.

grim pier
#

Thank you. ❤

brittle charm
#

Hey there, What is the correct way of registering events for luckperms? Or is it the normal bukkit way?

crystal sonnet
#

@brittle charm it’s explained on the wiki

brittle charm
#

Perhaps i'm just blind, Can't see any way to do so.

atomic sapphire
brittle charm
#

Me either! Thanks for the help.

#

Really, That helped.

brittle charm
#

Hey just a quick question, Why is the NodeAddEvent being called when i /lp user <user> listnodes
in the javadocs it says "Called when a node is added to a holder"
Or am i interoperating that completely wrong?

crystal sonnet
#

@brittle charm you can find it easily by clicking on API in the navbar

#

Then you’ll see all the subpages

#

@atomic sapphire 👆🏻

atomic sapphire
#

That's where I was looking first but google seemed faster. But thanks 😃

tender aspen
#

Hey, how would I get a user's current place in a track, so then I can find the next group in their track?

naive notch
#

How give Players permission to use command from modyfication please help?

tender aspen
tropic cipher
#

Is there any way of using the api with another language such as Node or does some sort of wrapper need to be made? Wanting to try manage ranks from my website without having do something like redis message back and forth between the website and a server connected to LuckPerms

proud crypt
#

I believe you'd have to create your own API for working with the database

tropic cipher
#

Might just go with the Redis route message in that case, with using LuckPerms across multiple servers. If someone is logged in and you edit their data from another server, those changes won’t be reflected as they’d logout and override any changes right?

crystal sonnet
#

@tropic cipher Syncing permissions across servers is built in

#

We even have a wiki page on that

thorny echo
#

@tropic cipher Yeah you're way overengineering that, it can be done with just luckperms config files

tropic cipher
#

What do you mean? I’m wanting to be able to make changes to a user from outside the server

thorny echo
#

Ah

#

Basically LuckPerms has a feature for multiple servers to sync together

#

Is that not what you're trying to do?

#

If someone is logged in and you edit their data from another server, those changes won’t be reflected as they’d logout and override any changes right?

They will be reflected immediately, using either bungee plugin messaging or sql message tables or redis

#

@tropic cipher

tropic cipher
#

Okay that makes more sense now 😃

thorny echo
#

😛 😃

crystal sonnet
#

@tropic cipher what you can do is edit the database and then trigger a network sync on any server (/lpb networksync for bungee and /lp networksync for all others)

#

Requires a proper data syncing setup though. You can find the infos on how to do that on the wiki pages Network Installation and Syncing Data between Servers

tropic cipher
#

Does the networksync command just check if any new messages have been sent?

crystal sonnet
#

It causes all servers to reload their perms (which won’t cause a lag spike. Because the new permissions are loaded in the background and the old data is only discarded when the new data is ready)

#

Though not 100% sure what you mean with messages

#

@tropic cipher

tropic cipher
#

Void mentioned that changes are reflected using sql messages table

thorny echo
#

@tropic cipher The command does not check if messages are sent, it sends a new one saying pls flush your cache and get perms data again

#

Message recieving is done differently depending on the method you use but it's always instantaneous

crystal sonnet
#

Yup. You could even put your own entry in the database. This will trigger a networksync too

#

(Though be sure to remove it again after like 30 seconds)

remote smelt
#

Hello, I am looking for a help with API

#

Someone can help me? @jaunty pecan

frank driftBOT
#

Hey IdkMan! Please don't tag staff members.

remote smelt
#

Emmm.. ok?

#

I want to to add user to the group for a specific time with LuckPermsAPI. The problem is that I want to accumulate the time...

#

I have tried to achieve the result in so many ways...

#

My code look like this:

@Override
    public void addTemporarilyToGroup(Player p, String groupName, long howLong) {
        User u = this.loadUser(p);
        Node existingNode = null;
        SortedSet<? extends Node> nodes = u.getPermissions();
        for(Node node : nodes) {
            if(node.isGroupNode() && node.getGroupName().equals(groupName)) {
                existingNode = node;
                u.unsetPermission(node);
                break;
            }
        }
        Node newNode = null;
        if(existingNode==null) {
            newNode = luckPermsAPI.getNodeFactory().makeGroupNode(groupName).setExpiry(convertToExpireTime(howLong)).build();
        } else {
            newNode = luckPermsAPI.getNodeFactory().makeGroupNode(groupName).setExpiry(existingNode.getExpiryUnixTime() + convertToExpireTime(howLong)).build();
        }
        u.setPermission(newNode);
        luckPermsAPI.getUserManager().saveUser(u);
    }
#

So..

  1. Find the previous node -> if preset unset
  2. Build new node -> if previous node was preset, then accumulate the time by existingNode.getExpiryUnixTime() + convertToExpireTime(howLong)
  3. Set new node
#

Effect: once it is working fine, since user don't have previous permission

#

On the second approach it is removing player from a group permanently.................

remote smelt
#

@crystal sonnet ? :c

frank driftBOT
#

Hey IdkMan! Please don't tag staff members.

sonic flare
#

I have a question - if a user has never joined the server, does attempting to set their group return a NPE?
and followup: can that user be "registered" before joining if their UUID is known?

crystal sonnet
#

no if you use their UUID and ues

sonic flare
#

Yeah, so I am able to setPrimaryGroup for the UUID of a user that has joined the server but not for one that hasn't joined the server

#

Does anyone have a solution for that?

sonic flare
#

please :o

jaunty pecan
#

try making a call to UserManager#savePlayerData before setting the primary group

#

although it's probably something I should fix :p

#

if you make a github issue for it I'll look into it sometime this weekend (hopefully!)

sonic flare
#

I did try that

#

I'll make an issue

#

yeah User#setPrimaryGroup is broken

#

made an issue about that too

tender aspen
#

res.wasSuccess is true but my user doesn't get promoted

    public static PromotionResult rankup(Player player) {
        Track track = luckPermsApi.getTrack(getCurrentConfig().getString("rankuptrack"));
        return track.promote(luckPermsApi.getUser(player.getUniqueId()), luckPermsApi.getContextForPlayer(player));
    }```
The rankuptrack in the config is set to the right thing and if I do `/lp user <user> promote rankuptrack` it promotes them.
tender aspen
#

This is also in Nukkit btw

remote smelt
#

Hello, can someone help me...

#

pls

#

Code is above

#

I mean.. how can i set temporary permission for player, but accumulating the time.

#

😦

sonic flare
#

it’s called luckperms but the 2 out of 3 or 4 API that I need don’t work

#

UNLUCKPERMS

#

😄

proud crypt
#

what

#

are

#

you

#

talking about

sonic flare
#

dw i made github issues already

#

just thought of that hilarious joke to complement the issues

low vessel
#

hey, short question: what is the best way to remove all members from a group?

#

like a bulkupdate but with the api 😛

remote smelt
#

So nobody will help me, yes...? :(

jaunty pecan
#

IdkMan, I've replied to your post on Spigot.

#

DrPanic, I assume this is you? :p

low vessel
#

Thanks @jaunty pecan 😃 It was our Serverowner, dosn't know he created a ticket 😛

frank driftBOT
#

Hey DrPanic! Please don't tag staff members.

sonic flare
#

ehm mister lucko how do I add a user to a group using the API? do I just add a permission?

thorny echo
sonic flare
#

@thorny echo but what is the node for a group

thorny echo
sonic flare
#

ohh I see

#

so build the node and then set it with setPermission

thorny echo
#

Aye

sonic flare
#

or add whatever

#

ty

thorny echo
#

👍

remote smelt
#

Luck.. I have to say sorry for the things that I have written on spigot. Check out my replay.

jaunty pecan
#

no worries

#

just a bad choice of words I think 😉

#

anyway if you can make a github ticket that would be great

remote smelt
#

I can do it. For sure, but tomorrow.

sonic flare
#

Does this make sense?

Starting from a user that has never joined the server
1. savePlayerData(uuid, player.getName())
2. loadUser(uuid)
3. build node
4. add node
5. setPrimaryGroup to node
6. save user
sonic flare
#

I have no idea if that will do it

sonic flare
#

would anyone happen to know if this is the right way to change a user's group

#

oh I never even set primary lol

#

well I could just use weights

sonic flare
#

it doesn't work

#

i cry

#

can someone like... write me a chunk of code that changes a user's group lol

long moon
#
        user.setPermission(plugin.luckPermsApi.nodeFactory.makeGroupNode(group).build())
        user.primaryGroup = group.name
sonic flare
#

wait... setPrimaryGroup requires "group.name" and not just "group"?

long moon
#

takes a string or something

#

DataMutateResult setPrimaryGroup(@Nonnull String group);

sonic flare
#

this is what I tried and it works the first time

#

but not any time after the first time

#

the getPerms thing is just the API

#

it also doesn't remove the group like I asked it to lol

#

OH I FIXED IT

sonic flare
#

oh

#

I have to save twice probably

sonic flare
#

okay, the granular control of LuckPerms is nice but this is outrageously complex for such simple tasks lol

long moon
#

loadUser returns a user

#

also, you should be using the group name for the primary group, not calling toString on the Node object

sonic flare
#

that's a Group object

#

and what I did there to set the primary group works perfectly in another class

#

but yeah maybe I'll save the loaded user as a variable

#

@long moon loadUser returns a CompletableFuture<>

#

love those

long moon
#

Which implies that the load is going to occur async

#

aka, getUser will return null, as the user isn't loaded yet, because it's doing that in the background

sonic flare
#

ohhhh

#

that makes sense

#

ehm

#

how do I make the rest of it run after the async task is done?

long moon
sonic flare
#

welp that's what I feared. I already have a synchronous task inside an asynchronous task for getting UUIDs from Mojang

#

now I'll have this inside that

#

I'm just gonna laugh and go to bed

#

don't comment on the conventions, the { on the next line is not my doing

#

it works...

#

lol

proven canopy
#

Hey there, I'm new to the luckperms api. Is there a possibility to check a permission on a offline player? I need to sync some stuff and therefore I need to check permissions from offline players.

thorny echo
#

Yeah, you can

#

Gimme a sec

#

Have a look at this to get the User

proven canopy
#

thank you very much! i will look into it!

thorny echo
#

And here's how you make a perm check

#

Make sure to read the part above it about getting Contexts for an offline player

#

😃

proven canopy
#
                CompletableFuture<User> userFuture = userManager.loadUser(entry.getKey().getUniqueId());
                userFuture.thenAcceptAsync(user -> {
                    PermissionData permissionData = user.getCachedData().getPermissionData(LuckPerms.getApi().getContextManager().getStaticContexts());
                    Tristate checkResult = permissionData.getPermissionValue("api.team");
                    System.out.println(checkResult.asBoolean());
                });``` this works, is it okay with the static contexts?
thorny echo
#

That looks alright 👍. You can't use anything other than static contexts if they're offline as they're not connected to a server so you can't check server= etc

proven canopy
#

Many thanks, you saved my day ❤

thorny echo
#

;D

remote smelt
#

How can I set context "server=survival" for permission using API ?

#

IMAO there is no examples which makes it a little bit difficult

#

Examples of setting permissions with contexts*

thorny echo
#

Have a look at

remote smelt
#

@thorny echo Thanks

frank driftBOT
#

Hey IdkMan! Please don't tag staff members.

nocturne elbow
#

How can i use the luckperms api to get the prefix

#

Help

thorny echo
#

@nocturne elbow Using Vault is easiest

#

Check their docs

#

Although using the LuckPerms api is also quite simple, and what you want is probably listed as an example on the api wiki page

sonic flare
#

ay

#

how do I get the plain friendly usergroup name of a group that also has a displayname

crystal sonnet
#

@sonic flare getFriendlyName()

sonic flare
#

I don't want the displayname @crystal sonnet

frank driftBOT
#

Hey Aerocet! Please don't tag staff members.

sonic flare
#

???

#

ok clippy

#

anyway, I want the actual name

#

is it possible to bypass the displayname

#

and just get the regular name

crystal sonnet
#

Oh

#

There should be a third method

#

Like just getName()

sonic flare
#

hm, I'll try it. I don't think it was returning a nice name though

#

it was probably that big long thing

lament bay
#

If I need to determine if a player's group inherits from another group, do I need to use a context?

#

a specific parent group that it inherits from at some point

spring jacinth
#

@lament bay this is how i have inheritance setup

lament bay
#

I followed the example on the wiki for user.getAllNodes and just filtered the results for GroupNodes that match the group name

#

I also had to make some adjustments to my groups so they properly inherit down the chain, so it may have just been that, and the inheritsgroup function might have worked.

spring jacinth
#

the group.admin

#

is the inheritance node

lament bay
#

I was referring to using the API, I just didn't have the chain of groups properly set, default -> youtubers, twitchers, supporters -> mods -> admins -> owner

#

i was trying to take a user who was a mod and see if they were a supporter and it wasn't identifying the inheritance as I expected, and I believe I just didn't have the parents for a few groups set properly

spring jacinth
#

ah kk

umbral bison
#

how do i set group with api
like lp user nick parent set group ?

trail oar
#

Luck why getName doesnt return the player name correctly? why only lowercase?

crystal sonnet
#

Because internally the names are lowercased everywhere @trail oar

trail oar
#

How am i supposed to get the correct name for a player using the api? So it's impossible?

polar hinge
#

Get the UUID and then convert that to the username?

crystal sonnet
#

Yeah. The Servers UUID cache should have you covered @trail oar

trail oar
#

Will it work for bungeecord?

long moon
#

You'd want your own UUID -> name cache for that as bungee doesn't retain anything about players outside of the locations.yml module thing

#

(if you want to store names long term for your plugins you're going to want your own cache anyways if you rely on them)

nocturne elbow
#

Hello, i have question, we are busy with a custom plugin, and we have a question
How you can get all groups of a user. via the api

#

@jaunty pecan Is there a way to get a list of groups of a user?

frank driftBOT
#

Hey JohannesHQ! Please don't tag staff members.

nocturne elbow
#

Oops

#

sorry

trail oar
#

So in short. Only lower case are supported, I got it

nocturne elbow
#

Someone can help?

rancid moss
#

Yes, you can do /lp listgroups, or if you want to target a specific user, /lp user info

thorny echo
#

@nocturne elbow that is pretty much detailed in the Developer API wiki page

rancid moss
#

oh, this is the super smart section

#

sorry

thorny echo
#

😆

rancid moss
#

i'm still a newb so im just gonna go back to offtopic, see you there xD

thorny echo
#

This is for the developer api @rancid moss

#

😝

#

Basically if you want to write a plugin that talks to luckperms

rancid moss
#

oh damn, i was miles away then

nocturne elbow
#

There is nothing about list user groups.

thorny echo
#

See

#

You can use the Stream API to easily filter the returned data to find what you need. For example, if you wanted to get a list of groups a holder inherits from, you could use something like this:

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

low vessel
#

Hey, short question: What happens if I change the permissions on Bungee and Bukkit promptly? Will Luckperms be able to merge the changes? I have the problem that sometimes group memberships or permissions of players are missing and suspect that it is something like this.

crystal sonnet
#

@low vessel should be fine

#

And even if there were issues, the nodes wouldn’t be missing but rather duplicated

low vessel
#

Ah, ok! Thanks

low vessel
#

Ok. Found the solution. I had to load the User again before i change the permissions.

atomic sapphire
#

How would I properly turn node.getExpiry() witch returns a Date-Object into a LocalDateTime?
Because node.getExpiryUnixTime() returns a Unix-Time in the year 1970 instead of 2018

jaunty pecan
#

multiply it by 1000

#

😃

atomic sapphire
#

Oh.. So UnixTime does not equal UnixMillis?

Anyways: Thanks Very Unlucky [At]Luck for helping me so that I was lucky because it only took a couple of minutes to solve my problem ^^

jaunty pecan
#

ya no, they're different

#

well, both called unix time, just a different degree of accuracy

atomic sapphire
#

Argh.. one more time: A player the group A for 1 day added using /lp user Sprax2013 parent addtemp A 1day. Now using LuckPerms-API I have the node with the expiry (permission is: group.A).

How would I set a new expiry? I used toBuilder() but it only returns a new Node based on the old one in the end ( unsetPermission and user.clearMatching(n->n.equals(node)); <-- I also tried just removing the node but I does not work...)

#

e.getPlayer().sendMessage(user.unsetPermission(node).name()); That will show SUCCESS in my Chat. But using LuckPerms's user-info command the user still has the temp. group

jaunty pecan
#

make sure you save changes afterwards

normal hedge
#

Hey, so I was making Bungeecord StaffChat with the Luckperms Player prefix. But it says the API is not loaded

#

How can I fix it?

jaunty pecan
#

make your plugin depend on LuckPerms

#

failing that, I need to see your code :p

normal hedge
#

Wait, whats the newest version of Luckperms Bungee?

#

4.2.89?

#

Nope, version doesnt matter

#

My Class

#

@jaunty pecan

frank driftBOT
#

Hey xCodiq | Developer! Please don't tag staff members.

normal hedge
#

Oh, yeah. Forgot about that lol

jaunty pecan
#

uhh ok

#

did luckperms enable properly?

normal hedge
#

yes

#

Connected with MySQL

#

All working fine

jaunty pecan
#

can you show me your full log file

normal hedge
#

From the console?

jaunty pecan
#

yeah

#

the bit where LP enables, up to the error message

normal hedge
jaunty pecan
#

pastebin please

#

i'm using my phone

normal hedge
#

Wait

#

To many characters xD

jaunty pecan
#

uhh

normal hedge
#

Sec

jaunty pecan
#

hmm weird

#

only other thing I can think of is that you may be shading the LP jar into your plugin

#

causing them to classload from different sources

normal hedge
#

Ehm

#

But the thing is

#

I worked one time

#

There must be something with my code

jaunty pecan
#

can you send your plugins jar file

normal hedge
#

Like the plugin folder from the bungee?

jaunty pecan
#

no, just the .jar file for your plugin

normal hedge
#

Just here|

#

Or private?

jaunty pecan
#

no send me the link to the file

normal hedge
#

Like that

jaunty pecan
#

yeah

#

you're shading the whole of the LuckPerms jar into your plugin

#

(that's a bad thing!)

normal hedge
#

How can I do that otherwise

#

I use IntelliJ btw

jaunty pecan
#

you don't need to do it at all

normal hedge
#

Modules, add depends

#

wut

#

How do I get an instance of the Api

#

without shading

#

This is how I got it learned

jaunty pecan
#

exactly the same

#

just don't shade

normal hedge
#

I dont understand or I dont know how

jaunty pecan
#

are you using maven or gradle

normal hedge
#

Maven

jaunty pecan
#

ok, show me your pom file

normal hedge
jaunty pecan
#

luckperms isn't defined as a dependency therte

normal hedge
#

Ehm

#

Thats what I mean

jaunty pecan
#

ok

#

well, you could try removing the maven-shade-plugin section of your pom

#

but really I'd recommend not using the intellij module system and just using maven

normal hedge
#

Hmm okay

#

Ill try

#

Luck

#

Can you guide me how to add a meven dependency

#

Never done it

#

nvm, its that easy xd

jaunty pecan
#

nod

normal hedge
#

Okay, how does it work

#

I dont know

thorny echo
#

?

normal hedge
#

Thanks

#

LOL

#

It still doesnt work

thorny echo
#

Define doesn't work

normal hedge
#

Okay sec

#

Im confused now

thorny echo
#

?

normal hedge
#

That should be good right?

thorny echo
#

What do you mean by doesn't work

normal hedge
#

It still gives me the same error

#

"API is not loaded"

thorny echo
#

That means you're still shading it in

normal hedge
#

wut

thorny echo
#

Why do you have maven-shade-plugin?

normal hedge
#

idk

#

I removed it, and it still says the API is not loaded

#

Ehm, Im really confused

thorny echo
#

You're writing for Bungee right?

normal hedge
#

Yes

#

I got to go, Ill work on this. Ill contact you guys tomorrow again if I dont get it

thorny echo
#

ok

normal hedge
#

Unless, you know the selution right now

#

Ahh nvm

#

See ya tomorrow

umbral bison
#

how do i set group with api
like lp user nick parent set group ?

thorny echo
#

Read this 😃

umbral bison
#

nothing here

thorny echo
normal hedge
#

Hey, I still have problems the: "API is not loaded"

#

Can someone help me?

#

Please @tag me

#

So, there is nothing wrong with my command or plugin itself. The LuckPerms api is just not working

cursive ravine
#

@normal hedge can we see some code??

normal hedge
#

Ofcourse

#

Give me a min

#

@cursive ravine

#

Are you still there?

cursive ravine
#

Yea

normal hedge
#

And?

cursive ravine
#

And you plugin.yml file??

normal hedge
#

Found anyting?

long moon
#

maven build log?

normal hedge
#

Wait

#

I dont do maven build log

#

I use BuildArtifact

long moon
#

Please make sure that you're actually building with maven if you're using maven and not your IDEs built in compiler

normal hedge
#

HMm okay

long moon
#

unzip the jar, is there a me/lucko folder in it?

normal hedge
#

let me take a look

#

There is

long moon
#

That's going to be your issue

normal hedge
#

Hmm, I got it working now

#

I removed that section

#

and its working now

#

I know why, thanks everyone for your help

thorny echo
#

Wait you just removed the section manually

#

🤦

normal hedge
#

What?

teal tartan
#

He said you deleted me/lucko folder manually

thorny echo
#

I asked if he did

#

And assumed that was the case

crystal sonnet
#

And as we can see it’s clearly the APIs/LuckPerms fault

sinful moat
#

I want to get the suffix of a player in BungeeCord and I do that : ```
Contexts contexts = LuckPerms.getApi().getContextsForPlayer(p);
User user = LuckPerms.getApi().getUser(p.getUniqueId());
UserData cachedData = user.getCachedData();

            MetaData metaData = cachedData.getMetaData(contexts);
            String prefix = metaData.getSuffix();``` But my prefix is null
#

Can you help me ?

crystal sonnet
#

@sinful moat try using getPrefix instead of getSuffix

#

😜

thorny echo
#

want to get the suffix
@crystal sonnet

crystal sonnet
#

They seem to interchange the two throughout the question

thorny echo
#

Oh yeah I see

#

🤔

crystal sonnet
#

Question starts with suffix, then the variable is named prefix and is assigned the value of suffix. And the last message uses prefix again.
@sinful moat there’s a difference between suffix (at the end) and prefix (at the beginning).

#

My guess remains that you meant the prefix and are just using the wrong getter

sinful moat
#

Oh I understand, finally I want to get suffix

sinful moat
#

Someone can help me ? Because I don't understand why it don't work

chrome rain
#

What are you trying to do, @sinful moat ?

sinful moat
#

I want to send a message to a player and is this message I want to show the suffix of the player behind the player's name

#

So I try to get the suffix of the player

chrome rain
#

Yea? getSuffix?

proud crypt
#

Is p actually a player object? You haven't shown that part of the code where you declare it.

sinful moat
#

Oh yeah

#

p is a ProxiedPlayer object

#

But without the "getPrefix system" Everithing work

proud crypt
#

Maybe post the full code?

#

I dont do java but I can at least read it and understand what happening

#

Try debug each line with println as well lol

sinful moat
#

I do that

#

And the thing wich is null is the suffix

#

But ingame the suffix is already set

proud crypt
#

Does the player actually have a suffix?

sinful moat
#

Yeah

proud crypt
#

/lpb user username meta info

#

Just to double check

sinful moat
#

Ok

trail oar
#

Make sure the player has a suffix

sinful moat
#

Yeah I have a suffix

trail oar
#

Which one is it?

proud crypt
#

Did you use /lpb to check? Or /lp

sinful moat
#

I use /lpb user Stargeyt meta info

proud crypt
#

Ok just checking

sinful moat
trail oar
#

Wait, you are using this in a bungee plugin?

proud crypt
#

"ProxiedPlayer" is a bungee thing

sinful moat
#

Yeah I know

#

I want to get the suffix in a BungeePlugin and ?

trail oar
#

Where did you add the suffix? In the bukkit chat? Or in the bungee console?

#

Maybe it hasnt been updated in bungee

sinful moat
#

On the BungeeCord

trail oar
#

Uhmm

proud crypt
#

Well if they did /lpb meta info and it shows then the suffix is there

trail oar
#

I made my bungee core using lp api, it's works without problem. The only thing is that i had to load the user before i use it otherwise user could be null

sinful moat
#

@trail oar So if you already do that can you send me the code when you get the suffix or the prefix ?

trail oar
#

Sure, as soon as i return home i'll send it

sinful moat
#

Ok thanks . If you want you can send this on private message

nocturne elbow
#

Someone can tell me