LuckPerms

LuckPerms

41.4k Downloads

/Lp pause <Groups/Permission>

Thefluffypvper1 opened this issue ยท 3 comments

commented

Description

The command would pause all temp permissions or groups at the time so the command can be used again to unpaused the temp permissions/groups. The reason this is a good idea is because a lot of servers have temp permission items inwhich players like to save for the end of the maps to save for the next start of world. A lot of owners like how to down time like a couple of days or even weeks and that time period players lose there temp ranks or permissions and get upset.

Proposed Behaviour

Commands:
/Lp pause

Tasks:

Permission:
Lp.pause

Extra Details

No

commented

A simple work around for this, could just be to use the current temporary modifier options for the temp commands and just add extra time onto the temp groups and/or permission to account for the downtime.

commented

Hello there!

As explained in discord, this isn't so easy. The thing with temporary permissions and groups is that when set, the date and time will be saved as the expiration based on how long you set it for. This is not a countdown - so it is impossible to be stopped without literally stopping real time or doing some really, really heavy recalulation. I see an issue with performance in this case to be honest.
The command itself would indeed be useful to some users, I personally just don't see enough interest in this based on discord conversations etc. Only twice have I come across someone asking for a way to freeze temp permissions and groups, so I propose for this to rather be an extension than being added to the main project.

Here is my idea of what we could do with this extension:
How about an export with enough data to - instead of attempting to freeze the time somehow - simply reapply it?
Also I would like to see a way to control this better than just /lp pause - this doesn't let the user control what to save and what not to for cases where donor (subscription) ranks should be saved but no other.

General behavior:
On command: get name/uuid, get temp groups or permissions based on command executed (see below), calculate time between now and expiry and save it, generate commands to reapply those nodes in the proper typical Luckperms syntax.
This info could then be saved to some type of export to the Luckperms directory similarly to the export, containing whole commands such as: lp user [name/uuid] permission settemp true [permission] [time]

Commands:

  • /lp export temporary group.[group] [filename] (save on specific groups such as donor ranks if needed, 1)
  • /lp export temporary group * [filename] (save all temporary group.[group] assignments, 2)
  • /lp export temporary permission [permission] [filename] (save only specific temporary permissions)
  • /lp export temporary permission * [filename] (save all temporary permissions but not groups, 3)
  • /lp export temporary * [filename] (save both temp groups and permissions to file, 4)
  • /lp import [filename] (run commands saved in the file, this permission already exists)

Permissions:

  • Luckperms.export.temporary.group.[group] (1)
  • Luckperms.export.temporary.group.* (2)
  • Luckperms.export.temporary.permission (3)
  • Luckperms.export.temporary.* (4)
    (Numbers reference the command and it's matching permission node.
    Impossible to assign specific permissions to export specific permissions since millions exist, but luckperms.export is already a thing, so it's not making a whole new command but rather hooking into what is there)

Exported file:
The exported file could have a very simple JSON format for convenience, allowing the users to delete specific things out of the file in case they saved all groups and want to only get rid of one entry, where it is easier to export all and delete one rather than export 50 groups separately to not include group 51 - we all are lazy, let's admit it lmao.

Import file:
The import command would cause LP to access the file in question and run all saved commands inside it. Since the user was saved, the time left as well as the permission or group node itself, the syntax is complete and would look something like this in the file:
Commands:
- lp user Zeromaniac permission settemp luckperms.* true [context]
- lp user ...

Importing multiple different files would be no problem as different files include different permissions based on what the user saved. also, in case a reopening of a server gets delayed for whatever reason, even after the exports were applied already, they could be reapplied right before the next launch is scheduled to ensure the user's players don't loose any time on their permissions/group.

I am aware that I just made an elephant out of something that can be done rather simple with only one command and include all temp groups and perms but LP is a plugin that offers an insane amount of fine tuning already, so it would absolutely not fit into the picture for LP to handle this request in a sloppy way.
Have fun with my input - what you do with it is all yours.
With Love,
~ Zero <3

commented

As Zero said, this would require a complete change in how LP's temp permissions system works: they are stored based on expiry time, not 'time remaining', and this can be solved in other ways as detailed above. For example, if you wanted to pause a countdown for 5 days, you could add 5 days to a temporary node. I'm going to close this as it's out of scope and unnecessary to do the work required to completely change LP's internals.