#luckperms-api
1 messages · Page 16 of 1
yea its great
its also helping my sponge transition
as he provides a ton of features within LP itself
For instance, I was having to do my own implementation of custom join/leave messages per-player, so that's stored in the player's meta. Otherwise it pulls from a pre-defined list of defaults, though I'm not entirely certain how I'm doing that piece yet.
ah i support that for claim enter/exit but its stored with claim data
That'll be the interesting piece for me though because I'm doing the same. Sponge's plugin base isn't as large, but most if not all of it is actively supported.
but definitely reasonable to have as meta
Fortunately, going from C# to Java isn't terribly painful and I'm able to figure most things out.
And when I'm not, Luck's usually willing to help out
They generally have the same feel, they just have a slightly different syntax, like enums being all upper or methods being in camel case vs pascal case.
My biggest complaint is I often miss some of the syntax sugar from C#, though I hear Kotlin is supposed to help with that. I always see Kotlin in a mobile development context though so I'm not entirely sure how it does with just compiling to Java IL.
aye
okay I am back. @hollow grotto I dont want to have a bunch of custom permissions per each user...
I'd rather have custom contexts or metas on a per session basis
Kotlin syntax is like typescript...
I dont like how you have to declare var name ten the variable type.
feels so weird to me...
am I the only one?
You know what. Example code mwould make a lot of sense. Any example plugins that use the luckperms API? I'd love to tap those for knowledge.
there needs to be a way to unregister context calculators...
No matter what you do, don’t calculate anything expensive in your context calculator. They’re essentially called every time a permission is checked and should be made as efficient as possible
(They’re cached for a tiny bit but called often. Though you should really treat them like they are called every permission check)
❤ thank you
Okay so I wont do a calculator then.
I'll do a transient meta or transient manually set context somehow
I mean you certainly can do a context calculator
Just be sure to calculate the context data outside of it
@hollow zodiac
need to be able to unregister the calculator if i go that route though... otherwise reloading my plugin will turn into a memory leak
Pretty sure there’s a method to do that. Did you check?
It's spigot. I'd not worry too much about it leaking. 😆
@crystal sonnet I did, but I was unable to find it...
Hey Taylor! Please don't tag staff members.
@hollow grotto I mean. I try to make sure my own plugins are leak free at least. And any plugin devs that dont properly handle reloads I avoid their plugins like the plague.
It's just bad practice to not do proper memory management
Nah, you're totally right. I was just making a joke.
Oh. Sorry.
You're good!
lol
searching for the unregister api right now...
"Everything in CachedData is indexed by Contexts, as this is how LuckPerms processes all lookups internally." Can someone paraphrase this?
contexts handle the indexing of cached data?
public void test(){
LuckPermsApi api = this.plugin.getLuckPermsAPI();
if (api == null) return;
ContextManager cm = api.getContextManager();
UserManager um = api.getUserManager();
CompletableFuture<User> lpUFuture = um.loadUser((UUID)null);
lpUFuture.thenAcceptAsync(lpU -> {
UserData cd = lpU.getCachedData();
// Need to somehow set the user's context so that their context cache will be:
// "SS3_RedstoneT1" = true (Is there a way to specify an int and then do a less/greater than operation?)
// "SS3_RedstoneT2" = true
// "SS3_RedstoneT3" = true
// "SS3_RedstoneT4" = true
// (And then I want the cache to be good to go until I update the cache again)
// Now modify the user here.
um.saveUser(lpU);
});
}
Thank you for your help so far by the way
You really should be using meta for that not contexts
Anyone able to help me with an issue?
Okay so the meta is really just a caching mechanism then? I basically set meta on a player, then have to calculate contexts from the meta?
I really want to use the luckperms interface for configuring permissions, but... this is...
It would almost be easier to just do my own custom permission s configuration right now.
@astral heath try asking your question
So I use Luckperms obvs... I want it so when a player enters a worlguarded area it will give them a certain permission is this possible?
I left a question in general before I realized this channel existed. I can copy it over if requested, but it's currently last message in general.
@astral heath The answer to your question is kind of. This can be done through region flags. It depends on what permissions you want to give though. I recommend looking at the WorldGuard wiki to see what you can do here.
If that doesn't meet your needs, you can write a custom context accepting a region name. Consumption would look like this:
/perm user <user> permission add essentials.fly true region=mountain_home
Hey, can I be added as a contributor to the Luckperms project so I can make a PR for the unregister and unsubscribe methods? my github is Pangamma
It's a blocking issue for me, so I'm trying to get it added in.
@hollow zodiac you don't need to be contributor of the project
Just fork it, make your changes and make a PR
Standard GitHub procedure
@hollow zodiac If you need help, I've documented a procedure on this.
Well, technically I stole it from Microsoft
This article shows you how to use the "major" contributor workflow to make contributions to docs.microsoft.com articles.
Actually, this guide may be better https://guides.github.com/introduction/flow/
@astral heath there is an extension to LuckPerms called ExtraContexts, which will let you define worldguard regions as contexts for permission nodes
Oh perfect, that's the plugin I was talking about last night. @rapid egret
Which IDE do I use for gradel projects?.... my netbeans IDE thing is not able to open this
Thanks FoxTrek
@hollow zodiac eclipse is what I use and IntelliJ is supposed to work great with it too, though I never really got the hang of it
Thanks. I'll DL it now
feel so stupid rn.
Help....
Are any special eclipse plugins needed?
hang on. it is building.
How was this compiling?
Could not fetch model of type 'BuildEnvironment' using Gradle distribution
Alright. I looked into the API....
you guys are using functional interfaces for the context creators...
great for lambdas...
There is a problem though.
in order for a removal to work, you need to be able to perform a .equals check.
By default, if no .equals method is specified, and the type is of a class or interface, the comparison will be on the pointer.
So if you have the pointer to the exact same instance you added, that instance can be used in the removal call.
As you can see, that plan just got thrown out the window.
In its current state there is no safe way to remove a context calculator.
Youd need to provide some form of key or batch set for it.
or perhaps return an integer value for the "ID" of the calculator in the map that could be used to remove it. Similar to how the bukkit scheduler works.
Man this is painful rn... no one cares about any of this but me.
@hollow zodiac This is a C# best practice though I can imagine it would apply just about anywhere - I strongly recommend using the Unicode form of non-standard (read non-Utf8) characters when possible. The Yen character isn't terribly uncommon, but some encodings still don't support it. This is especially the case if you're going to be pushing to some type of git repository like GitHub or GitLab, as some peoples' computers may not fully support that character. If they do any pushes, that character may get scrambled or replaced by the dreaded □.
Eclipse -> Windows -> Preferences -> General -> Workspaces -> Text file encoding
can you check?
I don't have Eclipse
:/
私は今とてもイライラしています。
I wonder if japanese people feel weird reading their text left to right
@hollow zodiac if I’m not entirely mistaken, remove the project from eclipse (make sure your working copy is unaltered) and run ./gradlew eclipse from the root dir (no ./ if it’s the windows cmd. Leave it if you use power shell)
And not having an equals is ok. You just have to store the object somewhere to be able to remove it
@dapper flame that’s nothing LP deals with
Only group displaynames
You can get the display name of a player through the platform’s API
Hey Hoxen! Please don't tag staff members.
No
Or not by default
It might if it’s enabled in EssentialsX
@dapper flame
Check the wiki
There’s plenty of examples there
Pretty sure they do
The page is called Usage under the developer section @dapper flame
@crystal sonnet you're correct. If you have an instance of the object you can remove that object. But in one instance, you passed in the object to the method and this towards the list as a wrapped object. You have no access to that new object that was just stored
Hey Taylor! Please don't tag staff members.
How can i get the ranks a user has(no display names) with the API
@dapper flame don’t use the player name to get the user object. Use the proxied player object or the UUID
And try using the user’s current context
...
Check the examples
Plenty do get the player’s context
And also your IDE should help you a lot
screenshot of lpb user <user> meta info?
Hey Hoxen! Please don't tag staff members.
The API should work consistently across the board
use the API singleton on bungee
and did any of your messages show up in the console?
I mean, you're showing us a lot of code but nothing whatsoever of what is shown in the console
Did you register your event handlers in bungee?
Something tells me that you probably broke the chat one
Okay, stop bungeecord
go into the folder and delete the plugin jar, leae the debug messages in there, e.g. the "it works" one at the top of the event and reexport your plugin jar and restart
Now, when you chat at the bare minimum you should see the log message
Also, make sure that that Utils class is using the logger and not System.out
Are you un registering your plugins and all of your data every time you unload the plug in?
speaking of unregister... any chance of a fix today?
I know that you can remove event subscriptions
fun destruct() {
val iter = plugin.luckPermsApi.eventBus.getHandlers(UserDataRecalculateEvent::class.java).iterator();
while (iter.hasNext()) {
val handler = iter.next()
if ((handler.consumer.javaClass.classLoader as PluginClassLoader).plugin == plugin) {
handler.unregister()
}
}
}
(there is probably a more "proper" way than that, but that's what I went for)
@long moon can you get it to work for comtext calculators?
for context calculators no, I couldn't see anything for them
Anyone know how to grab transient permissions from CachedData?
Luck told me to use CachedData if i want to inheritance to work but i see nothing for transient
created ticket 😃
Hey I just saw an update on an issue that I created. Looking over the commits it doesn't look like it would actually work though. Has anyone actually tested the unregister methods? Specifically I noticed the bungee cord version of it would not work
Also the sponge API still passes in an instance that is wrapped in another proxy object
I am reading this for my phone right now though so I could be misinterpreting the commits
Hey i was wondering is there an event for tracking when a user is added to a group ? I have tried to listen to UserPromoteEvent but that doesnt seem to work ?
anyone know why when doing a lookup for permission griefprevention.flag.interact-block-secondary.minecraft it returns UNDEFINED when griefprevention.flag.interact-block-secondary is set to true? I'm testing in Paper using permission holder's cached data
ah i think my issue is, on bukkit side I should be setting griefprevention.flag.interact-block-secondary.*
let me try that 😃
yup that solved it, i completely forgot bukkit permissions do not treat a.b.c the same as a.b.c.*
The luckperms api is being gay and not loading
what has the api's sexuality got to do with anything?
gay? i didn't know an api could be homosexual.
this is not working >:(
public class PlayerTalk implements Listener {
LuckPermsApi api = LuckPerms.getApi();
@EventHandler
public void onChat(ChatEvent event) {
Utils.log("This is working m8");
ProxiedPlayer player = (ProxiedPlayer) event.getSender();
User user = (User) api.getUser(player.getUniqueId());
ContextManager cm = api.getContextManager();
Contexts contexts = cm.lookupApplicableContexts((me.lucko.luckperms.api.User) user)
.orElse(cm.getStaticContexts());
MetaData metaData = user.getCachedData().getMetaData(contexts);
String prefix = metaData.getPrefix();
if (prefix == null) {
player.sendMessage(new TextComponent("Error the prefix is null!"));
} else {
player.sendMessage(new TextComponent(prefix));
}
}
}
the whole class just doesnt work
:(
if I remove the code using the luck perms api it works
y
(BungeeCord)
if anyone could help me get it working ill give u 5 bux
;)
@dapper flame make sure to load your plugin after LP
how would I do that
I just added it as a dependency
but I'm not sure how to load it after annother plugin with bungee
with bungee?
Alright
You might as well check it too it you don’t want to google for the syntax
name: BungeeChat
id: bungeechat
main: dev.aura.bungeechat.BungeeChat
version: 2.1.6.855
author: shawn_ian, BrainStone
description: A new way to send private, global or help messages and to do much more with chatting network wide!
url: https://www.spigotmc.org/threads/bungee-chat.93960
softDepends: [BungeePerms, PowerfulPerms, LuckPerms]
oooooh
I was
doing
softdepend: ["LuckPerms"]
wait
;)
Yeah. The s is important
hi, um. i have a question, how to get players Prefix and Group ?
The wiki has an examples page
Is there a way we can push a new change for the luckperms API to maven?
I really want to use the latest code
if not I can wait a day or so
just wondering when the next maven update would be
@hollow zodiac add this repository to your buildscript
https://oss.sonatype.org/content/repositories/snapshots/
and depend on 4.4-SNAPSHOT
thanks!
Hello.
What causes this error:
https://hastebin.com/evebuvuges.shell
On ln43 there is if(!event.isUser()){...}
also event.getTarget() instanceof User works fine 🤔
> [03:19:47 WARN]: java.lang.reflect.UndeclaredThrowableException
It's been a while since I've done Java, but don't you need private void myMethod() throws SomeException? It sounds like that may be the cause but I'm also really rusty.
Somehow possible to remove a Meta Node without knowing the value/getting the value first?
@hollow grotto As far as I know java.lang.reflect.UndeclaredThrowableException is throwed because event.isUser() throws exception or rather when you try to call that method
isUser(), judging by its name, should be safe. It should either return true or should some sort of cast fail or something it should return false. It shouldn't ever throw.
I'd say to file an issue and to use instanceof User for now.
My assumption it's because of getTarget() but yeah instance of User worked I guess I should file an issue then.
@hoary hornet update to the latest version of LP
bug was fixed already
@sudden kelp Yep, you can do so by using the removeIf methods
or maybe they're called removeMatching
@jaunty pecan Alright thanks
Hey MTM123! Please don't tag staff members.
sorry
Just calling MetaDataMap.remove(key) and it's done? Without building a node and unsetting it? I am not that advanced:D
Ah, guess create a MetaNode with the key and an empty string and call clearMathcing on Permissionholder and pass the created node?
Extending off my question in #support-1, if I am going to be storing a collection of items in a user's meta, can I store that directly or should I do something like String.join(';' myCollection)? and store the collection as a string in a known format?
Need some one on one help please and thank you
@hollow grotto I'd just do it with the join
As that makes the value easily humanly editable
@graceful cliff try asking your question first
That's definitely true. Fortunately, this field should normally only hold one value, though I want to provide the capability to have more than one.
Essentially I'm making a plugin that has feature parity to EasyTitlesReloaded but for SpongeForge, but I want players to be able to have their own custom titles should they donate and buy one.
So I'm storing user-specific titles in user meta, as well as their currently selected title.
Yeah. Do it like that
hey guys can you help me with something?
how do you add a primary group with luckperms
TL;DR you don't https://github.com/lucko/LuckPerms/wiki/Default-Groups
The default group is built in and is roughly analagous to @Everyone from Discord in that it's a role everyone has.
But I want to add a primary group for a plugin I'm using....
What is it exactly you're trying to do?
Ok so I'm using a plugin called DiscordSRV
And when I type in chat it broadcats to discord
but It doesnt broadcast my prefix
But if I add a primary group to me
then it will broadcast that before my name
Ah, ok. So your primary group in that context whatever group you have with the highest weight.
Typically, default has a weight of 0 and that goes up until you hit your admin or owner group, which should have a weight higher than any other group. That's also how prefixes are determined in-game.
If you run /lp user <username> info it should show what your primary group was resolved to be.
The primary group is calculated based on the most superior group the user is a member of.
For instance, if I were to list the groups I am a member of with their weights, I'd have the following:
default - 0
mod - 90
admin - 100
Because the admin group has the highest weight, that makes it the most superior, and therefore that is calculated to be my primary group.
If you want to see all groups and their weights, you can use /lp listgroups. To configure a weight for a group, use /lp group <group> setweight <weight>
So if I'm owner I set 100
The important thing is that superior groups have a higher weight than inferior groups. The exact weight doesn't matter, but you should use something that gives you ample breathing room in case you need to add groups later. I used 100, but you could use 500 or 1000 or whatever you like. Just don't get too crazy with it.
That works
Ok, but how do I create a group
!usage
:paperclip: https://github.com/lucko/LuckPerms/wiki/Usage
Hope this works....
Also, I just realized we're in #luckperms-api. This chat should be moved to #support-1.
☝
Can someone help me with api ?
How i can get prefix of the group where is the player ?
@reef nimbus the wiki has plenty of examples
Any way to depend on the common core of luckperms without depending on a platform of luckperms? Having to re-create context calculations and subjects for representation in a platform.
I’m guessing the API itself is not enough for that?
correct, it isn't
lots of graphing and context calculations classes that end up needing me.lucko.luckperms.common
If it’s not on the maven, I’d make a feature request on GitHub
Is there no way to grab transient permissions from LP API?
@jaunty pecan please add support for transient permissions via API.
Hey bloodshot! Please don't tag staff members.
yes there is already
how?
cacheddata already includes transient
OK so I see the transient permissions are contained within nodes and each node has a ContextSet along with a permission. So will there multiple nodes with the same contexts and different permissions?
Could be yes
Could you add a way to grab all permissions from a ContextSet without going through nodes?
I'm currently building it myself internally
would be nice to just do this via API
k got it all working internally 😃
I'm not sure what you mean by that
yea sorry i meant grabbing a Map<ContextSet, Map<String, Boolean>> for transient permissions
currently i have to build the map myself by going through all nodes
easier to handle over Node
how do I clear ALL permissions for a PermissionHolder?
ah found it
clearNodes
Anyone know if clearNodes(contextSet) will clear nodes that contain the set?
so for example, if a node has contexts [A,B,C] and you say to clearNodes passing context [A]
i assume not
nm figured it out 😃
how do you set an option?
Node only accepts boolean for value
ah buildMetaNode
got it 😃
If we want to use the LuckPermsApi for a BungeeCord plugin.
How should we import your API ?
Are we obliged to call it statically
LuckPerms api = LuckPerms.getApi();
Or there is another way to do so ?
Ok Thank you 😃
Probably a really dumb question, but i havent found the solution yet and im super tired, I am just wanting to pull the colored prefix of players for an event message to post in chat, but getting white text with the &color codes in it
MetaData userMeta = cachedData.getMetaData(contexts.get()) ;
String prefix = userMeta.getPrefix().;
String finalMessage = prefix+": "+player.get().getName()+": "+mess;
@dapper prism check the wiki. Under the developer section, the usage page contains plenty of examples
musta missed the one on colored prefixes, ill go back thanks
There really is no difference between colored prefixes and non-colored prefixes
sponge actually, but thanks
so maybe thought i missed something, but nope, just 1 usage example for bukkit, but hey ill just refer back to the only advice once more and check the wiki, thanks for at least trying to be helpful @surreal acorn and @crystal sonnet i could be wrong but i typically think its safe to assume someone asking for help has probably already googled a few times especilaly when they said they couldnt find a solution, sorry for being an idiot, but hey check the wiki again is helpful........ man i hate people who think being a dick does someone good
Hey LGCM! Please don't tag staff members.
ha wow alright yeah im out ill figure it out on my own thanks for bein so helpful brain, ill be sure to check those bukkit examples a few more times
I was gonna say the same
And not trying to be rude, but it's safe to assume that the person hasn't googled/searched for themselves
Which is sad
@LGCM#2297 And I'm still not really sure what your exact issue is
Lol. Goodbye then
Some people...
And thus LMGTFY was born! With their powers combined, Google, Yahoo, and Bing have dedicated their lives to fighting ignorance and the forces of evil!
Wait, maybe not Bing 😆
Was this a Power Puff Girls reference?
Nah fam that's captain planet!
Ok
hi is there a wiki for a list of commands? Also how do I delete someone from a group?
Unless you mean in-game commands? If so, you're looking for #support-1.
@winged radish
I am trying to use the LuckPerms API, but the part where the octo-boolean connects the protocol keeps on failing. It does work with another DNS, though. Is this a bug?
Also it comparates the IPv6 address, too.
parent add, instead of parent set
Wait, are you using the API?
if so, you add a group like any group, use the node builder and make it a group node
I have LuckPerms.getApi().nodeFactory.makeGroupNode("My rank");
How to add this node to a user
Can I use User#setPermission(node.build())
?+
@long moon
There is a wiki linked in the channel description which goes over all of this
Afaik that looks correct, but I don't have anything open to go look
I was on the Wiki on github (https://github.com/lucko/LuckPerms/wiki)
And i tried to access to "Modifying existing nodes" but i can't access it. It said "You do not have permission to update this wiki."
Maybe I've done something wrong but i don't think so.
Fixed 😃
Thanks
How can i get a list of all the Prefix that a player have ?
I tried to get that using user.getAllNodes() and them the Stream and the Filter Node::isPrefix
But then ?
I need one precise prefix who have a define weight in my Plugin but can't find a way to get this prefix using the API
Hey? My plugin isn't loading the LP API
at me.lucko.luckperms.LuckPerms.getApi(LuckPerms.java:55)
at net.modrealms.conversify.Conversify.onEnable(Conversify.java:74)
at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:226)
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:289)
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:112)
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)```
@Override
public void onEnable(){
luckPermsApi = LuckPerms.getApi();
// lots of other stuff
}```
depends: [LuckPerms]```
@rain lodge Did you shade the API in your plugin?
is there a way to see when a player has been promoted to a specific rank?
There’s an event fired when permissions change
I just want the date
How do I setup bytebin with WAMP?
bytebin is a java app
I’m trying to add bytebin to the Virtual Host
use a reverse proxy
I have no idea of your familiarity, nor do I use apache, but: https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html should help
I'm creating a plugin of kits
How do I check if a player is in a track and he also has a group?
I don't think tracks exist how you think they do. They just set up a handy advancement system. A group can be a member of a track, but a player can not. As far as the LP Player object is concerned, it's just a member of a group.
If you wanted to see that, you'd need to get a collection of all of the groups the player is a member of and then test each group to see if it's part of the track you want.
Is it possible to get a player's rank from a certain ladder?
Is there a way to get the user's groups? There's only a method for primaryGroup()
How can i check with the Api the Player Permissions in BungeeCord ?
i have this:
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
UserData cachedData = user.getCachedData();
Contexts contexts = Contexts.allowAll();
PermissionData permissionData = cachedData.getPermissionData(contexts);
but i dont know how i check the Permission
So i have this to check
@nocturne elbow If you're just wanting to know if a player has a particular permission regardless of context (judging by Contexts.allowAll()), then just use player.hasPermission("some.plugin.node"); from Bukkit.Entity.Player (I think that's the right namespace...)
Hey all, wondering if LP recognizes, and subsequently adapts, permissions added via this method? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/permissions/Permissible.html#addAttachment-org.bukkit.plugin.Plugin-java.lang.String-boolean-
It does 😃
This is more for general development, but it applies here too. Found this handy gif. https://media.giphy.com/media/xUPGcLrX5NQgooYcG4/giphy.gif
Literally the most important concept in computer science/programming
At least in OOP, yeah
I don't know a single paradigm where that knowledge isn't essential
@hollow grotto
You know, now that you mention it... I can't either.
I know only three things that are essential and present in pretty much every programming language or paradigm:
- pointers/references vs. values
- arithmetic
- conditional branching/if statements and loops
And ironically that's really all a computer can do
What's the command to give someone a permission?
Hello, I'm trying to set a meta node via the API, the node I'm trying to set is "limit = 2" and that is working so far, now, I want to increase that node. But setting a node with the same key does not overwrite the old key and just adds another "limit = 3". I couldnt figure out how to delete or overwrite a meta via key without having the value. Can anyone tell me how to delete a meta node when just having the key?
int permsamount = Main.lp.getUser(target.getUniqueId()).getOwnNodes().size();
List<Node> perms = Main.lp.getUser(target.getUniqueId()).getOwnNodes(); ```
this is the way im getting the permissions but it shows other stuff aswell which i dont want how would i fix this?
What's the problem you're trying to fix here? If you don't need the other data, don't use it.
Also, just use int permsamount = perms.size()
@vagrant dome
Is there any way to detect when a group receives or is removed permissions?
@opal salmon i want to get the players permissions but it shows like this https://paste.helpch.at/okabunovon.cs
List<Node> perms = Main.lp.getUser(target.getUniqueId()).getOwnNodes();
sender.sendMessage(C.color("&7Permissions &8(&e"+ perms.size() +"&8) &7: &e" + perms).replace("[", "").replace("]", ""));```
You are invoking List.toString here, which probably doesn't get the output you want.
I suggest doing a forEach on perms and sending the Node.getPermission()
Be aware that a permission might be negated, so check with Node.getValue()
@vagrant dome
@sweet path yes. There are events. Check the docs
They are generally pretty generic, so your best bet would be to filter them yourself
Hey can anyone help me with this?
https://github.com/lucko/LuckPerms/issues/1445
Thanks! 😄
nvm
was juuuust about to ask "what's wrong with the loadUser method?"
xD I didn't realize that method actually exists 😛
Step 1: Make a feature request/issue asking about a feature
Step 2: Check if that feature already exists
Fucking. Genius 🤪
@vagrant dome Please look into the documentation - Google is your friend
I did Google it and found nothing to what I need
@vagrant dome https://www.baeldung.com/foreach-java
So I'm running a copy of the plugin on the proxy (bungee) and the sub servers, from a proxy plugin how would i get an instance of the api?
Wrong channel, there is a wiki page on migrating
Does the Bungee plugin not instantiate an instance of the Api?
@gilded bane
Are you waiting until after LP has loaded?
Also make sure to not shade in the API @autumn tide
permission.getExpiry().getDay()+"d. "+permission.getExpiry().getHours()+"h. "+permission.getExpiry().getMinutes()+"m."
Should return 29days 23hrous 59minutes or similar
something to 30 days
Is that a question or a reply to someone?
Are you trying to make a GUI for LP?
Then I don’t understand what you’re even asking
I add a parent group for 30 days
Luckperms in console says 30 days
But api shows 1 day, 16h and 11mins
You are fast enough that I didn't manage to ask 😄
What could be an issue, that permission.getExpiry().getDay() doesn't show the correct day?
and others too
What does it say by now?
Didn't understand the question
Yes
Ok. Then I don’t know
😄
Will try debuging, maybe async causing the problem
Is time in getTime() in miliseconds?
Ohhh, I got it
permission.getExpiry().getDay()+"d. "+permission.getExpiry().getHours()+"h. "+permission.getExpiry().getMinutes()+"m." will show when it expires, not how much time is left
That makes sense
@crystal sonnet thanks for the reply to the issue, just closed it 😃
Hey Marshall Walker! Please don't tag staff members.
apply plugin: 'java'
group = pluginGroup
version = pluginVersion
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/groups/public/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
compile 'me.lucko.luckperms:luckperms-api:4.3'
}
import org.apache.tools.ant.filters.ReplaceTokens
processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}
I got this
But it doesnt download luckperms in extrernal libraries 😦
And in case you're curious why gradle is better:
https://github.com/AuraDevelopmentTeam/GradleCommon/blob/master/common.gradle
@quaint zinc
That's some stuff you can't do with maven
Or not nearly as easily
@crystal sonnet
BrainStone 🇺🇸🇬🇧🇩🇪Today at 5:52 PM
And in case you're curious why gradle is better:
https://github.com/AuraDevelopmentTeam/GradleCommon/blob/master/common.gradle
GitHub
What does that mean
Hey PixelNotFound! Please don't tag staff members.
And that file are the accumulated scripts and tricks I collected over time, put into one big script
hello
how do you set a player in a group
@quaint zinc That's a gradle script I linked
what does it do?
@crystal sonnet
Hey janschaaf! Please don't tag staff members.
@crude plover there are examples on the wiki
@quaint zinc A shit ton of different stuff
Okay
Everything I've found useful in 2+ years
BrainStone you are longer in the developer game. How can i sync my gitlab with my intellij project
I couldnt find the answer myself
Contains stuff like automatic versioning, tagging of versions, source code formatting, test suites, etc.
I don't know
Don't use InteliJ myself
Oh okay
Though just using git should work
I tried the git bash thing and followd the commands but it said that it couldnt find the commands
Try fixing that
Hey guys
I want get the all player groups, and I need help
I'm try this:
public static List<String> getGroups(Player player)
{
List<String> groupsString = new ArrayList<>();
if (player == null)
return groupsString;
LuckPermsApi api = LuckPerms.getApi();
if (api != null) {
Set<Group> groups = api.getGroups();
if (groups != null && !groups.isEmpty()) {
for (Group group : groups) {
if (group != null) {
if (player.hasPermission("group." + group.getName())) {
String displayName = group.getDisplayName();
if (displayName != null && !displayName.isEmpty()) {
groupsString.add(displayName);
}
}
}
}
}
}
return groupsString;
}
But it's not working
What is it doing then?
the groupsString retuns empty
Check the javadocs of getDisplayName. It might be that it returns nothing if no display name is set @nocturne elbow
String displayName = group?.getDisplayName() ?? group?.getName();
Erm, wait, ignore me
That's the weird C#/Java crossbreed code again
That should be very well documented.
I already solved this! tnks
It would be super cool if I could use 4.3.100 or whatever it is for my maven API work
If this thing worked it could be automatic.
This is why I don't like maven. I can't just pop in a jar dependency and call it good.
Just a quick note, to the mods:
LuckPerms GUI doesn't use API to change any of the groups, tracks or users information (permissions, etc). Plugin uses API to get information, but only for that. It runs commands as a player to change that information (like adding a prefix plugin runs command as a player /pl group $group prefix add "prefix"). So if user has any issues with Luckperms, it really isn't because of the GUI, and you can support those users
Doesn’t mean we know which ones it uses
And out of principle I don’t support unofficial addons
Maybe except the ones I know throughly
But it doesn't change any information via API, so that is equal as if player itself run those commands
You can dont give support to addons, but the base principle how GUI works is that evey change is made via commands
So if something doesn't work, GUI has not a slightest effect on it
Again. I don't know which commands it runs @brave saffron
Example: "lp user "+g.getName()+" parent add "+message
Sure
I get that
But I don't know which action runs which command
Also there could be errors in the implementation creating invalid commands
Especially with edge cases
Like spaces could be passed incorrectly
So unless you provide us with a way to know which commands have been run it's beyond our scope to help
And even if you do, you can't expect us to do support for your plugin
Even if it's an addon
Or do you provide addons for your plugin that you are not familar with (and didn't create)
Tools.sendCommand(p, "lp user "+g.getName()+" unset "+'"'+permission.getPermission()+'"'+" "+Tools.contextConverter(permission.getFullContexts()));
This command is used everywhere where I remove any permission
Posting your code won't change anything
Then I honestly don't understand you informing us that your plugin just uses commands
I sow a message that a person had issues with LuckPerms, and someone wrote that they don't support addons (even when the issue still existed without it)
So I just want to make clear that GUI doesn't change anything with API, everything is with commands
As long as they're not using commands, it's not our buisness. Even if it's not within your addon
So if a plugin runs the same command as it would be done normally, then it won't be supported?
If you have issues while changing any information, first try the same thing with LuckPerms commands before contacting me or LuckPerms developers!
Then this line is needed in the resource
Thanks for clarifying it
I can’t provide support if I don’t know the commands the user is running. Or the GUI running for them
Does UserManager.loadUser return a valid user instance even for players that never joined?
It should @opal salmon
thanks! :)
private static void setPrimaryGroup(UUID uuid, String group) {
if(!luckPermsApi.isPresent()) {
log.severe(String.format("Failed to set group %s for player %s - LuckPerms API not present", group, uuid));
return;
}
UserManager userManager = luckPermsApi.get().getUserManager();
CompletableFuture<User> userFuture = userManager.loadUser(uuid);
userFuture.thenAcceptAsync(user -> {
user.setPrimaryGroup(group);
userManager.saveUser(user);
log.info(String.format("Successfully assigned %s to group %s", uuid, group));
});
}
Output: Successfully assigned ((uuid)) to group member
But the database entry for this uuid is still default - what am I doing wrong?
Please, can someone have a look, it's kinda urgent 😅
@opal salmon This is how I do it. This is tested and it works.
public void addToGroup(Player player, String groupName) {
// player.sendMessage("In Add Method");
User user = loadUser(player);
Group group = luckPermsApi.getGroupManager().getGroup(groupName);
if (group == null) {
player.sendMessage("Group " + groupName + " not found!");
return;
}
Node node = luckPermsApi.getNodeFactory().makeGroupNode(groupName).build();
user.setTransientPermission(node);
}
Oh, wait, you're trying to set the primary group...
Thanks for your response!
I am, but this might be sufficient. Will test asap
fwiw this comes from a class I built called LuckPermsTool. When the plugin loads, I do the following:
// Hook LuckPerms
luckPermsTool = new LuckPermsTool(this);
if (luckPermsTool == null) {
log("Unable to hook LuckPerms!");
return;
}
log("LuckPerms hooked!");
Because the LuckPerms API is a hard dependency for this plugin, if it is unable to load it, then it calls return, which aborts loading the plugin.
Here's the relevant ctor
private final LFUtils plugin;
public LuckPermsApi luckPermsApi;
public LuckPermsTool(LFUtils plugin) {
this.plugin = plugin;
RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
if (provider != null) {
this.luckPermsApi = provider.getProvider();
}
}
After that, whenever I need to do something with LuckPerms, I use the tool.
@EventHandler
public void onAfkChangeEvent(AfkStatusChangeEvent event) {
IUser user = event.getAffected();
Player player = user.getBase();
// player.sendMessage("In AfkListener Event!");
// getValue = isGoingAfk()
if (event.getValue()) {
// plugin.luckPermsTool.addAfkPrefix(player);
plugin.luckPermsTool.addToGroup(player, "afk");
} else {
// plugin.luckPermsTool.removeAfkPrefix(player);
plugin.luckPermsTool.removeFromGroup(player, "afk");
}
plugin.nametagEditTool.refresh(player);
}
So...
user.setPrimaryGroup(group); returns DataMutateResult.FAIL
Any idea what might cause this? @crystal sonnet
Hey Flare! Please don't tag staff members.
sry
@opal salmon yes. Setting the primary group is not the same as assigning a group
And with default settings it does nothing, as the primary group is calculated automatically
You’ll need to assign the user the group
How do I get Displayname of a group with API?
group.getDisplayName()
Hey xCodiq! Please don't tag staff members.
Found it
plugin doesn't compile why?
- What went wrong:
Execution failed for task ':common:checkLicenseMain'.
License violations were found: src\main\java\me\lucko\luckperms\common\util\CaffeineFactory.java
@nocturne elbow make sure you're up to date with the plugin
@jaunty pecan you broke your plugin it seems
Woopsie
ok all fixed now
@nocturne elbow
oof
Does getPrimaryGroup return the group with the highest weight?
Also UserPromoteEvent doesnt seem to get called when I add a user to a group
probably because it only fires when you promote along a track
not sure but that would be my reasoning for it
Yeah that's kinda was I thought when it didnt work. Is there an event that gets fired when a player is added to a group?
How does getPrimaryGroup work?
Will it return the group with the highest weight the player has?
It depends
on what this option is set to
how do i get the player rank
rank or ranks?
in luckperms, players can inherit from multiple groups
you can get their "primary group" - maybe that's what you're looking for
What can cause a NodeMutateEvent?
Also is there a better event to check for when a player's group is changed than NodeMuate?
what’s a primary group?
uhhh depends on your settings. If you want to see what primary group would return for a player just do /lp user [player] info
@compact zinc NodeMutateEvent is fired on any change
Though check it's Java docs
@willow dust And the primary group is like "the most important group a player has"
LP only even has that becuase Vault mandates it
Anyone know how to get who gave a user a group/permission? Or when someone got it? I found api.getActionLogger(), however I can't figure out how to link it to api.getUser("").getPrimaryGroup()
I don't believe LP audits that by default. If it does, it's most likely in a log file somewhere, not stored in a database.
Why do you need to link it to a user's primary group?
Yes it stores that in the database @hollow grotto
@upper nacelle my guess is that you’ll have to iterate over the logs to find the most recent appropriate change
Oh? TIL. That's outstanding.
I am creating a system that shows who gave a player a rank and when. Looks like this might not be easily doable. rip
Yeah. The logs aren't really designed for that
And there could also be manual changes to the database
Your best bet might be to hook... there's an event for that, but I don't remember what it's called. I'd say watch for that event and then record that information yourself. If you use Helper, you can hook into an H2 or MySQL database pretty easily.
hi
Someone knows how to work with mysql?
just ask your question
is it possible to add a transient permission trough the LP api? and if it is how would do that is there some example i can look up?
or i just need ability to add and remove permission to a specific player
If it wasn’t possible, I wouldn’t have mentioned it 😉
Not sure if there are any examples on it, but all examples can be found on the wiki @hardy halo
Though in any case, the Javadocs should explain pretty much everything
yea i figured how to use it did what i needed, will see later if it works when he tests it @crystal sonnet
Hey Lynx! Please don't tag staff members.
Awesome
Hey all just sanity checking? User#setPermission(Node) where Node is a group node == add user to group?
I see User#setPrimaryGroup -- but I've handled that case, now just need to handle how to add a regular weighted group.
You are correct
And you can completely ignore the primary group method
It’s for settting which of players groups is the primary one. And not for changing the groups the plate is in @nocturne elbow
aha!
so I always use setPermission(Node) to get them in there, but setPrimaryGroup to actually signal the primary?
Yes. But by default the primary group is calculated automatically
So attempting to change it won’t even do anything
Just ignore it
Meaning what? Let me give some context on what I'm doing. I am creating a plugin to hook between AdvancedAchievements and LuckPerms. Essentially, when a user receives an achievement it runs through a list of arbitrary requirements on my end and then applies a group or groups. There is an option however to add a group that will be primary to the user. What's the proper way to set the primary group for a user?
(If it's calculated.)
It means that whenever the groups of a player change, LP looks at them and automatically selects one of them as the primary group
At least with the default settings
I see. Hmm ok. I was looking at this as if the primary group would override the weighted prefixes. However, if I'm wrong in that sense then I understand what you're saying by "ignore it"
Thank you!
Prefixes are completely independent of the primary group
Hey again. I have stopped worrying about primary groups -- however, even after receiving a successful DateMutateResult, according to lp user <player> info the group has not changed.
Here's my output indicating success: https://hastebin.com/adacetukom.md
Here's the code if you want to look: https://hastebin.com/esopabugeh.kt
Do I need to do something to merge immediately or something?
Mmm might need this! https://puu.sh/D0K5D/ce1cdcbfb5.png
No luck (😉 ) 😦
If the group is in a track, am I required to promote?
Have you like, considered saving your changes?
that's what im asking
do I need to do that? Docs do not state so
it says just call the method
Yes
as per my PM, ur bad ❤
There are plenty of examples on the wiki
link plz
Also check the Javadocs
yh
:paperclip: https://github.com/lucko/LuckPerms/wiki
yh thats what i ned
that does not contain any javadocs, and if it does where are they?
Oh boy...
bit rude mate cya
Lol. They left 😂
Oof
What
It clearly showed you were gone... my bad
Anyways I’ll go out of my way and help you with something that’ll help you a shitton in the future when working with Java
How are you including the LP API in your workspace @hybrid remnant ?
As I said. For basic stuff like that, there are examples on the wiki
And you haven’t answered my question
yes i have
I asked how you include the LP API
ohh im getting confused!
Can I start again, how would I go around implementing a way to give perms to players. Can I not just add LuckPerms to my build path
Also you should use gradle or maven
gradle i hate, ill use maven
Then it’ll automatically include javadocs and sources in your IDE
yh which is good
So hovering over classes and methods will show you the docs for that method
Yes, thats easier. Bukkit doesnt do that, how would I change a normal java poject into a maven one, or do i have to restart?
@hybrid remnant https://github.com/lucko/LuckPerms/wiki/Developer-API
Bukkit can also be included with Maven or Gradle
And in fact should
As that also will include javadocs
Which is beyond helpful
Though out of interest, what do you dislike about gradle?
Ik thanks. Can I make a java project into a j=maven one?
oh ok
I have had bad experiences with it... like when trying to make mods for forge and other cases
Ok. Really up to you
well thanks for the help
Though it’s far superior in pretty much every way. Except maybe popularity
And for a basic java project it’s ridiculously simple
Though in any case pick one and start familiarizing yourself with it
still trying to figure out how to display it if anyone can show me please https://github.com/lucko/LuckPerms/issues/1441
Hello! So I am working on a custom staffchat plugin for bungee. I am curious on how to use LuckPerms as an add-on, or if this is even possible.
Like get prefix or what?
Yeah
So I want to replace [prefix] with their prefix over bungeecord.
Pretty simple except for getting their prefix
Oh wait I just figured out that I can use vault to do this.
That makes a lot more sense.
Now the only other thing I have to figure out is how to check their permission. Will probably use vault also.
How to check for permissions:
Player p = how.yougettheplayer();
if(p.hasPermission("some.perm")) {
//if he has
//some code
} else {
//if don't has
//some code
}
Or moment, bungeecord
Not plain bukkit
That works for Bukkit Plugins, but I don't know if it works for Bungee too
It may work for bungee, but bungee perms are different then bukkit perms
@tacit tiger lp has it's api
For bungeecord?
hmm is there any documentation for using the bungee api?
@tacit tiger
@tacit tiger the LP API is the same for all platforms
why does api return "default" group as primary when player has another one on the server he is on
Is that player on the hub server and the world world when that line is hit in code?
@eager lark does helper have a higher group weight?
they posted in general, it does
LP is displaying the correct primary group (as you can see in that screenshot) but the API isn't
Ah ok
I think that's his IDE being over-protective
It's possibly seeing getUser and saying "that could return null"
But since the player should be online from what I understand, that should never happen
Yea, it didn't do that before
It’s likely throwing elsewhere
Let me try something hold on, I think I know what might be causing it
Oh, rip me. I didn't read that it was actually throwing.
Check line 30
private CommandSource source;
Weird, I just tried this and it worked
for (Player player : Sponge.getServer().getOnlinePlayers()) {
Bossbar();
Sponge.getServer().getBroadcastChannel().send(TextSerializers.FORMATTING_CODE.deserialize(LuckPerms.getApi().getUser(player.getUniqueId()).getPrimaryGroup()));
}```
and it said [Server thread/INFO] [minecraft/DedicatedServer]: default
Ah okay, I found the issue
Thanks for helping :p
Ok 👌🏻
lemme try that
No luck
I was doing this before and i received these errors in console
oh nevermind, just got it 😂
sorry to bother
Also you really should turn on line numbers
i do have it on, that's just a snippet of my screen
Ok
thanks for the help 👍
For future reference, I'll often break down code like this when I get errors like that.
{
try
{
var api = LuckPerms.getApi();
var user = api.getUser(player.getUniqueId());
var group = user.getPrimaryGroup();
}
catch (NullPointerException ex)
{
// ...
}
}```
Splitting it into multiple lines helps the JIT debugger when stepping through your code
(also I know the var keyword gets a lot of flak in Java but I'm a C# dev so fite me)
Just as a general rule, only use var when the type is obvious from context.
// good - user is a User
var user = api.getUser();
// bad - what is file? A string array? A stream?
var file = input.read();
yes the player the player was in the hub, the api don't found primary group
@hollow grotto you shouldn't be catching an NPE like that...If the user is not loaded, you should be attempting to load it. If it is still null at that point, then the user has never logged into the server.
use LP's UserManager
ah @sick elbow was making the call 😃
https://github.com/lucko/LuckPerms/blob/master/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java#L263
As per docs, it can return null if not loaded
I recommend always using the UserManager to handle all user operations
Good point. That was more of a demonstration of splitting your code into multiple lines for debugging purposes, though I should have mentioned the user manager.
thanks bloodshot 👍
@eager lark update to LP 109
I have updated.. nothing changed
tab dont found primary group from lp, on the server where you are
This should go into #support-1
Oh, was confused sorry bout that
any help for me? T-T
Ask in TAB support?
it's on bungee, ther's no vault version i think
@eager lark See my suggestion here: https://discordapp.com/channels/241667244927483904/420538367986499585/557391953776345088
Once you split all of the properties, put in some debug logic, either sending results to the player or the console, the console being preferred.
This will let you know what's failing, if you're not getting any explicit exceptions in the console
"i am not getting any exceptions
my code works
just their api returns something else"
from neznamy dev of TAB
any help? ç_ç
still trying to figure out how to display it if anyone can show me please https://github.com/lucko/LuckPerms/issues/1441
@me if you can help
Take a look at the Node class on the javadocs, it has methods for working out what type of node a node is
are you able to link me to it @long moon ?
i have no idea how to get it lol
You can literally browse it online with the link @vagrant dome
I mean I'm not sure how I would get just the players permissions from using node
You have a List of nodes, each of those does represents an entry on the users permissions, e.g. groups, meta, etc; There are methods exposed on Node, which allow you to check what type of node a node is, meaning that you can take that list and filter out what you want
does anybody know how to create a Node so i can add permissions to players on a server?
LuckPerms.getApi().getUser(p.getName()).setPermission(a node here);
thanks
I am wondering is there a way to get the next rank hierarchy in the API?

@keen tree You mean next highest group by weight or the next highest group in a track?
Both can be done, just very differently.
Just api in where I can find it. How to use/ call.
Just a quick question: is it possible to create and save a User from a UUID alone, without having an associated Player?
@gilded bane as far as I know, that should just work
Okay, just checking
Wasn't sure because getUser's docs say it throws a NPE if the user doesn't exist
I mean LP can handle unknown UUIDs just fine. I’d be surprised if the API didn’t
Hello all! Not sure if this is the right place, if not my appologies.
Completely new to Luck perms and how to make it work for me. I'm configuring a pixelmon server using the sponge version of Luck Perms in conjunction with Nucleus.
I've run into some problems...
-Though I've managed to set basic perms for users mods and admins don't get access to any of the admin level commands even if I can see the codes for these in the /lp group <group> edit tool.
-I'm also unable to find how to add basic minecraft commands like /gamemode to Luck Perms in a way that actually allows it XD
-I can not seem to figure out how to re-enable my ability to edit protected spawn areas.
-Lastly I have not been able to figure out how to set my self as server owner, with 0 restrictions.
I am using Nodecraft Server hosting.
Thank you all for your time and help! This Discord has become my last fallback for answers having spent a good 6 hours researching and testing last night
@deft scroll still need help?
I do!
Okay let's go to general since this is for API questions
i have pixelmon installed but the auto fill for pixelmon and pixel extras is not showing up in the editor neither is normal minecraft
@modern veldt
I am pretty sure you can search up the pixelmon permissions on google
Also this is API chat please use general
Did you give yourself the right group?
yes
i put the command it said into my user group and myself just the same need to be OP
stuff from nucleus works tho
Because you are doing something wrong with the permissions
This isn't a LuckPerms problem i am sure.
i just did another command it works
im trying to add the check spawns plugin for pixelmon and then it doesnt work but others seem to
Maybe the plugin isn't working at all, And it isn't a permissions error
luckperms or pixelmon
Hello, I'm trying to set the permission node keepinventory.enabled to false, but it doesn't seem to be working.
Would someone be able to tell me if I'm doing something wrong? Thanks 😄
You need to save your changes
Hi ! I use the bungeecord api and to get the suffix I have to get the context but I don't know how it work , my code is ```java
public String getSuffix(ProxiedPlayer player) {
User user = LuckPerms.getApi().getUser(player.getDisplayName());
Contexts contexts = LuckPerms.getApi().getContextForUser(user).orElseThrow(() -> new IllegalStateException("Could not get LuckPerms context for player " + player));
MetaData metaData = user.getCachedData().getMetaData(contexts);
String suffix = metaData.getSuffix();
System.out.println(suffix);
return suffix;
}```
Don’t use player.getDisplayName(). Use player directly when getting the user @sinful moat
Ok
The wiki also has examples on how to get stuff @sinful moat
The method getUser doesn't accept a ProxiedPlayer so I get the UUID
And it doesn't work
That doesn’t answer my question
But as I said. The wiki contains plenty of examples on how to get stuff from the API
I'm already looking for an exemple but I don't found
Did you find the examples at all?
I find that exemple Contexts contexts = api.getContextManager().getApplicableContexts(player); but if I replace api with Luckperms.getApi() it tell me that I have to cast it to an object
Yeah, create an object and then run that command LuckpermsAPI api = Luckperms.getApi();
LuckPerms chat-prefix not working on my minecraft server.. Why?
i have essentials-chat
please help
@here
This channel is for developers making use of LuckPerms' API
If you need help using LP, ask in #support-1
Okay 😄
I've a problem , I did everything you said but eclipse tell me I have to cast api , but it cast at LuckpermsPlugin
LuckPermsPlugin isn't part of the API; what dependency are you using
hi
Hey guys. Haven't really been active with Minecraft since college as well as work but I used to host the server called "RuneCraft" for five years.
I currently work as a SR Identity and Access Manager for a company and was looking for project opportunities to work on for identity governance to put on my resume. Do you guys need support in the development of your plugin?
Experienced in:
Creating connectors between third party applications and our enterprise application.
Creating schemas to extract consumer data and map it to the enterprise application.
Code optimization and documentation for enterprise applications.
@clever charm Luck is the sole writer of the plugin. Though I think he’s good for now
In any case, the plugin is open source, so feel free to jump onto issues marked as “help wanted”
I was at one point looking at hooking into the LP API and providing AD Sync, but that's sorta on the backburner.
Essentially it would allow mapping LP groups to AD groups and Minecraft users to AD accounts.
So when a player joins the server, it does a check for AD groups and ensures they're in all of the corresponding LP groups.
And when one is updated, it updates the other.
But due to the nature of the component, I definitely feel a stand-alone plugin would be better. That's probably best in your case too, Ri - I'm sure these tools would be useful for someone and may even get an honorable mention on the LP readme, but I feel that functionality might be a bit too localized for a majority of users to leverage.
Is there not a standalone plugin for that already @hollow grotto ?
Seems like something that would be developed already haha
No idea. This was just something on my to-do list
I've not actually researched it yet
Time to develop it before you kek
Tbch though, I'm not sure if that would've been developed already. We may be the only two people on the planet interested in hooking LP/Minecraft to AD.
Most people have no interest
I'd probably do this in two parts - an LD API that maps users by GUID to the corresponding AD GUID, and a second plugin which hooks that API and LP's to perform group syncs
That said, it'd probably need to be a read only API for safety reasons.
I doubt Minecraft's a very secure platform (doesn't need to be). I mean, it's secure enough for what it is, but if you give it write access to an AD environment, you gotta be very careful.
I'd much rather just support write requests than read requests since if you had the plugin able to read the ad user if it was misconfigured you could have staff members get members personal information on their ad account. If it was writing it could cause data issues if massive amounts of AD users were generated but at least the server wouldn't be able to read in PII.
The connectors would be writing
minecraft server to ad server, then having a third party application such as your website reading from the ad server.
If you wanted to read from the AD I'd have the server able to read from it but not allow any ingame commands even if the user is op if that is possibly from the Minecraft server. Haven't touched programming in minecraft for a while though so not sure what would be supported or not.
Hello, I want to use the API in a BungeeCord plugin. But I dont know where to "register" it. I just found this: https://github.com/lucko/LuckPerms/wiki/Developer-API#obtaining-an-instance-of-the-api
No need to register it. Just use it @nocturne elbow
So LuckPerms.getApi() is just enough?
Yup
getApi works on all platforms, but those platforms with a services manager have an additional way to retrieve it
I've mentioned this before, but while LuckPerms.getApi() works fine, for safety reasons I've wrapped it in a class called LuckPermsTool
public class LuckPermsTool {
private final LFUtils plugin;
public LuckPermsApi luckPermsApi;
public LuckPermsTool(LFUtils plugin) {
this.plugin = plugin;
RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
if (provider != null) {
this.luckPermsApi = provider.getProvider();
}
}
// Utility methods here
}```
That way, if lpTool.luckPermsApi == null I can abort the start of my program or else handle it as needbe. If it's non-essential, my utility methods are configured to be non-op (i.e. they don't do anything).
It also gives me one centralized location that I can use for any utility methods I may need, like adding/removing group memberships and so forth.
java.lang.IllegalStateException: API is not loaded.
How to be sure that it's loaded?
The safest way is probably the way described in my code sample above.
Since swallowing exceptions is considered bad practice, you can do something like this in your onEnable():
// Hook LuckPerms
RegisteredServiceProvider<LuckPermsApi> provider = Bukkit.getServicesManager().getRegistration(LuckPermsApi.class);
if (null == provider) {
log("Unable to hook LuckPerms!");
return;
}
log("LuckPerms hooked!");
Be sure to also place it in the dependencies section of your plugin.yml (assuming you're building a Bukkit plugin). This will delay Bukkit loading your plugin until at least all of its dependencies are loaded.
getApiSafe returns an Optional