#luckperms-api
1 messages · Page 23 of 1
either works honestly
I just need to track the command /lp user lazerpent parent set myGroup
I would say the second one
when a group becomes the parent
You first need to grab an instance of the luckperms API, hunter. This best practices for this can be found here: https://github.com/lucko/LuckPerms/wiki/Developer-API#obtaining-an-instance-of-the-api
Just to check, do you want to track what happens with the event, such as the permission changes, or do you want to track whether the command was actually used?
@warm ginkgo
what I am trying to do
is track if a user is given a role (in this case VIP), at which point I trigger an action somewhere else
Ahh okay
After looking over the API, I'd have to say that the best method would be to listen for the NodeMutateEvent.
- You would first check that the target of the event is a user using NodeMutateEvent#isUser
- Then use NodeMutateEvent#getDataBefore and NodeMutateEvent#getDataAfter, comparing the two to determine what node was changed, storing the node is a var once it is found
- Check the isolated node to see whether the node is 'group.vip', or whatever your group node is.
It's long-winded, but it's the best solution I can find
alright
ya
thats getting into stuff I don't know lol
I literally started working with luckperms two days ago lol
@warm ginkgo Just got home and decided to try it. All you really need is the following:
public class Listener {
private VIPListener plugin;
private LuckPerms luckperms;
public Listener(VIPListener plugin) {
this.plugin = plugin;
luckperms = plugin.getLuckperms();
EventBus eventBus = luckperms.getEventBus();
eventBus.subscribe(NodeAddEvent.class, this::onVipSet);
}
private void onVipSet(NodeAddEvent event) {
// Check if event is targeting a user.
if (!event.isUser()) return;
// Check if the node added is the group.vip node.
// User is in the VIP group.
if (event.getNode().getKey().contains("group.vip")) {
Bukkit.getConsoleSender().sendMessage("[VIPListener] " + event.getTarget().getFriendlyName() + " is in group.vip");
}
}
}
ignore the console message, just debugging
ty @cold panther, thats much cleaner than my solution (it did not make use of the .getKey().contains)
Hey Lazerpent! Please don't tag staff members.
@fresh blade apologies, I was on mobile at the time and must have missed the docs link. Either way, sorry about that. Unfortunately, there is no shortcut to adding permissions to a user. Do you have LuckPerms added as a dependency? If you are using a dependency manager like Maven or Gradle, ensure you have it set as a dependency. The luckPerms reference on the last line is an already defined variable, and can be retrieved by (from the docs) ```java
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}The `api` variable is now the same as the `luckPerms` variable on the last line. To get a user object, all you have to do is:java
User user = api.getUserManager().getUser(Your_Player_Object.getUniqueId());```
@azure latch THANK YOU.
np, sorry about earlier
It's okay
why is this not working for me? (The Plugin loads and everything is fine, except the LuckPerms Event)
@SuppressWarnings("deprecation")
public void onEnable() {
new UserPromoteListener();
}
}
public class UserPromoteListener {
public UserPromoteListener() {
EventBus eventBus = LuckPerms.getApi().getEventBus();
eventBus.subscribe(UserPromoteEvent.class, this::onUserPromote);
}
private void onUserPromote(UserPromoteEvent event) {
System.out.println(event.getGroupFrom() + " to " + event.getGroupTo());
}
}```
if the API being loaded?
Also, are you an older version of LuckPerms, as that is the old method of getting an instance of the API. The newer implementation would be something along the lines of
LuckPerms api;
try {
api = LuckPermsProvider.get();
}
catch (IllegalStateException e) {
e.printStacktrace();
}
Yeah i am using the older version and yes the API is being loaded because other functions are working
Interesting, it is working for me but I've only got a bukkit test environment setup currently. Are you using the promote command in the bungee console?
or are you using the /lp prefix rather than /lpb?
I was using /lp
ahhh okay, does using /lpb fire the event?
wait
hmm, it does send a message to the bungee console now but my event in my plugin is not getting fired (http://prntscr.com/rcmj3l)
Wait, are you looking to listen for /lpb user <user> parent set/add <group> or /lpb user <user> promote <track>?
Hello ! Is it possible to remove a Meta node without knowing his meta value ?
(Or better, replace a meta by a new one)
How can I get a Player object from a User? java Player p = Bukkit.getPlayer(user.getUniqueID()); seems to result in an NPE, and the User isn't null since I use i before this line
Well getPlayer returns null if the player is not online
LP] Permissions data for your user was not loaded during the pre-login stage - this is likely due to a conflict between CraftBukkit and the online-mode setting. Please check the server console for more information.
@nocturne elbow please go to the right channel.
So I'm trying to download spongeforge and luckperms but Ender IO has a smaller Mixin version so when I update it to a better one, ender IO fucks it up and I can't use it
any ways to fix this?
@still girder go to the right channel.
@languid socket wat channel
Hello how i can check if offline player has permission with UUID thx, because https://pics.edensky.fr/2020-03/07/19-20_h0pf.png not work :/
Hum i'm find .join
!api
Learn how to use the LuckPerms API in your project.
I can use lp in forge dev mods?
how do i get the luckperms api into my code?
!api
Learn how to use the LuckPerms API in your project.
What do you mean exactly? Do you want to add the dependency manually?
don't i have to
You can use a dependency manager like Maven or Gradle
Yeah im useing maven i just don't know where in intellij i find dependencies i forgot
They are usually kept in the pom.xml
i get a error when i put in the dependencie
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project brings a error when i add your dependice
Then you're doing something wrong
i copied it and pasted it in.
And it's kinda hard to help with errors if you don't tell us the errors
Duplicated tag: 'dependencies'
But what exactly do you need?
@crystal sonnet I need to get the installed metadata to the player in the forge environment on CatServer (Bukkit) 1.12
lp group default meta set custom-limit 10
Hey Prototype! Please don't tag staff members.
sorry
Isn't there a more efficent way to do that:
final User user = luckPerms.getUserManager().getUser(uuid);
ContextManager contextManager = luckPerms.getContextManager();
ImmutableContextSet contextSet = contextManager.getContext(user).orElseGet(contextManager::getStaticContext);
user.getCachedData().getMetaData(QueryOptions.contextual(contextSet)).getPrefix();
Not that im aware of
There actually is
final User user = luckPerms.getUserManager().getUser(uuid);
ContextManager contextManager = luckPerms.getContextManager();
user.getCachedData().getMetaData(contextManager.getQueryOptions(user).orElseGet(contextManager::getStaticContext)).getPrefix();
@sleek maple
Do u have a example?
Right there
It's your code
But improved
Btw feel free to join the discussion here: https://github.com/lucko/LuckPerms/issues/1926
Not significantly
I have one simple question. As luckperms v5 has different API, none of old plugins supporting v4 will work?
LuckPerms v5 allows the creation of extensions, and one extension is the legacy-api extension, which allows some plugins developed using the v4 API to work on the newest version https://github.com/lucko/LuckPerms/wiki/Extensions
However, if you are the developer of the plugin(s), you really should update them to use the new API
How do i give someone a permission
Learn how to use the LuckPerms API in your project.
a node is a permission correct?
Nodes are groups/permissions
what you mean groups/permissions
I don't understand that document'
Oh, I linked the wrong section, sorry
Using that you can do
User user = ...; // explained on the wiki
user.data().add(node); // Creating nodes too
userManager.saveUser(user);
Hello, I'm really new to LuckPerms. Is there an event that is fired when the parent rank of a player is changed?
Can you get a users groups without having a list of possible groups?
Or can you get a list of possible groups without having to manually add them all into the code or a config, etc
To get the user's primary group, use .getPrmaryGroup() @urban verge
@urban verge yes there are events. I'm not sure which one is fired for that. But you can check out this:
!api
Learn how to use the LuckPerms API in your project.
Thanks
What import is used for MetaData in the developer API thing on github? My IDE isnt finding any imports
Where?
Here
I found CachedMetaData which seems to work tho
Maybe its an error on the docs?
Possible.
Hi i want to ask how to get luckperms with bungeecord
I have a question! I am running Sponge with Pixelmon and Im trying to use Luck Perm prefixes inside of an Easyscoreboard plugin. Issue is I dont think I installed the Papi Luck Perms extention right
I have the Expansion Luck perms jar in a folder here: /config/placeholderapi/expansions
I tried to do the automatic install using the /papi command but it didnt recognize it
@brazen mason make sure you get PAPI from https://ore.spongepowered.org/rojo8399/PlaceholderAPI
@rustic laurel I have figured it out!
kk !!
@true rapids elaborate
hello, I have a problem with luckperms and nucleus permissions
Hello, I am rewriting code from LP v4 and after my changes, saving meta doesn't work, it run successfuly but meta is not saved. Can someone give me an advice what i am doing wrong? https://prnt.sc/rew83j
My luckperms prefixes does not show up in chat, I use nucleus as a chat vault
Is there a more optimized way to do this : java @EventHandler (priority = EventPriority.NORMAL) public void onAsyncPlayerChat(AsyncPlayerChatEvent event){ Player player = event.getPlayer(); RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); if (provider != null) { LuckPerms api = provider.getProvider(); User user = api.getUserManager().getUser(player.getUniqueId()); ContextManager contextManager = api.getContextManager(); assert user != null; CachedMetaData metaData = user.getCachedData().getMetaData(contextManager.getQueryOptions(user).orElse(contextManager.getStaticQueryOptions())); String prefix = metaData.getPrefix() == null ? "" : metaData.getPrefix(); String suffix = metaData.getSuffix() == null ? "" : metaData.getSuffix(); event.setFormat(prefix + player.getName() + suffix + ChatColor.GRAY + " » " + ChatColor.WHITE + event.getMessage()); } }
No need to get the API instance and the ContextManager every method call
Store them in a member variable of the class
Besides there's not much you can do
@crystal sonnet Is there a method to get the display name ?
Hey Arnaud L. - ZeProf2Coding! Please don't tag staff members.
no with his rank
No
okay
That is how you do it with the API
Why does it matter how complicated the code is?
If you want it simpler, throw it into a helper function
okay thank you 😄
That’s how I do it @novel nebula : https://github.com/AuraDevelopmentTeam/BungeeChat2/blob/master/src/main/java/dev/aura/bungeechat/hook/LuckPerms5Hook.java
Okay thank you 😄
is there an api out there that will allow me to make time promotes and what not?
thank you
well i was looking at GroupCacheLoadEvent
GroupDataRecalculateEvent
NodeAddEvent
NodeClearEvent
NodeMutateEvent
NodeRemoveEvent
UserCacheLoadEvent
UserDataRecalculateEvent
UserDemoteEvent
UserFirstLoginEvent
UserLoadEvent
UserPromoteEvent
UserTrackEvent
and i was wonder on how to set up like a userpromoteevent using lp
okya so how would i make a userFirstLogianevent that would run userpromoteevent
@fierce halo Events are fired when something happens. You don’t fire them to make something happen
You use API calls to make changes
!api
Learn how to use the LuckPerms API in your project.
I have a question, how can I query the weight of the group in order to find out that my group is larger than the one that wants to give me.
@narrow dune pretty sure there's a direct call on the group for that
@next orchid use meta
Up to you really
best to use a prefixed name though
like you do with permissions
myawesomeplugin.chatcolor
Instead of just chatcolor
To prevent collisions with other plugins
Hey,
I'm having trouble understanding how the API works
I want to check if a player (UUID i am in PreLogin event on Bungee) has a permission
Just check it as you would anywhere else
Learn how to use the LuckPerms API in your project.
hey i have this code
private static LuckPerms api = null;
@Override
public void onEnable() {
setupChat();
Bukkit.getPluginManager().registerEvents(new ChatEvent(), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
private boolean setupChat() {
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
}
return api != null;
}
public static LuckPerms getChat() {
return api;
}```
but for some reason getChat throws null?
I think because of:
private static LuckPerms api = null;
@autumn niche you never set the static variable api to anything
Where you try to set it you create a new variable instead
Remove the type before the assignment
ah i see
Is there an easy way how to remove MetaNode from player with key as a parameter?
Now I have to compare all keySet from player with my key and also remove value from it.
something else:
the perms of users dont get an update until I type /lp editor...
but i save everything
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(UUID.fromString(spielerUUID));
InheritanceNode groupNode = InheritanceNode.builder(teamName).build();
user.data().add(groupNode);
api.getUserManager().saveUser(user);
api.runUpdateTask();
even if the Player rejoins, he has not the permissions...
someone any idea how to update?
what is the best way to give someone a rank
set his primary group
@wicked kiln either set the primary group, or apply the permission group.<groupname>
no help?-.-
user.setPrimaryGroup(group.getName());
LuckPerms.getApi().getUserManager().saveUser(user);``` My parent group don't change why???
Please help.
is he parent in teh lp editor?
No
you can give him with
LuckPerms api = LuckPermsProvider.get();
CompletableFuture<User> userFuture = api.getUserManager().loadUser(UUID.fromString(spielerUUID));
InheritanceNode groupNode = InheritanceNode.builder(teamName).build();
userFuture.thenAcceptAsync(user -> {
user.data().add(groupNode);
api.getUserManager().saveUser(user);
api.runUpdateTask();
});
an parent group
but then you have the same problem like me.. it will not updating until you typ /lp editor or /lp networksync
My API cant find https://prnt.sc/rgpkav
version of your api?
ah, my code is for version 5
Have you some of version 4.4.1
no, sorry, i use the api since yesterday:D
Ok I found out
= LuckPermsProvider
.get()
.getUserManager()
.getUser(target);
user.setPrimaryGroup(Configuration.unlockGroup());
LuckPermsProvider
.get()
.getUserManager()
.saveUser(user);
LuckPermsProvider.get().runUpdateTask();``` User#setPrimaryGroup(String) does not seem to work on BungeeCord can someone help me please? I want to change the parent group of a player.
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user" + event.getPlayer().getDisplayName() + "parent add rank1");
addParent.put(player, g);
Thats a horrible way of doing it and completely defeats the purpose of the API
setPrimaryGroup does not modify their groups
you actually need to add them to the group
Then what is this method for?
User#getPrimaryGroup() even return the actual parent group
people can be in multiple groups. Their parent group is the highest priority group they have available.
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(target);
user.data().add(Node.builder("group." + Configuration.unlockGroup).build());
api.getUserManager.saveUser(user);
Something like that may work if your config has groups in lowercase
Node.builder throws an exception so i removed this specific Code. Migrating from 4.x to 5.x
Any chance that User#setParentGroup(String) will be available at some point?
I'm pretty sure that method simply elevates a user's existing group to their parent group, rather that adds a new group. Do you recall what exception the code I gave was giving?
Something like Inheritance problems when building this node
so the default rank on my server cant open chests can I make this true with luck perms
is it possible to change the server's name that LP uses via the API
@idle slate no exception, no help
Or more elaborate: If code we give you causes exceptions/crashes and you say "it caused an exception" without giving us that exception we cannot help you
There you go
people can be in multiple groups. Their parent group is the highest priority group they have available.
@cold panther Yes, thats why i didn't use his code
Hey joestr! Please don't tag staff members.
oh! i meant to cite the code
I mean the error message
In that error, you're using PermissionNode.builder() when a group node isn't a permission node, it's an InheritanceNode
You'd either use the generic Node.builder() or InheritanceNode.builder()
The generic Node.builder throws that error message @cold panther
And what was that about spoon feeding? 😛
I'm in a decent mood, sush you 😉
Ah I see it what I've been doing wrong ... PermissionNode worked in 4.x
But LuckPermsProvider#runUpdateTask() is like /lpb networksync or are changed user groups propagated automatically?
No you need to do that
Finally it works! Thanks again!
👍🏼
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user" + event.getPlayer().getDisplayName() + "parent add rank1");
addParent.put(player, g);
what's a better way of doing something like taht
You use placeholders.
how??
can u help me in DM?
Just read that article.
dude u dont understand me
o.setDisplayName(Main.color(" &9&lLobby "));
o.getScore(Main.color("&2 &7")).setScore(8);
o.getScore(Main.color("&cName &9» " + p.getName())).setScore(7);
o.getScore(Main.color("&7 &a")).setScore(6);
o.getScore(Main.color("&cRank &9» default")).setScore(5);
o.getScore(Main.color("&7 &8")).setScore(4);
o.getScore(Main.color("&cOnline &9»" + Bukkit.getOnlinePlayers())).setScore(3);
o.getScore(Main.color("&7 &7")).setScore(2);
o.getScore(Main.color("&7")).setScore(1);
how can i display the group here...
Hi
How can I get the prefix of a player with LuckPerms. I have been using pex before and I always did:
PermissionUser user =...
i will see it
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
User user = api.getUserManager().getUser(p.getUniqueId());
assert user != null;
String group = user.getPrimaryGroup();
String groupDisplayName = Objects.requireNonNull(api.getGroupManager().getGroup(group)).getDisplayName();
o.setDisplayName(Main.color(" &9&lLobby "));
o.getScore(Main.color("&2 &7")).setScore(8);
o.getScore(Main.color("&cName &9» " + p.getName())).setScore(7);
o.getScore(Main.color("&7 &a")).setScore(6);
o.getScore(Main.color("&cRank &9» " + groupDisplayName)).setScore(5);
o.getScore(Main.color("&7 &8")).setScore(4);
o.getScore(Main.color("&cOnline &9»" + Bukkit.getOnlinePlayers())).setScore(3);
o.getScore(Main.color("&7 &7")).setScore(2);
o.getScore(Main.color("&7")).setScore(1);
}```
thanks i will try it.
User user = api.getUserManager().getUser(p.getUniqueId());
its not working.
oh
i fixed it
nvm
@wicked kiln
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(target);
user.data().add(Inheritance.builder(gropup).build());
api.getUserManager.saveUser(user);
What would i put for target
I'll loop every user to see their groups
What for?
To see how much players are in Team groups eg. Sup, Mod
#getLoadedUsers don't return every Users
That's not the method I linked
Only that which was online since the last restart
I linked the right method
getWithPermission
yes
But I need a UserList
Use streams
???
What type of user objects do you need?
And you should really look into streams
@prime glacier
I need the LuckPerms User class
One sec
Every User which have set a special prefix in their group
You need to find those groups seperately
But to get User objects for all users in a specific group:
UserManager userManager = api.getUserManager();
userManager
.getWithPermission("group." + group)
.join()
.parallelStream()
.map(HeldNode::getHolder)
.map(userManager::loadUser)
.map(CompletableFuture::join)
.collect(Collectors.toList());
thx
You're welcome
Hey Forumat! Please don't tag staff members.
Sry
Is the permissions applied directly to the users?
The getWithPermission method doesn't respect inheritance
And what's the issue with the screenshot?
Then import it
So with this method I won't get the user which is in gorup Supporter (supporter has set the suffix) ?
Yes
So i have to give the player the suffix
As I said you need find the groups with the permission first
Mhh I think I've found another way 🙂
And that would be?
Loop every group and check suffixes there
That's what I was getting at
and then get every member of the group
Is there a method to get all members of a group?
i dont have HeldNode in my API
What version of the API are you using?
@wicked kiln
LuckPerms api = LuckPermsProvider.get(); User user = api.getUserManager().getUser(target); user.data().add(Inheritance.builder(gropup).build()); api.getUserManager.saveUser(user);
@wicked kiln the target (user)
So i got 2 issue what do i put for target. I mean like i tried to put user and it didn't work. Also what do i put for Groupup
Oops. It has a typo. I mean group
Put the name of the group there
And the target needs to be an UUID
@prime glacier
4.4.1
Well, then that can't work because it's for API 5
And if you're not interested in my help you can just tell me. No need to make wait 20 minutes+
Your behavior clearly says otherwise
Would be nice telling
In any case API 4 is outdated and at the very least I don't provide support for it
The code shouldn't be too different
Here would be the complete code btw xD
final String permission = "test";
final QueryOptions queryOptions = api.getContextManager().getStaticQueryOptions();
GroupManager groupManager = api.getGroupManager();
UserManager userManager = api.getUserManager();
Stream.concat(
groupManager.getLoadedGroups().stream()
.filter(
group ->
group
.getCachedData()
.getPermissionData(queryOptions)
.checkPermission(permission)
.asBoolean())
.map(Group::getIdentifier)
.map(Identifier::getName)
.map(groupName -> "group." + groupName),
Stream.of(permission))
.parallel()
.map(userManager::getWithPermission)
.map(CompletableFuture::join)
.flatMap(List::stream)
.map(HeldNode::getHolder)
.distinct()
.parallel()
.map(userManager::loadUser)
.map(CompletableFuture::join)
.collect(Collectors.toList());
thx
this is prob a stupid question but does wieght do and what should i set it as
@dim leaf if it's about the developer api, ask it here otherwise please ask it in #support-1
Hello im not sure to understand, how i can get all meta, even if there is context or not ?
Use there should be a getter for noncontextual query options on the ContextManager. Noncontextual means that it allows all contexts
actually i do this :
QueryOptions options;
if (getApi().getContextManager().getQueryOptions(user).isPresent()){
options = getApi().getContextManager().getQueryOptions(user).get();
}else{
options = getApi().getContextManager().getStaticQueryOptions();
}```
That’s respecting the contexts
Which according to your initial question is not what you want
Also there is a utility method on Optional that provides a fallback if the optional is not present
Is there an event that is fired when any data relating to a user is modified? For instance, if /lp user bob7l set bukkit.permission is executed, will an event then be forwarded?
I'm seeing "UserDataRecalculateEvent" and "UserTrackEvent" that may be useful for this
Eh, I'm just going to use ServerCommandEvent from Bukkit
UserDataRecalculateEvent is probably what you want
That's my code : I create a command : "farmoney" and I want to player to remove the permission to use it. How can I do that with Luckperms ?
@tulip agate What do you mean the player to remove permission?
You want to add a permission to use the command?
yes excatly !! @dusky shell
ok and after that can I add/remove this permission with LuckPerms ?
Yes
You can also do
your code here.
} else {
Code when the player doesn't have the permission```
Alright and then I can go on Luckperms to remove the permission ?
I'll try and get you a feedback
if you want players to use it, add it
Also please add return true
after the return false ?
Instead of
ok....
@dusky shell thx very much it works ! In love with Luckperms ❤️ xD
You are welcome.
How do I get the prefix of a group using the API?
check that @viscid coyote https://discordapp.com/channels/241667244927483904/420538367986499585/687744647044268037
The thing is I don't want the prefix of a player but the prefix of some group by its name
@viscid coyote
i will give you the code
1m
RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
if (provider != null) {
LuckPerms api = provider.getProvider();
net.luckperms.api.model.user.User user = api.getUserManager().getUser(p.getUniqueId());
assert user != null;
String group = user.getPrimaryGroup();
String playergroup = Objects.requireNonNull(api.getGroupManager().getGroup(group)).getName();
PlayerGroup = getting group name
I'm trying to get an offline user to get his primary group so I can get a colored username based on the group he is. When the player is online, it works great, but when the player is offline the user is null. Can someone tell me what do to in order to fix that?
LuckPermsApi api = Happia.getInstance().getLuckPermsApi();
User user = api.getUser(this.uuid);
This is how I get the user ^^
From that snippet, are you not on the latest API?
uhm, I'm using the extension for the v4 of the API for some reason I can't get it to work with the Bukkit version of the plugin.
Is there something else that I have to do in order to get the V5 to work with the plugin?
If you don't need to update, you should be fine. You should have a loadUser(UUID) method available to you. That will load the user into memory from your storage on request
I actually have V5 implemented into the plugin, but V4 in-game because when I try to start the server without having the extension for the V4 I get "no class found".
I suppose you may be using a plugin which depends on the V4 API then
No, you don't understand. I'm saying that my plugin has V5 API implemented. But when I put my plugin into the server and just run it, it says that it didn't find a class for the API, but I actually have Luckperms-Bukkit 5.0.72 into the server.
And to get it to work I installed the V4 extension API to Luckperms
Oh strange, do you have the error on hand, or can get the error?
I can get it wait a min
sure
There you are: https://pastebin.com/VWNWFaFM
This is running Luckperms-Bukkit 5.0.72 without extension-legacy-api-1.0.0
Ah, that package doesn't exist in the V5 API. the base package for the V5 API is net.luckperms.api rather than me.lucko.luckperms.api
In order to get an instance of the API (using the singleton), you'd use LuckPerms api = LuckPermsProvider.get();
Oh this might be it because I copied it from another plugin that I've made for older versions
Ok, thank you for your time :)
No problemo 🙂
It is not working again with this, should I do something else?
nvm, I used loaduser() and everything worked :)
user.setPrimaryGroup("smth"); Why does it return FAIL?
I tried to do that with thenAcceptAsync, but still returned FAIL
What do you think this does?
Sets a player group?
I want to do something like /lp user nick group set smth
but with api
@viral igloo
how to get tempparent expire date with API
Node.getExpiry
How i can get all users from a group?
Considering inheritance or not?
yes
final String permission = "group.<group>";
final QueryOptions queryOptions = api.getContextManager().getStaticQueryOptions();
GroupManager groupManager = api.getGroupManager();
UserManager userManager = api.getUserManager();
Stream.concat(
groupManager.getLoadedGroups().stream()
.filter(
group ->
group
.getCachedData()
.getPermissionData(queryOptions)
.checkPermission(permission)
.asBoolean())
.map(Group::getIdentifier)
.map(Identifier::getName)
.map(groupName -> "group." + groupName),
Stream.of(permission))
.parallel()
.map(userManager::getWithPermission)
.map(CompletableFuture::join)
.flatMap(List::stream)
.map(HeldNode::getHolder)
.distinct()
.parallel()
.map(userManager::loadUser)
.map(CompletableFuture::join)
.collect(Collectors.toList());
unless you just want online players
no
Only issue this code has is that it ignores contexts on groups assigned to players directly
Can someone exsplain to me how to add a player to a group bc i got no idea
this is what i got.
public class Rank1 implements Listener {
public static Map<Player, User> addParent = new HashMap<>();
private String rank1;
@EventHandler
public void RightClick(PlayerInteractEvent event){
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
LuckPerms api = LuckPermsProvider.get();
User user = api.getUserManager().getUser(uuid);
final ItemStack itemStack = player.getItemInHand();
ItemMeta meta = itemStack.getItemMeta();
if (player.getItemInHand().getType() == Material.PAPER){
if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
if (stripColor(String.valueOf(equals("Rank: <I>")))){
if (player.hasPermission("trainee")) {
if (player.getItemInHand().getAmount() == 1){
player.setItemInHand(new ItemStack(Material.AIR));
} else {
player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1);
}
player.sendMessage("You got rank 1!");
user.data().add(InheritanceNode.builder().build());
} else if (player.hasPermission("rank.1") || player.hasPermission("rank.2") || player.hasPermission("rank.3") || player.hasPermission("rank.4") || player.hasPermission("rank.5")) {
player.sendMessage("You got a better rank already or equal to it.");
}
}
}
}
}
private boolean stripColor(String s) {
return true;
}
}
how to get prefix and sufix with API
@steep shadow https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#retrieving-prefixessuffixes
ok
dont really understand the api xD
What do you want to know about?
Hallo, I have some question about the Luck Perms API.
So I wona know, how i can request, in what group the Player is
!api
Learn how to use the LuckPerms API in your project.
hey how can i do so all players that join have normal permssions?
when attempting to use API on bungee there's an error http://prntscr.com/rk8zuh, is it an issue on my end ?
@silver dirge are you referring to making a plugin yourself?
@warm hazel don't shade the API in
huh ?
Don't shade the LP API in your plugin
yeah the luckperms, i have EssentialsX on my server but dont have permissions, so installed luckperms
so just want to do so all new players have normal permissions
@silver dirge are you referring to making a plugin yourself?
ups wrong chat i think
so how do you want me to get player groups without using LP API ?
I never said you're not supposed to be using the LP API
All I'm saying is that you're not supposed to shade the LP API classes into your plugin
In other words your plugin jar must not contain the LP API classes
Also don't put the API jar in the plugins folder
is this a help chat
Take a guess based on the channel name and description
If you can't even figure it out based on some very simple observation, I'm afraid you're lacking the mental capabilities to run a server
my jar does not contain any LP classes
wtf is wrong with you?
I just strongly dislike people that refuse to use their own brain and expect to be spoon fed
@warm hazel ok. Also don't put the API jar in the mods folder
why the hell does oberserving which chat room to speak in determine my mental capacity of running a server?
there doesn't seem to be a luckperms api jar in the folder
i just saw this one active and choose to get help and lead me to the right direction
but instead you attacked me
@violet tendon because it shows a clear lack of willingness to put any effort in finding out info on your own
Not quite
theres LITERALLY no chat
that says "help"
so i went to something that look like it had higher ups speaking
and choose to went here
I asked you a simple question, which you failed to answer
Which lead me to my conclusion
If you are now kind enough to read the description of #support-1, you might get somewhere
And no
That you're lazy
@warm hazel what jars do you have in the plugins folder?
the person experiencing the issue sent me this https://media.discordapp.net/attachments/690962522429456505/690969231424094238/unknown.png?width=980&height=460
Can you reproduce it with only LP and your plugin?
appears to still be happening
Could you send the plugin jar?
my plugin, right ?
Yes
Is there an Liberty for non Minecraft use? Just for accessing the DB...
No
do someone know how to change the 127.0.0.1 ip to 0.0.0.0 on mysql what i have installed on my vps? I want to connect to it from an other vps
i found
hey everyone! i have a question regarding the luckperms api for bungee.
Everytime i try to get the API, I'll get the following exception:
java.lang.IllegalStateException: The LuckPerms API is not loaded.
My code is:
LuckPerms api = LuckPermsProvider.get(); (called when a User joins the Server)
Can anyone help me out?
is the dev API even usable in a bungee plugin?
Yes it is
The issue here is that you most likely call that code when initializing your class
Actually not. It's only called when a User joins the server (when everything is already loaded)
What do you mean by shading?
Copying the LP API classes into your own jar
that was it
i used "compile" in my gradle. replaced it with compileOnly. were already curious that the docs are saying that u should use "compile"
thank you!
have a ask I make a scoreboard and wants to let the rank display my question is how do I do this quasi how do I bind luckperms
Are you making a plugin?
yes
@stable sandal This will help https://github.com/lucko/LuckPerms/wiki/Developer-API
Hello
I have a question
is there's any way I can listen to this?
What for exactly @long wyvern
because I want to listen to any call that any plugin made on Player#hasPermission(String)
is it possible to listen into that event?. Because I looks like that event can only be called by the Verbose handler
The event you showed has nothing to do with the Player#hasPermission(String) method
What exactly do you want to do with the actual PermissionCheck event?
I want to make my own verbose handler for my lpgui plugin
I don't think the API supports that
Pretty sure you'll have to rely on internals
alright then, thanks
You're welcome
@long wyvern one thing comes to mind
You can try to see if the event ends up in the LP event bus
LP uses its own event bus for events it fires
hmmm I didn't found any event that can related to permission check
but I do have another way, but I'm not sure if its good or not xd
lp inject their custom permissible into the player
so after that injection I can override it with my custom permissible which also extends lp's default permissible
not sure if that would work but I'll try lol
I mean make an event listener on the event bus that listens to objects and see if they are the right type
so after that injection I can override it with my custom permissible which also extends lp's default permissible
please don't do that
why do you need to reimplement the verbose handler?
what's wrong with the way it is at the moment? if you have ideas for improvements why not just contribute them to LP itself
From what I understood they want to implement their own verbose frontend
anyone can help me transition from api v4 to v5?
What do you need help with?
well the verbose handler is perfect already, but I didn't see any method to actually access it from luckperms api thats why I did that. But well my custom injection also need to use internal api from luckperms that will require reflection to access it, I'll try to use verbose handler then since you said not to inject custom permissible
also I do not think a custom injection is a bad idea, because I extended the default one with super call so luckperms will actually still works plus I only overrides 2 methods, hasPermission with Permission param and String param, then after that method executed I called my custom callback which didn't take too much of resources it stills runs fine (below 2-3 ms)
Is there a way to get the offline and online users of a group? (Bungee Version)
i am sorry
no worries
Hello. I don't know if this fits the subject, but.
I'd like to know how you guys planned the project to make it multiple-API. Like you can use Sponge Bukkit or anything "on the go" and I have to say, I'm pretty impressed. I kinda want to do the same thing for my next projects. So far I'm mostly doing ports of plugins from Spigot to Sponge, thus why i'm highly interested.
Not asking for a tutorial (tho if you have ressources I'm completly ok with that) just, the process behind it. What questions did you asked yourself for this or this part of the code. Did you made two different project first, check for redundancy, and then made the "mixed" project based off this. I never did anything like that because I felt like Sponge and Bukkit API were a bit too different to be mixed toghether, and I never thought such a thing was possible for API like that. But it's the most simple and long-term solution imo. So yeah, if you have any tips, how to start, etc, I'll greatly take it. Thanks.
Is there an Event that triggers once a users group gets changed
@somber sage the process works as follows:
You create a common core. That's where all your plugin logic happens. The API only ever talks with the core.
Then you create implementations for each platform
Like say you need to be able to set a block
In the common core you define an abstract class that has a method to set a block. And in all platform implementations you create a class that actually sets the block
@raven pelican not one specifically for that
But I think there's the UserDataRecalculateEvent
Try that
@crystal sonnet How would i go ahead in using that? aka. how do i check if user has a new group and what that group is
Hey Johni! Please don't tag staff members.
Listen to it and inspect the event data (like print it to console)
but how do i get the Groups out of the event data?
Also how to get all members of a group?
!api
Learn how to use the LuckPerms API in your project.
That won’t answer all questions but gives you access to the docs
@ancient sierra ask and ye shall receive
ight so to keep things clean, please move the convo to #support-1 or #support-2 - you'll notice the channel topics specify this as well
ight
Hey can anybody give me a quick way of getting all members of a group?
Why does this not work? user.setPrimaryGroup(getGroup(user.getUniqueId()))
getGroup returns a String from SQL
when i add .wasSuccessfull to the setPrimaryGroup it returns false
but i dont see a reason
i just did a sout and getGroup returns "test" which is a valid group
Hey. How would I set a players parent group (and how do I add one) (v5 API)?
How do I set a permission User#setPermission from v4 is no more?
I am still waiting for a bit of help up there?
user.setPrimaryGroup returns always FAIL
Please anyone...
@crystal sonnet i know i am not allowed to ping staff, but i am really frustrated, i don't know what todo and google isn't helping
Hey Johni! Please don't tag staff members.
Searching this channel in regards to setPrimaryGroup should answer your question
Also check out
!api
Learn how to use the LuckPerms API in your project.
@raven pelican
All you need is on that page
User user
= LuckPermsProvider
.get()
.getUserManager()
.getUser(uuid);
user.setPrimaryGroup(group);
LuckPermsProvider
.get()
.getUserManager()
.saveUser(user);
LuckPermsProvider.get().runUpdateTask();``` this doesnt work, i found that during the search you suggested
You're supposed to read what's being said
Not just blindly copy what you come across
No wonder you're not finding what you're "looking" for
i am sorry its pretty late for me, and i am trying to fix that for 4 hours now
Ohh now i get it
i have to add a group to the user
and set it as primary using the method
user.data().add(Node.builder("group." + Configuration.unlockGroup).build()); can i replace Configuration.unlockGroup with the specific Group?
Almost
You need an inheritance node builder
How it works is explained clearly on the API usage page
Okay adding the Group wasnt a problem at all
but the setPrimaryGroup still no result, i guess i need to try even more
By default the primary group is calculated automatically
That’s why setting it fails
And using the node builder will fail
You mean Node Builder the code i sent above?
You need the inheritance node builder
By default the primary group is calculated automatically
@crystal sonnet Ok thats why it always returns fail
Hey Johni! Please don't tag staff members.
Yes I’m talking about the example
If you’re writing a public plugin it’s a good idea to set the primary group. But don’t bother for a private plugin
Another thing, i am doing this Plugin for a Friend he doesn't want to use the LuckPerms Network Synching (for some reason idk) he wants to have an extra Plugin for that, how should i go at this, its supposed todo it via SQL
Use the SQL storage method in LuckPerms
he doesn't want to use LuckPerms for synching
Everything else is not just stupid, but straight up insane
Especially if he wants it synced over SQL, it’s actually insane trying to do that through an external plugin
I know, i don't know why he wants it like that
but he made an order via Fiverr so i cant just cancel it for no reason, so i need to just do it
There’s no easy way to do it
It’d be around 10h of work for someone that knows the plugin in and out.
And considering you’re struggling setting a group I frankly don’t think you’ll be able to do that in any reasonable time frame
I’m afraid you have to cancel or renegotiate due to it not being possible to do in any reasonable time frame
Good advice, thank you. And sorry for wasting your Time!
Next time make sure to check the amount of work before you agree on a price
If you need help convincing him to use built in LP stuff, send him here (to #support-1 or 2)
I Just quoted you, he understood and sayd he would look into SQL Storage
lost a bit of Money but hey, atleast i tried
Thanks again @crystal sonnet Good night! and Clippy dont kick me pls
Hey Johni! Please don't tag staff members.
/ban
How can I check if a user has a certain permission and if it's true/false ?
I want to check if someone has * and if it's true (I want to ignore those players in my event).
Use the normal permission check
So you can detect a player's group/parent update using NodeAddEvent/UserDataRecalculateEvent.. How would I get the previous parent group(s)?
There should be a getter for the previous data
Hey, I just moved from Pex over to LuckyPerms is it hard to get used to the change or? I also need to hook into the api as well 😄
!api
Learn how to use the LuckPerms API in your project.
If you just want prefixes and basic stuff, use the vault API
Can vault handle that?
And yes it's a huge difference
I feel like the commands are strange with the clicking on things in the chat. Pex is straight forward just type the command etc.
What clicking things in chat?
No I mean, pex doesn't have that so it's strange for me.
OMG an additonal feature
?
I mean you don't have to use it
It's just there in addition
YOu can type the commands out just like that
Also this getting #support-1
(or #support-2
?
?
Also this getting #support-1
This discussion doesn't belong in this channel. Move it to #support-1 or #support-2 if you want to continue
so i'm asking how to do something via the api isn't for this channel??
That's for this channel
But you were asking about general plugin usage and features
i dont know how to create a group to test with the code
!usage
Here's a guide to help users understand and use LuckPerms for the first time.
The wiki is a magical place
Use the normal permission check
@crystal sonnet doesn't really help me... This is what I'm trying to do.
for (Player players : Bukkit.getOnlinePlayers()) {
if (!players.hasPermission("*") && (players.hasPermission("permission1") || players.hasPermission("permission2")) {
players.sendMessage(...);
}
}```
Hey Neon! Please don't tag staff members.
But what I did is negated * for default group.
So with that code everyone will get the message.
I want to check if * is true or false and thus want to use LuckPermsAPI.
how do I get the prefix of a rank via the API
how can i get the prefix of a player with the LuckPerms API? i have looked in the dev api but i find nothing whick works can you help me?
Hey 🌴uS1x | Basti 🌴! Please don't tag staff members.
Hello! So I'm currently making a plugin for my own use in order to try and open a Command Shop. I would like to integrate LuckPerms into my code in order to make the permissions a lot nicer and more organized. So far it seems that I have almost everything figured out, and I was really hesitant to post anything here, but I've been trying to figure this out for hours. I'm not sure if I'm just exhausted because it's 5 am, or something, but I have no idea what the provider is, seen in this code here
api = provider.getProvider();
Keep in mind I am very new to Bukkit programming, so I could just be completely overlooking something, and if this isn't the place to ask, I'm so sorry, and I'd be fine with getting redirected somewhere else, though my main problem is I do not know why the provider is null. I've done tests to test to see if it is in fact, null, and I know for a fact that it is. I'm sorry if this is a dumb question. If it is, please feel free to tell me, thank you!
Also, feel free to mention me, or even DM if you would need to for any reason, to respond. Thank you!
@deep cairn when are you initializing the provider?
hello can you help me please?
If you let me know with what I can answer if I can help you
yes please, first I'm french and my english is not good, and I can't arrived to go in group's but I arrived tu create group's
I think he's saying that be can't go to groups, but he can create them?
yes
Through the plugin API (if you don't know what that is, the answer is no) @celest crow
Also I'm not sure if I should interrupt or not
Oh alright, and well the answer is, I have no idea what the provider even is. And I completely understand that you're busy, so take all the time you need. And if it would be easier, and you're able to link me to a page, that'd be amazing, though if you're not able to help me for whatever reason then that's completely fine, and I'm sure I can figure it out eventually, I'm just really not sure where to start
!api
Learn how to use the LuckPerms API in your project.
Oh does it mention it in there? I might've missed it then. I'll take another look!
I look and I say
Oh! I completely missed that! Thank you! Sorry for the inconvenience!
Using the API you want to make a InheritanceNode (see https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#creating-new-node-instances) and add it to a user/group (see https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#modifying-usergroup-data)
thanks
Hello, I try to upgrade from v4 to v5 api, but i have some problems. I want to get a group what is temporary
Old code:
Set<Node> groupNodes = this.getNodes().stream()
.filter(Node::isGroupNode)
.filter(Node::isTemporary)
.collect(Collectors.toSet());
Does somebody know how to migrate it to v5?
Set<InheritanceNode> groupNodes = this.getNodes().stream()
.filter(NodeType.INHERITANCE::matches)
.map(NodeType.INHERITANCE::cast)
.filter(Node::hasExpiry)
.collect(Collectors.toSet());
Something like that
Thank you
Hmm. I think I asked my initial question extremely weirdly. Sorry about that! So I actually had the provider, but for whatever reason, which I am drawing a complete blank on, it's null. I made sure I had this code in mine https://github.com/lucko/LuckPerms/wiki/Developer-API#obtaining-an-instance-of-the-api
Would you have any idea why it would be null? I am very confused, and, again, if this isn't the place to ask I'm fine with being redirected, if even to another Discord or website entirely. Thank you in advance :)
Again, when do you initialize your provider @deep cairn
I understood your initial question just like that
Oh! Umm I initialize it inside of an event, which I'm realizing isn't the smartest decision. Should it be inside of onEnable() method?
Certainly! Would you like to see all of the code? Or just parts?
Getting the instance of the API once and storing it is typically better
The event for now
Well I moved it into the onEnable() method to test, do you want me to move it back, or do you want the onEnable method?
Wait
I'd like to see it how it was
And now it's working???
Okay I can get it how it was
Ignore the messy, spaghetti-5am-code
https://pastebin.com/r642d1ZS
I'm pretty sure it was a random piece of code earlier on the onEnable method that I had only seen after all this time. I'm so sorry for the trouble!
It’s a possibility
how do I get the prefix of a rank via the API?
!api
Learn how to use the LuckPerms API in your project.
Hi, can i talk about helper here ?
@gentle geode ask and ye shall receive, but #luckperms-api is for help with the LuckPerms developer API, #support-1 and 2 are for general support
ok, so my question is : is there any command completition on helper ?
You mean the library Luck has developed? He made another Discord for his projects not related to LuckPerms, link is pinned in #general
Ok thx
hey guys, what
5.1 is ?
i get some issue with my plugin compiled with api 5.0 and the error come for here 
Pretty sure he meant 4.1. There's no 5.1 version/API so that must be a typo
yeah okay
And the question of all questions
What error?
And more importantly why do I have to ask for it?
i ask twice in general support but since i get no anwser, i try to ask somes little things to find my issue
What LP version are you using?
i say the build 108 😦 a bit late
Because what you think is latest may not be the actual latest
I saw
You still said latest
yeah, true, just cause its the actual latest atm, but i added the build in case <w<
but, yeah, any V5 version i get this, i think it come from one of my plugin which use LP api 5.0 so i'm trying to figure what is it and how to fix it actually
i use compile 'net.luckperms:api:5.0' so it should be fine ?
also, just see that one of my plugin use shadow instead of compile, might be the bug 
But that error is so weird
Has nothing to do with the API being used in a plugin
I'd report than on GitHub to be honest
Oh
okay, i'll do just some more test to be sure
yeah pretty sure its the bug
And clear the gradle cache for the file so it downloads it again
thanks, i dont know at all why i shadowed it
If you shadow it in that's your issue
Because then you likely have a slightly outdated version of the API and are shading it in
yep, i have like 4-5 plugins with lp api and 2 are usings shadow
yeah i'll remove that rn
thanks for the help
You're welcome
Can someone help me with worldguard on my minecraft server?
how do I get someone's prefix
I've seen this metaData being thrown around but it doesn't exist
You need to use metaData#getPrefix https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage
https://github.com/lucko/LuckPerms/wiki/Developer-API:-Usage#the-basics-of-cacheddata See if that is any help.
In the V5 version of the API, MetaData has been renamed to CachedMetaData iirc, although the wiki has not been updated. I ran into the same problem @Foulest#1955
oof
he gone
I've updated the wiki to fix that now btw
Heey i was wondering if i can make my lucky perms ranks showup in my tab list?
Hey, how can I use the LuckPerms API to query whether a player has a certain permission?
anyone here that knows if this is possible and how to do it?
idk
domi cant u just check the editor for that?
no xD My question is how can I query how a user has permission
Hey, how can I use the LuckPerms API to query whether a player has a certain permission? @thorny echo @neat jackal
Hey Domi<3! Please don't tag staff members.
jeez Domi
have some patience. not everyone is here for you
find it out yourself or be patient ...
I'm trying to find out, but unfortunately I can't find out I just don't understand this API, which is why I'm asking here. And I felt like 20min no one gives an answer.
For all those people that find it more convenient to bother you with their question than to google it for themselves.
Because some people are doing other stuff when they are online...
20 min- has been 2minutes XD
Anyways, the wiki should explain that.
solid 😛
!api
Learn how to use the LuckPerms API in your project.
what bout the tab list?
Can you please just tell me exactly where I find that and not this wiki. Thank you.
Just use the platform’s permission check @spring helm
You don’t need the API for that
And don’t ask to be spoonfed
I need the API because I work with MultiProxy
Take docs we give you and read them
proxiedPlayer#hasPermission brings me little
Why?
Because I heard MultiProxy and the standard permission does not go there
Did you check?
no
As long as LP is on the bungee (which it needs to be for the API to be accessible in the first place) that method will work for online players
Yes
I'll explain it to you again: I want to query (with LuckPerms) from Bungee-1 whether the person on Bungee-2 has the permission "teamchat.access". How do I do this?
If there’s a decent multiproxy plugin in place, then I don’t think you need the API
@wanton ginkgo you are not a Mod!
srry Im getting triggered by his additude -_-
Very much possible
so cocky and rude
I don't use a MultiProxy plugin, I do it differently. But I would like to know how I can make a permission query via the API.
!api
Learn how to use the LuckPerms API in your project.
Pretty sure there’s an example there
I just don't use LuckPerms anymore, that's too stupid for me.
That support is supid!
This guy xD
If you insist @candid pewter. You are free to go and find better support
But in terms of free support you’ll never get spoonfed
Always send the same link where there is not what is required!
Then you’re not explaining yourself properly
@spring helm in order to use the LP API you need a decent understanding of LP itself, of programming and be able to read docs
If you want to go beyond the examples provided on the wiki
How to make a query with multiproxy whether he has a certain permissions
That's not his problem that is a bungee thing so it does not even belong here
Check the API docs
We’re not here to poop out code on demand
If you have some code that’s not working we’re happy to help you fix it
@heavy frigate But because it goes over the Luckperms aip so if you have no idea then be quiet
You could’ve said that nicer. But yes. It’s appropriate here
My apologies
Question from you folks, do you know of an event that I can listen to that is similar to UserTrackEvent that will trigger when /lp user USERNAME set parent GROUP is ran?
@tender iris Just listen for a permission node change and check if the node#isGroupNode() is true
hi everyone i have this erreur on every server i put luckperms on .... on the website they say this :
````Note that slf4j-api versions 2.0.x and later use the ServiceLoader mechanism. Backends such as logback 1.3 and later which target slf4j-api 2.x, do not ship with org.slf4j.impl.StaticLoggerBinder. If you place a logging backend which targets slf4j-api 2.0.x, you need slf4j-api-2.x.jar on the classpath```
do i need to upgrade the slf4j api file in the luckperms lib files or not ?
@someone ^^ :p
any help? An exception was thrown by me.lucko.luckperms.bukkit.context.WorldCalculator whilst calculating the context of subject CraftPlayer{name=TheHumdrum}
I've seen this error one tome before
anyone for me lol ?
Hey Beelzebub! Please don't tag staff members.
update to the latest version
It is the latest version
Think I fixed it by changing world name in server properties
Hi. I've wrote some code in a command to edit some permission nodes on a user and I want to know if I've done this right without blocking the main server thread. Also, if loading the user fails or editing permission nodes fails, how would I be able to catch this and inform the user? https://pastebin.com/h9Md9j53
Can anyone help?
Anyone at all?
Can anyone help me please? I really need help.
As soon as somebody with the right knowledge comes on and reads your messages, I'm sure they'll help! 😄 I'm sorry but I can't help cause I don't have the knowledge, but with patience I'm sure you'll get the help you need!
@onyx linden that's for #support-1 !!
@dreamy jasper , remove the second call to loadUser on line 45, you don't need to do it twice :p
and also throw in a call to getUserManager().saveUser() after you've removed/added your nodes
once you've done that, then yep looks good!
to answer your questions:
line 48: yep it is
line 60: it's not super easy, but have a look at CompletableFuture.exceptionally()
@Speedy11CZ that's for #support-1 !!
Sure it is? I mean they might be asking on how to add a group to a user using the API?
Someone already asked that before: https://discordapp.com/channels/241667244927483904/420538367986499585/693047133569548298
@jaunty pecan https://pastebin.com/aaE51V0w Something like this? Anywhere I can improve it still?
Hey Riley The Fox! Please don't tag staff members.
Also I've been trying to grab the user prefix asynchronously without blocking but haven't really got anywhere and had to settle with a blocking method to get it working for now.
public static String getChatMeta(UUID uuid) {
CompletableFuture<User> user = luckPerms.getUserManager().loadUser(uuid);
if (user == null) {
// user not loaded, even after requesting data from storage
return null;
}
//Retreive user metadata
MetaData metaData = null;
try {
// Blocking :(
metaData = user.get().getCachedData().getMetaData(Contexts.allowAll());
} catch (Exception e) {
e.printStackTrace();
}
return metaData.getPrefix();
}
And I'm not sure on how to do this without blocking the main thread :/ (this is on Bungee this time if it makes a difference)
with the first link, not quite - hard to explain how to improve though
I'm on mobile atm but can have a look tomorrow when I'm at my computer
about getting chat meta on bungee: where are you doing it?
in an event?
and is it always for an online user?
Not always
The chat meta is grabbed in a ChatEvent and some message/reply commands
But for a friends list too, which shows offline friends and their prefixes
/*
These 2 methods are called from a Message/Reply command
*/
public static String messagePlayer(ProxiedPlayer sender, String msg) {
String temp = ChatColor.translateAlternateColorCodes('&', BungeeCore.getConfig().getString("messages.msgreceive"));
temp = temp.replace("%player%", ServerUtils.getChatMeta(sender.getUniqueId()) + sender.getName());
temp = temp.replace("%msg%", msg);
return temp;
}
public static String messageSender(ProxiedPlayer reciever, String msg) {
String temp = ChatColor.translateAlternateColorCodes('&', BungeeCore.getConfig().getString("messages.msgsend"));
temp = temp.replaceAll("%player%", ServerUtils.getChatMeta(reciever.getUniqueId()) + reciever.getName());
temp = temp.replaceAll("%msg%", msg);
return temp;
}```
An example of where the chat meta function is used
And those functions are called from a command
Thank you for all your help so far as well 😄
friends list is a little more complicated, but here's some example code
public class Example {
private LuckPerms luckPerms;
public CompletableFuture<List<String>> getUsernamesWithPrefix(Set<UUID> uuids) {
return CompletableFuture.supplyAsync(() -> uuids.stream()
.map(uuid -> luckPerms.getUserManager().loadUser(uuid))
.parallel()
.map(CompletableFuture::join)
.map(user -> {
CachedMetaData metaData = user.getCachedData().getMetaData(QueryOptions.nonContextual());
return metaData.getPrefix() + user.getUsername();
})
.collect(Collectors.toList())
);
}
public void displayFriendList() {
/* this is the code that would go in your command */
ProxiedPlayer player = ...;
Set<UUID> friends = getFriends(player);
getUsernamesWithPrefix(friends).thenAccept(friendList -> {
for (String friendUsername : friendList) {
player.sendMessage(friendUsername);
}
});
}
}
I highly suggest reading as much as you can about CompletableFutures if you want to go down that route, there's lots of resources available online
the alternative is just wrapping your whole command in a call to the Bungee scheduler (run an async task) - then everytime you encounter a future, just call .join() on it
Alright, I will try this tomorrow. Thank you!
@unreal mantle Pls help
Hey Manni! Please don't tag staff members.
Hey Manni! Please don't tag staff members.
@nocturne elbow No I will not help. Because you are impatient and tagging everyone. I don't feel like helping now.
and on top of it, you aren't even asking a question
Sorry, my question is: How can I put two prefixes and 2 ranges to the same user? I already saw the github page but when I try to the finals I ended up deleting the plugins folder, please help me I'm desperate
!stacking
Display multiple prefixes/suffixes alongside a player's name.
I already read that page but as I said I ended up deleting the plugins folder because all my luckperms was buggy or something like that please help me
I speak Spanish
If you delete the folder, your progress will not save and you need to start again, or get it back from your deleted folder
I already have all my progress now what I need is for you to tell me please how to set 2 ranges and 2 prefixes to a single user please help me
Translate the wiki page and use #support-2 this is the wrong channel
Pls help me
Translate the wiki page and use #support-2 this is the wrong channel
You
Use #support-2 please
@rustic laurel i think how to add group to user with dev api ...
Hey Speedy11CZ! Please don't tag staff members.
Ah, sorry ._.
Aight, Tobi has your answer
Ah, okey. Thanks
Hey whenever I try to transfer my luckperms perms this error pops up
can someone please help me?
brainstone can you help me?
Hello i create a group called Admin. But when i say something its looking [world]Mustafa: hello
İ Want to like this
Admin : Hello
How can i Fix it
Hmm, not sure. Probably use a chat listener and use it to override the other formats? Nothing you can do in the LuckPerms Developer API yourself.
As LP doesn't manages chat
İ use for permissions
İ have a kit pvp plugin . Whatever peoples need permission for get kit.
Learn how to use the LuckPerms API in your project.
And if you don't want to use the dev API. You have to configure the format in your chat plugin. The [world] in front may also came from MultiverseCore
Dude look 2:50 https://youtu.be/ZyyN_JimBfQ
https://server.pro
In this tutorial, we teach you how to create groups and manage permissions within those groups so that you can have ranks on your server. We use LuckPerms for this tutorial so ensure you have the correct plugins.
LuckPerms Plugin: https://www.spigotmc.org/r...
When he write testing
{Guest}=testing
But when i say testing
{world}=testinh
Yes dude i use multiverse core
This plugin no support ?
Hey Mustafa Esad TEMEL! Please don't tag staff members.
Wait you're talking about using the plugin? Not the developer API?
Yes i just use lucksperm
Why are you asking in this channel then
And for multiverse it is a setting, there should be tons of help threads on forums for that. Something like /mv set prefixchat false
/mv modify set prefixchat false.
Next time, please ask in #support-1 or #support-2
Oh thank you very much
@velvet oriole #support-1 or #support-2
oh sorry
Hey guys lpapi.getUserManager().lookupUsername(UUID.fromString(uuid)).get() return the name without check the case of the name (example, Flashback083 become flashback083), any way to fix this ?
You could always just use java Bukkit.getPlayer/getOfflinePlayer(UUID.fromString(uuid)).getName();
Explain what you need help with
The problem is when i check the permission for example VIP like:
if (player.hasPermission("group.vip")){ // do something }
Player has 2 permission
like group.vip and group.default
i'd like they have only group.vip
So you're wanting to check if they are in the vip group only