#luckperms-api
1 messages · Page 43 of 1
Uh how is this lp api related?
Hello, I have problem. This function: user.data().remove(PermissionNode.builder(permission).build()); not removing permission node from user :/
Permission add works with similar function: user.data().add(...).
are you saving the user
Yeah
without saving and add function doesn't work
at this moment ADD works, REMOVE not
I tested to add permission without expire duration, and these function work
Keep in mind that NodeMap#remove(Node) will remove nodes that match every aspect of the node:
- Key (the actual "permission")
- Value (true/false)
- Expiry
- Applicable contexts
If you want to remove a certain permission regardless of expiry, contexts and value I suggest you do .data().clear(NodeMatcher.key(PermissionNode.builder()...))
That of course will remove every permission matching that key, ignoring value, expiry date and contexts
It works!!! Thank you 😉
Hi, can you help me with get a rank by player? (I don't want to use p.hasPermission())
!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, but i using bukkit api in Java...
Thanks, where i can get it?
get what
!api
Learn how to use the LuckPerms API in your project.
1st link
ok, i will watch it
I need some like this:
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(p.getUniqueId());
Group group = api.getGroup("owner");
if(user.inheritsGroup(group)){
}
sigh
cas gave you a link which shows how to do it
I can't use p.hasPermission(), because i need get and Operators...
what?
I need some like this, this is my code.
Sorry i have small misstake with Strings...
im not understanding what you need and what the problem is, i cant help you. sorry
You sended me link >> https://luckperms.net/wiki/Developer-API-Usage#checking-if-a-player-is-in-a-group, at this link is it, what i need, but i can't use "player.hasPermission()", because operators have all permissions.
Do you want to see what group(s) they are in or, if they are in one (boolean)
boolean, please
https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/GetGroupsCommand.java then check if the list contains a group?
Can you give me source code for condition?
what?
guys I am kinda stuck with the developer API and i cant find (probably just me looking a the wrong place) the solution or any information about what i need.
I'm trying to promote the player when they did a certain command (though a clickable text in a book)
but beside letting the console execute the promote command im wondering if it possible with the luckperms api
You mean promote on a track?
Get the track from the trackmanager which you can get from the LuckPerms API object, get the user from the usermanager and invoke the Track#promote(User) method
You can pass ImmutableContextSet.empty() if you want it to be global // with no contexts
aah awesome 🙂
https://pastebin.com/BxxhVRdc so just like this?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lgtm
cool i will test it later 🙂
Using user.getCachedData().getMetaData().getMetaValue("key-here"); - this returns null. What's the difference between that and doing user.getCachedData().getMetaData().getMeta().get("key-here").get(0);
Using that method that returns a list ^ I checked, and the data corresponding to key-name is there
Contexts
How do I pass that first method contexts?
You don't, the first one returns the values for the applicable data (i.e. where context applies); contexts let you define when and where a permission is applied, so if it doesn't apply it isn't calculated
Oh...nevermind it actually does work. The problem was that, I was setting the key keyName, and it looks like meta fetching doesn't support camel casing...?
I was getting with the key keyName and that was null.
oh yeah I think there's some woes regarding casing
should prolly make an issue or something
!issue
If you would like to request a feature for LuckPerms, or report a bug, feel free to open an issue on GitHub!
yeah but when querying it doesn't make it all lowercase
Right
So the issue is not that it's not saving with casing, it's that it's not querying with lowercase
yep
i want to make a secret command and when my friends type it they get a role without me being online, but without giving them OP to have acces to giving roles.
are you making a java plugin?
@hybrid panther im kinda noob, is there a plugin or should I learn with luckperms API?
Hey Panyel! Please don't tag helpful/staff members directly.
I thought that I there could be a way to override the permissions obstacle in bukkit-commands
I dont really know java to start doing a plugin.
I just need a way for my friends to get a role while Im away
user manager keep nulling on me?
5.2.113 Bukkit Luckperms
import net.luckperms.api.LuckPerms;
import net.luckperms.api.model.user.User;
import net.luckperms.api.model.user.UserManager;
UserManager u = luckperms.getUserManager();
Caused by: java.lang.NullPointerException
at me.reecepbcups.evnt.PlayerPicker.onCommand(PlayerPicker.java:119) ~[?:?]
Sounds a whole lot like your luckperms object is null
Are you actually getting the LuckPerms instance and assigning it to your luckperms object?
luckperms = getServer().getServicesManager().load(LuckPerms.class);
correct? inside of my constructor
wait, nvm. I am a dummy I believe
You should put it in the onEnable method
And ensure you add depend or softdepend of luckperms in plugin.yml
Hey there, is anyone able to tell me why I am getting this error when trying to change my users group?
broken pwfl plugin
lol
yeah, I don't understand why this isnt working, I took it straight from the cookbook!
ya i thought this was #support :(
That looks like... your Player object might be null?
👀
i resign my right to code
Lol
Does LuckPerms Api works on BungeeCord too?

It's platform agnostic, the main API usage pages explain how to get the LP API instance
!api
Learn how to use the LuckPerms API in your project.
!api
Learn how to use the LuckPerms API in your project.
@everyone


Indeed 
I am getting cacheddata meta when a player joins but it's returning null for keys that actually do exist
Is cacheddata only loaded after a join happens and that's why it's null? If so, what other method should I use to get meta / tell it to load all meta first
example?
on player join:
val = user.getCachedData().getMetaData().getMetaValue(key.toLowerCase());
// val is null, even though I am 100% sure that it exists by doing /lp user <user> meta info
I am wondering if cacheddata isn't cached until after the player joins, so it shows up as null
testing time!
it should be in the source
just wanted to know if you knew off the top of your head
How are you getting the user? PlayerAdapter or UserManager?
user manager
Works fine for me
does it return the correct value if you run it anytime later?
I think all of this is invalid...it works fine on my environment but not on my client's
Keep in mind that just because it shows in /lp user <user> meta info it doesn't mean they "have" the value; maybe there are contexts that don't apply, and even if there are none there are settings to make permissions not apply if they are global // have no context
!cookbook @sterile tree
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
why dose he have the default rank when i promoted him to a vip
Is this to do with the API?
whats api
There are two channels named support and you're asking in the one that has the thing you don't know what it is in the name .-.
well i dont look at the name i just want my help and im gone
General LP help in the support channels please
...
can i please just get a yes or no answer
If you ask in the right channel
is #luckperms-web the right channel?
I wonder
I wonder hmmm
Is there a way to get a list of the groups using the api?
Yes
how?
Groups a player has or all groups on the server?
all groups on the server
d;lp GroupManager#getLoadedGroups
@NonNull Set<Group> getLoadedGroups()```
Gets a set of all loaded groups.
a Set of Group objects
So like this. Set<Group> groupList = LuckPermsProvider.get().getGroupManager().getLoadedGroups();
Ye
alr ty
Hi, can I give player temporary rank in plugin by api?
I want to do something every time a command or permission is denied. What event would I listen to for that?
!cookbook check the SetGroup example, but in the node builder add an expiry
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
d;lp Builder#expiry
default B expiry(long duration, TimeUnit unit)```
Sets the time when the node should expire.
The expiry time is calculated relative to the current system time.
duration - how long the node should be added for
unit - the unit duration is measured in
the builder
okay, thanks 🙂
I don't think there is any, is that for your own permissions or for other plugins'?
For others
Darn - I was hoping to make setting up permissions for a new server / plugin easier. Thanks for the response.
No u
Oh ok
Thank you Abner!
@hybrid panther Is PermissionDeniedEvent something that exists or were you suggesting to create one?
Hey Magnum! Please don't tag helpful/staff members directly.
Suggesting it 😛
Gotcha! Thanks I misunderstood and I've been searching all over for it 😄 Yes that is a great idea. And sorry Clippy ^_^
how can i get the Luckperms rank player?
Like what group a player is in?
!cookbook has examples - I'm not super experienced with the API but I suggest the GerPrefixCommand for reference, just change it for group.
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
actually the API reference has a better example https://luckperms.net/wiki/Developer-API-Usage#finding-a-players-group
Hello
Is there a way on the luckperms api to get the history of groups of a user?
Where can i find a explanation of how to use those loggers sir?
You can look around the methods and classes in the JavaDoc
!javadoc third link
Learn how to use the LuckPerms API in your project.
Okay, thank you Fefo for helping me with this 👍
permission update event??
anything like that?
can't find anything in the API docs
Because permissions don't update, nodes are immutable
What are you wanting to achieve exactly?
I want to catch all the changes done by a user/console...when updating the permissions.
NodeAddEvent/NodeRemoveEvent?
Ohh yeah should should work
BTW
what is LogPublishEvent?

Probably to do with the log you get when someone makes a change with a command
But that's pure text, you would need to parse it yourself which egh
hmm I actually want pure text nothing much...
If you want to listen to updates in people's/group's permissions, NodeAddEvent/NodeRemoveEvent is what you're looking for
d;lp LogPublishEvent
public interface LogPublishEvent
extends LuckPermsEvent, Cancellable```
LogPublishEvent has 1 methods, 2 extensions, and 2 super interfaces.
Called when a log is about to be published to the storage file/table
oh wow
I have no clue what that is to be honest lmao
I guess I know what that is
It's never been in my interests list lol
lol ok thanks
as expected.
Hello, I'm using a BungeeCord network and want to use permissions for players which are currently connected to a different server. e.g. Player A is connected to server1 but I want to do permissions checks on server2. I know how to use the API and I can load the permissions for that user. For performance and code reasons I want to keep the permission data cached and I don't want to use the loadUser method with a CompletableFuture.
The UserHousekeeper does cleanup every 30 seconds all users which are older than 5 minutes.
What's the best way to keep the cached data in memory? Do I have to call UserManager.loadUser(uuid) every 3 minutes?
~~ xy 
It seems you are trying to avoid something tho... what is it you want to achieve exactly?
Hello, is there a way to keep an offline player's data loaded into cache?
lol didn't read that
I have a multi-bungee setup, and i need to keep data loaded across all the nodes
It’s not possible to customise the user uncache behaviour at the moment
But I could add an event for it I suppose
Hmm, yeah that would be very helpful
I have some sort of "bridge" api. E.g. I can use /city info <id> and get some informations from another spigot server for a worldguard region. Admins have more permissions and should be able to see more stuff there.
I would really appreciate that. Would be pretty clean and easy to cancel that DataUnloadEvent
in the meantime i guess we can just call the UserHousekeeper.registerUsage method every minute or so
@brazen spire
I mean that is not API but you could do that (although with registerApiUsage instead).
IMO if it's something like commands you can run them async and wait until the user loads, but if it's for things like events that require real-time checks you should be looking at some workarounds
Lol or that

Heyo! What's the best way of getting recently changed roles? Any return for when a role is set or a sort of log?
Working on making OBS alerts for role change hahaha
!cookbook has a listener example for that I believe
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Well it has something similar, check the player remove group whatever listener, but instead of that you can use either both NodeRemoveEvent and NodeAddEvent separately or both actions in a single NodeMutateEvent
So
I have this error
that pops up when I try to get a player prefix, it works in my test server, but on my client's server it's not working.
this is the method
and this is the starcase
Does anyone knows how to fix that
Tell them to update LuckPerms
You sure he has that version? That method has existed ever since v5.1
OH ye ye ye
I read it wrong
it's 5.0.72
do you know how can I get it with this version
?
Update
I mean they should 100% update..
No reason not to
Not you doing workarounds lol
They already have over 45 groups with alot of thing set up
If they don't delete the folder nothing will be lost
Are you sure that it won't harm the info
The data is stored in the folder, not the jar
All they have to do is replace the jar and that's it
Hey peeps, if we use canAccess for the serverInfo interface for bungee.api to check if a player has the right right perm, would this work with LP?
¯\_(ツ)_/¯ I don't see why it wouldn't
What was the node thing called that didn't get saved to storage?
transient
Oh yeah yesterday I was talking with someone about transient fields & serialization and then it hit me "that's why the transient node map is called transient" :P
Took me a while 😆
How do you add them? Can't find anything on the wiki
instead of data() use transientData()
ah thanks didn't look good enough then :p
can anyone help me on how i would clear all players from a group using the api?
tried to look through but cant seem to find it think im just dumb
was thinking of this but the group.getdata clear doesnt seem right at all
That will clear the group's permissions :d
Groups don't contain their "members" because it's not a group of people
Users have the group as parent. What you'll have to do is build an InheritanceNode for the group you want, use the UserManager#searchAll method to find everyone who has that node, iterate through the UUIDs, modify the user and remove the node
That's a bit of a process lol
Much
no easier way then? xd
I mean you could use a custom CommandSender class and make it run a bulkupdate command, record the output and run the confirm command ¯\_(ツ)_/¯ but that's hacky af and I wouldn't trust That to work all the time
How do I get the UUID of a permission holder?
Check if it's a user, cast and get
So there isn't a way to just get the uuid straight off of the PermissionHolder?
Well what if it's a group?
How do I check if the a permission holder is a group?
a) instanceof
b) check the identifier (PermissionHolder.Identifier)
@nocturne elbow After I updated the luckperms
Hey Ayouub! Please don't tag helpful/staff members directly.
The commands are not working anymore
any commands?
Yes
Or just LuckPerms'?
"nothing" as in..? Does it say no perms? Does it print any errors? Nothing prints anywhere but the action occurs successfully?
What about in console?
What client do you use?
MC client
What server & client version? Is ViaVersion installed on the server?
let me see rq
Loads of info :d
Spigot 1.13.2 and no
is ViaVersion installed?
no
*Error is a VV error*
Tell them to update ViaVersion and modules
So only update viaversion to latest update?
Yes
Alright ty
It's not my server, and They can't do anything about it because of some other plugins
Good luck to them making the server hold at least 1 player on 20TPS
How to get user prefix on bungeecord if luckperms is on spigot server and bungeecord
If everything is synced together you should be able to get it the same way you would do on Bukkit
!cookbook has an example command for getting the prefix
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
That example plugin is Bukkit oriented but the LuckPerms API itself is the same across all platforms!
How would I get the player's prefix as an adventure component?
you get it as a string and do the adventuring yourself
Hello!
i am attempting to get the time remaining of a specific node. any idea how to do this?
please @ me if you respond. Thanks!
i am currently checking if they have the permission node if (api.getUserManager().getUser(p.getUniqueId()).data().contains(time2, NodeEqualityPredicate.IGNORE_EXPIRY_TIME).asBoolean())
but no idea how to get the permission node they have
You should get the set of distinct permissions, loop through it and compare the key to get the one you want
d;lp PermissionHolder#resolveDistinctInheritedNodes
@NonNull SortedSet<Node> resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions)```
Gets a resolved and sorted view of the holders own and inherited distinct Nodes.
Effectively a sorted version of resolveInheritedNodes(QueryOptions), without duplicates. Use the aforementioned method if you don't require either of these attributes.
Inheritance is performed according to the platforms rules, and the order will vary depending on the accumulation order. By default, the holders own nodes are first in the list, with the entries from the end of the inheritance tree appearing last.
queryOptions - the query options
a sorted set of the holders distinct inherited nodes
Hey CodingMachine! Please don't tag helpful/staff members directly.
d;lp PermissionHolder#getQueryOptions
@NonNull QueryOptions getQueryOptions()```
Gets the most appropriate query options available at the time for the PermissionHolder.
For Users, the most appropriate query options will be their current active query options if the corresponding player is online, and otherwise, will fallback to the current static query options if they are offline.
For Groups, the most appropriate query options will always be...
This description has been shortened as it was too long.
query options
I need to get a list of OfflinePlayers that belong to a LuckPerms group. So a list of UUID's of players who belong to a group would be best. I have no idea how to even get close though. My best attempt so far is: gm.getGroup("groupName").getNodes(NodeType.INHERITANCE) Where gm is GroupManager. I don't know what to do from there. Thanks
Build an InheritanceNode for the group you want to get members of and then use the UserManager#searchAll method
d;lp UserManager#searchAll
<T extends Node> @NonNull CompletableFuture<Map<UUID,Collection<T>>> searchAll(@NonNull NodeMatcher matcher)```
Searches the normal node maps of all known Users for Node entries matching the given matcher.
matcher - the matcher
the entries which matched
hello, how do i add time to expiring permission?
for example player has "group.vip" for 30 days, and i want to add 30 days more
Build the InheritanceNode with an expiry and use the NodeMap#add(Node, TemporaryNodeMergeStrategy) method with the strategy as ADD_NEW_DURATION_TO_EXISTING
can you get the prefix from a Group?
Group -> getCachedData -> getMetaData -> getPrefix
Thank you! here's the actual code if anyone's looking at this in the future.
try {
UserManager lpUserManager = plugin.getLuckPerms().getUserManager();
InheritanceNode node = InheritanceNode.builder("groupName").build();
Map<UUID, Collection<InheritanceNode>> map = lpUserManager.searchAll(NodeMatcher.key(node)).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}```
Of course the actual list comes from map.keySet()
Hello! I'm trying to hook LuckPerms into my plugin that uses Guice. It works 100% LuckPerms hook on plugins that doesn't uses Dependency Injection.
If I could receive help to this, it would be nice n.n
I'm doing this on my onEnable method:
LuckPerms luckPerms = getServer().getServicesManager().load(LuckPerms.class);
luckPermsLine.register(luckPerms);
And this it's my listener of LuckPerms:
public class LuckPermsLine {
@Inject private PhoenixHub plugin;
// @Inject
// public LuckPermsLine(LuckPerms luckPerms) {
// this.luckPerms = luckPerms;
// }
public void register(LuckPerms luckPerms) {
EventBus eventBus = luckPerms.getEventBus();
eventBus.subscribe(this.plugin, NodeAddEvent.class, this::onNodeAdd);
eventBus.subscribe(this.plugin, NodeRemoveEvent.class, this::onNodeRemove);
}
private void onNodeAdd(NodeAddEvent e) {
if (!e.isUser()) {
return;
}
User target = (User) e.getTarget();
Node node = e.getNode();
this.plugin.getServer().getScheduler().runTask(this.plugin, () -> {
Player player = this.plugin.getServer().getPlayer(target.getUniqueId());
if (player == null) {
return; // Player not online.
}
if (node instanceof InheritanceNode) {
String groupName = ((InheritanceNode) node).getGroupName();
player.sendMessage(color(String.format("&8&l* &fThe &b%s &frank has been added on you.", groupName)));
// scoreboardAPI.setScoreboard(player, "normal");
}
});
}
Did you /reload or use plugman?
Nope, I don't use any plugins of that style
It happens when I change of the parent on a Player, where I want to make an action
(For testing I commented line that injects dependency of another class)
I think it's the plugin instance on the task, but no idea about how to fix it
Does it work if you don't pass the plugin instance the eventbus subscribe method?
I have no idea what's going on lmao
Oops, it calls here too the plugin instance
could the command need an explicit context for some reason
And if I comment that I suppose wont work the listener
You can subscribe to events without passing a plugin
I don't think about that
that's what I meant by that
Guice 
Does the plugin cache a player on all servers if they join one server
or would I need to use User#loadUser
LP is per-server and afaik won't cache on others
i don't recall there being infrastructure for that but @nocturne elbow would know for sure
fefo has actually read the code
what's so bad about it?
I hate futures
why lol
futures are... the future!
I need to return the players primary group weight
and returning in futures is.. annoying
if you don't mind bogging down your main thread a bit why not just .get() the future as soon as you call loadUser
i cant imagine it'll take too long anyways after the first call for any user
cuz caching
for API calls the user will be loaded for 5 minutes tops
I forgot about .get
I can just do it async right
I mean.... futures are async
future = async
.get blocks thread
ok larry
😄
The idea with that is that you do
luckPerms.getUserManager().loadUser(uuid).thenAccept(user -> {
// user & async :D
});
man I need to return the users group
anyone
you cant return inside thenAccept its dogshit
afaik thenAccept will run it on the same thread as the other CompletableFuture's method; thenAcceptAsync will run it on the specified executor (or on ForkJoinPool if none is specified I think)
I’m checking when someone does /sudo the target’s group weight isn’t higher than the executor
private String groupname(UUID uuid){
luckperms.getUserManager().loadUser(uuid).thenAccept(user -> {
LuckpermsGroupObjectThing group = user.getmethegroupPLEASELuckperms;
return group.pleaseGiveMeTheNameLuckPerms }
then... move everything in the future method?
if it were me i'd probably check a specific meta value rather than just the group weight
there's the pseudocode kekw
larry that's not how futures work lmao
you're not how futures work
yeah yeah yeah
i had to rewrite chunks of code
but where are you wanting the weight
it scared me
you just instantiate the string outside and assign inside right?
Inside the command class
then you can totally do everything inside the thenAccept consumer
heck, even the command itself
the thing is I’m trying to create a simple util for my core
and it should do PermissionUtil.getWeight(uuid) and compare it to another weight
ygm?
Then return a CompletableFuture<Integer> 

I mean it's your call, either do things safe for the server and run them async or use CompletableFuture#join() every time it gets called
Your choice ¯_(ツ)_/¯
my totally super awesome beginners guide to completablefutures, in case you haven't stumbled across it already: https://luckperms.net/wiki/Developer-API#using-completablefutures
yes, that 😎
I know how it works
but its just
so shit compared to javascript’s one
I agree, it's not the best
How can i get the group of a player in JoinListener?
!cookbook has 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.
tanks
Is LP on the server
Hello, I'm getting prefix always as null with code:
User permsUser = plugin.getPerms().getPlayerAdapter(ProxiedPlayer.class).getUser(player);
String prefix = permsUser.getCachedData().getMetaData().getPrefix();
when I perform command /lp group vip info it says prefix is set. Any help, please?
What does '/lpb user <user> info' say?
Thanks, through /lpb it's working.
To remove grade for player I can use this code ? https://pastebin.com/5k6Hy12G
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
what is this code :
user.data().clear(NodeType.INHERITANCE::matches)
Removes every parent of a player
Yes

👍
LuckPerms api = LuckPermsProvider.get();
User u = api.getUserManager().getUser(p.getName());
u.data().add(PrefixNode.builder(chatCode, Integer.parseInt(nc.getConfigValue("NickColor.Priority"))).build());
api.getUserManager().saveUser(u);```
should that be adding a prefix node bc it isnt working for me
no errors, just no updates
What is "chatCode" exactly? Does it show in /lp user <user> meta info after saving the data?
but what are the contents of that string
what LP version?
that works fine for me 
keep in mind that "color codes" will be rendered in meta info and formatted so check you don't have something like this showing up:
if you hover over it it will show the raw data
wdym
ok lol
:)
wdym?
like with /lp setprefix
instead of /lp addprefix
bc I end up with multiple at the same priority
I guess you could have something like hmm
user.data().clear(node -> NodeType.PREFIX.matches(node) && ((PrefixNode) node).getPriority() == 1233);
u.data().clear(node -> ((PrefixNode) node).getPriority() == Integer.parseInt(nc.getConfigValue("NickColor.Priority")));```
is producing me.lucko.luckperms.common.node.types.Inheritance cannot be cast to net.luckperms.api.node.types.PrefixNode
Because you are not checking if the node is a prefix node
Check what I did there @dire remnant
Ah right, sorry haha
You can also make it even nicer:
int i = Integer.parseInt(nc.getConfigValue("NickColor.Priority"));
user.data().clear(NodeType.PREFIX.predicate(node -> node.getPriority() == i));
does the casting for you :)
Luck himself 
Tyvm sir haha
Hi
Omg hi
Check the methods in the NodeBuilder class https://javadoc.io/static/net.luckperms/api/5.3/net/luckperms/api/node/NodeBuilder.html#method.summary
More specifically the value(boolean value) and expiry(long duration, TimeUnit unit)
You can see an example for building & adding a permission in general in the AddPermissionCommand example in the api-cookbook https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/AddPermissionCommand.java
oke realy thanks
How I can remove permission?
I try this
Node node = Node.builder("ray.chat").value(false).build();
DataMutateResult result = user.data().remove(node);```
or this
```java
Node node = Node.builder("ray.chat").build();
DataMutateResult result = user.data().remove(node);```
but don't work
are you saving the user
save user?
Yes
UserManager#saveUser(User)
hmm I don't understand how this work ;/
d;lp UserManager#saveUser
@NonNull CompletableFuture<Void> saveUser(@NonNull User user)
throws NullPointerException, IllegalStateException```
Saves a user's data back to the plugin's storage provider.
You should call this after you make any changes to a user.
user - the user to save
NullPointerException - if user is null
IllegalStateException - if the user instance was not obtained from LuckPerms.
a future to encapsulate the operation.
Node node = Node.builder("ray.chat").value(false).build();
Main.luckPerms.getUserManager().modifyUser(Bukkit.getOfflinePlayer(args[0]).getUniqueId(), (User user) -> {
DataMutateResult result = user.data().remove(node);
});```
that should work yes
Node node = Node.builder("ray.chat").value(false).build();
Main.luckPerms.getUserManager().modifyUser(Bukkit.getOfflinePlayer(args[0]).getUniqueId(), (User user) -> {
DataMutateResult result = user.data().remove(node);
if (result.wasSuccessful()) {
sender.sendMessage("§aWork");
} else {
sender.sendMessage("§cError");
}
});```
and 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!
remove will also remove the node that matches all of the qualities:
- Node key (a.k.a "permission")
- Node value (true/false)
- Contexts
- Expiry
oh
You should use clear(NodeMatcher.key(node)) or something similar
oke realy thanks
but question
I can get result this?
or I can only check before clear this?
You can use contains before clear I guess..?
yea
sorry but I don't understand parameters
It takes a Node no?
Node first
d;lp nodemap#contains
@NonNull Tristate contains(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate)
throws NullPointerException```
Gets if this instance contains a given Node.
Returns Tristate.UNDEFINED if the instance does not contain the node, and the assigned value of the node as a Tristate if it is present.
node - the node to check for
equalityPredicate - how to determine if a node matches
NullPointerException - if the node is null
a Tristate relating to the assigned state of the node

