#luckperms-api
1 messages · Page 40 of 1
As explained on the wiki it’s for all platforms
Btw what for do you need to iterate over the permissions?
just making a simple plugin that formats join/quit messages and check permissions for proper prefix and suffix formatting
something set by essentials i think
part of a cross-server chat plugin
Huh?
I'm sure such a thing already exists
so like when a player joins it says [Moderator] minecraftUserName
BungeeChat for example 😜 (which I made)
Those are prefixes
lol
nice
so I just need to check the permissions to get the right colors basically
The API has methods for getting prefixes and suffixes
that's just what i need
Hey!
I've been using the API for a bit, but never used the Event System which I am currently a bit stuck on.
I have read up on the Documentation Page (https://luckperms.net/wiki/Developer-API-Usage) on how to Subscribe to Events using the EventBus and basically replicated that Code in my Project.
Now whilst running a simple task of outputting a Message in Chat once the "UserLoadEvent" should be called, sadly nothing is happening.
In my Main Class I added this: new LuckPermsListener(this, LuckPermsProvider.get());
And my Listener Class looks somewhat (shortened out most of it) like this:
public class LuckPermsListener {
private Main main;
public LuckPermsListener(Main main, LuckPerms api){
this.main = main;
EventBus bus = api.getEventBus();
bus.subscribe(UserLoadEvent.class, this::onPlayerDatabaseLoad);
}
public void onPlayerDatabaseLoad(UserLoadEvent e) {
Bukkit.getScheduler().runTask(main, () -> {
Bukkit.broadcastMessage("UUID: " + e.getUser().getUniqueId());
});
}
That looks correct to me
any errors in console?
did you fully restart the server to load your plugin?
i wanted to set up luck perms
but when i type " lp editor "
it says plugin desabled
how do i enable it
!paste your latest.log
Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
@jaunty pecan Nope, no outputs in the Console. Also tried fully restarting the Server and still nothing.
Some more Infos:
Minecraft Version: 1.16.4
LuckPerms Version: 5.2.67
API-Version: 5.2
Hey Stunter! Please don't tag helpful/staff members directly.
Hello
https://sourceb.in/cLLAIaIXd5 I have this code
the server provider that is in there is from the luckperms website and I do not know how to access it since the website isn't as helpful like Vault's..anybody can give a hand?
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
or type provider. then look at the suggestions
Hey, i was trying to find a way on how to get the permission expiry time from a player's node from the LuckPerms API. I tried different ways but none of them work. and I also searched a lot in the #Developer_API wiki but I couldn't find an example similar to it could be great if somebody knows how. and share it, it will save me time. Thanks
sorry for the bad english.
How are you trying to do it currently?
Aah you see, parent group nodes are not permission nodes, they are inheritance nodes (of type INHERITANCE), so getNodes(NodeType.PERMISSION) will never give you parent group nodes :d
alright, i'm going to try that out
And you'd filter if the group name isn't member
Yeah, InheritanceNodes contain the group name
I may be tried but I fail to give myself a parent. I'm doing lpUser.data().add(linkedNode); where linkedNode is InheritanceNode.builder("linked").build(); and linked is the name of a group in LuckPerms. Am I doing it wrong?
I'm a little confused about how the server vs world context works
I'm using the following code to send the user their CachedPermissionData and their contexts when they type a command
public void execute(CommandSender sender, String[] args) {
if (sender instanceof ProxiedPlayer) {
sender.sendMessage(new TextComponent("You have these permissions:"));
for (String perm : sender.getPermissions())
sender.sendMessage(new TextComponent(ChatColor.GOLD + perm));
LuckPerms api = LuckPermsProvider.get();
User user = api.getPlayerAdapter(ProxiedPlayer.class).getUser((ProxiedPlayer) sender);
CachedPermissionData data = user.getCachedData().getPermissionData();
for (Map.Entry<String, Boolean> entry: data.getPermissionMap().entrySet()) {
sender.sendMessage(new TextComponent(ChatColor.GOLD + entry.getKey() + ChatColor.RESET + ": " + ChatColor.GREEN + entry.getValue()));
}
ImmutableContextSet ctxSet = api.getContextManager().getContext(sender);
QueryOptions queryOptions = api.getContextManager().getQueryOptions(sender);
sender.sendMessage(new TextComponent(ChatColor.RED + "Context set:"));
for (Context ctx: ctxSet) {
sender.sendMessage(new TextComponent(ChatColor.GOLD + ctx.getKey() + ChatColor.RESET + ": " + ChatColor.GREEN + ctx.getValue()));
}
}
my server admin has a bunch of permissions for my user set with context server: creative or server:survival
nothing is set by world. But when that Context ctx: ctxSet loop runs, it tells me the server is bungee and the world is the servername
i'm trying to figure out why the context is always bungee for server
In bungeecord yea, server is bungee, and world is your servername
i'm expecting it to be survival or creative
yikes. so i need my admin to redo all the permissions?
I have server: survival in the luckperms config.yml for the spigot server
so server is always gonna be bungee?
that's hard to believe because the permissions work correctly on his server using server: survival and server:creative when running under bungee
the docs also show the example "world: world_nether". It seems odd that world would represent a spigot server under bungee since those spigot servers could have multiple worlds too
config.yml
# The name of the server, used for server specific permissions.
#
# - When set to "global" this setting is effectively ignored.
# - In all other cases, the value here is added to all players in a "server" context.
# - See: https://github.com/lucko/LuckPerms/wiki/Context
server: creative
it should be the server context as far as what this says, not world. is there anyway i can make it show the spigot servers as servers rather than worlds
Not on bungee LP
The "server" setting refers to the LP instance rather than a "server"
I see
There is an open issue about that
I just don't understand how it works on on our production server since our admin has all the permissions set as server: creative, server: survival etc.
yet when i do it on my test server using the above code i get get world:survival so there is no way i can get the correct permissions
unless we redo all the contexts
as far as i can tell we have the same setup
i wonder if i can force change the player's context somehow
when players login
Everywhere, "server" refers to the specific LP instance, on the survival server it'll always be "survival", on bungee it'll always be "bungee". The "world" context however refers to "where the player is in", in Bukkit that is the actual world and on bungee that is the server name they are in
Yeah nah
Contexts are more like a "state" that LP "observes"
Say for example you wanted to give Bungee LiteBans' perms while you were in the creative server only, you would grant them for server=bungee and world=creative
That's what I figured. But my server admin has the permissions set up as server: creative, server: survival and somehow they work
Not sure how
So you say that I cannot force change the player's context. But could I calculate and somehow return a list of what permissions they would have under a certain context?
like calculate all the permissions they would have if they were under context server: survival even if their current active contexts are server: bungee and world: survival
that would solve my problem
A bump for this if possible 
When you say "In my Main Class I added this new LuckPermsListener(this, LuckPermsProvider.get());" where is that exactly? In your onEnable?
Yeah, basically where I register all the Listeners
Thank you for your help even if it's simple. ❤️
it's fixed
@honest anvil can you verify that the code is actually being called?
How can I find out when a player's permission expires?
Okay sooo
I can confirm that the code is being called.
I tried usig /lp networksync to see if that does something, and well, I can confirm that it actually subscribes to the Event!
https://i.imgur.com/7WU0IsG.png
It does not work if the Player joins the Server, or the Plugin gets reloaded though 
Very interesting. That looks like a bug then. I'd recommend you report it on GitHub with all your findings
@honest anvil
Alrighty, will do!
<groupId>me.lucko.luckperms</groupId>
<artifactId>luckperms-api</artifactId>
<version>5.2.35</version>
</dependency>``` Why maven doesn't find the version 5.2.35 ?
!api
Learn how to use the LuckPerms API in your project.
First link
Hey, for some odd reason I can't seem to be able to get the api on bungee, anybody may have any idea why?
Currently I'm trying to get the api using LuckPermsProvider.get();
do you get an error?
Did you add the api?
Yes, this is the error I'm getting
java.lang.IllegalStateException: The LuckPerms API is not loaded.
at net.luckperms.api.LuckPermsProvider.get(LuckPermsProvider.java:50) ~[?:?]
at me.yarinlevi.parlabungeegroups.ParlaBungeeGroups.onEnable(ParlaBungeeGroups.java:56) ~[?:?]
at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:300) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:1d2221d:384]
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:289) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:1d2221d:384]
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:1d2221d:384]
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15) ~[Waterfall.jar:git:Waterfall-Bootstrap:1.16-R0.4-SNAPSHOT:1d2221d:384]
Show full code
did you add depends: [LuckPerms] to your bungee plugin yml
if (getProxy().getPluginManager().getPlugin("LuckPerms") != null) {
luckPerms = LuckPermsProvider.get();
isLuckPerms = true;
commandSender.sendMessage(Utils.newTextComponent("&fHooked into LuckPerms!"));
} else {
isLuckPerms = false;
}
Yea, ofc.
That isn't the full code
The rest of it is something else, that is a piece of code from Main
Is that the only place you're calling LuckPermsProvider.get()?
Yea
onEnable()
How are you managing your dependencies?
Maven
Could you share your pom please? https://paste.helpch.at/
Aah there it is
You are shading the API into your plugin
Add <scope>provided</scope> to the LP dependency
how do you add/remove a permission from a User?
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
ty
Can I promote/demote users using the api?
Yes
Is that another node I would have to add? I couldn't find any examples.
According to a github issue it's pretty complicated. Is it still the case?
it's like 3 years ago. maybe something has happened? 🙂
Something did happen!
Thank you! ❤️
how can I get a list of all groups a user is member of?
Well, parent groups are nothing more than an InheritanceNode
So you're looking for UserManager#searchAll(NodeMatcher) https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/model/user/UserManager.html#searchAll-net.luckperms.api.node.matcher.NodeMatcher-, you have to build the InheritanceNode for the group you want, put it in a NodeMatcher and use that method
And if I only want the highest group in each track?
last one
TrackManager#getTrack(String) and then get the last group from Track#getGroups
permissions -> permissions.equals("system.givepremium.lock"))
.forEach(permissions -> System.out.println(permissions.getExpiry().getDate()));```
Is there a mistake?
Yes. the permissions are a permission node, not a string. So the .equals will always return false
What else should I use?
Look at the suggestions your IDE gives you when you try to call a method on the permission variable
!api
Learn how to use the LuckPerms API in your project.
I've been reading the docs for hours and I can see how to query permissions for an active context, but what I actually need to do is, if the context is world: survival, then I want to take that word "survival" and somehow query what permissions the player WOULD have if they were currently under a context of server: survival, even if they are not currently under that context. I have no clue how to do that from anything I'm reading, and I'm not sure I understand what query options even are.
or how i actually use them to find a permission based on a theoretical context that may not be active, but definitely has permissions defined. like how my admin has server: survival defined as a context for like a hundred permissions but I can't query them because they show up wrong when I check the user's permissions and contexts
I need to get the displayname.{somewildcard} that they would have if they were under a server: survival context
example: I am a Moderator and i have the permission displayname.Moderator. I am using the "Moderator" part in messages sent as chat messages to proxied players, and I need to be able to obtain whatever is after the "displayname." and I need to be able to obtain this from the context it is defined under regardless of what server that user is on or what the active context is because the active context is never set correct thanks to the spigot servers being world contexts and our permissions being defined as server contexts. so I can't seem to obtain the displayname by any method i've tried with the API so far
well I figured it out mostly, but I'm just trying to figure out how to get the right display name because now i get all the displaynames for all groups inherited from
lol
LuckPerms api = LuckPermsProvider.get();
User user = api.getPlayerAdapter(ProxiedPlayer.class).getUser((ProxiedPlayer) sender);
String server = null;
// Loop through the active contexts to find the value for the key "world" if possible
for (Context ctx: api.getPlayerAdapter(ProxiedPlayer.class).getContext((ProxiedPlayer)sender)) {
if (ctx.getKey().equals("world")) {
server = ctx.getValue();
break;
}
}
// If world context is active
if (server != null) {
QueryOptions opts = QueryOptions.contextual(ImmutableContextSet.of("server", server));
CachedPermissionData data = user.getCachedData().getPermissionData(opts);
// Display all the permissions for key "server" with a value matching the "world" value
for (Map.Entry<String, Boolean> entry: data.getPermissionMap().entrySet()) {
sender.sendMessage(new TextComponent(entry.getKey() + ": " + entry.getValue()));
}
}
so I get the active context world: whatever and query permissions for server: whatever, but is there anyway to only get the permissions at the Moderator level? for example, right now I get displayname.B+, displayname.guest, displayname.B-, displayname.Moderator. I would like to only get the permissions at the highest level I guess, so i need only displayname.Moderator. Is this possible?
I tried using Flag.RESOLVE_INHERITANCE but that didn't do what I expected
sorry for text wall
I'm the admin @compact spruce mentioned. From what I can understand, that setup would not make sense. What's the point of doing a server: context if it's always going to be server: bungee? I have a BungeeCord setup with 3 servers: lobby, survival, creative. To give players specific permissions on the survival server, I add the server: survival context to the permissions. This works perfectly. Is this not the correct way to do it?
the only reason it can possibly work perfectly as I can see it is that Essentials must have some workaround because according to the developer, what you have setup should not work as there does not seem to be a way to programmatically obtain the information that Essentials must somehow be obtaining
or I'm unaware of how to obtain it
Idk man I didn't design this, but again:
Everywhere, "server" refers to the specific LP instance (where LP is running), on the survival server it'll always be "survival", on bungee it'll always be "bungee". The "world" context however refers to "where the player is in", in Bukkit that is the actual world and on bungee that is the server name they are in
It's not just Essentials; the permissions work perfectly with that setup for every plugin.
because when I obtain the active contexts using the API, i do not get the correct permissions
oh, I thought you were the developer lol my bad
Lol no
Maybe it's because Essentials and all our other plugin permissions are being checked on the local spigot server.
Exactly!!
it always shows me the context of world: survival when it should be server:survival
yeah probably.
so it seems like my solution is gonna have to be the one I originally had which was to send the permissions from the spigot servers to the bungee server with plugin messaging or something

Just get the ProxiedPlayer server name and put that as server context for the QueryOptions
Well yes no shit, that's how inheritances work
I don't need 10 displaynames, i need Moderator
Transitivity exists
ok, but that's not the point. the context is world: survival
From my (maybe incorrect) understanding, contexts are supposed to be used like this:
NO BUNGEE:
-world
-world_nether
-world_the_end```For this setup, I should add the context `world: world_the_end` to any permissions I want the player to have in The End.
BUNGEE:
```2 servers, 1 world each:
-creative (server name)
-world (world name)
survival (server name)
-world (world name)```For this setup, I should add the context `server: survival` to any permissions I want the player to have on the Survival server.
Maybe it's not correct, but it works. :/
If you're supposed to use world: <servername> then how do you specify a world context for that server?
Thing is
There are two separate, totally independent and unrelated "levels" of perm checks, the permission checks occurring on server level (EssentialsX, vanilla commands, Bukkit commands, WorldEdit, etc), for those the world context is the actual world you are in (end, nether, overworld) and the server context refers, again, to the specific LP instance based on the setting in config
And then there's bungee perm checks (LiteBans/AdvancedBans, bungee commands, etc), for those, the world context is which sub-server you are in, and the server context refers to, yet again, the running LP instance based on the setting in config
Basically:
Server context refers to what LP and where the permissions are being checked
World context refers to where the player is in, regardless of where LP is
There is an open issue to change that, let me find it rq
As for your actual displayname issue, you are getting all perms because permissions and inheritances are transitive, and since the nodes' keys themselves are different, you're gonna get all of them. If I'm not mistaken they should be sorted by how inheritances are resolved, so the first one in the resulting collection should be the one of the "closest" group (presumably direct parent group)
if they're sorted and that the defined behaviour then problem solved lol
i just take the first displayname i find
lol
perfect
I'd assume you're using the PermissionHolder#resolveInheritedNodes(QueryOptions) method?
// If world context is active
if (server != null) {
QueryOptions opts = QueryOptions.contextual(ImmutableContextSet.of("server", server), new HashSet<Flag>() {
{
addAll(Arrays.asList(Flag.values()));
}
});
CachedPermissionData data = user.getCachedData().getPermissionData(opts);
// Display all the permissions for key "server" with a value matching the "world" value
for (Map.Entry<String, Boolean> entry: data.getPermissionMap().entrySet()) {
sender.sendMessage(new TextComponent(entry.getKey() + ": " + entry.getValue()));
}
}
when I added only the RESOLVE_INHERITANCE flag, it gave me only the bungeecord.whatever permissions
or possibly none, i can't remember
but when i use either all the Flags or none of the Flags i get the full permissions list for server: <servername>
<servername> being a value i obtained from the world context that is currently active
I'm doing that specifically because @high tiger has the permissions configured with the server context not the world context
so with the code there, I get a list of all the correct permissions but like i said, multiple display names
and I know that I am part of the moderator group, so i inherit all those other displaynames, but i just need the Moderator one. if it's at the top, then i can just loop through the results and find the first occurence of displayname
I'm not sure how the CachedPermissionData is backed, if it's backed by a regular hash map, then it isn't sorted, but in that case you should use either PermissionHolder#resolveInheritedNodes(QueryOptions) or PermissionHolder#resolveInheritedNodes(NodeType, QueryOptions) since those are sorted according to the platform's inheritance rules (a.k.a config)
Hey!
Is there an Event that gets called once a Player finished loading out of the Database?
It turns out I just needed to use Vault API to get the prefix and group name
That’s why it helps to always explain your end goal. As you might be on a very roundabout way of doing things
Like even if you insisted on using the LP API there’s a ready made call to get the prefix
Is there a possibility that the Event does not get called on Server Reload?
The Event only gets called before Player Join for me and not when the Plugin Loads
I'm sure there's a ready made prefix call but can I do that based on a non-active context or can I only get a User's current prefix?
!api
Learn how to use the LuckPerms API in your project.
You can pass any queryOptions
And embed any set of contexts there
I mean with vault you can only get the prefix of the user’s current context
yes but it works correctly with the way our permissions are defined using server instead of world
whereas with luckperms API it does not
so it's either redefine all our contexts as world or find a programmatic solution
because when i get the context it shows world: survival
Are you talking about the bungee?
yes
Yeah. Of course you can do it programmatically
so CachedMetaData.getPrefix()
Yes.
gives the highest priority prefix for the current context?
I just need to change it to get the context for world instead of server
If you want to see an example on how to do it, then have a look at BungeeChat. I implemented it there
Not quite. It returns what’s calculated to be the prefix after taking the stacking settings into account
But by default that means the highest prefix
But since you’re working with the bungee why are you even bringing up vault?
because I couldn't figure out how to do what i needed with bungee
but i figured out how to do it with vault at the spigot level
at which point i would send the information to bungee using plugin messaging
but if i can do it in luckperms in bungee that is preferable
I mean why wouldn’t you be able to?
it's a big project, which file might I look in?
Look for the LuckPerms5Hook
Hope that helps 🙂
Struggled a fair bit to get it working
found it. So, if I'm understanding this right, you get the QueryOptions from the ContextManager and use that to create a copy of the original context, then foreach WORLD_KEY you add a corresponding SERVER_KEY containing the world value to the new context which you build into a new QueryOptions. Then you use that new QueryOptions to get new meta data
then you can get the suffix from that
or prefix
Exactly
I get the gist of it, I don't fully understand what you're doing with streams there
Well only difference in the newer API would be that there’s a ready made call to get the query options with a fallback
but i think I understand more or less
Normal stream stuff
how i can do what i need
yeah, i haven't used that in Java, but i've used something similar in javascript so I get the idea
still kind of new to Java
Isn’t this exactly what you need?
yeah it is
I just mean your code helped me understand how to use the API better
I just have to test it but it looks like it's what i need
Alright
probably won't test it tonight, time for a break
Up to you
is there an event for when a players group changes? I can't find any @ https://github.com/lucko/LuckPerms/tree/master/api/src/main/java/net/luckperms/api/event
I think this is what you're searching for https://javadoc.io/static/net.luckperms/api/5.2/net/luckperms/api/event/user/track/UserTrackEvent.html
Saw this earlier, not entirely sure tho since I haven't used this yet
Oh thank you, I wonder if it works if a user has been set to a rank instead of demote/promote, ill test
As long as a track is involved this should fire
nope, im looking for anything that interacts with a players rank at all (that event only does it on promote/demote on a track) i.e through the API or /lp user playername parent set rank
if nothing exists, I guess listening to the scheduler repeat and checking every few seconds couldn't hurt
NodeMutateEvent - check the node type is INHERITANCE
node.getType()
Hey, how do I add someone to a group? (Bungee if that makes a difference)
add an InheritanceNode to their data
there's an example on the wiki and in the cookbook
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
In NodeAdd/RemoveEvent is there a way to find out who added said node? If not what event should I listen to for that?
probably LogBroadcastEvent
is there a way to just get the node that was added using that? because doing event.getEntry().getDescription() returns permission set test.permission.xd.8 true
No, unfortunately not
Nothing some regex cannot solve 
Hello, i'm developing a plugin using the LuckPerms API, but i couldn't find a way to listen for an event when a Player receive a group and when a group is removed from the Player, is there any event like that? If yes, could you guys provide an example on how to do it? Thanks for the great plugin!
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Hello, I am trying to implement a system a bit like the unix sudo command where an Admin has to first enter a superuser state to access all admin permissions. I was trying to implement it using Events and searching an AsyncPermissionCheckEvent or something like that. I'd like to ask if there is such an event or if there is a a better way to implement what I am trying to do
a sudo group perhaps?
Oh, thanks it worked!
add them to the group before the command execution starts, then remove it shortly afterwards
I'm worried that might be problematic with the tab/nametag system
Although on second though, I should be fine if I don't set it as the primary group
mhm
Weight determines the primary group, right?
by default, yuh
Okay, I have a plan then, thanks!
Is there a way to prevent the inheritance node getting saved to storage? My idea is to only have the inheritance stored in cache so as soon as the player switches the server, disconnects or anything like that it gets erased
@silver sleet use transient nodes
There's a transient storage map
Like the nodes are the same, they just don't persist because you save them in a different place
Thanks, thats exactly what I've been looking for
I can't find
get the key then check if its equals
Knowing how to get autocompletions out of your IDE is pretty much required
!api
Learn how to use the LuckPerms API in your project.
Sorry! I do not understand the command !how
Type !help for a list of commands.
!hp
Sorry! I do not understand the command !hp
Type !help for a list of commands.
@blissful basalt what do you need help with?
i'm understand dont Help me
Do you know about Luckperms api? because I will have this in my scoreboard when a player shows his group on the scoreboard that I have set with a prefix I do not know how to do it does anyone know?
Yes
I'm using Vault to access player prefixes/suffixes for when I'm displaying their formatted names in my plugin, it works great. But when a users prefix/suffixes changes for any reason I would like to know that so that I can update the formatted name(My plugin is creating holographic displays with formatted names). It looks like Vault doesn't have events to notify when that happens and I wouldn't like to hardcode my plugin against LuckPerms since Vault is supposed to be the abstraction layer here...
I haven't tried anything yet, I ask because the api is so heavy. I just want that the group in the player is displayed so the prefix with color of the group name stops
well if you really want a easy way its probably just use placeholderAPI
or else
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
If there’s no event you need to check in regular intervals for changes
Can you send me the method
For?
Just asking, did someone know how to put to a player with luckperm API a tempo group (like vote system, just have role vote for 24h) ?
inheritance node with expiry
is there a way to get a list/set of every group on a server with the api?
GroupManager#getLoadedGroups?
you can also do GroupManager#loadAllGroups and then whenComplete GroupManager#getLoadedGroups if you want to be 100% "safe", although afaik they will all be loaded
ill do loadedgroups
Me
Hi. Is it possible (and if yes, how?) to fire an UserPromoteEvent to promote a user?
oh okay. Thank you.
Can you point me into a direction on how to do that using the API?
ya, you just listen to events, LP fires them :p
the method you want is in the Track interface
promote specifically
Thanks. What is that ContextSet that has to be provided?
What version of the API are you using @vapid terrace
according to my pom it's 5.2
the contexts to promote in -- if you don't know what they are, then don't worry and just pass ImmutableContextSet.empty()
nice
!context fyi
You can set a permission or group on a per-world/per-server basis, through what we call "contexts".
Do I still have to save changes after promoting, given that the promotion is the only change?
Yes of course
so
LuckPerms api = LuckPermsProvider.get();
User user = api.getPlayerAdapter(Player.class).getUser(player);
api.getTrackManager().getTrack("track").promote(user, ImmutableContextSet.empty());
api.getUserManager().saveUser(user);
looks good enough for you, does it?
Looks good
Thank you fine people 🙂
You're welcome
If you inherit many different values for a certain meta key, by default (https://github.com/lucko/LuckPerms/blob/0a99a9618835cb2b6b8a828fc61b4b4412e7673a/bukkit/src/main/resources/config.yml#L439-L453) the one from the group with highest weight is picked
hmm
The cached meta data is the holder's meta data after resolving inheritances
So you should be able to grab it from there just fine
and i just want the value with the highes weight.
seems totally reasonable and sounds like the default behavior suffices your needs
the ids are not orderd from lowest to highest :c
jo wait
i just fill out some missing meta ids
btw what does getMetaData().getMetaValue("discord") give you?
mhm it's the inherited one from the parent group with highest weight
a.k.a default behavior
?
i need help
!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!
no encuentro respuesta en la web
Felo...
that is what i mean
at the moment it´s from lowest to highest..
but if a new role is created it will be at the last place...
I don't see what the issue is, all this seems like the correct behavior
You can give a group its weight upon creation
/lp creategroup <name> [<weight>] [<displayname>]
so the meta keys are orderd from weight
i have problems with mysql
#support-1 or #support-2 if it isn't related to the developer API please
nope :/
> the one from the group with highest weight is picked
> mhm it's the inherited one from the parent group with highest weight
> a.k.a default behavior
hell, even this
the first is confusing...
I don't see the issue
I would first load the default group...
What you want is already default behavior, and when creating a new group you have to specify a weight if you want it to take over
i´m just brain dead. 😣
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
!api
Learn how to use the LuckPerms API in your project.
?
@nocturne elbow
!help
!advanced
!api
!argumentbased
!ask
!bulkupdate
!bungee
!bungeecheck
!cauldron
!colours
!commandequivalents
!commands
!config
!context
!cookbook
!default
!downloads
!editor
!editorsafety
!errors
!essentials
!extensions
!extracontexts
!faq
!formatting
!helpchat
!inheritance
!install
!libsdir
!locale
!meta
!migration
!notworking
!nowildcard
!pasteit
!permissions
!placeholders
!selfhosting
!stacking
!storage
!suggestions
!switchstorage
!sync
!testingperms
!tracks
!translations
!upgrade
!usage
!userinfo
!verbose
!weight
!whyluckperms
!wiki
how would i add a parent group to a player with the api? something like the equivalent of the command /luckperms user <name> parent add <group>
You add an InheritanceNode to the user
!api
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
ok
i dont see anything in the cookbook or the api docs about adding a temporary group/permission. does anyone know how? something like /lp user username parent addtemp group time
Fun fact: LuckPerms is open source, and the existing commands are on github. https://github.com/lucko/LuckPerms/blob/master/common/src/main/java/me/lucko/luckperms/common/commands/generic/parent/ParentAddTemp.java
i didnt know i could use that!
Yeah but the LP way of doing things is not always a 1:1 correspondence with the API
Because LP does not use its own API 😛 it uses the internal implementations
but it couldnt be that much different right?
Typically simpler
Of course it doesn't. /s
It kind of depends what is it you're looking at specifically, but it is very similar (sometimes it isn't lol)
In any case you have to do is specify an expiry time when building the node
At any rate, just remember that 30 minutes of googling can save you 5 minutes of reading the documentation.
I'm promoting a user on the bungeecord-side via the API (via a bungeecord plugin command). However, it seems that this information is not fully synced to all spigot servers, because of some weird behaviour with Multiverse and Worldguard.. Can i trigger an immediate sync after promoting the player?
When the user relogs, everything is cool, but I do not want to tell every new player to reconnect after promotion
Just trigger a network sync
how can this be done via the API?
anyone pls? :/
LuckPerms#getMessagingService gives you an Optional<MessagingService> (it's an Optional because it can be disabled)
Then you can just call MessagingService#pushUpdate if it's present ;)
You do that after saving the changes
Thx
LuckPerms api = LuckPermsProvider.get();
User user = api.getPlayerAdapter(ProxiedPlayer.class).getUser(player);
api.getTrackManager().getTrack("track").promote(user, ImmutableContextSet.empty());
api.getUserManager().saveUser(user);
Optional<MessagingService> messagingService = api.getMessagingService();
messagingService.ifPresent(MessagingService::pushUpdate);
does this look correct to you?
Almost there :o
since the saveUser runs asynchronously, you'll have to pushUpdate on saveUser(blah).thenRun(...)
Alright, thx! 🙂
LuckPerms has a problem, it currently has many vulnerabilities and some users take advantage of this to hack into servers, for example to give themselves permissions as members and have this same plugin give them such permissions
- How is that related to the LP dev API?
- You'd need to provide some details on what is it exactly that's going on with that, as far as I know there are no known vulnerabilities
This has been brought up many times and always boils down to backend server security
In other words the backend servers are accessible from the internet which means people can just directly connect to them
i.e. set up a firewall and use online-mode=true 🙂
online-mode=true doesn't work for backend servers @nocturne elbow
Hey BrainStone! Please don't tag helpful/staff members directly.
I will give an example on my server and go 2 times that a user executes the command lp user giving the permission of * which the user does not have permission for that as they are commands that are currently blocked
You can join my server without perms as many times as you want and you won't be able to do that 
#support-2 might be more appropriate btw :)
Please can someone help me configure luckperms on bungee
@calm girder don't crosspost. And stay in the appropriate channels
ok
Does removing a node from a user happen if they inherit said node from their groups
Not quite sure what you're asking
Am I making the wrong assumption that user.getNodes() returns all nodes from inherited groups?
Ah that makes this much easier for me then!
There is a call to get all nodes, but it's a read only collection for quite obvious reasons
Mhm
!api me
Learn how to use the LuckPerms API in your project.
how can i get a players luck perms prefix using the api?
!api
Learn how to use the LuckPerms API in your project.
!cookbook @blazing portal
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Can anyone help me understand why a simple hasPermission check as well as registering a Command with Command(String name, String permission, String... aliases) fails EVERY time in a BungeeCord plugin? I have luckperms set up both on my spigot server and bungee server
both servers are connected to the same sql database
i have server: bungee in the bungee config.yml and server: lobby in the spigot server's config.yml. pluginmsg for messaging
and if i create a custom bungeecommand and set a permission, then give my player that permission in the lp editor, with the correct context, it still says I don't have permission for the command
and it's red when i type the command, like it doesn't exist. If i change permission to null in the Command constructor, I can run it, but with permissions I cannot
I must be missing something...do the permissions not sync to the CommandSender that has the permission or do I have to cast them to ProxiedPlayer or what? I've been trying to figure this out for awhile
Did you sync your permissions?
messaging should be sql btw
also are you refering to a bungeecord plugin you are making, or every single bungee plugin you tried to install in your server network
I've tried setting messaging to both sql and pluginmsg but I can try again
i'm referring to a bungeecord plugin I'm making
how do I sync permissions?
I tried /lp sync that didn't do it
screenshot /lp info and /lpb info
Then that's likely the problem ;d
but how can that be
it literally is set to MySQL in my config.yml
wait is that from the spigot server?
that's the spigot command isn't it
shit
lmao now I get it. i copied spigot servers and started using lobby which I hadn't configured
i'm dumb lol
hm, storage method is set to sql. probably should say MySQL
that would probably make it fall back on h2
yep
that is a silly mistake
permissions still aren't working though, so
i'll have to try sql for messenger service see if that works
well it seems to work now as long as I don't set a context for the permission
setting context server=lobby makes it fail
even though I'm on lobby
maybe world=lobby
Ye
context system with bungeecord servers is a bit weird
so server=bungee would mean on the bungee server itself and world=lobby would mean the lobby server
iirc
beautiful. thanks for your help man, it's working now
yeah it's weird, i figured that out about the world/server thing but on our production server all the contexts are set as server and it still works for some reason. but not on my test server
world does the trick
Looks like you are not sure what CompletableFuture is?
@obtuse jolt
Hey LoopRich161! Please don't tag helpful/staff members directly.
not sure about the guide, but from the javadocs, it is suppose to return a CompletableFuture
!export
Sorry! I do not understand the command !export
Type !help for a list of commands.
also read lol
that example you screenshot is a example of what you SHOULDNT do
However, we can't, because #loadUser returns a CompletableFuture - as it performs lots of expensive database queries to produce a result.
thx, i solved problem
How do I get the weight of a prefix with the api?
?
Do you know the group the prefix is in / do you know which group holds the prefix?
I have an array of every group name
That uuh.. doesn't answer the question
You want to get the weight for a certain prefix
That prefix is being held by a certain group
Do you know which group?
Well, each group will only have one prefix, and I want to get the weight of it for each of them
So yes, I have an arraylist of every prefix, and I need to get the weight for them and make them into a hashmap or something
Do you have an array of group names or prefix values?
both
Well for each group you can do getNodes(NodeType.PREFIX), that will give you a collection of the holder's own nodes, not inherited ones
mm ok
Then from the PrefixNode you just getWeight or getPriority
What class is getNodes a part of?
PermissionHolder
You get the Group from the GroupManager#getGroup(String)
!api btw
Learn how to use the LuckPerms API in your project.
!cookbook has a few common api usage examples
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Sorry for all of the questions, but when I try and use the api it gives me this error, I've tried installing the legacy extension and I get the same message
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
Well you probably don't need the extension anyway, assuming you're using up to date LP and up to date api as dependency
But that sounds a whole lot like you didn't add "LuckPerms" to your depend
is that in plugin.yml?
mhm
mk
Now I get this:
org.bukkit.plugin.InvalidPluginException: java.lang.IllegalStateException: The LuckPerms API is not loaded.
RegisteredServiceProvider<LuckPerms> provider;
LuckPerms luckPermsApi;
@Override
public void onEnable() {
provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if(provider != null) {
luckPermsApi = provider.getProvider();
}
}
Here's the part of my main class that deals with it
Did you soft depend on luckperms?
See above :p
How are you managing your dependencies? maven, gradle, "external dependencies"..?
I'm manually adding them to the build path with eclipse
Hm... make sure you are not including the API jar into your jar when exporting
I'm not, theyre not in the project folder
Is there any place you're calling LuckPermsProvider.get()?
mind pasting the whole stack trace?
I was, I changed it
The paste link you sent in is invalid or expired, please check the link or paste a new one.
clippy stfu
you relo----
don't
no
don't /reload
never ever
send
The paste link you sent in is invalid or expired, please check the link or paste a new one.
paste your whole code
just main?
Yes
Hmm do me a favor
Open your compiled .jar with 7zip or winrar and make sure you are not compiling the API inside your plugin
wait hold on, earlier I was using the api jar with the first error I had, then I switched to the actual plugin jar (for luckperms), that could be why, i'll switch back
yikes stick with the api jar
Fefo, is there a difference in using the serviceprovider or just doing LuckPermsProvider.get()
Well ideally the instance would be the same, but things like /reload beg to differ
Using the service provider also gives you the possibility of not crashing your plugin because something is missing, since it would return null instead of throwing ClassDefNotFoundErrorWhatever
So the service provider is 100% the way to go if you soft-depend on it
Hey, is it possible to check for a permission which is on a certain server context using the api?
Yes
You got any examples?
Learn how to use the LuckPerms API in your project.
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Alright, thank you.
You’re welcome
You might want the mutable variant if you want to change it
Not sure what a mutable variant means, but I'm using it like this currently ImmutableContextSet contextSet = ImmutableContextSet.of("server", serverName);
Ah, I see nvm. I don't really need to change it after I create it.
Ok
how to hookup luckperms api from bungee to spigot plugin?
What do you mean?
use luckperms api in spigot plugin when the luckperms in installed on bungeecord
how could i use it
im getting java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider error
By installing LuckPerms on the backend server and properly syncing all instances
!bungee
If you run a Bungeecord network, learn how to correctly setup LuckPerms on all server instances (including Bungee).
Syncing data between servers
How would I get every group a certain user is in?
Whether it's an arraylist or something else
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
is there a way to set the server name via the api?
You mean.. the setting in config?
yeah
we have a system which syncs configs across servers, but i'm trying to avoid doing text replacement in it
Well, you can't really change the setting without replacing it in the config file. You could potentially do it with reflection but you are on your own there, specially because in Java 15+ final actually means something and you can't use any reflection to change final fields (afaik)
So no, there is no API for that
that's about what i figured, thanks though
fortunately minecraft probably won't be updating to 15 for quite a while lol
Not minecraft itself, no, but you can't rely on server owners not using java 15 for running them
true, but with forge it's just asking for problems
at least as far as i'm aware
oh ew the f word 🤢
facts
f-fo-forge 🤢
hi, help
please don't post in several channels, and be sure to read the channel topics to ensure that you're posting in the correct place @solar siren 😄
you've already been helped @solar siren - in #support-1 which was the correct place to post it. My apologies for not having thought to help you 4 times, to correspond to your 4 redundant requests
Is there a problem with this command (not with the command itself, but the way i typed it)
/lp group default permission set easykits.kit.archer true world=kitpvp
becouse it does not work
oh wait wrong channel
Hello, i want to ask how do you get the Next Prefix, or rank you can say, from UserPromoteEvent
and can you cast player to user?
I see you ignored the other 2 messages
Oh well
!cookbook
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
!api
Learn how to use the LuckPerms API in your project.
You can't "cast a user to a player", you get the UUID and from it you get the player (depending on the platform it's going to be one method or another)
i cant search in that
i want to seach in JavaDocs
and there was a method for checking what is user beng promoted to, but forgot its class
Third link in the second embed
And yes it is UserPromoteEvent
wheres the search bar
There is no search bar, but you can click "Classes" or "Index" and Ctrl F what you want
k
how do i remove a meta data key from a player? looking at the javadocs i see a clear method on NodeMap that either clears all nodes or accepts a ContextSet, but im not quite sure how to create the context set that it needs
doing /lp user <user> meta unset <key> does exactly what i want to do, but i cant figure out how to do that other than literally running the command as console which is obviously not a good solution
Is there a specific event for checking when a user's groups are updated or not? There is TrackPromote but by description that doesn't seem to be what I'm looking for...
@main dagger there are variants of NodeMap#clear that clear things as you want
e.g. NodeMap#clear(Predicate<Node>) or NodeMap#clear(ContextSet, Predicate<Node>)
not sure what you mean by "are updated".. could you reword that?
yeah but how do i use those?
You can use that to only clear the nodes that meet certain criteria
That "certain criteria" is what the Predicate evaluates
And that you define
So changed in general. Added, removed to group, etc
I mean they will always be updated
Why'd you "check" that?
What are you trying to achieve
This is #luckperms-api :p
I know
That’s why I don’t quite understand why you’re questioning the motives when it’s pretty clear and the answer itself is pretty clear
Like I’d have answered but I keep forgetting the event name
Something like NodeMutate
Oh I must have misread the original question
I thought they were trying to check if the data was updated
Which... always is lol
No. Looking for the event
And yeah NodeMutateEvent is what you're looking for ^^
I use Vault to get offlineplayers prefix and suffix during the startup of my plugin but I'm having problems where sometimes I don't get a prefix/suffix for a offlineplayer and I believe it's because Luckperms have not had the chance to set everything up... I don't really know what luckperms is doing behind the scenes but has this come up before?
I use
vaultChat.getPlayerPrefix(null, offlinePlayer)
And I do have a softdepend on Vault
And I'm not running getPlayerPrefix/Suffix on the main thread
Throw in a softdepend on LuckPerms just to be sure
I thought about that but then I looked in the console that Luckperms always is enabled before my plugin and Vault. I can test it right now
My plugin is setting up some leaderboard and for each leaderboard a new thread is created where the getPlayerPrefix/Suffix is called on. It's completely random which leaderboards doesn't get the prefix/suffix back
I see. That’s interesting
My guess would be some kind of race condition
Just for the fun of it what happens when you don’t multithread it?
Like you might need to test it a few times
It unfortunately didn't work
The softdepend?
yes
LuckPerms gives me a warning that I shouldn't perform the getPlayerPrefix on the main thread
When I reload my own plugin then all leaderboards are re-created and it all looks good so the problem has to be that luckperms isn't really finished yet with whatever it's doing. I believe I can bypass this problem by waiting for some amount of time before I setup my leaderboards when my plugin gets enabled but I rather not 🙂
I didn’t mean doing it on the main thread. I mean doing it in one thread
I’m guessing you’re running into a race condition where too many concurrent requests of the same player cause the issue
If you find a way to reliably reproduce it make a bug report on GitHub
Yes, I have managed to get the problem with around 4 leaderboards as well
Yes I can try
What are you responding to here?
I mean I’m experiencing the problem with a low thread count as well.
But i will file a report
I said single threaded
Hello!
I'm trying to make a basic plugin that gets the luckperms prefix, and displays below the users name using scoreboards. I added the luckperms api, and added the listener as well. This is my main class:
public class Main extends JavaPlugin implements Listener {
@Override
public void onEnable() {
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
String prefix = user.getCachedData().getMetaData().getPrefix();
User user = luckPerms.getUserManager().getUser(uuid);
}
@Override
public void onDisable() {
getLogger().info(ChatColor.RED + "Goodbye!");
}
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("rank", "dummy");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setDisplayName(prefix);
for(Player online : Bukkit.getOnlinePlayers()){
Score score = objective.getScore(online);
online.setScoreboard(board);
}
}
}
But for some reason, I get an error saying "user can not be resolved to a variable"
what is uuid
It was just a quick test, let me get did of it
also can you post the full code on hastebin?
Sure.
discord formatting isn't the best
This is my main class.
This the listener class. https://paste.lucko.me/Dnf6vK8XXK
These are the libaries that I have installed.
you'd probably want to move the prefix & user variable in the playerjoinevent
then move LuckPerms api above the onEnable() so that you can access it from the anywhere in the class
then do luckPerms.getUserManager().getUser(player.getUniqueId() or whatever the correct method is from player
Okay, this is what I did: https://paste.lucko.me/tHw7SwyouP
But I'm still getting this issue:
send the full code again
https://paste.lucko.me/lA1AA0Qhnd I meant like that (you'll need to fix the formatting)
and you also need to register the listener
And today we learned why making plugins requires existing Java skills
yea I agree... learn how variables and classes and methods works first
Don't advertise
@thorny echo
@nocturne elbow Do not advertise, first warning
are you using your own custom leaderboard or something like holographic displays API?
Yes its that Api
well then refresh the placeholders using the {medium}
tag
at the end of the placeholder
this will refresh the placeholders
even after initial load
Hey there, I am using luckperms 5.2.76 with my plugin (I was using previous version of 5.2 aswell) and it used to allow me to update my users player group but for some reason, it stopped working! In the PlayerJoinEvent I have this System.out.println(Main.lp.getUserManager().getUser("username").setPrimaryGroup("groupname")); and it returns "FAIL" .. It was working previously and then suddenly stopped.. I am stumped as to why, please give me some advice 😄
however getPrimaryGroup() succeedes! The group exists in luckperms, and if my parent group is already set to it, luckperms returns "FAIL_ALREADY_HAS"
yeah..... that sounds totally normal behavior?
If your primary group is that group already, then it will fail because you already have it as there is nothing to change
No, What I am saying, is that when it isn't already my primary, it Fails
it fails to set the primary
yet it is able to get the primary
in the case where it is the primary, it acts as it should
Well that's because setPrimaryGroup is likely not what you want, the primary group is, by default, calculated and it's the parent group with highest weight and you can't change that unless you change a setting in LP config which no owner should change lol
setPrimaryGroup changes the users parent group no?
No
!cookbook there is an example that replicates the parent set command which sounds that is what you want to do
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
thank you, this is helpful! Strangely, it used to work by setting the primary group!
where do I download releases of this api?
!api first link
Learn how to use the LuckPerms API in your project.
It's an example plugin, there is no built jar out there lol
ahh I see, thank you
The idea is that you check how it uses the LP API
was gonna say that fefo :(
You can download it as a zip tho under "Code"
makes sense, just wondering why these features (eg setParentGroup()) isn't a function in the plugin?
Because a PermissionHolder (users or groups) can have many parent groups, not only one
And there are many variables taken into account too
I mean, could they not just copy whats in the onCommand of the ingame user <> parent set command
the command is a lot more complicated than you think
but they could just turn it into a function as part of the api
xD
Malleable
so to set parent group?
You've got to be kidding
.
mhm
I'm writing a command that will remove all users from a list of groups, and clear all personal permissions
User#getNodes says it's fast, but I'm assuming modifying it won't modify the user's permission nodes
Or maybe it's not modifiable at all
What's the most efficient way to do this?
oh hello redempt
o/
Yeah getNodes returns an immutable collection (I think
), if you want to modify the holder's data, use PermissionHolder#getData instead
Ok
!cookbook you can see a few examples in here on how to modify a user's nodes and uuh other examples
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
NodeMap data = user.data();
user.getNodes().forEach(data::remove);
luckPerms.getUserManager().saveUser(user);
}```
This should do it, right?
But I'm assuming this will also clear all groups because groups are technically nodes?
you just want to clear all nodes the user has?
a node is also parent group, meta key/values, prefixes, suffixes etc etc etc
Yeah, but I only want to clear specific groups
Ah, alright
user.getNodes().stream().filter(n -> n.getType() == NodeType.PERMISSION).forEach(data::remove);
This, then?
You can getNodes(NodeType.PERMISSION) 👀
also, UserManager#getUser will return null if the player is offline and judging by what it seems you want to do, you should use UserManager#modifyUser(UUID, Consumer<User>), it loads the user, runs the action and saves the data, all async
Ah, cool
So, something like this
luckPerms.getUserManager().modifyUser(player.getUniqueId(), u -> {
NodeMap map = u.data();
u.getNodes(NodeType.PERMISSION).forEach(map::remove);
});```
luckPerms.getUserManager().modifyUser(player.getUniqueId(), u -> u.data().clear(n -> n.getType() == NodeType.PERMISSION));
what?? lol, you just end up with u.data().clear(NodeType.PERMISSION.predicate())
Yeah
or if you're fancy NodeType.PERMISSION::matches
Having a preciate() method seems so unnecessary
come on Redempt I know you're better than this hah
INHERITANCE
Ah cool
afaik PERMISSION are wildcard permissions, specific permissions and shorthand permissions
I'm assuming I'd get the group name with Node#getKey
regex have their own type
mnop
InheritanceNode#getGroup I think?
getGroupName
Ah cool
getKey will return the whole string representing the node (group.<group> if it's a parent group)
Yeah that's what I was figuring
That's probably simpler honestly
luckPerms.getUserManager().modifyUser(player.getUniqueId(), u -> {
u.data().clear(NodeType.PERMISSION.predicate());
u.data().clear(NodeType.INHERITANCE.predicate().and(n ->
toRemove.contains(((InheritanceNode) n).getGroupName())));
});```
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
luckPerms.getUserManager().modifyUser(player.getUniqueId(), u -> {
u.data().clear(NodeType.PERMISSION.predicate());
u.data().clear(NodeType.INHERITANCE.predicate().and(n -> toRemove.contains(n.getKey())));
}```
I think this is the second time ever I see someone using Predicate#and(Predicate) lol
instead of &&
¯_(ツ)_/¯
is neat ngl
I'll just stick with the first way because it's less compact but probably better practice
I presume toRemove is a set/list containing the group names to remove?

LuckPerms API is strange but I like it
strange how 
NodeType.PERMISSION.predicate()
Well it returns a Predicate<Node> that checks if the node type matches it
Yeah
Could have done ::matches too ¯_(ツ)_/¯
It's so weird
if I'm not mistaken #predicate() does that


It doesn't seem to have worked
Groups and personal permissions of players seem to be unmodified
It only prints for online players .-.
Guess the user data was reset
So LuckPerms has stuff for offline players that bukkit doesn't
Doesn't getOfflinePlayers return the ones in usercache.json or whatever?
Yeah
and I think you can get all UUIDs LP knows of since it keeps a cache
uuuh
Assuming I can do luckPerms.getUserManager().getUniqueUsers()?
yeah that must be it
if it returns a completablefuture<collection<uuid>> then yeah
luckPerms.getUserManager().getUniqueUsers().thenAccept(s -> s.forEach(id -> {
luckPerms.getUserManager().modifyUser(id, u -> {
u.data().clear(NodeType.PERMISSION.predicate());
u.data().clear(NodeType.INHERITANCE.predicate().and(n ->
toRemove.contains(((InheritanceNode) n).getGroupName())));
});
}));```
or.. something similar

meh its pretty neat once you learn it
What’s odd about it?
Could not load 'plugins/Myplugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/luckperms/api/LuckPermsProvider
...
Anyone can is able to tell me what I need to do with this error, It like 4 hours I am trying to do tests on tests
Are you (soft)depending on LP?
Make sure you're not statically getting the provider & that you dont shade it in
What I need to soft depend?
LuckPerms
Now it print another error
The LuckPerms API is not loaded.
But I imported with maven dependency
!paste full error
Seeing a paste of the problem makes everything so much easier! Use https://bytebin.lucko.me/ for easy pasting!
Pastebin any relevant segments of the console log. If it's a startup error, this includes the entire startup log!
Pastebin the entire LuckPerms config file (passwords removed) as well as any other relevant files!
paste your FixEssentials class
put LuckPermsProvider.get() under onEnable()
Same error
you didn't do what I said
move LuckPerms luckPerms = LuckPermsProvider.get(); in onEnable()
if I wasn't clear sorry
If I move the other things can't compile
then at the top do LuckPerms luckPerms; then in onEnable() do luckPerms = LuckPermsProvider.get();
Thank you for the patience and for the helping, this works now
I'm looking for which event to use for checking when a user's primary group is updated. Closest one I could find is UserDataRecalculateEvent but it exhibits some unexpected behavior. I'm extremely close to just making the event myself and submitting a PR
And the track events do nothing in my use case
NodeAddEvent
Probs, that's most likely always what people really want lol
Check that the target is a User and the node is of type INHERITANCE
That would be when a new parent group is added (which may or may not be the primary group, remember that holders can have several parent groups and even then the newly added one may not be the primary group according to settings and weights setup)
I don't know if this is LP's fault or not, but now it's doing this for all online players every 10 seconds or so. Otherwise, It's doing exactly what I need
I have no clue what you're talking about but (if it is what I think it is) data recalculation happens somewhat frequently, mostly when contexts update
F
Hi is there a way to allow only to do lp commands if a player has a certain ip?
No, unless you want to code a plugin that might do that?*
yea but abit weird that you need to do that tho
Someone has hacked my server and is able to spoof my admins account to get permissions and we can't fix that. So we only want to authorize commands by ip. My server is in prenium
!bungeecheck

they left