LuckPerms

LuckPerms

41.4k Downloads

API - im trying to get a players ownnodes using the API

Twi5TeD opened this issue ยท 10 comments

commented
      int permsamount = Main.lp.getUser(target.getUniqueId()).getOwnNodes().size();
      List<Node> perms = Main.lp.getUser(target.getUniqueId()).getOwnNodes();

this is the way im getting the permissions but it shows other stuff aswell which i dont want how would i fix this?

commented

With node you mean the permission of a user?

In that case you may want to use me.lucko.luckperms.api.PermissionHolder#getPermissions

I never used the API, so I can't say if that would be the right/better way to do.
It would be a good thing to join the Discord and ask in the #api channel for support if you aren't on it.

commented

ive asked in the discord channel and havent had any help with it ive tried #getPermissions but that also has alot more information that i dont need all i need is all the players permissions with group perms

commented

The getOwnNodes method should do what you need.

You can then extract the permission from the Node object using the getPermission method.

commented

how would i do that?

commented

Call node.getPermission().

commented

what would i do though?
List node = Main.lp.getUser(target.getUniqueId()).getOwnNodes();
node.getPermission();

would it be like this?

commented

The Javadoc (and your IDE) should help you figure out which method is the correct one (I don't know by heart)

commented

anyone able to help?

commented

Now is the best time to familiarize yourself with Java Streams. Easiest way to bulkedit lists and collections in Java.

And how to get the permission from a node should be trivial to figure out with your IDE.

commented

ive already looked at it ive found out how to get the nodes but it shows other stuff aswell i just want the list to show like perm.test.1, permtest2