summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2020-04-24 12:21:47 +0800
committerkeuin <[email protected]>2020-04-24 12:21:47 +0800
commit5749fc65909f0ee934d0410406265387157575a1 (patch)
tree111efa8934bae8761372bb7a13227abb75e3dc5a /src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java
parentb692a73e039fbdb404ef1219785660dc9eb60e60 (diff)
Refactored pending task using OCP design pattern.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java b/src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java
new file mode 100644
index 0000000..c8fdd71
--- /dev/null
+++ b/src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java
@@ -0,0 +1,20 @@
+package com.keuin.kbackupfabric.operation;
+
+import com.mojang.brigadier.context.CommandContext;
+import net.minecraft.server.command.ServerCommandSource;
+
+public abstract class Confirmable {
+
+ public static Confirmable createRestoreOperation(CommandContext<ServerCommandSource> context, String backupName) {
+ return new RestoreOperation(context, backupName);
+ }
+
+ public static Confirmable createDeleteOperation(CommandContext<ServerCommandSource> context, String backupName) {
+ return new DeleteOperation(context, backupName);
+ }
+
+ public abstract boolean confirm();
+
+ @Override
+ public abstract String toString();
+}