question how I can read time (Expiry) with permission player?
and where I can learn this? xD
long time = user.getNodes(NodeType.PERMISSION).stream()
.filter(Node->Node.getPermission().equals("ray.chat"))
.filter(Node::hasExpiry)
.filter(permissionNode -> !permissionNode.getValue())
.map(Node -> Node.getExpiry().get(INSTANT_SECONDS))
.mapToLong(Instant-> Instant)
.max()
.orElse(0);```
but this don't work
how I make bad?

@nocturne elbow You can help me? I want make mute and unmute work on luckperms
Hey Raymano! Please don't tag helpful/staff members directly.
and I try read time to end mute xD
Is it possible to do a BulkUpdate with the API? If so, how?
Is there any way to get the members of the group?
I mean... couldn't you just check for the permission if they want to chat with Player#hasPermission(String permission)? If it didn't expire it will evaluate to false, and if it did expire it got removed and it will evaluate to (presumably) true
There is not a bulk update API currently, you would have to make the operations manually. What is it you're trying to do exactly?
Build an InheritanceNode for the group you want to search its members UserManager#searchAll(NodeMatcher matcher) method https://javadoc.io/static/net.luckperms/api/5.3/net/luckperms/api/model/user/UserManager.html#searchAll(net.luckperms.api.node.matcher.NodeMatcher)
yea I make this
but I want read time to end mute
Ah
That should work..
what's the code you're running exactly?
@EventHandler
public void chatEvent(AsyncPlayerChatEvent e) {
final Player p = e.getPlayer();
if (p.hasPermission("ray.chat")) {
String message = Tab.Color(NonBukkitMethods.getTagPrefix(p)) + ChatColor.translateAlternateColorCodes('&', p.getDisplayName()) + "§r: " + translateColorFormat(filterChat(e.getMessage()), e.getPlayer());
for (Player online : e.getRecipients()) {
online.sendMessage(message);
}
} else {
Main.luckPerms.getUserManager().modifyUser(p.getUniqueId(), (User user) -> {
final Instant expiry = user.getNodes(NodeType.PERMISSION).stream()
.filter(Node -> Node.getPermission().equals("ray.chat"))
.filter(Node::hasExpiry)
.filter(permissionNode -> !permissionNode.getValue())
.collect(Collectors.toList()).get(0).getExpiry();
System.out.println(expiry.get(ChronoField.INSTANT_SECONDS));
long time = user.getNodes(NodeType.PERMISSION).stream()
.filter(Node->Node.getPermission().equals("ray.chat"))
.filter(Node::hasExpiry)
.filter(permissionNode -> !permissionNode.getValue())
.map(Node -> Node.getExpiry().get(ChronoField.INSTANT_SECONDS))
.mapToLong(Instant-> Instant)
.max()
.orElse(0);
p.sendMessage("§cYou have been muted on " + time);
});
// p.sendMessage("§cYou have been muted");
}
e.setCancelled(true);
}```
like this ?
Group group = luckPerms.getGroupManager().getGroup(group_name);
Inheritance inheritance = Inheritance.builder(group.getName()).build();
NodeMatcher<InheritanceNode> matcher = StandardNodeMatchers.key(inheritance);
for (UUID uuid : luckPerms.getUserManager().searchAll(matcher).join().keySet()) {
}
Yes but uuh you shouldn't be using internal classes and methods 😅 you should stay with the API only as it is not subject to change between patch versions https://luckperms.net/wiki/Developer-API#adding-luckperms-to-your-project
final Instant expiry = user.getNodes(NodeType.PERMISSION).stream()
.filter(Node -> Node.getPermission().equals("ray.chat"))
.filter(Node::hasExpiry)
.filter(permissionNode -> !permissionNode.getValue())
.collect(Collectors.toList()).get(0).getExpiry();```==good value (2021-03-08T13:55:44Z)
but
```java
expiry= expiry.get(ChronoField.INSTANT_SECONDS)```==null
maybe posibble read this time as on website (luckperms editor)?
It works fine for me though, I'm doing the following
final User user = this.luckPerms.getPlayerAdapter(Player.class).getUser(player);
final Node node = PermissionNode.builder()
.permission("test.permission")
.value(false)
.expiry(5L, TimeUnit.MINUTES)
.build();
final Instant expiry = user.getNodes(NodeType.PERMISSION).stream()
.filter(Node::hasExpiry)
.filter(NodeMatcher.equals(node, NodeEqualityPredicate.IGNORE_EXPIRY_TIME))
.map(Node::getExpiry)
.findFirst().orElse(null);
Hey, I have a question not target at the API of LuckPerms but at the build process of LuckPerms itself. I am running a arch linux machine and I executed
./gradlew build. This doesn't output any thing inside of build besides build/loom_cache folder.
If I check bukkit/build/libs I find a bukkit-5.3-SNAPSHOT.jar and a luckperms-bukkit.jarinjar file. These files don't seem to be the final compile output since stuff like "plugin.yml"
are missing. Which steps do I have to complete the compiling process and end up with a LuckPerms-bukkit-5.3-SNAPSHOT.jar that is drag-and-drop ready for a minecraft server?
The final jars for Nukkit, BungeeCord, Bukkit and Bukkit Legacy are now located in the [platform]/loader/build/libs dir
The rest (Velocity, Fabric and Sponge) are located in their regulars [platform]/build/libs dir
Thank you! This works perfectly now!
hello should i use
InheritanceNode.builder("vip")
or
InheritanceNode.builder("group.vip")
?
i didn't understand the meaning of "group"
okay ty
@nocturne elbow are you sure I can't use anything to do a bulkupdate inside of my own plugin?
Hey ignPurple! Please don't tag helpful/staff members directly.
There is no API for it. Of course you can use internal classes and all
Yea
Which isn't advised :p
I didn't directly mean the API
you initially did lol
Is it possible to do a BulkUpdate with the API?
I meant is there something inside of the API to do it?
Or would I have to use other classes which aren't apart of the api
what are you trying to do exactly?
At the end of a season I want to clear playerdata and remove only certain permissions
I mean you could use UserManager#searchAll(NodeMatcher matcher) to find all players with a certain permission, loop through them and do the thing but that will run the operation for each individual user, not as an operation in bulk
Lately I was thinking of adding API for it but uuh yeah, can't and it would be due to v5.4 anyway so lol
BulkUpdateBuilder builder = BulkUpdateBuilder.create();
builder.dataType(DataType.USERS);
builder.action(DeleteAction.create());
QueryField field = QueryField.PERMISSION;
Comparison comparison = StandardComparison.parseComparison("==");
builder.query(Query.of(field, Constraint.of(comparison, "essentials.fly")));
plugin.getStorage().applyBulkUpdate(builder.build()).whenCompleteAsync((v, ex) -> {
if (ex == null) {
plugin.getSyncTaskBuffer().requestDirectly();
}
}, plugin.getBootstrap().getScheduler().async());
}```
@nocturne elbow
Hey ignPurple! Please don't tag helpful/staff members directly.
Wonder if that would work ya know
this pls
I'll eventually read it anyway though
and yeah that should work, although StandardComparison is an enum so you can just StandardComparison.EQUAL
Ah didn't realise it was an enum then
yea this work for me but how I try get time to end mute I can't
getExpiryDuration
Also collect(Collectors.toList()).get(0) can (and should) be replaced with findFirst().get()
oh realy thanks ❤️
Realy you helped me a lot
I use max()
Hi, I want to get group list as ArrayList, it is possible ?
whats the equivalent of pex user %player% add %permission% with luckperms ?
wrong channel also
GroupManager#getLoadedGroups() returns a Set<Group> which you can then pass into new ArrayList<T>(Collection<T>), may I ask why you need exactly an ArrayList?
are there like events (eg. LuckRankChangeEvent, or something in this type)?
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Hi
Can someone explain me how does luckperm sync messages work between server and server?
I think Vaulut read luckperms and other plugins read Vault
They are talking about something else
How can I get the hightest group of the player
Hi, If i want to extend the expiry time of a Node I need to remove it and re-add it with the new time?
No need to remove it, you can call this one method instead https://javadoc.io/doc/net.luckperms/api/latest/net/luckperms/api/model/data/NodeMap.html#add(net.luckperms.api.node.Node,net.luckperms.api.model.data.TemporaryNodeMergeStrategy)
Is it me or did it not format the <>
mobile?
Yep
literally trash app lol
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
return provider;
}
}```
Its not working, but why?
Send error
!api
Learn how to use the LuckPerms API in your project.
Here, I mean that
is there a way to quickly set a player's group instead of getting the NodeMap, remove the old group, then add the new group?
is there a way to set a user's group without running the command? So trough the luckperms api?
The cookbook is a working example plugin which shows how to get/change data for users and groups, listen to LuckPerms events, and more.
Thanks, I will take a look
I see when he adds a user to a group. But I want to specify context world=(worldName)
@turbid solar
Hey Creatos! Please don't tag helpful/staff members directly.
Ah okay
Thanks sorry to bother you ♥
Another question, I am looping trough the nodes a player has and I want to check if the node is a group and if it has a certain name. How would I do that? I don't know what nodetype I should look for
InheritanceNode
Thanks btw, and how would I go about getting a list or collection of all users from a group?
Do I also get it from the InheritanceNode?
Use that method alongside the InheritanceNode you built, you can see the methods NodeMatcher has to create one https://javadoc.io/static/net.luckperms/api/5.3/net/luckperms/api/node/matcher/NodeMatcher.html#method.summary
Thank you for your help, I will try this out!
api.getGroupManager().searchAll(/* ??? */);```
This is what I currently have but I dont know what to put in the seachAll fucntion
you can see the methods NodeMatcher has to create one https://javadoc.io/static/net.luckperms/api/5.3/net/luckperms/api/node/matcher/NodeMatcher.html#method.summary
NodeMatcher.key(node) ?
Well I want to get all users with the group node
I think this is it
api.getUserManager().searchAll(NodeMatcher.equals(node, NodeEqualityPredicate.EXACT));
Keep in mind that also takes into consideration the duration and the contexts of the node
Duration? Duration of what?
Expiry time
Ooh
Temporary permissions
I didn't know that luckperms had expiry times
I don't use any expiry times so I think thats okay
but do I convert the return value to users?
CompletableFuture<Map<UUID, Collection<Node>>>
and then loop trough the keys
Yeah and loadUser
Hmh, when Im on the docs and search for something I often get a page with no information. Is that normal?
Hm?

