LuckPerms

LuckPerms

41.4k Downloads

The Undo Update

aeyu opened this issue · 5 comments

commented

Hi,
TLDR : I would like to suggest an enhancement : add a
/lp undo

command to LP (and, of course, associated commands), wich would undo changes made by the command last typed by the user.

For reference, I would like to suggest (I'm not affiliated) WorldEdit :

  1. How all of that works in WE :

//undo | [num-steps] [player] |   | Undo your last action.
//redo | [num-steps] [player] |   | Redo your last (undone) action. This command replays back history and does not repeat the command.
/clearhistory |   |   | Clear your history.

perms :
worldedit.history.undo
worldedit.history.redo
worldedit.history.clear

  1. How I would suggest you to add it in LP (replace worldedit by luckperms)¨:

/lp undo | [num-steps] [player] | | Undo your last action.
/lp redo | [num-steps] [player] | | Redo your last (undone) action. This command replays back history and does not repeat the command.
/lp clearhistory | | | Clear your history.

perms :
luckperms.history.undo
luckperms.history.redo
luckperms.history.clear

NB : source for WE cmd & perm (fetched from) : http://wiki.sk89q.com/wiki/WorldEdit/Reference
http://wiki.sk89q.com/wiki/WorldEdit/Permissions
PS : That title looked funny, so I picked it up.

commented

I don't quite see a real use for this command, since pretty much any command has a counter part to it.

A few Examples:

/lp user permission set -> /lp user permission unset
/lp group meta addprefix -> /lp group meta removeprefix [prefix]

And since there's also the web editor which makes changes/removals much easier, this would just be a second option...

The only real place where I can see this option myself is for the applyedits command, which does apply the edits of the web-editor which in laymen's terms is just a bunch of commands.
There a undo command would make sense to revert the applied changes, in case you messed something up that breaks stuff...

Those are just my thoughts tho

commented

the applyedits command

You're absolutely right, I was thinking about that command... and also this one (to put it in a nutshell : all commands that make lots of changes in one go) :

/lp bulkupdate
https://github.com/lucko/LuckPerms/wiki/Bulk-Editing

PS : And there's also the fact that /lp user arandomguy unset minecraft.command.gamemode
is waaaaay longer than a simple /lp undo

commented

Undoing applyedits wouldn't be too hard, but would require some added tracking.
I'd prefer to see LuckPerms/LuckPermsWeb#34 implemented though.

The nature of the way bulkupdate operations are applied means it's impossible to implement undo.

As for all other commands, I'm not so keen on /lp undo style rollbacks, but we could potentially add click triggers to the "User x had permission y set to z" to undo the action. Benefit of that approach is LP doesn't have to store any state about what actions happened last for each sender.

commented

I'd prefer to see LuckPerms/LuckPermsWeb#34 implemented though.

I know I ask for many things, but I'd prefer having both (just my thoughts).

commented

I'm going to close this suggestion on the basis that it's unlikely to make it into the main plugin in the near future. A quality PR implementing this functionality would likely still be accepted, but it's not something I'm going to work on. :)