LuckPerms

LuckPerms

41.4k Downloads

How can i get the Expire date from an temporary added group using /user xy parent addtemp? Cant ask on discord right now because i am blocked.

einfachBlu opened this issue ยท 12 comments

commented
commented

Do you mean with the LP API or with commands, like lp user <name> info

commented

Via the api. I did not found any_hing in the docs

commented

What is your discord name?

commented

Blu#0002, if i remember correct. But i am disabled and have no access for the next 1-2 days

commented

My apologies, I thought you were saying you were banned from our Discord.

commented

No Problem.

@Laarryy you may know how to receive the duration over the api? i have seen a Node Object with expire fields. but there is no NodeType for PermissionGroup. Just for Permission, chat and some other things

commented

Oh, thx. I thought it is just for the inheritances, not for the permissiongroup itself. I will try that!

commented

image
image

commented

I suggest you

lpUser.getNodes(NodeType.INHERITANCE)
      .stream()
      .filter(Node::hasExpiry)
      .filter(node -> !node.hasExpired())
      .collect(Collectors.toList());

It will return a List<InheritanceNode> with the user's parent group nodes that have an expiry and have not expired yet. Why a list? Well you can have multiple or no parent groups with an expiry time.

commented

Okay thanks! I will try that one :)

commented

Yes it works! Thx for the help here :)

commented

but there is no NodeType for PermissionGroup

NodeType.INHERITANCE is what you're looking after.