#luckperms-api
1 messages ¡ Page 13 of 1
Kinda
Unzip the zip, and add the bin folder to your path
i'm on the installation tips thing
I need Jdk then don't i
See here, ignore the first bit and look at the To add a path to the PATH
alright
You'll want to add the full folder location to it, like C:\Users\Insqnity\Downloads\apache-maven-3.5.4\bin
i have windows 10
and?
"On the Start menu, right-click Computer."
oh, just open up file explorer and right click this pc
Ah good
In the Edit System Variable dialog box, scroll to the end of the string in the Variable value box and add a semicolon (;).
[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
cmd was never opened
Is it in Downloads?
yes
"C:\Users\Tyler Chaky\Downloads\apache-maven-3.5.4\bin\mvn.cmd"
can you run that, with the quotes, please
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
i copied that
Show me your path variable
okay
wait
Now click the ok save etc buttons
i had to press ok on the computer thing
if you haven't already
yeah
Now do you have git?
yeah
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
can i get the source from a folder in my pc?
alright
just cd into it and mvn package
and it has to include maven or gradle?
what if the plugin doesn't include maven or gradle
how would i compile it
... you can't
oh so every plugin has maven or gradle?
Or at least you have to make one yourself
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?
Yes, but not every plugin publishes the source code @zenith linden
Does it have a file named build.gradle or pom.xml?
ok, then it's made with maven
Dwdw
i didn't know what pom.xml meant
Yeah, it's a strange name
Yeah tends to happen with java apps
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
firstly, why?
secondly, those values are configured in the main plugin class, and also in the plugin.yml file
my manager
wants me to change the command
plus i want it to look like my server colors for fun
you can configure the colours and general appearance of the plugin without needing to change the code
hmm how?
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?
just block the command then for regular players?
they can still do the command /lp and see that it's blocked
knowing we have luckperms
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?
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
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
no it's not, it's editing a configuration file
can i edit this config file without having to recompile it?
yes
yeah
i need to add lang.yml?
put a file named lang.yml there
oh ok
With the content from the wiki
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
Write a plugin
Ask your developer
don't have one
lmao
Lol
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
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
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
Yes I do save them, they work fine when they donât have an expiration
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
I posted it above, let me paste it in again
In other words trying as hard as possible to make it work and if it doesnât, failing with a useful exception
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?
Looks good
k thnx đ
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;
}
Looks good to me. So not sure whatâs the issue here
Iâll take a look over it again tomorrow try find the issue
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?
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);
}```
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)
I didn't get you point
But yes, bungeecord is the same as bukkit. You just use proxiedpkyer
I'll just test it and find out for myself.
In short, I was trying to be lazy and gave a bad example.
@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)
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?
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
Oh, thank you. I was worry about it đ
Hello! How can I get user prefix and suffix using LuckPerms API?
thank you very much!
np
sorry, but I don't understand what user is on user.getCacheData().getMetaData(contexts);
somewhere up
there should be how to get user
everything is in the github
User user = luckPermsApi.getUserManager().loadUser(uuid);
there u go
ok thanks
Hi! I want to ask at the luckperms how do i add a prefix to a permission without writting it as a global?
@nocturne elbow #support-1
oh sh*t sorry
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
What do you mean with different value? @tropic cipher
How would you (using the API) find out if a permission node is temporary and get the time remaining?
@gloomy saffron check the examples on the wiki. Iirc thereâs an example that does just that
I looked on the wiki and couldn't see anything mentioning timed permissions
Node.isTemporary
Thatâs a case for you ;P
@jaunty pecan deprecated stuff, what's updated alternative now? http://prntscr.com/khw669
Hey Milburn! Please don't tag staff members.
@nocturne elbow UUID uuid = <player>.getUniqueID();
they don't have a player instance there
milburn, check the javadocs for the deprecated method, it will tell you what the new alternative is
yes, or online
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
Luck
luck work
@jaunty pecan how to create bungeecord subcommand's manager?
Hey sbyte! Please don't tag staff members.
i don't understand the question
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
ok, sorry
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
@gusty goblet does saveUser return something? If so you could check that too
@gusty goblet It would be nice to send the whole code on pastebin
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
How I add expiry to a command on Luckperms?
depends on what command
oh its api channel my bad
@deep gazelle There's an example for exactly that in the Developer API wiki page
Okay
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])
@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
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?
It should be using UTC
Java has methods to work with so called unix timestamps
@atomic sapphire
Okay I'll try it - Thanks!
?
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.
Why you cast a playername to an event? ._.
I see a huge issue in your code. Mixed languages!
Use
One
Language
Only
So @trail oar how i say if players was demoted?
if e.getWinner() returns the player name that was demoted, then load it using the UserManager from luckperm api
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.
@junior crag yes you can promote with contexts
How?
I want only event works when i promote only on server called server understand?
Youâre command is correct
And in regards to the event, the event should contain the context somewhere so you can check for that
hmmm okay, thanks, i will see it.
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
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

I use default void for different class.
Example:
public class Settings extends FileUtil implements messages_intf, exec
how can i give a player a rank for a time with the api?
@idle nymph by checking the examples on the wiki
Check the very bottom of the nav bar on the right (or bottom on mobile)
can Main.api.getUserManager().lookupUuid(realName).join(); be used in ASYNC?
@nocturne elbow yeah
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.
@nocturne elbow in fact it should be used async!
Every call that loads something shouldnât be called on a main thread
@junior crag that event is sent when the promote command is used
i know it, but dont have other way to identify it?
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;
}```
@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
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;
}
}
Looks good
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]
Probably your LP API instance is uninitialized
O to initialize? Is not like put LuckPermsApi luckPermsApi; on class and done?
No
Thatâs how you create a variable
It has no value
It needs to get the instance somewhere
So, you can help me about it please?
But let me tell you something
Yes please, say me.
Stop what you are doing and learn Java first
ahm, again?
And no. Donât learn Java by writing plugins
First, i learned Java when i was programming on program in Java on school.
I learned something.
but not all.
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
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.
@junior crag youâre missing my point here
Which is?
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
Okay, thanks for your opinion.
How i can say like, on track.
Contexts have nothing to do with tracks
I want like, only pick prefix if player is on track x
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
Is possible you send me a snippet of code?
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
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.
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
Thank for your opinion @ebon ether
Yeah, nice one dash.
Just tryin to help, if you have further questions regarding programming ( not specific help with code ) you can always dm me
@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.
thats true :3
I have no problem with people telling other people to start from the beginning, but the way you did it was just awful.
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
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
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
Honesty is best policy!
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.
Thatâs a good one đ
Yeah, no worries about that, just didn't like the fact you call my way of telling people to start easier is sugar coating.
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
Well of course if you keep going, but that's not my intention.
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.
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
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
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
đđ
XD
.5 germans
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 )
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!
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
A course with a good teacher is better. But also more expensive
Well I do both, when I get the hang of a concept, I play around with it in java.
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â
That's my problem with youtube tutorials and courses
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
1%*
I started with java but never continues. I was going more for the web languages and C++
Javascript was fun for a while, tho I believe it was too lightweight for me.
@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
I learned php, html, js, css, lua, c++, c# ( still at it thought ), sql
JS is cancer. Itâs like the king of type mangling
I already speak C++ XD
Thereâs always stuff to learn
Not a single person has or ever will master C++
Not even Bjarne Stoustrup
Yes I agree to that, but I understand the syntax and how to read the error trace of c++
And there arenât many people that surpass his skill and knowledge
@random fossil yes and no
You sacrifice functionality and speed for compatibility
Yeah, really does it for me. lol.
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
It is a programming language
i'm thinking about trying Rust
Rust is overhyped
Well, more a script language
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
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
My current Gmod project is this: https://github.com/Aperture-Development/MSync-2
My other main GMod project is on hold for now untill I have more time, as this requires a lot of planning and work
Good night
@crystal sonnet Where do u live?
Hey HnoDYy250! Please don't tag staff members.
@proud blade Germany
Ohh xD
Why are you asking? @proud blade
No cuz i thought that you r Asian/KSA xD
Not even close XD
What's up with this bot telling people not to --> @crystal sonnet <-- , lol
Hey Albert! Please don't tag staff members.
Well you are coders after all
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
Actually it can, it just chooses not to lol
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
whered my message go? :C
what message? no one has deleted any messages
error: cannot access Component
class file for me.lucko.luckperms.lib.text.Component not found```
Why when i try compile i got that error?
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)
Ok
Hey there ...
How can i use the api to put a player in a speciall group ?
@wispy totem wiki
BrainStone Wehre ? đ
Where it says API
hello! Is this the best room for LuckPerms support?
mine is causing all sorts of trouble
Hey, it's the official, best, and only room đ
Marvelous!
What troubles are you having?
Wait I never noticed this was #luckperms-api
I thought you meant the server in general đ
but many such as essentials.balance are not working
You wanna ask in #support-1
ah!
Does anyone have an example of setting a temporary permission node w/ the API?
@gusty goblet there are plenty of examples on the wiki @gusty goblet
Including one of exactly that
I have null exception error
Hey sbyte! Please don't tag staff members.
@nocturne elbow you want to access the LP config through the API?
No, this offtopic, sorry
I have no idea what youâre talking about...
BrainStone ... the setPrimaryGroup function isn't working
setPrimaryGroup won't add them to the group if that's what you're expecting, you'll need to add and then set that
how do I add a limit on a groups claim blocks for GriefPrevention?!
anyone?
@crystal sonnet
Hey Louie! Please don't tag staff members.
Through meta
Itâs documented on GP wiki (which values) and on the LP wiki how to add them
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 are a magician
Hey gappy! Please don't tag staff members.
Thank you. â¤
Hey there, What is the correct way of registering events for luckperms? Or is it the normal bukkit way?
@brittle charm itâs explained on the wiki
Perhaps i'm just blind, Can't see any way to do so.
Had to use google, because I couldn't find it directly from the wiki: https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#listening-to-luckperms-events
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?
@brittle charm you can find it easily by clicking on API in the navbar
Then youâll see all the subpages
@atomic sapphire đđť
That's where I was looking first but google seemed faster. But thanks đ
Hey, how would I get a user's current place in a track, so then I can find the next group in their track?
I found this code, but I'm not sure of an easier way
https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/model/Track.java#L273
How give Players permission to use command from modyfication please help?
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
I believe you'd have to create your own API for working with the database
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?
@tropic cipher Syncing permissions across servers is built in
We even have a wiki page on that
@tropic cipher Yeah you're way overengineering that, it can be done with just luckperms config files
What do you mean? Iâm wanting to be able to make changes to a user from outside the server
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
Okay that makes more sense now đ
đ đ
@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
Does the networksync command just check if any new messages have been sent?
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
Void mentioned that changes are reflected using sql messages table
@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
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)
Hey IdkMan! Please don't tag staff members.
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..
- Find the previous node -> if preset unset
- Build new node -> if previous node was preset, then accumulate the time by
existingNode.getExpiryUnixTime() + convertToExpireTime(howLong) - 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.................
@crystal sonnet ? :c
Hey IdkMan! Please don't tag staff members.
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?
no if you use their UUID and ues
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?
please :o
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!)
I did try that
I'll make an issue
yeah User#setPrimaryGroup is broken
made an issue about that too
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.
This is also in Nukkit btw
Hello, can someone help me...
pls
Code is above
I mean.. how can i set temporary permission for player, but accumulating the time.
đŚ
itâs called luckperms but the 2 out of 3 or 4 API that I need donât work
UNLUCKPERMS
đ
dw i made github issues already
just thought of that hilarious joke to complement the issues
hey, short question: what is the best way to remove all members from a group?
like a bulkupdate but with the api đ
So nobody will help me, yes...? :(
IdkMan, I've replied to your post on Spigot.
DrPanic, I assume this is you? :p
Thanks @jaunty pecan đ It was our Serverowner, dosn't know he created a ticket đ
Hey DrPanic! Please don't tag staff members.
ehm mister lucko how do I add a user to a group using the API? do I just add a permission?
@thorny echo but what is the node for a group
Aye
đ
Luck.. I have to say sorry for the things that I have written on spigot. Check out my replay.
no worries
just a bad choice of words I think đ
anyway if you can make a github ticket that would be great
I can do it. For sure, but tomorrow.
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
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
it doesn't work
i cry
can someone like... write me a chunk of code that changes a user's group lol
user.setPermission(plugin.luckPermsApi.nodeFactory.makeGroupNode(group).build())
user.primaryGroup = group.name
wait... setPrimaryGroup requires "group.name" and not just "group"?
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
https://paste.md-5.net/jocevawano.java
This causes an NPE the first time I run it for a user that hasn't joined the server yet, but doesn't cause an NPE on any subsequent attempts
oh
I have to save twice probably
okay, the granular control of LuckPerms is nice but this is outrageously complex for such simple tasks lol
loadUser returns a user
also, you should be using the group name for the primary group, not calling toString on the Node object
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
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
ohhhh
that makes sense
ehm
how do I make the rest of it run after the async task is done?
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
if this: https://paste.md-5.net/cufatuhuwe.java works
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
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.
Yeah, you can
Gimme a sec
Have a look at this to get the User
thank you very much! i will look into it!
And here's how you make a perm check
Make sure to read the part above it about getting Contexts for an offline player
đ
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?
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
Many thanks, you saved my day â¤
;D
How can I set context "server=survival" for permission using API ?
I have already read this: https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#the-basics-of-context
IMAO there is no examples which makes it a little bit difficult
Examples of setting permissions with contexts*
Have a look at
@thorny echo Thanks
Hey IdkMan! Please don't tag staff members.
@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
ay
how do I get the plain friendly usergroup name of a group that also has a displayname
@sonic flare getFriendlyName()
I don't want the displayname @crystal sonnet
Hey Aerocet! Please don't tag staff members.
???
ok clippy
anyway, I want the actual name
is it possible to bypass the displayname
and just get the regular name
hm, I'll try it. I don't think it was returning a nice name though
it was probably that big long thing
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
@lament bay this is how i have inheritance setup
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.
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
ah kk
how do i set group with api
like lp user nick parent set group ?
Luck why getName doesnt return the player name correctly? why only lowercase?
Because internally the names are lowercased everywhere @trail oar
How am i supposed to get the correct name for a player using the api? So it's impossible?
Get the UUID and then convert that to the username?
Yeah. The Servers UUID cache should have you covered @trail oar
Will it work for bungeecord?
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)
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?
Hey JohannesHQ! Please don't tag staff members.
So in short. Only lower case are supported, I got it
Someone can help?
Yes, you can do /lp listgroups, or if you want to target a specific user, /lp user info
@rancid moss this is #luckperms-api
@nocturne elbow that is pretty much detailed in the Developer API wiki page
đ
i'm still a newb so im just gonna go back to offtopic, see you there xD
This is for the developer api @rancid moss
đ
Basically if you want to write a plugin that talks to luckperms
oh damn, i was miles away then
There is nothing about list user groups.
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());
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.
@low vessel should be fine
And even if there were issues, the nodes wouldnât be missing but rather duplicated
Ah, ok! Thanks
Ok. Found the solution. I had to load the User again before i change the permissions.
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
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 ^^
ya no, they're different
well, both called unix time, just a different degree of accuracy
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
make sure you save changes afterwards
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?
Wait, whats the newest version of Luckperms Bungee?
4.2.89?
Nope, version doesnt matter
My Class
https://pastebin.com/G06XxmFb
My error
@jaunty pecan
Hey xCodiq | Developer! Please don't tag staff members.
Oh, yeah. Forgot about that lol
can you show me your full log file
From the console?
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
can you send your plugins jar file
Like the plugin folder from the bungee?
you can upload it to https://transfer.sh/ & delete the link afterwards
no, just the .jar file for your plugin
no send me the link to the file
Like that
yeah
you're shading the whole of the LuckPerms jar into your plugin
(that's a bad thing!)
you don't need to do it at all
Modules, add depends
wut
How do I get an instance of the Api
without shading
This is how I got it learned
I dont understand or I dont know how
are you using maven or gradle
Maven
ok, show me your pom file
luckperms isn't defined as a dependency therte
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
Hmm okay
Ill try
Luck
Can you guide me how to add a meven dependency
Never done it
nvm, its that easy xd
nod
?
Define doesn't work
?
That should be good right?
And than I use it in here: https://pastebin.com/F3RT2vEq
What do you mean by doesn't work
That means you're still shading it in
wut
Why do you have maven-shade-plugin?
idk
I removed it, and it still says the API is not loaded
Ehm, Im really confused
You're writing for Bungee right?
Yes
I got to go, Ill work on this. Ill contact you guys tomorrow again if I dont get it
ok
how do i set group with api
like lp user nick parent set group ?
Read this đ
nothing here
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
@normal hedge can we see some code??
Yea
And?
And you plugin.yml file??
Found anyting?
maven build log?
Please make sure that you're actually building with maven if you're using maven and not your IDEs built in compiler
HMm okay
unzip the jar, is there a me/lucko folder in it?
That's going to be your issue
Hmm, I got it working now
I removed that section
and its working now
I know why, thanks everyone for your help
What?
He said you deleted me/lucko folder manually
And as we can see itâs clearly the APIs/LuckPerms fault
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 ?
want to get the suffix
@crystal sonnet
They seem to interchange the two throughout the question
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
Oh I understand, finally I want to get suffix
Someone can help me ? Because I don't understand why it don't work
What are you trying to do, @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
Yea? getSuffix?
Is p actually a player object? You haven't shown that part of the code where you declare it.
Oh yeah
p is a ProxiedPlayer object
But without the "getPrefix system" Everithing work
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
I do that
And the thing wich is null is the suffix
But ingame the suffix is already set
Does the player actually have a suffix?
Yeah
Ok
Make sure the player has a suffix
Yeah I have a suffix
Which one is it?
Did you use /lpb to check? Or /lp
I use /lpb user Stargeyt meta info
Ok just checking
Wait, you are using this in a bungee plugin?
"ProxiedPlayer" is a bungee thing
Where did you add the suffix? In the bukkit chat? Or in the bungee console?
Maybe it hasnt been updated in bungee
On the BungeeCord
Uhmm
Well if they did /lpb meta info and it shows then the suffix is there
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
@trail oar So if you already do that can you send me the code when you get the suffix or the prefix ?
Sure, as soon as i return home i'll send it
Ok thanks . If you want you can send this on private message