From 9411a7826f00e6d4d893ccb406f521d887706aad Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 22 Dec 2019 15:57:06 +0100 Subject: [PATCH] Adding explicit support for 1.8, 1.9, 1.10 --- SchematicSystem_10/pom.xml | 61 +++++++++++++++++++ .../schematicsystem/CheckSchemType_10.java | 11 ++++ .../schematicsystem/WorldEdit_10.java | 16 +++++ SchematicSystem_12/pom.xml | 6 ++ .../schematicsystem/WorldEdit_12.java | 20 +----- SchematicSystem_8/pom.xml | 49 +++++++++++++++ .../schematicsystem/CheckSchemType_8.java | 11 ++++ .../steamwar/schematicsystem/WorldEdit_8.java | 34 +++++++++++ SchematicSystem_9/pom.xml | 61 +++++++++++++++++++ .../schematicsystem/CheckSchemType_9.java | 11 ++++ .../steamwar/schematicsystem/WorldEdit_9.java | 16 +++++ SchematicSystem_Main/pom.xml | 18 ++++++ .../schematicsystem/CheckSchemType.java | 9 +++ .../steamwar/schematicsystem/WorldEdit.java | 6 ++ pom.xml | 3 + 15 files changed, 313 insertions(+), 19 deletions(-) create mode 100644 SchematicSystem_10/pom.xml create mode 100644 SchematicSystem_10/src/de/steamwar/schematicsystem/CheckSchemType_10.java create mode 100644 SchematicSystem_10/src/de/steamwar/schematicsystem/WorldEdit_10.java create mode 100644 SchematicSystem_8/pom.xml create mode 100644 SchematicSystem_8/src/de/steamwar/schematicsystem/CheckSchemType_8.java create mode 100644 SchematicSystem_8/src/de/steamwar/schematicsystem/WorldEdit_8.java create mode 100644 SchematicSystem_9/pom.xml create mode 100644 SchematicSystem_9/src/de/steamwar/schematicsystem/CheckSchemType_9.java create mode 100644 SchematicSystem_9/src/de/steamwar/schematicsystem/WorldEdit_9.java diff --git a/SchematicSystem_10/pom.xml b/SchematicSystem_10/pom.xml new file mode 100644 index 0000000..47b45e2 --- /dev/null +++ b/SchematicSystem_10/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + + steamwar + SchematicSystem + 1.0 + + + SchematicSystem_10 + 1.0 + + + src + + + src + + **/*.java + **/*.kt + + + + + + + + steamwar + Spigot + 1.10 + provided + + + steamwar + WorldEdit + 1.0 + provided + + + steamwar + FAWE + 1.0 + provided + + + steamwar + SchematicSystem_9 + 1.0 + compile + + + steamwar + SchematicSystem_API + 1.0 + compile + + + \ No newline at end of file diff --git a/SchematicSystem_10/src/de/steamwar/schematicsystem/CheckSchemType_10.java b/SchematicSystem_10/src/de/steamwar/schematicsystem/CheckSchemType_10.java new file mode 100644 index 0000000..4ba671d --- /dev/null +++ b/SchematicSystem_10/src/de/steamwar/schematicsystem/CheckSchemType_10.java @@ -0,0 +1,11 @@ +package de.steamwar.schematicsystem; + +import java.util.List; + +class CheckSchemType_10 { + private CheckSchemType_10(){} + + static void autoCheck(List errors) { + errors.add("In der 1.10 können keine Schematics eingesendet werden"); + } +} diff --git a/SchematicSystem_10/src/de/steamwar/schematicsystem/WorldEdit_10.java b/SchematicSystem_10/src/de/steamwar/schematicsystem/WorldEdit_10.java new file mode 100644 index 0000000..fbf4449 --- /dev/null +++ b/SchematicSystem_10/src/de/steamwar/schematicsystem/WorldEdit_10.java @@ -0,0 +1,16 @@ +package de.steamwar.schematicsystem; + +import com.sk89q.worldedit.EditSession; +import de.steamwar.sql.NoClipboardException; +import de.steamwar.sql.Schematic; +import org.bukkit.entity.Player; + +import java.io.IOException; + +class WorldEdit_10 { + private WorldEdit_10(){} + + static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException { + return WorldEdit_8.pasteSchematic(player, schematic); + } +} diff --git a/SchematicSystem_12/pom.xml b/SchematicSystem_12/pom.xml index 364351e..5a1966a 100644 --- a/SchematicSystem_12/pom.xml +++ b/SchematicSystem_12/pom.xml @@ -45,6 +45,12 @@ 1.0 provided + + steamwar + SchematicSystem_10 + 1.0 + compile + steamwar SchematicSystem_API diff --git a/SchematicSystem_12/src/de/steamwar/schematicsystem/WorldEdit_12.java b/SchematicSystem_12/src/de/steamwar/schematicsystem/WorldEdit_12.java index 191887f..4771bfc 100644 --- a/SchematicSystem_12/src/de/steamwar/schematicsystem/WorldEdit_12.java +++ b/SchematicSystem_12/src/de/steamwar/schematicsystem/WorldEdit_12.java @@ -1,16 +1,8 @@ package de.steamwar.schematicsystem; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.function.operation.Operations; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.world.World; import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.Schematic; -import org.bukkit.Location; import org.bukkit.entity.Player; import java.io.IOException; @@ -19,16 +11,6 @@ class WorldEdit_12 { private WorldEdit_12(){} static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException { - World weWorld = new BukkitWorld(player.getWorld()); - Location playerLocation = player.getLocation(); - Vector vector = new Vector(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()); - Clipboard clipboard = schematic.load(); - Vector offset = new Vector(clipboard.getRegion().getMinimumPoint()).subtract(clipboard.getOrigin()); - Vector dimensions = clipboard.getDimensions(); - Vector v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset); - EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1); - Operations.completeBlindly(new ClipboardHolder(clipboard, weWorld.getWorldData()).createPaste(e, weWorld.getWorldData()).to(v).build()); - e.flushQueue(); - return e; + return WorldEdit_8.pasteSchematic(player, schematic); } } diff --git a/SchematicSystem_8/pom.xml b/SchematicSystem_8/pom.xml new file mode 100644 index 0000000..1950a72 --- /dev/null +++ b/SchematicSystem_8/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + + steamwar + SchematicSystem + 1.0 + + + SchematicSystem_8 + 1.0 + + + src + + + src + + **/*.java + **/*.kt + + + + + + + + steamwar + Spigot + 1.8 + provided + + + steamwar + WorldEdit + 1.0 + provided + + + steamwar + SchematicSystem_API + 1.0 + compile + + + \ No newline at end of file diff --git a/SchematicSystem_8/src/de/steamwar/schematicsystem/CheckSchemType_8.java b/SchematicSystem_8/src/de/steamwar/schematicsystem/CheckSchemType_8.java new file mode 100644 index 0000000..aad4abc --- /dev/null +++ b/SchematicSystem_8/src/de/steamwar/schematicsystem/CheckSchemType_8.java @@ -0,0 +1,11 @@ +package de.steamwar.schematicsystem; + +import java.util.List; + +class CheckSchemType_8 { + private CheckSchemType_8(){} + + static void autoCheck(List errors) { + errors.add("In der 1.8 können keine Schematics eingesendet werden"); + } +} diff --git a/SchematicSystem_8/src/de/steamwar/schematicsystem/WorldEdit_8.java b/SchematicSystem_8/src/de/steamwar/schematicsystem/WorldEdit_8.java new file mode 100644 index 0000000..a11bdf6 --- /dev/null +++ b/SchematicSystem_8/src/de/steamwar/schematicsystem/WorldEdit_8.java @@ -0,0 +1,34 @@ +package de.steamwar.schematicsystem; + +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.function.operation.Operations; +import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.world.World; +import de.steamwar.sql.NoClipboardException; +import de.steamwar.sql.Schematic; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import java.io.IOException; + +class WorldEdit_8 { + private WorldEdit_8(){} + + static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException { + World weWorld = new BukkitWorld(player.getWorld()); + Location playerLocation = player.getLocation(); + Vector vector = new Vector(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()); + Clipboard clipboard = schematic.load(); + Vector offset = new Vector(clipboard.getRegion().getMinimumPoint()).subtract(clipboard.getOrigin()); + Vector dimensions = clipboard.getDimensions(); + Vector v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset); + EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1); + Operations.completeBlindly(new ClipboardHolder(clipboard, weWorld.getWorldData()).createPaste(e, weWorld.getWorldData()).to(v).build()); + e.flushQueue(); + return e; + } +} diff --git a/SchematicSystem_9/pom.xml b/SchematicSystem_9/pom.xml new file mode 100644 index 0000000..53bcf19 --- /dev/null +++ b/SchematicSystem_9/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + + steamwar + SchematicSystem + 1.0 + + + SchematicSystem_9 + 1.0 + + + src + + + src + + **/*.java + **/*.kt + + + + + + + + steamwar + Spigot + 1.9 + provided + + + steamwar + WorldEdit + 1.0 + provided + + + steamwar + FAWE + 1.0 + provided + + + steamwar + SchematicSystem_8 + 1.0 + compile + + + steamwar + SchematicSystem_API + 1.0 + compile + + + \ No newline at end of file diff --git a/SchematicSystem_9/src/de/steamwar/schematicsystem/CheckSchemType_9.java b/SchematicSystem_9/src/de/steamwar/schematicsystem/CheckSchemType_9.java new file mode 100644 index 0000000..cf18f33 --- /dev/null +++ b/SchematicSystem_9/src/de/steamwar/schematicsystem/CheckSchemType_9.java @@ -0,0 +1,11 @@ +package de.steamwar.schematicsystem; + +import java.util.List; + +class CheckSchemType_9 { + private CheckSchemType_9(){} + + static void autoCheck(List errors) { + errors.add("In der 1.9 können keine Schematics eingesendet werden"); + } +} diff --git a/SchematicSystem_9/src/de/steamwar/schematicsystem/WorldEdit_9.java b/SchematicSystem_9/src/de/steamwar/schematicsystem/WorldEdit_9.java new file mode 100644 index 0000000..0ef2a9e --- /dev/null +++ b/SchematicSystem_9/src/de/steamwar/schematicsystem/WorldEdit_9.java @@ -0,0 +1,16 @@ +package de.steamwar.schematicsystem; + +import com.sk89q.worldedit.EditSession; +import de.steamwar.sql.NoClipboardException; +import de.steamwar.sql.Schematic; +import org.bukkit.entity.Player; + +import java.io.IOException; + +class WorldEdit_9 { + private WorldEdit_9(){} + + static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, NoClipboardException, IOException { + return WorldEdit_8.pasteSchematic(player, schematic); + } +} diff --git a/SchematicSystem_Main/pom.xml b/SchematicSystem_Main/pom.xml index 7f5ab24..94b2b47 100644 --- a/SchematicSystem_Main/pom.xml +++ b/SchematicSystem_Main/pom.xml @@ -80,6 +80,24 @@ 1.0 compile + + steamwar + SchematicSystem_10 + 1.0 + compile + + + steamwar + SchematicSystem_9 + 1.0 + compile + + + steamwar + SchematicSystem_8 + 1.0 + compile + steamwar SchematicSystem_API diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index dcf94ca..85d78f5 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -66,6 +66,15 @@ public class CheckSchemType implements ICheckSchemType { case 14: CheckSchemType_14.autoCheck(errors); break; + case 10: + CheckSchemType_10.autoCheck(errors); + break; + case 9: + CheckSchemType_9.autoCheck(errors); + break; + case 8: + CheckSchemType_8.autoCheck(errors); + break; default: CheckSchemType_12.autoCheck(schematic, errors, warnings, this); } diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java index 10bec52..cc892a2 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java @@ -17,6 +17,12 @@ public class WorldEdit { return WorldEdit_15.pasteSchematic(player, schematic); case 14: return WorldEdit_14.pasteSchematic(player, schematic); + case 10: + return WorldEdit_10.pasteSchematic(player, schematic); + case 9: + return WorldEdit_9.pasteSchematic(player, schematic); + case 8: + return WorldEdit_8.pasteSchematic(player, schematic); default: return WorldEdit_12.pasteSchematic(player, schematic); } diff --git a/pom.xml b/pom.xml index 89f08c6..964414f 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,9 @@ + SchematicSystem_8 + SchematicSystem_9 + SchematicSystem_10 SchematicSystem_12 SchematicSystem_14 SchematicSystem_15