#luckperms-api
1 messages · Page 22 of 1
Hello !
I search what replace user.inheritsGroup(groupname) can you help me ? (for the new api)
How does this ContextSet Thing work?
I just purely want to get the users group from the database
the prefix is mostly want Im aiming for to display on the side
the context i need would probably be "server" "lobby"
So you just want the players prefix?
Search this channel
I think there have been many examples of that
Why bother with their group prefix?
I just mainly in the end to put their rank on the sidebar
If you get the players prefix you get their group prefix if they don’t have one applied to themselves with a higher priority.
Ok
good morning 🙂
how long does u need to create a lp configuration on a 1.14.4 Citybuild, Arena, .... system ? 😄 (30 plugins) ^^ i need help
@errant inlet #support-1. Read the channel description before asking
And also we are not here to set things up for you
Hi, I'm new at using plugins' API. Does it need to be the exact same version as a plugin? Or can I just use the newest one?
Or does p.getDisplayName() include a prefix? I just want to send a message with player's name and the prefix.
is it possible to list all players in a specific grou? even if they are offline?
I don't understand how to add a permission to a player. Have already looked at this here: https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage
LuckPerms.getApi().getUser(pp.getName()).setPermission(HERE??)
permission is easy
then say
use the web editor
uffff
do u wanna talk
haha no
ok
u wanna create ur own plugin?
yes..
Can anyone help me??? I have an bungee system , which works with an specific permissions system! But this System is shit and i want to swap the old system with luckperms. I cant programm java so somone have to help me. PLS is there somone? Its not hard...Just 2 Commands
@haughty solar it seems you can programm java..Can you help me???
@golden forge Can you help me?
Ask
is it possible to list all players in a specific grou? even if they are offline?
@haughty solar what do you mean
What do you need?
@sleek axle tell me
can you make an example @crystal sonnet
Hey HOPE! Please don't tag staff members.
Help please
Sorry it didn't link the method properly
so can i load every player in a group with the method even if they are offline?
Hey _NotSeba! Please don't tag staff members.
@nocturne elbow you can get their UUIDs at least
sorry for tag
You will need to load the separetely
@chrome kelp You might want to check if you're in the right channel
CompletionStage<List<HeldNode<UUID>>> manager = LuckPermsProvider.get().getUserManager().getWithPermission("*");
gives me not an uuid
Do you have anyone with a * permission?
yea
it gives me this output:
java.util.concurrent.CompletableFuture@73f3455[Not completed]
Not completed
means?
You have to wait for the Future to complete
Yes
okay
yea
is there a way to get a user's group expiry
Hi, how can I check when a player's rank changes? With api
@gentle ocean there are events
@wary locust with the plugin API?
@slow lake get the group node and check the expiry
@crystal sonnet Wath is that ?
Hey Zelix! Please don't tag staff members.
@golden forge ok...so i want to implement luckperms on my bungee system.....but i cant programm java.....would you do it for me?
Hey, new to using all this stuff - was just wondering how to get a pre-existing plugin to pull prefixes/ranks from LuckPerms instead of the current .yml file?
!api
Learn how to use the LuckPerms API in your project.
how do i use it with spigot/bukkit? need to change perms with essentialsX
Is there an event for tracking users prefix change? (Edit: nvm, figured it out)
net.luckperms.api.model.group.Group, wie kann ich da die member getten?
@dusky wagon https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/user/UserManager.html getWithPermission
and wich permission have the groups?
group.<group>?
oh okay
CompletableFuture<List<HeldNode<UUID>>> test = BuildSystem.api.getUserManager().getWithPermission("group.builder");
it will return null
What returns null? @dusky wagon
@glad leaf I can't help you if you don't tell us what you need
No I don't
I have a LuckPerms placeholder problem. I get an error and I cannot restart the PlaceHolderAPI configuration
Is this
On that page is the problem
Ok
@crystal sonnet the code there are over the message
Hey Meerpaluten! Please don't tag staff members.
Nö he has tag me too
@dusky wagon I'm asking what part of that returns null?
How do you know it returns null?
Because there is a null exception in the console
That means that a call before the getWithPermission returns null
So my guess would be that either BuildSystem.api or BuildSystem.api.getUserManager() is null
Most likely you are accessing the API too early
Then you access the API too early
You can onyl get the API after LP has initialized
Make sure you do not try to initialize your LP API instance before your onEnable
I have check api and don't find Event on player rank update
There should be one for any updates to permissions
Use that and see if the group changed
Okay, is it used the same way as spigot events?
Learn how to use the LuckPerms API in your project.
public boolean hasPermission(User user, String permission) {
ContextManager contextManager = api.getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
PermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
return permissionData.getPermissionValue(permission).asBoolean();
}
Why it this not work, it is so on wiki
When i create a Group and give them somoene they cant write in the Chat. I use it on Nukkit
Can any help meee
@dusky wagon what's happening with this code?
Does it not compile?
Give the wrong answer?
etc
i fix it.
in the wiki is the error
public boolean hasPermission(User user, String permission) {
ContextManager contextManager = BuildSystem.api.getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
return permissionData.checkPermission(permission).asBoolean();
}
this is the code that it right
@nocturne elbow this is the channel for plugin developers asking for help with integrating the LP API
I think you want to ask in #support-1
Good evening, I would like to use the spigot API of LuckPerms but I have this error:
java.lang.NoClassDefFoundError: net/luckperms/api/LuckPerms
I have version 4.4.1 and I added to the classpath of the project the jar api-5.0.jar but the package net.luckperms.api
The API changed completely between v4 and v5
I mean you're already using the v5 API
What is the easiest way to get a user group (a string) ?
Get the primary group of the player
that's not what I'm looking for
because it is often default even if the player has a rank on a specific part of the server
Then give the groups weights
how do i change the i set autolistranks false on rankgrantplus how do i do prefixs???
Currently my custom chat plugin uses a custom rank+prefix setup, which pulls ranks from .yml file everytime a player speaks. I'm struggling to figure out a way to have it instead pull the chat prefix from luckperms instead of the current one right now. Any tips on what documentation I should be looking at or what I should be focussing on?
Set a String when the player is joining
Set a string where?
@fallen bronze have a look here: https://github.com/AuraDevelopmentTeam/BungeeChat2/blob/master/src/main/java/dev/aura/bungeechat/hook/LuckPerms5Hook.java
Is it possible to copy all userdata from one server to another server?
Copy the storage files over while both are off or use the export/import functionality
Is there a wiki for how to use export/import?
I just want to transfer the "users" not the "groups"
Since I got different perms for the servers.
That sounds like a different story then
In this case I’d recommend you use a network setup with contexts
How do I do that?
Can I then setup different perms for different servers? But if a player gets a rank at one of the servers. He gets the rank at all servers?
what happened to user.unsetPermission()
how do u unset a node in 5.0 api
is this correct user.getNodes().remove(node);
so is there a way to mass give all permissions to a group at once like, for admin I want complete OP
or i should use CachedPermissionData instead
public static void unsetPermission(User user, String permission) {
ContextManager contextManager = api.getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
permissionData.getPermissionMap().remove(permission);
api.getUserManager().saveUser(user);
}
Hi, how can i add transient permissions to a player?
permissions which wont be persisten anywhere in luckperms database and are cleared when the player disconnects, or server stops?
Im on spigot platform.
@sly hearth user.data().remove(...)
the collections are all immutable
@wicked coral use this method
it's part of the Bukkit API, no need to depend on LP
@jaunty pecan Do i need to remove the attachment later manually? is is the context cleared when player disconnects?
Hey NeumimTo! Please don't tag staff members.
Oh thanks and i assume for adding is user.data().add()
it's cleared when the player disconnects
nice, thank you
anyone knows anything about installing luckperms global and making it work global on a bungee?
@upper jetty check the channel description
wich event is trigger if a player have a permissionchange?
What is the permission for able to use /perm /lp commands ?
For manager like we are not giving manager op so how can they able to use /perm and /lp command which perms we need to add
@timid axle check the channel description
I just need help
Then ask in the right channel
which channel can i ask
The channel descriptions should tell you
can't you help me i am kind of new this things
I know but please
wich event is trigger if a player have a permissionchange?
How on earth do i make a query to get permissions from a group? Why can't it just be group#getPermissions :/ this new API is so confusing
Add that suggestion here: https://github.com/lucko/LuckPerms/issues/1926
Hi friends 🙂 Can anyone point me in the right direction on how to promote a user down a track if they enter a certain command? ie. when they join a server, they have to say something in particular to be put in a group that allows them to start playing?
Any rankup plugin compatible wich luckperms?
@flat quiver there’s a method for that on the user object
@upper jetty wrong channel. #general
Oops sorry
Anyone have advice as to which API placeholders to use in order to get the correct prefix to show? I have a normal path and a staff path and I want staff to show, then normal, but to not show staff path if they do not have that group
I may not make any sense.... send help... lol
You probably need prefix stacking.
So if I understand you right you want that it shows "[Staff] [Member]" for staff. And just "[Member]" if they aren't staff.
!stacking
Display multiple prefixes/suffixes alongside a player's name.
Correct, how would I couple this with my chat program? Would there be a specific API to use for it?
it should insert using your plugins {PREFIX} placeholder that would pull from vault.
(i thought you wanted actual API info) sorry, but yea, just using LPs stacking would put the right info in if you pull from vault for prefix
how can i give a permission to a user using the API?
Hello, i am trying to see if a user has a permission so i looked at the dev api usage and found this (i had to slithly change it, as PermissionData does not exist) but its not working```Java
public boolean hasPermission(User user, String permission) {
ContextManager contextManager = instance.getLuckPerms().getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
return permissionData.checkPermission(permission).asBoolean();
}```
@raven pelican what’s stopping you from using the normal permission check?
which event is triggered if a player have a permissionchange,and which event after /lp applyedits?
guys i want to know how i can create an owner rank and a staff rank plz help
@crystal sonnet when i tried it, it didn't work
Hey Johni! Please don't tag staff members.
if(player.hasPermission("CAH.Game.Answer"){
@warped finch if you ask in the right channel we can help you
outcome is that i got the message that my plugin removed the permission even though the user didnt have the permission
so it should give an error saying hey, that player doesnt't have that perm
but it always game me the success message
@raven pelican I'd recommend using lowercase permissions
@crystal sonnet where is the right channel
Hey Abdollah Senpai! Please don't tag staff members.
Ok
but using non-lowercase permissions aren't causing these problems right?
There's a chance
ok ill try that in a sec, cheers, may i tag you if it doesnt work? i know cwippy doesnt really like that but yea
btw isn't clippy like from windows xp or something?
Can I use the luckperms api in a bungeecord plugin? (i.e. check the meta to get their prefix/color)
Yes
Oh? Could I possibly get some kind of pseudo example? Can't seem to find it on the developer-api page on github
Oh wait nevermind
Didn't see the singleton access one
Have a look here: https://github.com/AuraDevelopmentTeam/BungeeChat2/blob/master/src/main/java/dev/aura/bungeechat/hook/LuckPerms5Hook.java
@nocturne elbow
Thanks for your help and time
Is there an event that is triggered when player gets permission change?
Yeah looks like it,thanks
I am confused as to how to alter a user's groups from nodes. How would I check if a given node is of a group?
how i get the group prefix?
group.getCachedData().getMetaData(api.getContextManager().getQueryOptions(group)).getPrefix();; so?
I need help with creating my own context
Skills:
- message{cooldown=10;m="thx for helping me"}
@PlayersInRadius{r=7} ~onSpawn
does it works with Playernames too ??
@"Name"InRadius{r=7} ~onSpawn
Hello.
Is there any information how to use the new API?
I would like to set player rank with it. (One player one rank.)
You want to create your own ranks? If so, you don't need to use the api
I am confused as to how to alter a user's groups from nodes. How would I check if a given node is of a group?
@rose anchor I think you go into group.yml then check which nodes the groups has
I need a help. Please can you solve it?
(problems : version 1.7.10 , permission did working but prefix and suffix didn't working.)
Do you have a prefix and suffix plugin?
Luckperms does not include that
Try VaultChatFormatter also by Luck, but that didn't work for me. I had to use a different one.
how do i limit permission per world?
or would i need a bungee cord server to do that?
?
ahh
by using context
@past acorn @coral plover this is not the general support channel. As indicated by both the channel name and the channel description. Use #support-1
ok
OK I see.
huhu, can someine show me how to use a command and after the user types /accept secr3tw0rd he will get the <normal> userrole?
I don’t see how this relates to the LP API. Only the group assigning part
For that see !api
The other part goes in #general
!api
Learn how to use the LuckPerms API in your project.
Hey guys, can i post here for getting API Support or is this the wrong channel?
perfect, i want to listen on a Luckperms Event who called if i change/add a Parent for an User. But i dont know wich one is the best Event and i dont understand how to subscribe the listeners. this is my class to test this stuff:
TablistModule.instance().getEventBus().subscribe(NodeMutateEvent.class, this::onGroupChange);
TablistModule.instance().getEventBus().subscribe(UserDataRecalculateEvent.class, this::onGroupChange2);
TablistModule.instance().getEventBus().subscribe(UserTrackEvent.class, this::onGroupChange3);
TablistModule.instance().getEventBus().subscribe(UserFirstLoginEvent.class, this::onGroupChange4);
}
private void onGroupChange(NodeMutateEvent event) {
System.out.println("track");
}
private void onGroupChange2(UserDataRecalculateEvent event) {
System.out.println("track");
}
private void onGroupChange3(UserTrackEvent event) {
System.out.println("track");
}
private void onGroupChange4(UserFirstLoginEvent event) {
System.out.println("track");
}```
!api @fair barn
Learn how to use the LuckPerms API in your project.
!api @fair barn
@crystal sonnet Yes i read this, but it dont work for me ^^ this is the reason why i write in this channel 😄
Hey AconTM! Please don't tag staff members.
@frank drift it's for a good cause xD
@fair barn
and again, i read this page but it dont work for me (look at my code on my second message) ^^
I can't tell where you're getting the event bus from
keep in mind it has to be the LP event bus
And not the platform event bus
How can I get the playr prefix with luckperms api 5.0?
Get the node and then get the expiry
with node, you mean the Node class?
Yes
I need get the group prefix, can U help me? @crystal sonnet
Hey ֆкуℓєя ɮ๏у! Please don't tag staff members.
Sorry for the tag :/
I dont understand this
@steel edge first you have to get your group with the GroupManager from LuckPerms (getGroup method).
then you get your cachedData from the group with group.getCachedData();
then you can get the cachedMetaData with cachedData.getMetaData(QueryOptions.nonContextual());
finaly you can get the prefix by using cacheMetaData.getPrefix(); wich will return you a String with the Prefix auf the group you define on the beginning 🙂 I hope you understand my english and i hope helped you with my answer 😄
but get group with the getGroup method return null @fair barn
then you have the wrong Groupname ^^
it works perfectly for me 10 minutes ago
String prefix = "&7User";
Group group = luckPermsAPI.getGroupManager().getGroup(groupName);
if(group == null) {
return prefix;
}
CachedDataManager cachedData = group.getCachedData();
CachedMetaData cachedMetaData = cachedData.getMetaData(QueryOptions.nonContextual());
prefix = cachedMetaData.getPrefix();
return prefix;
}``` this is my method
And here you can see it InGame (it works for me ^^) https://i.imgur.com/Q06u31u.png
And how do you get the group? The method returns a null value to me.
String primaryGroup = user.getPrimaryGroup();
e.a
e.a
@steel edge what does this means?
Nothing, a confused face, I'm trying, thanks for the help ^^
ah, ok 😄 i dont know this "smiley" so i was confused ^^ if this is not worked for you, just wait for another helpfull guy who can help you 😄 i go offline for now ^^ have a nice evening (or what ever is at this moment in your timezone xD)
Ty ^^
How can I get the prefix of a user?
!api
Learn how to use the LuckPerms API in your project.
Wasn't it something like this: ```java
String cprefix = api.getUser(p.getUniqueId()).getCachedData().getMetaData(Contexts.global()).getPrefix();
String group = LuckPerms.getApi().getUser(p.getUniqueId()).getPrimaryGroup();
?
try it and see
how to set permissions in version 5? in version 4 user.setPermission(permNode); worked for me
Hey guys, wich event you would prefer to check if a players group changed by commands like /lp user <name> parent add/set <group> i try it with the NodeAddEvent wich is called on this command, but it doesnt have informations about the player
oh
can someone ban @spring estuary please
harassing me with alt accounts
@spring estuary what is wrong with you?
because you need to grow up
the hell is wrong with you?
what did I do to you?
lmfao
please stop pinging me and brigading my server/discord with alt accounts
oh wait there's no way you're capable of doing that because you have the maturity of a 10 year old
you literally pinged me here twice in the past 10 minutes
grow up and leave me alone
Make him stop pinging me from random channels then?
Which he is not
Take a look at the ExtraContexts plugin from Luck.
Ok
Anyone here a permission wiz? i am having trouble finding someone with any knowledge to help me learn ! I have setup permissions and the values change true/false no problem. It's the commands that are buggy....they work...but without tabcomplete...I have no other plugins on the test server aside from luckperms i was using to debug. It seems i can have the tabcomplete working if i am OP only.....However on a side note when changingworlds(PlayerChangeWorldEvent) i set permissions true/false also gamemode creative/survival.....when i go to creative permissions are true and i can use w/o tab complete...when i got to survival i can use tabcomplete but have no permissions ! also when first joining the server i do not have access to tab complete...i've been reading code/tuts/spigot forums/bukkit forums/java docs...u name it i think i have probably seen it google is nothing but purple links lol
I feel like theres an easy fix in the handlerList or somewhere along the lines of the WorldChangeEvent....or some code thats run just after we switch perms/worlds therefore it doesn't register tabcomplete until we switch again, as if i op via console and deop in game i can still see commands but not use them....I really need some help here guys! a nudge in the right direction would be awsome I'm stuck and feeling like i have no where else to look. all i really need todo is establish the connection with tabComplete to "refresh" it...i have the logic just no know how of implementation...
Vault doesn't support the concept of weights afaik
Hello.
Is it just me or is the web-editor not working?
I hasn't been working for me for a while
For me it's working
Does anybody know why .getUserManager().saveUser(user); doesn't actually save the user?
For me, it always comes up with the same area
@next moth if you want to debug perms, try /lp verbose on to log all permission calls.
Perms are not the issue, only tabcompletion is the issue...
@void flume do you mean error?
If so what error?
Also wrong Chanel ask in #support-1
How do I add a permission to a user?
Updating an old codebase. I was using user.setPermission(Node)
Docs have a TODO https://f.jacob.engineer/iXIerj.png
Gimme a ping if anyone sees it. I'm heading off to do some other stuff.
I'm having issues, I initially set permissions in my plugin, and have tried luckperms and pex to ensure it wasn't my code. I then debugged and pulled everything apart and tried everything i could, and am now asking for help xD
This is hard to explain? as this is not suppose to happen from what i can understand, i'm going to try and explain it.
When i use a permission plugin, or i set a permission within my plugin I can use the commands as expected but NOT the tab complete. The name of the command is typed in red as if invalid, however it still works.
Now i have permission, but NOT the tabCompleter information i must manually type everything in. I want tabCompleter to send me the information like it does when i set myself, or another player as an OP.
If i TP to another server world, or if i /op and then /deop myself I now have the TabCompleter information and permissions, I would like to know how minecraft does this so i can mimic it without the need to TP to another world or /op then /deop myself, or another player i may not know who might find an exploit to this. Now knowing this is not intended behaviour I'm wondering if i've done something wrong can anyone take the time to skim my plugin, maybe test the code themselves and give feed back? server setting? ... Spigot's tabcomplete option is set to 0 i'm not an idiot, but thanks for thinking it 😜 Thanks for any help in the matter 🙂
@unreal mantle Hey is there a way to have different plugins on different worlds using MultiVerse?
Hey Evan! Please don't tag staff members.
@unreal mantle Hey is there a way to have different plugins on different worlds using MultiVerse?
@wooden pine Off topic
Hey TurboSlayer! Please don't tag staff members.
Ohh my bad
How is that off topic
im trying to set up different permissions for different worlds
!context
You can set a permission or group on a per-world/per-server basis, through what we call "contexts".
@wooden pine @grim cape Please do not tag me. This is not important and neither questions are related to this channel.
Sorry, i was quoting his message and it automatically had that in there. Promise I won't do it again.
Can I get some luv on my question? https://discordapp.com/channels/241667244927483904/420538367986499585/676697674795319315
Thanks
Hm do I need to inject my own permissibleBase to update permissions in runtime? or is that purely to implement the "*" wildcard token? I feel like thats why world change /op work as they naturally inject via Bukkit with no worries of the "final" variables.
So I tried to add the API to my plugin
but it just gave me an error that I can't figure out
Can anyone help me?
Can I just use lombok to generate an instance and call it that way?
?
post the error message
Syntax error, insert ";" to complete ConstructorDeclaration
Adds that error to my currently generated Lombok instance
not for luck perms
just as an instance
Syntax error on token ";", { expected after this token
That on the luckperms
Nevermind i was being an absolute spastic
I forgot it needed to be in a private boolean
reposting: Can I get some luv on my question? https://discordapp.com/channels/241667244927483904/420538367986499585/676697674795319315
Thanks
Okay, I think I got it. Will have to test first. It's in the docs but has a whole two sentences dedicated to it. I'd expand but I can't edit the wiki. https://f.jacob.engineer/lHpxLS.png
I was just looking through my chat with my dev to tell you, but looks like you found it
I remember him muttering about how it's added as a node and "is bad" haha
nbd
there is a repository for the wiki if you want to add a PR
https://github.com/LuckPerms/wiki
Mirror of https://github.com/lucko/LuckPerms/wiki. Contribute to LuckPerms/wiki development by creating an account on GitHub.
done thx
question, using the API to switch primary groups but it seems the prefixes lag behind/are cached for the previous group until i do /lp sync
but if I do it directly through /lp user foo parent switchprimarygroup bar prefixes also update immediately
using placeholders if that matters, tried with generic prefix placeholder and the direct ones from LuckPerms, not sure if it recreates them or something
is there maybe something else I need to save to make the prefixes take effect?
I guess I could request an update task to work around this for now, just not sure if im missing something
For using the API, I was wondering how one could retrieve a list of all user permissions which the user possesses specifically, not those from any group or inheritance.
@EventHandler
public void onInventoryClick(final InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
ClassName user = ClassName.getUser(player);```
does anyone know what class has a method getUser?
WHat do you want to get anyways?
the user
Do you want to get permissions?
Here are a few examples of the API usage
https://github.com/lucko/LuckPerms/wiki/Developer-API
net.luckperms.api I think
Hello, i have 2 questions.
- how i can change the group of player with API ? Currently i have tried (but its not work) :
final User user = luckPermsApi.getUserManager().loadUser(targetUniqueId, account.get().getName()).join();
user.auditTemporaryNodes();
user.transientData().add(InheritanceNode.builder(group).build());
luckPermsApi.getUserManager().saveUser(user);
luckPermsApi.getUserManager().cleanupUser(user);
- with
commodorewe could overwrite minecraft command suggestion, or i need lock ther commands with permission ?
Thanks.
does anyone know a sound SQL query to fetch the group with the highest weight of a player
@dim thunder yes. There's a user/player table
And the primary group there is the one with the heighest weight
(Unless you change how the primary group is calculated)
But in most cases, that's the group you want to have anyways
k tyty
I need Help!!
My english is not the best, but i try my best
So today ive put The Luckperms Plugin on my Server and then ive informed all the Staff that i changed from Pex to LP
then one of my staff said it was easy to hack
that means, someone could hack luckperms.* and he could have acces to the web interface
and then destroy everything
I said, i beleave in Luckperms that it is an Safe plugin but she doesn't think so
can you say me, if it is possible to hack that plugin??
or is this safe
and an Reason why it is Safe
@nocturne elbow ask in #support-1
How do you get a prefix from the API? I havent updated luckperms until today, and a plugin I made isnt working due to the new API updates.
How can I check if player has a certain group with Player#hasPermission?
group.identifier doesn't work and so doesn't using UserManager#getPrimaryGroup().
Doesn’t work means what exactly?
Always true, always false?
Are you using the native player object or LPs one?
It doesn't really check at all? I tried this: user.getUser(player.getUniqueId()).setPrimaryGroup("name");
and this: event.getPlayer().hasPermission("group.name");
For example I did this:
and instead of checking and executing the command only if the player doesn't have the rank
i get spammed instead
This is without the LuckPerms API.
I will try with and give you output
I'll try this:
actually this should work well
Nope, spams and doesn't give me the rank.
Igrač == default
@visual wadi I think your check is wrong
If the user doesn’t have one of those 3 groups the check succeeds
yeah it should succeed but it shouldn't spam
but this should work
and it doesn't set the primary group and just spams the message
seems that check if player has the default group works tho
found the problem, I can't seem to get user.getUser(player.getUniqueId()).setPrimaryGroup("neutral"); to work.
with Bukkit#dispatchCommand it works perfectly
That’s because setting the primary group is not the same as setting/adding a group
fixed it
Setting the primary group only selects which one of the groups is the primary one
It doesn’t change the groups the player actually has
To see how to do that, check this:
!api
Learn how to use the LuckPerms API in your project.
Learn how to use the LuckPerms API in your project.
This is an example function you can add to your code @visual wadi
ok
Hello I am currently working on a spigot plugin for my server and I am wondering how I could get the group the person is in
!api
Learn how to use the LuckPerms API in your project.
Is there an equivilent of this method https://github.com/lucko/LuckPerms/blob/v4/api/src/main/java/me/lucko/luckperms/api/Node.java#L208 in 5.X api?
yeah
use getContexts and then this method
cheers ❤️
How do you get the prefix of a group from a groupname?
Well for those of you that remember my issues with tab completer not resetting until WorldChange or (/op, /deop) commands.......All i needed to know was ...
player.updateCommands !!!
Holy how stupidly easy the fix was, i was into NMS to complete my task...which i accomplished with pages of java and the TabComplete Packet ... compared to one line of bukkit api... 🤦♂️
ah yes :p
I might be about to do something really smart or really dumb in a fork... only one way to find out...
So I'm intimately familiar with Minecraft Permissions... And I hate discord permission management, twitch bot permission management, or really, any sort of permission management anywhere else...
What if LuckPerms was standalone?
would be quite easily doable
Yeah I've already checked out the structure
most of it is standalone already soo ye
(I've also been writing tests for brigadeer-ts)
Think compiling it to JS would be kind of insane though, so going to NOT do that.
and instead try to wrap it in a web service
brigadier rather
Yeah, I've seen the implementation of Luck Perms, think I'd rather not port all that effort to JS, just yet,
not to mention jdbc drivers etc
haha yeah that sounds like a lot of work :p
you'd be better off just creating something new
You'd be surprised, the end result of luckperms has been built on 10 years of iteration, from various developers
don't sell yourself short
that's true
by all means use the concepts / patterns etc
I'm just saying a full 1:1 port in a different language is probably not a good idea
got a preferred micro/small web server / network protocol?
(just in case it eventuates, / is any good)
I'd be tempted by protobuf / websockets / rest/json
To start with I expect I'm only making a way to query per user/context
so that way I can just firewall it / not care about auth
yep
cache, unless redis invalidates it, or timer
Does LP use redis much? other then pub/sub notifications?
nope, just for pub/sub
Is there any way to grab a group prefix from just a groupname?
after I updated lp, I had to update the api
and yeah
its kinda broken now
So i query string names of users whos groups should be updated from mysql db.
Than convert the string to optional player object, check if the player is online and convert it futher to normal sponge player.
Than i call the LP method, which should update the user group.
User load_user = api.getUserManager().getUser(player.getUniqueId()); line crashes the server.
Can someone expain what im doing wrong ? Сouse im realy pepeg at java.
Main
LP method
We need to know the error message
java.lang.NoClassDefFoundError: net/luckperms/api/node/Node
@oak ingot
Make sure you're using LP5
And that you're not shading in the API
and what does "shading in the API" mean ?
You're not doing it, so you're fine
It means copying the class files of the API into your jar
so whats my issue then
LuckPerms-Sponge-5.0.39
its a test one, but the same version is on my main vds server aswell
That seems very old
Make sure you use a more up to date one
And be sure to not contruct your LP class before the pre init phase
well
!downloads
You can download LuckPerms for Spigot/Paper, BungeeCord, Sponge, Nukkit or Velocity.
and then scheduler from the screenshot is at GameStartedServerEvent, so it should be fine on that part
its inside the scheduler
You're not initializing an instance anyways
Can you post the code of your main plugin class?
yeah, sorry sir i was retarded
i've had it
but before the initialization, just in the main class
works now
i mean, initialization was before the server start, and that was the crash
thank you
And one more question. So i've done this
Get the old node (if it exists) get the remaining time and your time into it
*onto
k, thank you again sir
Be sure to remove the old node and add the new node
got you
i've got some issues with the luckperms api. i'm not sure if i'm reading the usage wrong, but it seems to me that the usage page is outdated. i have since deleted the plugin project out of pure spite, but shortly: i was trying to make a chat plugin where you could speak like in real life, default chance was 15 blocks, you could yell, whisper etc. etc. but i ran into a problem
when trying to put prefixes and suffixes into the mix, the api didnt work. it just gave me errors
@placid jay yeah thanks just totally skip over mine lmAo
😄 sorry
it's ait
Hi, I have a problem. How can I add permissions per world with the new editor? Please, help me as soon as possible
@ember fulcrum is this regarding the api?
idk xd
Then don’t post here
it just gave me errors
@nocturne elbow use it properly then
I mean that's about as helpful as I can get with that detailed error description
@crystal sonnet yeah well hard to use it properly when u can’t even use the fucking functions mate
Hey Strobe! Please don't tag staff members.
As I said that's the best advice I can give you as long you don't provide your error messages
It was meant as a humerous attempt at pointing out that you haven't provided nearly enough information to be able to help you
@nocturne elbow
Mhm. I’ll try recoding it
ok
Hello how can I p.getDisplayName with the rank ?
how does one query remaining time for user on node.expiry ? Сouse if i get it right, node.getExpiry is not what i need.
Check the javadocs, but, that's probably the time it expires
Which, simple maths from that point
I need like an actual example, couse i dont know the structure, and i cant find it anywhere. Like how do i call it? do i do it from api. or user. or node. If i call it from the node, how do i get the user, or other way, or both.
If you can't do it with that, then you shouldn't be programming plugins @oak ingot
Learn the Java basics
well im forced to write connection plugin, because i cant just modify the db value, which i would've like to do. and i did manage to get the rest together. and im pretty sure i can finish the last part if you just give me an example 😕
God imagine being like that. All i ask for is a simple, well simple for you line of code, which would save me 10 hours of just trying different stuff. Like i've even specified, that i need from it. But all i get is -"ugh you shouldnt be programming, its right there, how could you not see it ?". I came here to get help, and that kinda the point. To not know something. I just cant. Its like saying to a game newcomer, well you're bad at the game, so you shouldnt be playing. Sometimes you learn from practise. And maybe i could've understood how to call those methods correctly, but ehh. Let me be hard stuck trying to find whatever you're talking about. Please don't even become a teacher, you'd be a horrible one.
Please don't even become a teacher, you'd be a horrible one.
If you insits. I'd disagree and let me tell you why
My base philisophy is that I am here to help people help themselves
I am not here to help them
That is a huge difference
Now you may be asking why
The reason for that is quite simple: If I just tell you, you haven't learned anything (or hardly anything) so you'll just come back and ask again the next time.
Now if I refuse to give you the direct answer and make you work for it then you're forced to learn how to find that info yourself
In other words I am helping by the saying "Give a man a fish and you'll feed him for the day. Teach a man to fish and you'll feed him for a lifetime"
Now me saying you should learn Java basics first isn't me being some elitist asshole or something
That is me showing you the easier way. Because in this case you can learn to write plugins by constantly begging for help, struggling and struggling with no real idea on what you're even doing or you can learn Java (basics) first (which is a lot easier) and then making plugins suddenly is 1000 times easier
And regarding the latter case all you need to do to find the answer is think about it and look for the right things. You clearly know already about instances how to call methods, etc. Now you are looking for a call on how to get the remaining time from a node. Luck linked you the method declaration of exactly that method. Now you asked which class you need to call that on. And the answer is quite simple. Check the top of the file. It tells you right there for which class the method declaration is for.
So once you figured that one out by yourself you can do it again when somebody links you another file or go a step further and search for those files yourself
@oak ingot
Now my method may seem rude, inconsiderate or even bad to you. But in the long run you'll learn the most
ok so im trying to get luckperms to help my Minecraft server to get ranks ingame but me actually trying to get it like it wont work with me and it wont install or anything how can i fix this please help
@thorny echo
Hey Nightz! Please don't tag staff members.
Are making a plugin that uses the LP API? @bold moth
Hello, I'm trying to use Commodore https://github.com/lucko/commodore and I get a null pointer exception when using "CommodoreProvider.isSupported()". Extracting my jar shows that Commodore has been shaded properly and my imports have changed to match the shaded package. I'm not sure why I'm getting the NullPointerException. My only guess is that something from the Commodore library is not being referenced properly (e.g. the pointer is missing the object it's supposed to reference). However the stacktrace doesn't tell me what pointer exactly is null.
If it helps, I'm using 1.15.2 Paper
I'm also compiling against Graal 11.0.6.
➜ ~ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07)
OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing)
I'm also using the maven method if importing Commodore. I pulled the information from how to include Commodore from the repo's ReadMe (https://github.com/lucko/commodore/blob/8c9d0d452d42a66256faf5293eaa9bc858eeff7f/README.md).
Nevermind, it turns out to have nothing to do with "CommodoreProvider.isSupported()" and has everything to do with lines such as "commandHealth.setExecutor(new Health());". I suspect it might be because I put "public static void registerCompletions(Main main, Commodore commodore, PluginCommand command) { ... }" in the commands' classes. I'm going to play around with that code and see if it starts working. I may have to create a separate package for commodore's registration of commands as opposed to putting the registration functions in the commands' classes.
omg, I may be an idiot. I forgot to rename the command from breakhealth to health in plugin.yml. I'm going to see if renaming it fixes the problem. This is not a problem with Commodore like I thought it was. 🤦♀️
Yep, I'm an idiot. For those interested, I figured out how to make the health bar disappear completely in survival by running "player.setAbsorptionAmount(Double.MAX_VALUE);" You can then fix it by resetting absorption back to 0.
follow-up from what i asked in #support-1; so as for implementing hasPermission so that it's backed by a luckperms group, the best way i can think of right now is doing LuckPerms -> getGroupManager() -> getGroup(@NonNull String name) -> getNodes(), and then for each Node, check that it is a permission node, and get the value if so.
just wondering if this is the best way to approach this, or if there is a more direct / efficient way of doing this (although I could also just cache this if necessary). i wanted to try doing this via vault at first but it seems the only method available for my use case with a custom CommandSender is http://milkbowl.github.io/VaultAPI/net/milkbowl/vault/permission/Permission.html#has(org.bukkit.command.CommandSender, java.lang.String) and it just checks Bukkit's hasPermission so I probably have to implement it anyways.
My recommendation would be that you give your command senders UUIDs and use the implementation used for players
@oak badger
Makes you compatible with most permissions plugins
i thought of that briefly but that seems like more of a hack, because this the command sender isn't a player
most of the player methods don't apply to this sender
unless a luckperms user doesn't need to be a player, is that possible here?
looks like UserManager has some methods for managing users, but how would i add the custom user to luckperms since it isn't an existing player?
So, here's a question that's actually related to Commodore. How do I remove the player's ign from tab completion unless I specifically want it in their. I'm looking at LuckPerm's Commodore file to try to figure this out, but have not been successful yet (https://github.com/lucko/LuckPerms/blob/master/bukkit/src/main/resources/luckperms.commodore).
I'm getting a null pointer exception when trying to get a Set of the loaded groups, I get like 20 errors when typing out my command so I know it has to to with my onTabComplete
Well you’re supposed to return an empty list and not null if there’s no suggestions
the return type for the method signature needs to be List<String>
you have it as Iterable<String>
wow im blind not sure how that got there
probably just a dumb auto-suggestion from intellij
exactly
😄
hm, yeah, that's strange
thanks it didn't like the return null; i changed it to an empty list :P
I'm wanting to get help with the Commodore API that Lucko has provided. Where would I be able to get help with that? Thanks
Here. Though not many know how to use it
So, looking at LuckPerms' source, I found resolving vanilla selectors, but I still have no idea how to remove displaying the player's ign from tab completion.
So you might wait a little for an answer
me? @crystal sonnet
Hey Alexis.Evelyn! Please don't tag staff members.
Yes
okay, thanks
i tried using commodore at one point but gave up because of https://github.com/lucko/commodore/issues/2
but when it was working, it worked well
pretty sure that issue is fixed now
Alexis, you also need to implement & provide the bukkit tab completion interface for your arguments
oh i see it's been a while... last time i used it was 1.3
it's on 1.7 now 😉
yeah i saw that XD
by the way, any advice on adding a user to luckperms which is not a player? brainstone suggested that earlier but i don't see in the api that there is anything for adding a new user
new users are created on demand
ah so then just loadUser would work?
yep
ah ok that could probably be more clear on the doc, since it just says Loads a user from the plugin's storage provider into memory.
made me think the user had to already have been created XD
sorry for the dumb question then
at this point though i'm fairly certain my idea is going to work then, and getting a custom command sender to handle perms via luckperms user is probably going to be better than by group directly
i think that will be a bit more flexible
i'll also check out commodore again soon then and see if i encounter that issue again -- will reply on github when i get around to it if it's working for me now 😛
i'm honestly so glad that exists because i was about to try implementing brigadier from scratch, but found that
haha well yea
people seem to really struggle using it in general
I think it's just because brigadier is confusing
and also because implementing tab complete even just in Bukkit can be tricky
makes sense to me
to be honest after reading the code for brigadier all i thought was, wow, this seems a bit complicated for how simple of a problem it tries to accomplish
i've also written a (quite nice) tab completer util which makes implementing the bukkit side easier
for example
otherwise you have to end up with loads of if statements
i ended up dropping brigadier after failing to have suggestions load with commodore because i just didn't feel like it was worth it enough
i just wanted the contextualized parameters with the custom coloring and such lol
also implementing it seems like a pain to debug
saw the commodore impl., you got a lot of nice recursive code to handle a lot of the stuff
Okay, so implementing the tab completion interface will remove the user's ign suggestions then?
if you implement that behaviour in your tab completer, yeah
okay, cool. I'll work on that now. Thanks
saw the commodore impl., you got a lot of nice recursive code to handle a lot of the stuff
hah I wouldn't say any of it is nice code, it's pretty horrible in a lot of places
by default spigot's tab completer returns player names if you return null
hah I wouldn't say any of it is nice code
well i commend you anyways for making it as clean as it is, mine would be worse lol
that actually explains a lot pop4959. I haven't implemented the completer at all and only have the .commodore files setup.
yeah spigot will just do that
honestly i'd rather have it reversed where spigot gives you a method of returning a set of players, but by default it is an empty set
Same
because i find myself having to return empty sets a lot lol
depends on the plugin though, i guess it could be a good default for some people, but it just seems kind of half baked to me
although it's probably already clear that spigot's impl of brigadier is extremely half baked, otherwise we wouldn't need to do anything ourselves or with commodore
well spigot just doesn't expose it
and have tried to keep the old api working with minimal effort
yeah and that's what sucks -- everyone would use this, just no one knows/cares enough
(sums up the state of bukkit/spigot's api development in general)
brigadier, at the end of the day, is pretty nice
i like how it works with vanilla commands a lot
One issue I have with bukkit is requiring both the plugin.yml and the command registry to have the command listed. I spent a good 2-3 hours debugging why my plugin threw a npe only to find I forgot to rename a command in plugin.yml. I now have a try/catch statement to make sure I don't have to spend that long again if I forget to rename/name a command in the yml.
eh im done bashing on spigot for now, but good chatting with you all. two good things out of this for me: 1) custom commandsender will probably work more or less painlessly using the luckperms api, and 2) commodore has gotten some updates. glad i figured all that out.
Good chatting! 🙂
honestly i would probably rather use vault or something instead but i don't think it'll work with the custom sender, as far as i can tell
plus that part is only for a personal use plugin so it won't be too bad if i'm stuck with using luckperms directly for it
ooo, Paper has an async tabcompleteevent. Since I'm developing for my Paper server, this looks interesting to look into. https://papermc.io/javadocs/paper/1.15/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.html
i may be missing something but is it not possible to get a uuid from a PermissionHolder
PermissionHolder could be a group or a user
figured
actually, is PlayerDataSaveEvent called whenever someone's groups are updated?
or does it wait a little bit to actually write the changes
depends on how they're updated
Basically called when ever something calls save on the data
commands, etc, do that immediatly
as for plugins using the API, they generally do it immediatly, but 🤷♂️
so at one point or another the data will be saved, got it
thanks
just needed a way to write the users groups to a database whenever they are modified
the thing toying with groups should generally be the thing to save it
lp user zbk parent add does not seem to be firing the event
or maybe im just registering it wrong
¯_(ツ)_/¯
PlayerDataSaveEvent refers to uuid/username data being written to the db
Not permissions
NodeMutateEvent is probably your best bet for catching that sort of thing
How can i get the Rank auf the Player with die LuckPerms API?
Help pls
Hey, I’ve been playing a lot of beta 1.7.3 lately, and I’ve used luckperms for modern versions to great success. How hard do you think it would be for someone to backport it/how portable is the code? I ask because I might end up attempting to do just that.
hey, i have the problem that i automatically create a server for each player and so i can't define the server name in the config, is there something like an onPermissionRequest event at the api to modify this?
@last mortar just try the legacy version
And it should be pretty portable
@mortal wyvern use the primary group
uh, if I try to set the PrimaryGroup of a player nothing happens with the player
LuckPermsProvider.get().getUserManager().saveUser(LuckPermsProvider.get().getUserManager().getUser(target.getName())); ```
The plugin gives no error back .-.
@unkempt oar you can make an addon that adds custom contexts
@dense shale setting the primary group only selects which of the assigned groups is the primary one
I does not add or remove groups assigned to the player
how can i create a Dynamic contexts
Learn how to use the LuckPerms API in your project.
@unkempt oar check the docs. Also you can have a look at the Plugin ExtraContexts for an example implementation
thanks
You’re welcome
Sorry if I'm dumb but how can I add a group to a player? .-.
!api
Learn how to use the LuckPerms API in your project.
uh, still haven't found it in https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage .-.
Where is it exactly? .-.
You would need to get the prefixes manually if you wanted them
For adding a group to a user, you'd create a group node with the factory and give it to them
Hi, just want to be able to check if a user has a permission within a Bungee Plugin.
The GitHub says ```public boolean hasPermission(User user, String permission) {
ContextManager contextManager = api.getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
//PermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
//return permissionData.getPermissionValue(permission).asBoolean();
//Although these two lines don't work, I assume they're meant to be:
CachedPermissionData permissionData = user.getCachedData().getPermissionData(QueryOptions.contextual(contextSet));
return permissionData.checkPermission(permission).asBoolean();
}
public User loadUser(Player player) {
// assert that the player is online
if (!player.isOnline()) {
throw new IllegalStateException("Player is offline");
}
return luckPerms.getUserManager().getUser(player.getUniqueId());
}
(The player will be online if it is called),
Not sure whether I need to run either of these async. Could someone let me know please? 😄
Ah okay. I'm just not sure whether or not that method needs to be called Async.
If anyone could lmk that'd be super useful, tag me if you can please
How do I give someone an rank?
Learn how to use the LuckPerms API in your project.
@nocturne elbow just use the bungee permissions check
much easier
@nocturne elbow @dense shale you give them a group node
*Inheritance Node
Would that work if I'm checking for spigot nodes? @crystal sonnet
Hey .Joe! Please don't tag staff members.
Oh! Sorry
Ty, wasn't sure if bungee and spigot permissions were linked
Just assumed they weren't
There is no difference
Or can you tell if this permission is a bungee or spigot permission: invsync.sync.health
@nocturne elbow
No I get you, I mean I didn't know if like ProxiedPlayer.hasPermission(permission) would return the same as Player.hasPermission(permission)
As you need to use luckperms bungee to give bungee perms - you can't use luckperms spigot to give bungee perms (or that's my understanding?), so I figured they must be separate things
anyone knows how I can add an default rank so people who joins get get that rank instant
@nocturne elbow wrong channel; ask in #support-1
oh okat
@nocturne elbow there are different jars, because permissions are not a vanilla MC concept
Meaning it's nothing that gets communicated between Spigot and Bungee
The permissions are synced when you use the same database for all instances
Ahhh brilliant okay! Thank you for your help, wish I'd of looked into permissions first now instead of assuming 🙄, wasted everyone's time!
How do I load Luckperms API on Velocity? If my plugin starts before Luckperms I won't be able to register / get the Luckperms api on startup.
Have it start after LP
How dat? Or is this the wrong place to ask for that
Declare LP as an optional dependency of your Plugin
👍🏼
has the context plugin to be on all servers or only on the testserver?
It has to be on all servers you want the context to be apllicable to
The context can only appear when the plugin is present
But unknown contexts don't break anything
@unkempt oar
okay, thanks
I so badly wished works app used a permissions API similar to luck perms
It's a gross mess
uhm..
help?
java.lang.IllegalArgumentException: Attempting to build non-permission node with PermissionNode.Builder. permission = 'group.owner', correct builder type = me.lucko.luckperms.common.node.types.Inheritance$Builder
You're tryna create a permission node for a group
oh thank you 😅
LuckPermsProvider.get().getUserManager().getUser(p.getUniqueId()).getPrimaryGroup().equals("Owner");
ist that right?
i only want to check if the Player has the Rank Owner
!api
Learn how to use the LuckPerms API in your project.
LuckPerms is with Perms? group.Owner also???
Sry i am from Germany xD
There are examples right on the page
Yeah
everything is a node
That works
Meaning that as a side-effect of that design choice, ^
I am making a prisons server and i was wondering how i would add a permsion / group to a users when they run the /rankup (my custom command not from ezrank or what ever its called)
how do I check if an offline player has a permission
OfflinePlayer#hasPermission doesnt exist and this is what the wiki says
luckperms cant get the offline player either
You need to first load the offline player's permission data using the UserManager#loadUser method
@upper linden (just incase you still need it)
If the vault API is working for you, you should be fine without the LP API then
hiya would i be able to talk to a member of staff, i have quite a few questions about the plugin :)
in general, how am I suppose to check the permissions of an offline player? or is that not something im suppose to do
the link ryanjh sent has the api on how to do it, but i just read another post regarding the luckperms api that it loads the user onto the servers main thread and it kills performance
ping when u answer pls
I don’t know where you read that but that’s plain wrong @upper linden
Also have a look here
!api
Learn how to use the LuckPerms API in your project.
@tidal scaffold
- just ask. Here are plenty of people that can help you. Not just staff.
- if you’d have asked your questions straight away I could’ve answered them now instead of asking you for what you actually want
- if you have questions about using the plugin and not about using the LP API so you can integrate your own plugin with it, the right channel is #support-1
Caused by: java.lang.RuntimeException: The operation to load user data for '23f54e58-e82c-4b33-bbb1-c9a2c4bb237b' was cancelled by LuckPerms. This is NOT a bug.
The lookup request was made on the main server thread. It is not safe to execute a request to
load data for offline players from the database in this context.
If you are a plugin author, please consider making your request asynchronously.
Alternatively, server admins can disable this catch by setting 'vault-unsafe-lookups' to true
in the LP config, but should consider the consequences (lag) before doing so.
^ my error when checking the offline player
do it async, basically
Well LP is doing it one the main thread if you're calling it on the main thread...
Or well by default LP refuses to
I used ```java
LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId()).data().add(Node.builder("group.prayer").build());
If you still need help, be sure to save changes using:
LuckPermsProvider.get().getUserManager().saveUser(user);
@visual wadi
Thank you. I thought it automatically saved.
LuckPermsProvider.get().getUserManager().saveUser((User) event.getPlayer()); is this fine?
It needs to be a luckperms User object rather than a Player object, so not really. When adding the permission above, you should store the user so you can use it for the save method
User user = LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId());
user.data().add(Node.builder("group.prayer").build());
LuckPermsProvider.get().getUserManager().saveUser(user);```
Something like that would probably be best
Thank you.
no problem
Whoops, I forgot about that myself
No problemo
Any reason why lp is setting my perm to have two .'s
if (player.hasPermission("apollonetworks.jointitle.default")) {
like my plugin is set to that perm.
But ingame its registering that there should be two dots in-between apllonetworks & jointitle
Have you registered it correctly in your plugin.yml?
If you registered it in your plugin.yml, unregister it and try Bukkit.getPluginManager.addPermission(new Permission("apollonetworks.jointitle.default"));
How can i give a player a group by enter a command?
@nocturne elbow what code do you have already?
How should I set luckperms for bungeecord?
@nocturne elbow this is the channel for plugin developers using the LP API
LP support is provided in #support-1
so if someone is in a rank like owner and u want there tag to be OWNER panda4121 not panda4121 like the thing on top of there head
@crystal sonnet
Server.getInstance().dispatchCommand((CommandSender) Server.getInstance().getConsoleSender(), "lp user " + p.getName() + " parent set booster");
Hey Florian! Please don't tag staff members.
sry
That's not really how you should set ranks.
I mean that looks like it would work
Not the ideal way but it should work
Have a look at this
!api
Learn how to use the LuckPerms API in your project.
Hi i need help with Info/option nodes
How I can use LP where get/setPlayerInfoString is used? I need it to Towny plugin.
I try it with /lp user pvvvo meta set towny_default_modes local but it doesn't work, (It should put me in towny local chat for default)
how do i make it so when someone joins they get that role in my server
Mal eine Frage, gibts für LuckPerms ein Event (ChaningGroupEvent, oder so, ihr wisst was ich mein)? Wenn ja, wie heisst es?
NodeEvent @bronze loom
NodeAddEvent
Called when a node is added to a holder
NodeClearEvent
Called when a holder has their nodes cleared
NodeMutateEvent
Called when a node is added to/removed from a user/group
NodeRemoveEvent
Called when a node is removed from a holder
es gibt nur diese
@languid socket
A nodeevent is same as changingrankevents just check the api.
but witch one?
Hello i want to ask if i set permission to player with api and i have bungeecord. It sets global permission or local permission?
if you don't define a context, the permissions would be global
This will show you an example of creating a node which includes a context https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#creating-new-node-instances
Hey, so how do I get prefixes and suffixes? I'm following the dev API wiki page but MetaData doesn't seem to be something I can import
Therefore I can't do this bit
code so far: java @EventHandler public void onPlayerJoin(PlayerJoinEvent e){ Player p = e.getPlayer(); User user = this.lp.getUserManager().getUser(p.getUniqueId()); ContextManager manager = this.lp.getContextManager(); ImmutableContextSet set = manager.getContext(user).orElse(manager.getStaticContext()); QueryOptions queryOptions = manager.getQueryOptions(user).orElse(manager.getStaticQueryOptions()); //MetaData metaData = user.getCachedData().getMetaData(queryOptions); }
NVM
solved
You should update the docs to show you have to use CachedMetaData now tho
Is there an event for when a player's primary group changes? If so what is it, and if not how can I check for it?
Also, how do I get all users in a group without using a for loop for online and offline players and then checking if each one is in the group?
When using NodeMutateEvent(in my caseNodeAddEvent) does the getDataBefore() method return group permissions too or only personal permissions ?
Is there a way to search for a permission value from online players on 3 different servers through the API ?(The permissions are shared between the servers)
Alright ill give a full explantation of what I am doing and what I have tried
I am working on three servers strongly connected
I have a placeholder plugin that I need to say how many of a certain permission is online
Currently I am using redis to set variables of how many of each perm is online on the server, incrementing and decrementing it when people log in and log out
That worked okay.. until someone has permission changes on them while logged in, so I had to listen to those with the LuckPerms API
For furturer explaining, lets say I am listening on the permission vv.a
Started of only listening on when vv.a was removed and added and incremented and decremented accordingly - This worked okay, until a group with vv.a was added or removed from someone - So I added group checking too, going through all the permissions of the groups being added/removed.. this again works okay but now the problem comes with adding multiple groups with vv.a perm as it has already counted it once.. This is what I am working on atm - any suggestions to another approach is very welcome
So if it was possible to just search all three servers for the amout of people online with the permission then it would be a lot easier to create as I would only have to call that whenever the placeholder was requested
@crystal sonnet
Hey Rasmus! Please don't tag staff members.
sorry
Hey guys, I'm just trying to find the easiest way to add a permission to a user, and a way to remove it for a plugin I created. I'm only an intermediate java developer, and I'm reading this https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#modifying-usergroup-data -- Seems way too complicated. I was simply hoping for a LuckPerms.addPermission(UUID, "permission"); but it appears to be way more complicted then that
I see
DataMutateResult result = user.data().add(Node.builder("your.node.here").build());
But I'm not sure where user is coming from. I used a Player instance, but then it wants me to cast it as something else..
Oh I think I found it... standby
Okay so I found
public class UserPerm {
public UserPerm loadUser(Player player) {
// assert that the player is online
if (!player.isOnline()) {
throw new IllegalStateException("Player is offline");
}
return luckPerms.getUserManager().getUser(player.getUniqueId());
}
}
but luckPerms on the last line cannot be resolved
Lmao I think I'm just gonna do this Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "lp user " + user + " permission set perm.here true");
Is there a specific event for a user being added to a group (for the API)?
Like would be triggered by the command /lp user lazerpent parent set myGroup
Learn how to use the LuckPerms API in your project.
@warm ginkgo mabye GroupDataRecalculateEvent?
alright ty
I am using UserDataRecalculateEvent right now
but it triggers on every join, leave, ect
It really depends on the use case. The basic NodeAddEvent allows you to get the node which was added, and then you can check the node to see if it contains 'group.'. Since it extends the NodeMutateEvent, you could possible check whether the subject is a user quite easily
alright, im really new to luckperms api, so I don't know much of this
https://github.com/lucko/LuckPerms/blob/master/api/src/main/java/net/luckperms/api/event/node/NodeMutateEvent.java https://github.com/lucko/LuckPerms/blob/master/api/src/main/java/net/luckperms/api/event/node/NodeAddEvent.java
it's all good
so this event will trigger whenever a users parent group is changed?
@azure latch You stated "Why don't you read the documentation?" Did you happen to read what I said? I clearly state that I referenced the documentation, I clearly gave an example from the documentation. Maybe you should use your own eyes and take your own advice before telling others.
