From d5cf3aa54530f24013ff750d6f9b3334c1bad02c Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 4 Jan 2021 22:03:22 +0100 Subject: [PATCH] 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