Skip to content

Commit

Permalink
Restructured the rollback command
Browse files Browse the repository at this point in the history
  • Loading branch information
MehradN committed Mar 5, 2023
1 parent f0d691f commit a7a6b04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ The "X Minutes" however is a strict timing. It will take a backup exactly every
### Command
#### /rollback list
Will show a simple list of all the backups available for this world.
#### /rollback backup now
#### /rollback create
Creates an automated backup
#### /rollback backup delete
#### /rollback delete
Takes an index and deletes that backup. This version of this command requires a restart every time you change the "Maximum Backups Per World" option, to work properly. <br>
It can also take the "latest" and "oldest" which will delete the latest/oldest backup.
19 changes: 9 additions & 10 deletions src/main/java/ir/mehradn/rollback/event/RollbackCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ public static void register() {
if (environment.integrated)
dispatcher.register(CommandManager.literal("rollback")
.requires(RollbackCommand::hasAccessToCommand)
.then(CommandManager.literal("backup")
.then(CommandManager.literal("now")
.executes(RollbackCommand::backupNow))
.then(CommandManager.literal("delete")
.then(CommandManager.literal("oldest")
.executes((context) -> deleteBackup(context, 0)))
.then(CommandManager.literal("latest")
.executes((context) -> deleteBackup(context, 1)))
.then(CommandManager.argument("number", IntegerArgumentType.integer(1, RollbackConfig.getMaxBackupsPerWorld()))
.executes((context) -> deleteBackup(context, 2)))))
.then(CommandManager.literal("create")
.executes(RollbackCommand::backupNow))
.then(CommandManager.literal("delete")
.then(CommandManager.literal("oldest")
.executes((context) -> deleteBackup(context, 0)))
.then(CommandManager.literal("latest")
.executes((context) -> deleteBackup(context, 1)))
.then(CommandManager.argument("number", IntegerArgumentType.integer(1, RollbackConfig.getMaxBackupsPerWorld()))
.executes((context) -> deleteBackup(context, 2))))
.then(CommandManager.literal("list")
.executes(RollbackCommand::listBackups)));
}));
Expand Down

0 comments on commit a7a6b04

Please sign in to comment.