From 5749fc65909f0ee934d0410406265387157575a1 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 24 Apr 2020 12:21:47 +0800 Subject: Refactored pending task using OCP design pattern. --- .../keuin/kbackupfabric/operation/Confirmable.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java (limited to 'src/main/java/com/keuin/kbackupfabric/operation/Confirmable.java') 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 context, String backupName) { + return new RestoreOperation(context, backupName); + } + + public static Confirmable createDeleteOperation(CommandContext context, String backupName) { + return new DeleteOperation(context, backupName); + } + + public abstract boolean confirm(); + + @Override + public abstract String toString(); +} -- cgit v1.2.3