Hello, can anyone show me an example on how to use UserPromoteEvent (https://javadoc.io/static/net.luckperms/api/5.3/net/luckperms/api/event/user/track/UserPromoteEvent.html)
I want to get the name of the rank player gets after promotion
Thanks 🙏
I had the same error, and I am still having it, I just closed the site and opened again and it was solved
Does it need a type of @EventHandler??
No, LuckPerms uses its own events system, independent from the platform one, all explained here https://luckperms.net/wiki/Developer-API-Usage#events
Dankje
so its necessary to add a constructor of the class to do the thing like
public MyListener(MyPlugin plugin, LuckPerms luckPerms) {
this.plugin = plugin;
EventBus eventBus = luckPerms.getEventBus();
// 1. Subscribe to an event using an expression lambda
eventBus.subscribe(this.plugin, LogPublishEvent.class, e -> /* ... */);
// 2. Subscribe to an event using a statement lambda
eventBus.subscribe(this.plugin, UserLoadEvent.class, e -> {
// ...
});
// 3. Subscribe to an event using a method reference
eventBus.subscribe(this.plugin, UserPromoteEvent.class, this::onUserPromote);
}
well that's just an example, but you subscribe to an event through the event bus, yes
!cookbook you can check out this example plugin, see how it does event listeners; it doesn't contain an example of every single thing you can do because that is straight up not viable lol but you should get an idea on how it should be done
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
Learn how to use the LuckPerms API in your project.
some code examples: https://github.com/LuckPerms/api-cookbook/blob/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java
!jd
Sorry! I do not understand the command !jd
Type !help for a list of commands.
!javadocs
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.
Has example
thanks, but what's the playerAdapter class for? Could you explain please?
Hello
When I'm getting prefix of player with this:
user.getCachedData().getMetaData().getPrefix();
It provides an NPE
How fix it please ?
I'm using API 5.3
You'll need to share a fair bit more of code than just that; also consider closing the issue on GitHub if you will ask for help in here
Ok nevermind
wat

There is literally no person on earth capable of knowing what is causing that issue with just that single bit of code
My guess is that you are running UserManager#getUser on an offline/unloaded player but I just can't know
It's a String variable in a Scoreboard
which is = to getPrefix
It's to show prefix of rank in SB
You'll need to share a fair bit more of code than just that
String prefix = AzoltAPI.getLuckPerms().getUserManager().getUser(board.getPlayer().getName()).getCachedData().getMetaData().getPrefix();
board.updateLines(
"",
"§e"+ChatUtils.CharUtils.ARROW_RIGHT+" §f§l"+p.getName(),
"§7Grade: "+prefix,
"",
"§7Joueurs: §a"+ BungeeUtils.getPlayersCount("ALL"),
""
);
Here is my scoreboard
It takes a UUID or a String (the player name)
String
Should I try with UUID ?
It wouldn't change a thing I reckon
purpur is very indirectly a fork of bukkit
What stack trace ?
the error
[23:35:42 WARN]: [AzoltHub] Task #12 for AzoltHub v1.0 generated an exception
java.lang.NullPointerException: null
at fr.azoltcraft.hub.manager.ScoreboardManager.update(ScoreboardManager.java:15) ~[?:?]
The line 15 is the String prefix = ...
the entire stack trace
The entire thing
[23:35:42 WARN]: [AzoltHub] Task #12 for AzoltHub v1.0 generated an exception
java.lang.NullPointerException: null
at fr.azoltcraft.hub.manager.ScoreboardManager.update(ScoreboardManager.java:15) ~[?:?]
at fr.azoltcraft.hub.tasks.ScoreboardUpdateTask.run(ScoreboardUpdateTask.java:21) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Purpur-1012]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Purpur-1012]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1378) ~[patched_1.16.5.jar:git-Purpur-1012]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:392) ~[patched_1.16.5.jar:git-Purpur-1012]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1291) ~[patched_1.16.5.jar:git-Purpur-1012]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1017) ~[patched_1.16.5.jar:git-Purpur-1012]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:179) ~[patched_1.16.5.jar:git-Purpur-1012]
at java.lang.Thread.run(Thread.java:834) [?:?]
Are you sure the player board.getPlayer() returns is online? I'm guessing getUser is returning null
Try printing what getUser returns
It's me the Player
I'm Online
you dont know that its actually returning the player unless you print it
"it should be" != "it is"
I understand nothing wtf
Try printing what getUser returns
System.out.println(board.getPlayer())
getUser
anyone know how to get player's highest groups' prefix?
Not the final prefix the player has?
@nocturne elbow The one they chat with
Hey Mal! Please don't tag helpful/staff members directly.
:(
(:
You can do that with a single line tbh
luckPerms.getPlayerAdapter(Player.class).getMetaData().getPrefix();
assuming luckPerms is a valid object of type LuckPerms
replace Player.class with the player type of the platform you're on (e.g. ProxiedPlayer.class on BungeeCord)
yw
Hey Mal! Please don't tag helpful/staff members directly.
ah right
you have to give it a player lmao
to getMetaData
totally didn't forget that, totally makes sense to not pass a player lol
where
you have to give it a player lmao
to getMetaData
Right, because you don't getUser
Yee
ty
Yw
@nocturne elbow sorry for ping but to defaults not have a group perm node?
Hey Mal! Please don't tag helpful/staff members directly.
like group.default
sorry for ping
*proceeds to ping*
Every player has at least one inheritance node
Not sure what kind of situation you are in so I can't really answer any specifics either
@nocturne elbow I am trying to sort a tab list
Hey Mal! Please don't tag helpful/staff members directly.
shit
Can you stop the pings? For real, I'll read the message anyway
Right... to which I say
Every player has at least one inheritance node
Not sure what kind of situation you are in so I can't really answer any specifics either
What is making you think that is not the case?
Well how could I get a players every gorup
What?
How can I get the expiry time of a group, not permission node? I am coding a command which, given you have a specific rank, it will tell you the time left of you having it.
I can't find anything about checking when a group is going to expire in the docs
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
P.S. I am more or less still noobish at minecraft plugin development, so don't hate on me if my code is kind of sloppy. 
!api as documented here, groups on players or other groups are stored as permission nodes group.groupname
Learn how to use the LuckPerms API in your project.
How can I get the expiry time of a group, not permission node?
you get the expiry time of the group node
Wouldn't that appear for operators though, or people with * it would be indefinite?
people with * don't have all groups, nor ops. I am not quite sure how luck handles it, but it's handled
@long violet you can check this SetGroupCommand example and do something similar but in a PlayerJoinEvent instead of a command
https://www.github.com/LuckPerms/api-cookbook/tree/master/src/main/java/me/lucko/lpcookbook/commands/SetGroupCommand.java
thanks
@nocturne elbow that is correcly?```
OfflinePlayer player = Bukkit.getOfflinePlayer("oldplayer");
Player p = e.getPlayer();
api.getUserManager().modifyUser(player.getUniqueId(), (User oldP) -> {
User newP = api.getPlayerAdapter(Player.class).getUser(p);
Group group = api.getGroupManager().getGroup("time");
Node node = InheritanceNode.builder(group).build();
newP.data().add(node);
oldP.data().remove(node);
});```
Hey Amonly! Please don't tag helpful/staff members directly.
i have tryed looking to see how i would get the if statement to see if the user has a rank and then if so it sets the chat formating to be with the user prefix
public class ChatEvent implements Listener {
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent e){
String format = LogicFlame.plugin.getConfig().getString("ChatFormat");
Player pl = e.getPlayer();
User user = LogicFlame.plugin.getLuckPerms().getPlayerAdapter(Player.class).getUser(pl);
String uprefix = user.getCachedData().getMetaData().getPrefix();
format = format.replace("{message}", "%2$s").replace("{DisplayName}", e.getPlayer().getName()).replace("{prefix}", uprefix);
e.setFormat(LogicFlame.colorize(format));
}
}
is there anything like, user.getCachedData().getMetaData().hasPrefix() to be used in the if statement
No, but getPrefix returns null if there is no calculated prefix, so you can check if it's null
so like
if(user == null) //do smthing
getPrefix returns null
so...?
lmao
Once you have a User instance, you can get the CachedPermissionData
https://luckperms.net/wiki/Developer-API-Usage#the-basics-of-cacheddata
thanks so I use .getPermissionMap() but it returns all permissions, i don't want "false" permissons :x
Why not lol
is it possible to return just all "true" permissions? or return a json so I can manipulate it
sorry if my english is bad :x
i can't remember if I already asked about this at some point but for transient permissions, do I need to
api.getUserManager().saveUser(luck_player);
after I give them a perm?
or is just adding the node enough since it'll disappear once they leave anyways?
i think you have to saveUser after adding the node
LuckPermsProvider.get().getUserManager().getUser(player.getUniqueId()).getInhertedGroups(queryOptions);
what's query options?
and how can i get it
hello , its been a while since i used the luckperms in my plugins ..
how to use the api ? and how to get the primary group
using spigot 1.8.8 + using luckperms 5.3.0
i can upgrade if that will fix the problem ..
nvm i fixed it .. i downloaded the api ..
another error
!extensions
A list of all the Luckperms extensions.
No need for the legacy extension, you should use 5.3
Also dont add the plugin, add the API
@slim willow
They should really read these two sections of the wiki page lmao
https://luckperms.net/wiki/Developer-API#adding-luckperms-to-your-project
https://luckperms.net/wiki/Developer-API#obtaining-an-instance-of-the-api
ppl really like to use static for some reason lol
it's not lol
I use lp api to add players to their ranks uppon first joining the server but it does not add the prefix on the first time they join the server?
Does the prefix show in /lp user <user> info?
I really doubt it's anything to do with the API unless you're doing something very wrong lol
How are you doing this?
I will send my code in 5 min, currently afk
Its only after they change worlds that the prefix is displayed
hmm okay
String worldName = entry.getKey();
String groupName = entry.getValue();
Group group = api.getGroupManager().getGroup(groupName);
if (group == null)
continue;
plugin.getLuckPermsApi().getUserManager().modifyUser(event.getPlayer().getUniqueId(), (User u) -> {
Node node = InheritanceNode.builder(group).withContext("world", worldName).build();
if (u.data().contains(node, NodeEqualityPredicate.IGNORE_EXPIRY_TIME) == Tristate.TRUE) {
} else {
u.data().add(node);
}
});
}
I have default ranks per world
this is inside my PlayerJoinEvent listener
@leaden iron
Works fine for me, it's probably the chat plugin doing some caching before the data is available
So when someone changes worlds it re-fetches it
That's my guess anyway, a wild guess
Hi with the api it's possible with bungeecord to get the displayname of player
You should probably read the main Dev API wiki pages
https://luckperms.net/wiki/Developer-API
https://luckperms.net/wiki/Developer-API-Usage
You can take the GetPrefixCommand example class as a base or a guide on how to get the prefix of a user with the API
https://www.github.com/LuckPerms/api-cookbook/tree/master/src/main/java/me/lucko/lpcookbook/commands/GetPrefixCommand.java
Right.. you need a LuckPerms object
You should probably read the main Dev API wiki pages
https://luckperms.net/wiki/Developer-API
https://luckperms.net/wiki/Developer-API-Usage
I need to create a bungeecord or spigot plugin to create a server-to-server globalchat?
isn't that what you're doing?
Right... which
isn't that what you're doing?
I mean, it doesn't really change anything lmao
You still need an object of type LuckPerms
Which is explained in those pages
Obtaining an instance of the API ?
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
That one specifically is if you are on Bukkit
i'm stuck x)
@nocturne elbow
LuckPerms luckPerms = LuckPermsProvider.get();
User user = (User) luckPerms.getPlayerAdapter(ProxiedPlayer.class).getUser(player);```
it's this ??
Hey shark_zekrom! Please don't tag helpful/staff members directly.
String prefix = user.getCachedData().getMetaData().getPrefix();
for the prefix of player
Mhm
it's not good ? x)
It is, that is how you get the prefix lol
you even have it right there
Not those
That
you even have it right there
ok i put it in the chat event?
yes
public LuckPerms lp;
this I do not need?
You can have that, but you need to assign it a value
Java won't magically know what lp is
yes
You use LuckPermsProvider.get() on BungeeCord to tell it "hey, lp is LuckPermsProvider.get()"
the final code is```java
@EventHandler
public void onChat(ChatEvent event) {
ProxiedPlayer player = (ProxiedPlayer) event.getSender();
LuckPerms api = LuckPermsProvider.get();
User user = (User) api.getPlayerAdapter(ProxiedPlayer.class).getUser(player);
String prefix = user.getCachedData().getMetaData().getPrefix();
if (!event.getMessage().startsWith("/")) {
ProxyServer.getInstance().broadcast("§b[" + player.getServer().getInfo().getName() +"§b] " + prefix + " §8» §f" + event.getMessage());
}
}```
that should work, yes
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i have a error :/
the same
it's weird
you are using the wrong jar
i have LuckPerms-Bungee-5.3.5 in bungeeplugin
don't import the LP plugin jar to your project
use the API jar
More specifically: https://luckperms.net/wiki/Developer-API#manual
You don't import the plugin jar, you import the API jar and work with that, it's very different
api 5.3 ?
yes
You might need to look for the correct imports, idk what your imports look like rn
I imported it as the luckperm plugin before
I know
Don't
You might also need to do something in that "Libraries" tab, I'm not sure how that part works
Because that's not the User you should use
You were importing the internal plugin User class
You should import the API User class
yes
import net.luckperms.api.model.user.User;


