From d5cf3aa54530f24013ff750d6f9b3334c1bad02c Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 4 Jan 2021 22:03:22 +0100 Subject: [PATCH 1/4] Refactor version dependant calls to new System --- .../de/steamwar/schematicsystem/CheckSchemType.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index 09546a9..7503a70 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -20,6 +20,7 @@ package de.steamwar.schematicsystem; import de.steamwar.core.Core; +import de.steamwar.core.VersionedCallable; import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicType; import org.bukkit.configuration.ConfigurationSection; @@ -67,14 +68,9 @@ public class CheckSchemType implements ICheckSchemType { } public AutoCheckResult autoCheck(Schematic schematic) { - switch(Core.getVersion()){ - case 15: - return CheckSchemType_15.autoCheck(schematic, this); - case 12: - return CheckSchemType_12.autoCheck(schematic, this); - default: - return new AutoCheckResult(); - } + return VersionedCallable.call(new VersionedCallable<>(() -> new AutoCheckResult(), 8), + new VersionedCallable<>(() -> CheckSchemType_12.autoCheck(schematic, null), 12), + new VersionedCallable<>(() -> CheckSchemType_15.autoCheck(schematic, null), 15)); } @Override From e155536573d44393ab2618f9f8a494e3c4868c77 Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 4 Jan 2021 22:04:31 +0100 Subject: [PATCH 2/4] Refactor version dependant calls to new System --- .../src/de/steamwar/schematicsystem/CheckSchemType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index 7503a70..4e3f284 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -68,7 +68,7 @@ public class CheckSchemType implements ICheckSchemType { } public AutoCheckResult autoCheck(Schematic schematic) { - return VersionedCallable.call(new VersionedCallable<>(() -> new AutoCheckResult(), 8), + return VersionedCallable.call(new VersionedCallable<>(AutoCheckResult::new, 8), new VersionedCallable<>(() -> CheckSchemType_12.autoCheck(schematic, null), 12), new VersionedCallable<>(() -> CheckSchemType_15.autoCheck(schematic, null), 15)); } From 59a75a524d85d712ebb18551eaf5cdaa089698fa Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 4 Jan 2021 22:05:16 +0100 Subject: [PATCH 3/4] Refactor version dependant calls to new System --- .../src/de/steamwar/schematicsystem/CheckSchemType.java | 1 + 1 file changed, 1 insertion(+) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index 4e3f284..fa0b66a 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -70,6 +70,7 @@ public class CheckSchemType implements ICheckSchemType { public AutoCheckResult autoCheck(Schematic schematic) { return VersionedCallable.call(new VersionedCallable<>(AutoCheckResult::new, 8), new VersionedCallable<>(() -> CheckSchemType_12.autoCheck(schematic, null), 12), + new VersionedCallable<>(AutoCheckResult::new, 13), new VersionedCallable<>(() -> CheckSchemType_15.autoCheck(schematic, null), 15)); } From e312fc8ced8f690facba306dfce65bb403b819af Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 4 Jan 2021 22:05:42 +0100 Subject: [PATCH 4/4] Refactor version dependant calls to new System --- .../src/de/steamwar/schematicsystem/CheckSchemType.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index fa0b66a..e1cd8c5 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -19,13 +19,14 @@ package de.steamwar.schematicsystem; -import de.steamwar.core.Core; import de.steamwar.core.VersionedCallable; import de.steamwar.sql.Schematic; import de.steamwar.sql.SchematicType; import org.bukkit.configuration.ConfigurationSection; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class CheckSchemType implements ICheckSchemType {