From 9dc5c535f5f3b659fa40e63f9d5465cb35ee5380 Mon Sep 17 00:00:00 2001 From: jojo Date: Mon, 8 Feb 2021 21:02:31 +0100 Subject: [PATCH] Add VersionedRunnable to Region --- .../de/steamwar/bausystem/world/Region.java | 32 ++++--------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index 0f3d682..e7a6007 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -21,7 +21,7 @@ package de.steamwar.bausystem.world; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.bausystem.commands.CommandTNT.TNTMode; -import de.steamwar.core.Core; +import de.steamwar.core.VersionedRunnable; import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.Schematic; import org.bukkit.Bukkit; @@ -298,14 +298,8 @@ public class Region { int x = region.minX + offsetX + sizeX/2; int y = region.minY + offsetY; int z = region.minZ + offsetZ + sizeZ/2; - switch(Core.getVersion()){ - case 12: - Region_12.paste(file, x, y, z, rotate); - break; - case 15: - default: - Region_15.fastpaste(file, x, y, z, rotate); - } + VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8), + new VersionedRunnable(() -> Region_15.fastpaste(file, x, y, z, rotate), 15)); } public void reset(Region region, Schematic schem) throws IOException, NoClipboardException { @@ -345,25 +339,13 @@ public class Region { } private static void paste(File file, int x, int y, int z, boolean rotate){ //Type of protect - switch(Core.getVersion()){ - case 12: - Region_12.paste(file, x, y, z, rotate); - break; - case 15: - default: - Region_15.paste(file, x, y, z, rotate); - } + VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8), + new VersionedRunnable(() -> Region_15.paste(file, x, y, z, rotate), 15)); } private static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){ - switch(Core.getVersion()){ - case 12: - Region_12.paste(clipboard, x, y, z, rotate); - break; - case 15: - default: - Region_15.paste(clipboard, x, y, z, rotate); - } + VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(clipboard, x, y, z, rotate), 8), + new VersionedRunnable(() -> Region_15.paste(clipboard, x, y, z, rotate), 15)); } } }