#luckperms-api
1 messages · Page 27 of 1
Isn't there a call that doesn't expect a world?
I don't believe so.
It sometimes works, and sometime doesn't.
You have to specify the world if the player is offline, which half of the will be.
Can you try to just speficy any world?
hello I have a problem, or I don't know if it is, when I create a role I put / lp group vip meta addprefix 1 "and 6VIP" the prefix does not appear to me
@steady jay yes
Alright. I'll try that.
#support-1 @inland storm
Seems weird though.
I'll commit it to github tonight and see if my users are still having the issue, thanks!
In any case send a bug report over to GitHub. But make sure you're using the latest version of LuckPerms first @steady jay
!download
You can download LuckPerms for Bukkit/Spigot, BungeeCord, Sponge, Nukkit and Velocity.
Thanks, I'll make sure they're using the latest version
@steady jay Just to check, are you doing this async? If you are not doing this async, luckperms determines it unsafe and will not load the data as a result. This issue covers it, and is still applicable to the newest api from what I can gather https://github.com/lucko/LuckPerms/issues/1150
I am doing it async. Everything in my plugin is async.
Hmmm, that's honestly the only thing I could think of as an issue. If the issue keeps happening, I'm sure luck would look into it when he's available
And just to be sure, providing a world is only to be seen as a temprorary fix and as a debugging measure.
!api
Learn how to use the LuckPerms API in your project.
For the listener does that need something in the main class of the plugin to register it?
nvm, I figured it out. I just registered it like other listeners
Is there a way to loop through all users?
You can get a set of loaded users (Those online), but you cannot get all users, no
Sigh
Actually, I just checked and UserManager#getUniqueUsers should provide you with a set of UUIDs, which you could then use to load all the users
Yeah couldn't get that to work so just decided to do things differently.
@crystal sonnet I'm still getting the errors from my uers.
Hey Olzie-12! Please don't tag helpful/staff members directly.
Hi, can someone explain me how I can set the group of an offline player? I've figured out how to get an offline User object (using loadUser()) but I can't find how to add that player to a group
I've this now, but this cannot be right.
user.getNodes().stream()
.filter(NodeType.INHERITANCE::matches)
.map(NodeType.INHERITANCE::cast)
.map(InheritanceNode::getGroupName)
.collect(Collectors.toSet()).add(group.getName());
@rugged hawk add an inheritance node. It’s done the same way as with online users
do you have any pseudo code? I don't know what you mean
Have a look here: https://github.com/LuckPerms/api-cookbook
@rugged hawk
Yeah where do you think I got that piece of code from. I've already read the dev wiki and didn't find anything about adding a 'group node'. I know I can set a permission via the Node stuff but there isn't a Node like GroupNode or am I wrong?
It's InheritanceNode as I mentioned @rugged hawk
Ow
Also that is not the dev wiki
That is the cooklbook
literally filled with nothing but examples
Yes, but i've already read that page via the dev wiki
But I didn't knew I had to use the InheritanceNode
It would be easyer if you add a 'modify group' example in those example pages
Add a suggestion on GitHub 😉
Last time I did that it was ignored completely
I mean on the cookbook
But anyway thx for responding I'll try it out tomorrow
You're welcome
I am making a plugin and I need to check if player is inside a specific luckperms group
So I am checking for the permission
What is the permission?
Someone knows?
Someone?
pls
try it with checking the player's permission "group." + yourGroupName
How can I find out which group a player is in?
Hello again!
I'm using LP v5, and can't get this to work; I'm basically trying to get the NodeRemoveEvent to fire, but either it isn't firing, or I'm just doing something wrong/I'm dumdum
https://pastebin.com/RNPHqBrw
If I want to format chat is it recommeneded to use Vault, PlayerholderAPI or LuckPermsAPI directly?
I have some issues using vault as it doesnt seem to retrieve the actual prefix but more just the group name.
typically if you can use Vault, use Vault, because it works on the most servers
Does Vault support Luckperms?
LuckPerms supports Vault
Hmm, weird that prefixes are just the group names then...
Is this just an issue I'm having or have others had this too?
Vault has a separate method for getting group vs getting prefix
Yes, thank you. I'm stupid 🙂
you're not stupid, you're just learning 😆
Are there any performance downsides of always getting the primary group of a player and then the prefix?
Or does Luckperms & Vault handle that all and cache it?
don't see why it should be a problem
afaik LuckPerms provides to Vault, and LuckPerms should have a fairly efficient method of handling it
Oke
nothing you should personally have to worry about -- which is why it's an API 🙂
just use it, let others do the work for you
This is a bit off topic for this channel but is it possible to format chat while the server is reloading or block messages during that
As during that (illegal) time the chat format returns back to vanilla.
reloading isn't really supported by spigot or plugins generally
during that time i don't think you have any control
Question.... when i add t he plugin to my server will I have to enable perms for ervyone to be able to mine and such?
Depends which plugin
@dreamy pagoda get the primary group from the user object
Anywhere where I can make a ticket?
Just ask your question
How do I get a permission user with a username string? And how can I obtain that players primary group and obtain a track instance?
!api (and the javadocs within) contain most if not all your answers
Learn how to use the LuckPerms API in your project.
I tried reading that, but I’m still confused on what to specifically do to get a player, would User permUser = (User) player; work?
pls send what you're trying in a codeblock so Brain or Luck or someone with more knowledge than I can help easily
I haven’t really done anything yet, but all I am trying to do is:
Get a User from a string that is a player’s username, then also get a certain track that has the name “default” on my server.
Then I want to get the primary group of said User and be able to set another group for that user.
All I am confused really is that on the online docs for the API, it says the variable luckPerms, which I’m not sure where that comes from. And I don’t know how to use a certain method such as “TrackManager#getTrack” in my class
This might help ^
I tried reading that, but I’m still confused on what to specifically do to get a player, would User permUser = (User) player; work?
@jovial saffron i believe you need to call getuser
api.getUserManager().getUser(player.getUniqueId());
maybe you can cast it
but i haven't tried
Hello again!
I can't get this to work; I'm basically trying to get the NodeRemoveEvent to fire, but either it isn't firing, or I'm just doing something wrong, thanks!
https://pastebin.com/RNPHqBrw
Hey, does someone of you know how to set the primary group of a player? I tried it for some time and didnt got this to work.
It is on the wiki
@jovial saffron check the javadocs. The user manager has the appropriate methods
Do you know what setting the primary group means for LuckPerms?
User user = userManager.getUser(uniqueId);
if(user != null) {
user.setPrimaryGroup("bewerber");
userManager.saveUser(user);
} ``` This wont work
Do they have the group bewerber already?
Good. Then it can’t work
You can’t set the primary group to a group they don’t have
wiki
That’s a very different thing
In short you need to add an inheritance node
!api
Learn how to use the LuckPerms API in your project.
add permission group.group
You’re welcome
@crystal sonnet
Hey !Angxstupst! Please don't tag helpful/staff members directly.
What is your LuckPerms version?
5.0
@dreamy pagoda you need to install LuckPerms
@crystal sonnet can you please help me man my servere is supposed to go up today and I really need help with luck perms
Hey Ranily! Please don't tag helpful/staff members directly.
!ask @upbeat oriole
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
1 on 1 support is 30€/h
Though in any case you might already have your solution if you bothered to read the bot message
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
Now what does the bot say?
ok
It has a lovely message there for you
Then you are blind
I just need to talk to someone for 5 mins about my server
But I'm utterly amazed that you still haven't understood the message
Do yourself a favor
buddy
Ignore the links
Read the bold message up top
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
Where?
How do I install luckperms?
!install
You can install LuckPerms on Spigot/Paper, Sponge, BungeeCord/Waterfall, Velocity and others. Check the installation guide for more info on setting up LuckPerms.
ok
yeah
I already am on the website
the server I am using doesn't reconize the luck perms plugin,
btw why's this in #luckperms-api xD
Good. Then a) go to the right channel ( #support-1 or #support-2 )
I did
lmao
and I wasn't able to find the information
gottem
I joined this discord for further support
I would just like to talk to someone for 5-10 mins about the plugin
Then ask your question in the right channel with as much detail as possible and wait
Obviously not
Then explain yourself better
I am now asking just to talk for 5 mins because its easier that way
is it really that hard ???
come on bruh
I don't want to talk
btw, does anyone know if I'm doing anything wrong? https://discordapp.com/channels/241667244927483904/420538367986499585/716230065800740967
In any case please move to the right channel
ok
@marsh matrix what's the issue with the code again?
Basically, I can't listed the onNodeRemoval event right, I'm probably doing something wrong
I tried to remove the node, or even just make it expire, and it the event doesn't fire; I also tried to add a thing that printed a message in chat, but it didn't even do that
ignore the random dumb gibberish like this:
kitArray = kitArray.toString();
I already changed it, it was kinda late lol
with the command (/lp u IGN unset etc) and by setting a temp node of 5 seconds and let it run out
both didn't work
And just to be sure, make sure the TestListener constructor is actually being called
How would I call it? (sorry, really just used to sponge listeners)
oh
I need some help. Where can I get fast help?
yea I was just an absolute dumb, sorry and thank you
@marsh matrix you’re welcome
Hello! This might be a dumb question but I can't seem to get permission removal to work for me. all I have to do is remove the node from the user and save and cleanup the user, correct?
Not sure what you mean with cleanup, but besides that, yes
ah, so usermanager.cleanupUser(user) is not required after save(user)?
No
How can I get the remaining time that the user will be in a parent temp?
!api the javadocs and the wiki should show ya
Learn how to use the LuckPerms API in your project.
Yeah for me its throwing errors when try to return LuckPerms.getUserManager().getUser(player.getUniqueId());
--
Cannot make a static reference to the non-static method getUserManager() from the type LuckPerms
You have to have an instance of LuckPerms first, you can't just pull non static methods from it like that
How to make the instance for LuckPerms?
!api i think it's one of the first things on here
Learn how to use the LuckPerms API in your project.
No its not
It's one of the first things right there
If you're not gonna look when help is provided, don't ask for help
Does someone know a good tablist plugin?
http://paste.simonm.net/bilokivuta.java why is this called 6 times for 1 rank change? I have a discord syncing plugin and I am trying to make it so if the user if offline, it will still fix their ranks but this wants to fire 6 times
Is the Documentation not updated? I am not able to get a UserManager#loadUser
public User getUser(UUID uuid) {
UserManager userManager = Skyblock.luckAPI.getUserManager();
CompletableFuture<User> u = userManager.loadUser(uuid);
return u.join();
}
loadUser isn't recognized and I cannot see any viable substitutes
Does LuckPerms support the default Bukkit implementation of Player#hasPermission()?
what's the context for this question - like what are you doing with it and what are you expecting to happen - if you're not using the LPAPI at all you should try verbose too what LP is checking (and if verbose isn't checking anything, make sure you have nothing else doing the job of LP)
// Check for permission
if (command.getPermission() != null && !sender.hasPermission(command.getPermission())) {
OChatMessage message = new OChatMessage(schemeHolder.getScheme(command, "no permission").getScheme());
message.replace(getPlaceholdersForCommand(command));
message.send(sender);
return;
}```
I don't use LPAPI I use Bukkit Player#hasPermission()
okay and what context does this have with Luckperms?
just need as much info about your situation as possible please
I'm new with LP, how do I use verbose to print in chat?
!verbose
LuckPerms provides a verbose command to help you find out what permissions a command/plugin is checking.
then you're either using another perms plugin on top of LP, you aren't using verbose properly, or your own code is doing LP's job
I realized that I had another permissions plugin installed
yep that'd do it lol
I feel so stupid sometimes 😄
happens to all of us 😆
Anyways thanks for the help 😄
np!
how can I do that the prefix is in the tablist ?
Hello guys! How I can get offline user info via api?
@stuck terrace check the user manager
Like this or something?
BrainStone I figured out with that error that was I was getting a while ago
Vault needed an offline player object, but in their method it just gets their name, and as some players haven’t logged onto the server yet the error was being thrown as OfflinePlayer#getName was returning null. So I’ve used my name method that returns their name no matter what if they’ve logged on or not.
How to get offline player meta via api?
Learn how to use the LuckPerms API in your project.
does the api have an event when a user’s rank changes?
hello how can i add player to any gruop for example 30 days?
Hi, how can I add a group to a user without settings it to primary?
Why do you want to not set it to primary?
I need to have two groups on one user. Is it possible?
With the API?
!ask
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
!ask someone can help me? i have problems
Please ask the question you have. Don't ask to ask, or ask to DM someone. There are people here to help you, but we need to know what to help you with, so please just ask the question you want to in as much detail as possible!
prefixes and permissions with other plugins.
i create the rank with prefix but not showing on chat and tab
haha
you need a chat formatter i.e essXchat and also you need something like TAB plugin
essentials X?
specifically chat yes, you need a chat formatter to enable prefixes in chat
can you join my server and help there? beacuse discord is on my phone and my phone battery is dying
also #support-1 or #support-2 lol
How to create user group inherts with LuckPerms API?
!api
Learn how to use the LuckPerms API in your project.
I already found this InheritanceNode node = InheritanceNode.builder(group).build();
But how I can apply to a user instance?
Done. Thanks.
Remove the </dependencies><dependencies> in the middle
oh
Hi I'm pretty new to this API I recently switched from PEX to LuckPerms because of lack of 1.15 support.
I always did this to get a player's group specified.
if (user.inGroup("RANK")) {
But I have no clue on how you can do the same thing in LuckPerms would be very appreciated if anybody could help me.
Can you give me the link to API?
Or i just need to add ```RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
chickenfricker: You can get the nodes, filter for the inheritance nodes and then there is a list or something of group names
I'll test if I can get a working example
Okay man thank you if you get me an example would be great ❤️
There's already an example on the wiki how to get a list of group names
I don't really know how I specifiy a rank with the API, I tried using an example I found on your Node site but I got this error.
You are trying to access the static method getGroupManager on the LuckPerms class, you need to use the api object you created
NVM
Thanks for the help @neat jackal 😄
Hey chickenfricker! Please don't tag helpful/staff members directly.
Hi guys hope you can help me, I'm trying to implement a chat formatter into my plugin using Luck Perms (no vault or anything) but I'm having an issue with the onEnable() method. I think it'll be a quick fix so can someone point me in the right direction please? https://pastebin.com/xcbGAF7h
Just to check, do you have LuckPerms as a dependency in your plugin.yml?
Also, you really shouldn't get an instance of the LuckPerms API whenever you're using it. It'd be best to get the API once in your onEnable method, and then pass the API as a parameter to the areas that need it
Okay I facepalmed myself and put LuckPerms as a dependency in the plugin.yml as shown here https://pastebin.com/niiDYfDa. However I'm still getting the same issue. I will modify to only get the API once in a sec.
Could you show me the exact line the issue is occurring on? Since you're omitting the imports at the top of the class, the numbers shown in the stacktrace are off 🙂
Wow okay I now feel stupid the line that was causing the issue was: public static LuckPerms api = LuckPermsProvider.get();
All I needed to do was delete it. Apologies for wasting your time 😫
It's all good 🙂
@tender minnow if you use the 5.1 API then there are loads of utility methods
Including getting the groups of a permission holder (which is either a user/player or a group itself)
Hello, I have a problem with the Error in the bungeecord console:
I think I have to use an older version of the bungeecord plugin (version 4.x).
I count on quick help.
Greetings!
That code is exactly the same on version 4, and the method definitely exists in the latest version of redis bungee. Are you using an incredibly outdated version of redis bungee? That area of redis bungee hasn't been touched for years
I dont mean to hijack this question, but how do i check if a group is temporary? I've read the api wiki but only found how to check a group, but not a way of knowing if its just temporary
The problem is that bungeeredis is no longer supported ;((
Hey MiłoszGG! Please don't tag helpful/staff members directly.
@refresh
That code is exactly the same on version 4, and the method definitely exists in the latest version of redis bungee. Are you using an incredibly outdated version of redis bungee? That area of redis bungee hasn't been touched for years
@cold panther We are using a redisfaker, because redis bungee isn't supported.
Hey MiłoszGG! Please don't tag helpful/staff members directly.
@pliant belfry To be honest, you'd be better off getting the group as a Node and then using Node#isTemporary
oh. I found another way that might work, not a proper way tho
private boolean isGroupTemporary(OfflinePlayer op, String group) {
return !PlaceholderAPI.setPlaceholders(op, "%luckperms_group_expiry_time_%groupname%%".replace("%groupname%", group.toLowerCase())).isEmpty();
}
``` XD
oh, if it works, it works I suppose xD
I havent tested it 😛
A node is a permission node, and the permission nodes define which group the player is in, right? Just want to make sure i got it correct
A node is a permission node, yeah. A node that defines a group is an InheritanceNode, but since the inheritance node extends Node they're similar except in how they're processed
@stray wharf Here's a link to a redis bungee jar https://ci.lucko.me/job/RedisBungee/ It isn't supported anymore, but it works perfectly fine
Okay thank you
That's legal? xD
It isn't supported anymore and it's open source 🤷
for developers?
open source for everyone
Thanks 😄
https://github.com/minecrafter/RedisBungee That's the github link to its repo
Dziękuje ❤️
Dzięki ❤️ From Poland 😄
No i git
No problem 🙂
First time in Minecraft dev stuff ive heard someone question if its legal 😮
o/
First time in Minecraft dev stuff ive heard someone question if its legal 😮
why?
Why what? I think its a good thing, people usually grab everything they can without questioning it
Have you tested that whacky solution, Bendix?
Honestly, I've never used LuckPerms and just sent it off to the guy who wanted it saying that its not tested 🙃
xD
If i were to run an mc server, i would use LuckPerms tho, i think. But getting into it and understanding the commands to setup a temporary group and a bunch of stuff is just too much work for this tiny project
fair enough, I don't run an mc server myself. I'm just here to provide support
Ahhhh, looking at it now I see why. You're passing an offline player, and luckperms won't have any data available for them. One moment
Is the player always going to be online when that method is ran?
Nope
private CompletableFuture<Boolean> inheritsGroup(String group, UUID who) {
return plugin.getLuckPerms().getUserManager().loadUser(who)
.thenApplyAsync(user -> {
Set<Node> groups = user.getNodes().stream()
.filter(NodeType.INHERITANCE::matches)
.map(NodeType.INHERITANCE::cast)
// .map(InheritanceNode::getGroupName)
.collect(Collectors.toSet());
for(Node n : groups) {
// Stuff
}
return false;
});
}```
I got this tho, mostly copy/paste from wiki
Then (I think) you'll have to load them to memory before you can do anything to them
Might be wrong, just learning this myself tbh
Yeah, which is why im going away from Papi and into Luckperms to check Luckperms stuff XD
private CompletableFuture<Boolean> isGroupTemporary(String group, UUID who) {
return plugin.getLuckPerms().getUserManager().loadUser(who)
.thenApplyAsync(user -> {
Set<Node> groups = user.getNodes().stream()
.filter(NodeType.INHERITANCE::matches)
.map(NodeType.INHERITANCE::cast)
.collect(Collectors.toSet());
for(Node n : groups) {
if(n instanceof InheritanceNode) {
InheritanceNode in = (InheritanceNode) n;
if(in.getGroupName().equalsIgnoreCase(group)) {
return in.hasExpiry();
}
}
}
return false;
});
}```
Ended up using that and it works 👍
Awesome 🎆
The variable metaData doesnt exist
Read up a little bit on the wiki and it shows you how to get an instance of CachedMetaData
@nocturne elbow I'd recommend upgrading to 5.1. It has some more convivence methods that may prove useful
But yes, as katsumag said, you need to get an instance of the player's CachedMetaData. If you're using 5.1, you can do this using the player adapter to reduce your workload.
CachedMetaData metaData = luckpermsApi.getPlayerAdapter(Player.class).getMetaData(player)
hello. since I'm working on a premium plugin and planning to convert it to use Kotlin, it's not as helpful to shade kotlin inside, so I was thinking of making it similar to how LuckPerms downloads and relocates libraries at runtime. I've got it mostly to work (downloading the jars), though I have absolutely no idea how to fetch the checksum of kotlin's stdlib. any possible help?
try this
the way I find the checksums is to just run it using something invalid, and then copy the correct checksum from the error message
I see, thanks a lot! but ultimately wouldn't that make the checksum comparing redundant?
hello, any help for create chat for group? for example /a text for admin chat etc? can i do it in or with luckyperms?
ultimately wouldn't that make the checksum comparing redundant
No, it'll ensure that your users end up with the same file as you
Is this a problem with the LP developer api
If so continue
If not, #support-1 pls
(channel topics ftw 🥳 )
Si i go to general for my problem no?
Um Can someone help me with LuckPerms api?
i can't seem to figure out how to use it on InteliJ
!api
Learn how to use the LuckPerms API in your project.
Thanks
String suffix = metaData.getSuffix();
metaData.getSuffix() Gets RedLined
;)
S'all good :) If you have issues, be sure to message here again
The player adapter was added in 5.1, so to use that solution you'll need to update
Yep, like I said you'll need to update to 5.1 to use that method. Change the version to 5.1 in your pom.xml, and then refresh
Is that after reloading your pom.xml?
How do I get a player's group suffix ?
@keen matrix This little example should cover that if you're using API 5.1 https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetPrefixCommand.java
just replace getPrefix() with getSuffix()
Hey JBeastlyz! Please don't tag helpful/staff members directly.
Sorryy
It's all good, it depends on your platform tbh. The easiest method isn't necessarily the most reliable, but it works if you ensure luckperms is always loaded before your plugin.
private LuckPerms luckperms;
// your enable method
this.luckPerms = getServer().getServicesManager().load(LuckPerms.class);
That also only works with bukkit. The more reliable methods for each platform can be found here: https://github.com/lucko/LuckPerms/wiki/Developer-API#obtaining-an-instance-of-the-api
In that example, the api instance is called luckperms whereas the documentation states it as api
thanks ❤️
is it possible to get a groups prefix using the api?
Learn how to use the LuckPerms API in your project.
like with the color
i have the api its okay
i jut cant find the method
for to get a users group prefix with thee color(not groups display name)
How does this work
String prefix = metaData.getPrefix();
String suffix = metaData.getSuffix();
how does i get this meta data
show the entire code
no one is going to be able to help you with that snippet even if they wanted to
That is from the wiki
Not my code
This is what I am saying
I wanna get a groups prefix/suffix and that's all the API shows
You need to scroll up a bit. The snippets right above that show how to get it
In the API version 5.1 ease of use functions were added, be sure to upgrade, they might make your life way easier.
You can find some examples over at https://github.com/LuckPerms/api-cookbook
Be sure to check out the JavaDoc: https://javadoc.io/doc/net.luckperms/api/latest/
Pinning because it might be useful. Any other mod/Luck/Turbo can feel free to unpin if it isn't :)
LuckPerms luckPerms = LuckPermsProvider.get();
CachedMetaData metaData
= luckPerms.getPlayerAdapter(Player.class).getMetaData(player);
``` i can find the getPlayerAdapterMethod
awesome
i spoke to soon
Error:
java.lang.NoSuchMethodError: net.luckperms.api.LuckPerms.getPlayerAdapter(Ljava/lang/Class;)Lnet/luckperms/api/platform/PlayerAdapter;
Code
LuckPerms luckPerms = LuckPermsProvider.get();
CachedMetaData metaData = luckPerms.getPlayerAdapter(Player.class).getMetaData(player);
String prefix = metaData.getPrefix();
player.sendMessage("Your Prefix: " + prefix);
you should update luckperms on your server
yes sorry, i thought i had the latest version. I make silly mistakes at midnight XD
and yes it works ❤️
Hey - does LP implement transient subject data for Sponge?
yes
it doesn't seem to apply permissions or parents
same code with getTransientSubjectData() and getSubjectData() and the normal one works but transient doesn't
I'm using a plugin that's using luckperms API and I get this error
!upgrading
Sorry! I do not understand the command !upgrading
Type !help for a list of commands.
!upgrade
Read about upgrading LuckPerms from v4 to v5.
Best to just tell the author to udate their plugin to the new api, but for now, the legacy-api extension should work
Alright 👍 thanks
Question: Do I have to register permissions a particular way so that luckperms know about it? Or I can just use hasPermission("your.permission.here")? (I also need permissions for sub commands)
Does this work in plugin.yml?
permissions:
plugin.subcommand:
description: description if you'd like
iirc it tries to collect data about what permissions exist as best it can
if you put it in the plugin.yml it will almost certainly know about them and suggest it in the editor
if you check for the permission anywhere in the plugin, it should suggest them in the editor at the very least after that check
??
im not used to maven, am I doing something wrong? https://gyazo.com/eb63fad861506ca7522ee05f173c3eda
Oh fuck. I never use mavens 😂😂
@rich ferry The LuckPerms API artifact is published to maven central, so you'll need to add it as a repository https://repo1.maven.org/maven2/net/luckperms/api/. I'd also recommend upgrading to 5.1 for some additional ease-of-use methods
@slim willow Any reason you're not using API 5?
mmm
Ok
So did I write it wrong?
now its not that easy :L
i mean in ver 5.x.x
No, the way you added lp as a dependency is fine, fxcilities. It just can't find the api in any of your repos
the setPrimaryGroup method doesn't actually give someone a group, it sets a group they already have as their primary group, muntder-I.Q. Even with the older API, you need to build an inheritance node and add it to the user
You should just need to add https://repo1.maven.org/maven2/ as a repo, fxc
ok
<repository>
<id>maven2-repo</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
You may need to restart your IDE, or reset the cache
Doesn't intellij (if thats what you're using) have a button to reload maven?
Hi, I want help with language Czech !
How would I get the prefix of a group
Learn how to use the LuckPerms API in your project.
hello
i'm using the API on bungeecord, but i always get this error: https://pic.wtf/u/PMUbLwDiq8.png
i have depend: [LuckPerms] in my YML tho
is there like a method i should be checking for to make sure the API is loaded?
Move the call to LuckPermsProvider.get() into onEnable
How would I set a users prefix with the luckperms API?
I can't figure it out
This is all I have
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(player.getUniqueId());
I've tried to google it but I can't really find a working method
Nothing is working
how do i lusten for events
listen*
like PlayerDataSaveEvent cuz i cant use a normal bungee event listener
@surreal harness You subscribe to the event in the event bus https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#listening-to-luckperms-events
thanks
@quick granite Here's an example of setting a prefix using the API. https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetPrefixCommand.java This is only compatible with API 5.1, so make sure you update if you want to use UserManager#modifyUser
The LuckPerms.getApi() method is also for API 4, hence why that method doesn't exist. You now use LuckPerms api = LuckPermsProvider.get();
S'all good 🙂
Why this Code not Working :
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equals("noprefix")) {
if (sender instanceof Player) {
Player player = (Player)sender;
if (player.hasPermission("newdycraft.noprefix")) {
LuckPerms lp = NewdyCraft.getLuckPerms(Bukkit.getServer());
User user = lp.getUserManager().getUser(player.getUniqueId());
Group noPrefixGroup = lp.getGroupManager().getGroup("noprefix");
if (user.getPrimaryGroup().equalsIgnoreCase("noprefix")) {
user.getInheritedGroups(null).remove(noPrefixGroup);
} else {
user.getInheritedGroups(null).add(noPrefixGroup);
}
}
}
}
return false;
}
The error is near getInheritedGroups
I'm not English, I'm French
So?
I'm not English either
I can only help you if manage to properly express yourself in the one language we both speak: English
What is line 47?
What I pass ?
Just use the method without a parameter
cough @jaunty pecan
Why is there a method that requires QueryOptions that has a clear user associated?
In any case get the QueryOptions like this:
ContextManager contextManager = lp.getContextManager();
QueryOptions queryOptions = contextManager.getQueryOptions(user).orElseGet(contextManager::getStaticQueryOptions);
Some method names may be slightly off. But that should fix it @karmic hill
ok I try that
But how do I apply this to my code ?
contextManager.getQueryOptions(user).orElseGet(contextManager::getStaticQueryOptions) doesn't have any add, remove or contains Methods
You then use the variable queryOptions instead of the null
Well you can't directly modify the group lists that are returned
You need to add or remove the group via an inheritance node
Can you explain ?
You add or remove groups a player (or another group) inherits from by adding or removing inheritance nodes
All data in LuckPerms is represented through nodes
!api
Learn how to use the LuckPerms API in your project.
thanks
Is there a way to get all users or their UUIDs who have a specific PermissionNode
Yes, Check the UserManager
Thank you 🙂
Regarding the QueryOptions, I believe there is now PermissionHolder#getQueryOptions, meaning you should be able to use user.getInheritedGroups(user.getQueryOptions()); to get their groups opposed to using the context manager
how would i even manage to reproduce this error: https://pic.wtf/u/RVQbPTiK-2.png
why would a player's primary group be null
Could we see your handler please?
sure
give me a sec
there is mroe in the switch statement
and the syncrole method just sends a POST request to an APi
Say you print user.getPrimaryGroup().getName() to console above the switch statement, is anything printed?
should getPrimaryGroup() already just return the string?
what would getName() even do in this case
It does not, no. It returns the group object
autocomplete says it returns a string 
Oh yeah, whoops my bad. But yeah, does user.getPrimaryGroup() return anything when printed to console?
i just tried it
it isn't 
don't all users have a primary group whether it be default or something else?
They should do, yeah. Is the person still online following the event?
not sure
i tried it without event
and it worked
just by iterating through every player
The user being cleared from the LP cache is the only thing I can think of, and that only happens when they leave the server. Perhaps try changing api.getUserManager().getUser() to api.getUserManager().loadUser()
If that doesn't work, I'm out of ideas so we'll ping luck xD
ok
@jaunty pecan Hi, can I translate to Czech ?
Hey LuKyN94! Please don't tag helpful/staff members directly.
lol
look
all i need is an event that runs pretty frequently
taht i can hook into real quick and call the API sync
@river ridge All you need to do is translate this file: https://github.com/LuckPerms/locale/blob/master/en_US.yml, rename it as lang.yml and submit a PR through github 🙂
Oh, lemme see renai
I don't see why the PlayerSaveDataEvent isn't working tbh, but perhaps you can try the UserDataRecalculateEvent
it has a getUser method
That event runs whenever a user's cache is refreshed, so it is ran a lot
alright
Using the API how do I get a players current prefix?
Are you using API 5.1?
Yeah
This should be very helpful then https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetPrefixCommand.java#L34
Ok thanks
Why is this giving me a null point exception?
Caused by: java.lang.NullPointerException
at me.imedia.kingstona.listeners.PrefixGUIListener.onInventoryClick(PrefixGUIListener.java:46) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]```
@quick granite what's line 46?
this.luckPerms.getUserManager().modifyUser(Color.CMDEXE.getUniqueId(), (User user) -> {
]I'm trying different methods to get the player
Nothing is working
I'm not seeing that line in the code you provided
Caused by: java.lang.NullPointerException
at me.imedia.kingstona.listeners.PrefixGUIListener.onInventoryClick(PrefixGUIListener.java:48) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
My guess would be that the luckPerms variable is not initialized
You should do some basic debugging
Did you check if it is null?
Yeah
Why are you always excluding the line numbers in the screenshots?
Double check it's actually not null and that luckPerms.getUserManager() is not null either
I thought it wasn't
I wonder why I asked you to check it
Then how would I not make it null? I thought it wasn't?
But I'm not initializing it to null. I'm looking at the docs and I've done everything correct on there
Also, has luckperms itself even initialized prior to you creating that listener?
I'm not even sure it's my first time using this API
I've just been looking at the docs
Alright
Listen
I don't mind you not knowing stuff
I really don't
But I do have an issue when you say stuff like "I know it's properly initialized", when you don't even know how you initialize it
I generally thought I did
Be honest and stop wasting my time
Alright
Now how are you initializing it
How do you initialize the variable LuckPerms? and why are you casting it?
How do you initialize the variable LuckPerms?
I don't I don't think
There's your problem
Also if you call it luckPerms you can actually use the type name LuckPerms instead of object
I could be being stupid but it doesn't let me import it or anything
and yeah ik I'm stupid
I'm talking about here: https://cdn.discordapp.com/attachments/420538367986499585/718924870695780372/unknown.png
And you really really should know Java programming before jumping into Minecraft plugins
Even more so working with the LuckPerms API
This is not a place to learn programming
Yeah ik :/
And you need more than "some java"
You actually need some decent java knowledge if you don't want to spend 90% of your time debugging java "issues"
Only exception is if you are familiar with OOP programming already and just want to learn java on top of knowing similar languages. Then MC is a good place as it's the right difficulty I'd say
Yeah when I was being taught in CS by school they did like 1 lesson on Java and the rest was python unfortunately
Anyway, I just tried it again and the same error
Did you initialize the luckPerms variable in your main class now?
Or are you expecting it to be initialized by some sort of magic?
I did initialize it this time
How?
I
I don't even know what to say anymore
I'm not here to teach you java
I mean I can tell you how to fix it
But then you'll get stuck on the very next tiny obstacle
And the one after that
etc
At this point it's not even basic Java anymore
This is basic programming
I'll just figure it out and do some googling to find out how to initialize it and things
what i found at my college was people who learned python had a lot of trouble grasping how assignments work in other languages
cause in python you just do something = whatever anywhere, and it just "works" which just isn't how it works for java/c/most other stuff
Phyton to Java (or any other C based language) is pretty hard. You practically need to start from 0
correction: people who learned python first
yeah lol i didnt fall into that pitfall thankfully
i took C++ as my first course in college
as well as linux scripting
then moved on to java/python
Unscoped languages are one of the worst to learn first imho
yeah python is a bit too loose i think, colleges are adopting it for their beginner courses because it is easier
but it's at a cost
It's not a difficult concept to learn unscoped variables. But learning scoped ones is difficult
yep
But in this case there's no excuse. It's not even the same variable name
going from python -> anything else and getting bonked on the head by type and scope
Also untyped languages are also a bad starting point
Because learning strict typing after the fact is also incredibly hard
So while Python does a great job at lowering the difficulty for entry into programming it raises the difficulty for learning C based languages tremendously
Because Python doesn't properly teach concepts
Just a watered down version of them
So you have to unlearn and relearn the properly
yeah funny story is i actually didn't know any python until i actually took up a tutoring job at my college lol
learned it in a couple weeks and then started helping the beginners, even there i saw a lot of mistakes
I never made anything in it to this point
I just talk to a lot of people using it
it's a useful tool but i wouldn't call it a go-to for a lot of things, despite being pretty easy
i mostly use it for scripts to automate/process things
not for a lot of full programs
I've come to the conclusion that anyone that considers it a good general purpose language and uses it as a first choice, frankly sucks at programming
Python is a scripting language
yeah i dont think that's a terrible assumption to make
And that's what trips up most people
of course if it's an experienced programmer and they justify why they chose python over other things, sure
I've yet to meet any
but yeah a lot of the time it definitely feels like a lot of people "just use it" because thats what they know
ya
But not as a general purpose language
as a scripting/tooling language it's great, it has a lot of nice stuff built in
i've used the http server module a few times, json parsing is great
(i wish java had built in json haha)
There are great libs
Not everything needs (or should for that matter) to be built in
yeah but for scripts you dont want to build stuff from the ground up
I started with java, and have started messing around with Javascript, and omg I miss inheritance and strict typing
yeah fair enough lol
i've tried to stay clear of it as much as possible
done a little web dev but i'm by no means good, at all
if you want to do anything web-related though, you are pretty much forced into it
yeah
I still can't believe anyone thought it was a good idea to put JS on the backend
what.
I mean who could've seen it coming that it's a giant pile of shit made by beginners and and everything is riddled with security issues because, surprise doing backend development is actually difficult
oh fuck
That was back in 2012, so they might have overhauled it since then
iirc dropbox hired the designer of python?
if my memory is still correct
so idk i think they might just have a lot of python
I use JS as back-end actually, it works, I know, bad argument, but I don't need more. And what else should I use?
Java, C#, etc
Heck even PHP is better
ok so it looks like Guido left dropbox in october actually
he worked there for almost 7 years
so maybe dropbox will actually move away from python lol
iirc dropbox hired the designer of python?
quick google, yes they did, until he retired in 2019
oop too slow
yeah lol i googled it again too
I doubt they will
The language can be actual cancer
The cost of rewriting everything is significant
hey 11 at least i didnt remember anything incorrectly
sometimes i just say things and they're wrong and i feel badly after
And that's why it's important to actually take time to pick the right tech stack when starting a project
well Guido thought python was the right stack! 😛
only thing I don't like about java is I can't add a eval command to my discord bot since it's a compiled lang
there's no reason you should need to do that anyway
(yes, I know, eval commands are dangerous)
11
They are not just dangerous, they are the best way to get your shit hacked
you could probably still do something like make a class that gets loaded in with new commands or something
but yeah nothing on the fly like eval
yeah that just sounds like a mess lol
There have been plenty of exploits where people have used evals to escape sandboxed environments
Just don't
There is a way I think, by doing something like parsing Java as JavaScript (here we are again) using Nashorn or something
Unless you want your stuff hacked
tbh all I really use it for is sending messages elsewhere or dynamically querying some value
There's a Java interpreter
also I did notice that my java bot was using considerably less ram then my clippy fork I was running for a bit, so it has that too
Reminds me
I need to make the bot for my server :/
My TODO list is waaaay to long xD
Doesn't node use Google's V8 engine? That may explain the high ram usage xD
oof
Though, I wouldn't be surprised if Oracle end up putting ads in Java consoles, or ask you to sign in to run an app...
openjdk
Btw am I the only one that thinks the trend to render web sites client side is just ridiculous?
If they end up putting ads/monetisation in java though, couldn't oracle just end the openjdk? I haven't really delved into the legality of openjdk
Here's a crazy idea: If your web stack needs to much resources instead of offloading the stuff onto the client, just use a stack that is actually resource efficient
all of luckperms.net is clientsided afaik
We try to change that, but... it takes time (and nerves, big nerves)
I think turbo was looking into nuxt.js
@wild whale and there you have the reason why I haven't contributed a single line of actual website code, even though I made the editor v1.1
LOL fair enough
And these standards are?
As little JS as possible
I've honestly considered working on a WASM version if the editor
That stuff is awesome
NGL
The only thing that makes me sad about it is that more people will start abusing the browser as their front end for things that should be actual programs
Hey, PWAs are coming too
RIP
Why not just make the editor an electron app 😛
Do you want to get punched or something?
lol sarcasm
Good
Btw this platform is a great example why electron apps suck
Before anyone asks:
You can easily shave off 95% of loading times and app size by turning this into a native app that's not 99% framework
yeah but where's the fun in that?!
The fun of spending hours because everything is @#$%€*&+ complicated
How do i give a player permissions
!api explained there, with 5.1 there may be a better method, let me check
Learn how to use the LuckPerms API in your project.
Nope, not really
i can't find where i give them there permissions
Are you wanting to do this with the developer API or just ingame
Developer api
Still don't see it
Modifying user/group data
Do i need to save it?
Yes, UserManager#saveUser
Wait do i need the begging part of it DataMutateResult result = user.data().add(Node.builder("Contie").build());
like DataMutateResult result
You can leave that out
When would i use it?
You can also do like api.getUserManager().modifyUser(player.getUniqueId(), (User user) -> user.data().add(Node.builder("Contie").build())); in newer version
And you would want the result if you want to do something with the result
Hello. I am currently trying to update a really old plugin of mine from Pex to LuckPerms. It basically gets the users from a called group (Admin for example) and displays all users of that rank a /staff list against that rank.
The old pex system had getUsersInGroup, What would be the best way to do this with LuckPerms? Would it be the obtaining a group instance and then list the members from that group?
Tobi what would i do with it though
There's DataMutateResult#wasSuccessful, so I guess you can do check if it was successful
hmm that sounds very intreasting
Hey,
How can I add/remove a Parent to a user ??
Learn how to use the LuckPerms API in your project.
sry but I can't find it
and by your.node.here the group
InheritanceNode i believe
thx
public CompletableFuture<Boolean> isAdmin(UUID who) {
return luckPerms.getUserManager().loadUser(who)
.thenApplyAsync(user -> user.inheritsGroup("admin")); // again, inheritsGroup is not a real method, just used as an example
}```
Would user.getCachedData() work here if the player is offline?
If not - how would I get the prefix of a player who is offline?
@naive imp Yes that should work since UserManager#loadUser loads the user into the cache
Alright cheers ryan.
hello
anyone can help me ?
i made this litile thing
but the command is not working
how i can fix it ?
any help?
There's no command with group, it's parent.
It's probably better practice to do this through the API also.
can you help me do it ?
i just want 1 example
give player a temp rank with api .
tried but could'nt do it xd
I need help I want to display a players rank in the scoreboard on the right how do I do that?
are you custom scoreboard?
making my own plugin
oh
i used this
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
Group owner = api.getGroup("owner");
Group member = api.getGroup("member");
Group gold = api.getGroup("gold");
Group diamond = api.getGroup("diamond");
Group war = api.getGroup("war");
Group youtuber = api.getGroup("youtuber");
Group fr = api.getGroup("friend");
Group helper = api.getGroup("helper");
Group ha = api.getGroup("ha");
Group mod = api.getGroup("mod");
Group srmod = api.getGroup("srmod");
Group admin = api.getGroup("admin");
Group co = api.getGroup("co");
yes
and how can I display there rank / prefix in the scoreboard
hmm idk xD
hahahah don't wurry
I am now working almost 3 days on this thing but nothing works
But do you know how to display the time and date on the scoreboard
It's probably easiest to do everything you're looking to do, with PlaceholderAPI and a compatible scoreboard plugin - it's so much smoother and easier, and allows for a lot of options a lot quicker, without you having to add stuff to your own plugin
pretty much yeah
especially when they're optimised and well made
the number of them matter less than the code
Well the server I am running has 41 plugins now and we want to optimise that plugin count so instat of 41 we want like 20. What we are doing now is putting plugins together only I don't know how to inport a luckperms prefix/rankname in a plugin. (And yea luckperms is added to the libbary)
beacose we are running les plugins and on a MySQL server and the performance will go up
well no one that can help me with this?
not about the plugin but about the luckperms prefix in TAB an scoreboard on the right baybe even in chat if that is possible
Do you need help getting someone's prefix and primary group?
That I have
I am making a plugin that show a scoreboard on the right
There a a fuwe things that are cutom made that have to shown in that scoreboard becauso of this I can't use a existing plugin
and now I am stuch with the probem: How can I show the players rank in the scoreboard on the right
rank = prefix | prefix = rank
so they are both the same
I personally can only help with the LuckPerms API rather than displaying it on the scoreboard. I've never used the scoreboard API, so you'd be better off asking on the spigot forums/spigot discord
well can you send me a invite to the discord server?
The links here: https://www.spigotmc.org/threads/426794/
@slim willow If you're not using API 5, then I can't provide you with an example of how to add a temp group with the API since we nolonger support it. If you're using the command dispatcher, try "lp user " + p.getName() + " parent addtemp gold 5d"
if it doesn't work, you should at least see some output in console you can use to see why
But @obtuse jolt how do I get the prefix
Hey Greazi times around here! Please don't tag helpful/staff members directly.
Well that was not my intension to @ you
!api im also not familiar with the api side of lp
Learn how to use the LuckPerms API in your project.
CachedMetaData metaData = this.luckPerms.getPlayerAdapter(Player.class).getMetaData(player);where player is a Player object