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/CheckSchemType_12.java b/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java
index 6fba870..a6a51a3 100644
--- a/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java
+++ b/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java
@@ -143,16 +143,16 @@ class CheckSchemType_12 {
continue;
}
- Material t = Material.getMaterial(item.getString("id").split(":")[1].toUpperCase().replace("SHOVEL", "SPADE"));
- if(t == null && item.getString("id").equals("minecraft:fire_charge"))
- t = Material.FIREBALL;
- if(t == null) //Leere Slots
+ Material itemType = Material.getMaterial(item.getString("id").split(":")[1].toUpperCase().replace("SHOVEL", "SPADE"));
+ if(itemType == null && item.getString("id").equals("minecraft:fire_charge"))
+ itemType = Material.FIREBALL;
+ if(itemType == null) //Leere Slots
continue;
- if(blockId == DISPENSER && (t.equals(Material.FIREBALL) || t.equals(Material.ARROW)))
+ if(blockId == DISPENSER && (itemType.equals(Material.FIREBALL) || itemType.equals(Material.ARROW)))
counter += item.getByte("Count");
- else if(!FLOWERS.contains(t) && !(blockId == CHEST && t.equals(Material.TNT)))
- errors.add("In einem/r " + Material.getMaterial(blockId).name() + " ist das verbotene Item " + t);
+ else if(!FLOWERS.contains(itemType) && !(blockId == CHEST && itemType.equals(Material.TNT)))
+ errors.add("In einem/r " + Material.getMaterial(blockId).name() + " ist das verbotene Item " + itemType);
}
if(counter > type.getMaxDispenserItems())
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_14/pom.xml b/SchematicSystem_14/pom.xml
index 746d6d8..98a4957 100644
--- a/SchematicSystem_14/pom.xml
+++ b/SchematicSystem_14/pom.xml
@@ -4,15 +4,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- SchematicSystem_14
- 1.0
-
steamwar
SchematicSystem
1.0
+ SchematicSystem_14
+ 1.0
+
src
diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java b/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java
index b778591..bae671f 100644
--- a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java
+++ b/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java
@@ -1,143 +1,11 @@
package de.steamwar.schematicsystem;
-import com.sk89q.jnbt.CompoundTag;
-import com.sk89q.worldedit.extent.clipboard.Clipboard;
-import com.sk89q.worldedit.math.BlockVector3;
-import com.sk89q.worldedit.regions.Region;
-import com.sk89q.worldedit.world.block.BaseBlock;
-import de.steamwar.sql.NoClipboardException;
-import de.steamwar.sql.Schematic;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-
-import java.io.IOException;
-import java.util.EnumSet;
import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
class CheckSchemType_14 {
- private static final Set INVENTORY = EnumSet.of(
- Material.CHEST,
- Material.TRAPPED_CHEST,
- Material.HOPPER,
- Material.FURNACE,
- Material.DROPPER,
- Material.JUKEBOX,
- Material.DISPENSER,
- Material.ANVIL,
- Material.BREWING_STAND,
- Material.BLACK_SHULKER_BOX,
- Material.RED_SHULKER_BOX,
- Material.WHITE_SHULKER_BOX,
- Material.ORANGE_SHULKER_BOX,
- Material.BLUE_SHULKER_BOX,
- Material.LIGHT_BLUE_SHULKER_BOX,
- Material.YELLOW_SHULKER_BOX,
- Material.GREEN_SHULKER_BOX,
- Material.BROWN_SHULKER_BOX,
- Material.CYAN_SHULKER_BOX,
- Material.GRAY_SHULKER_BOX,
- Material.LIGHT_GRAY_SHULKER_BOX,
- Material.LIME_SHULKER_BOX,
- Material.MAGENTA_SHULKER_BOX,
- Material.PINK_SHULKER_BOX,
- Material.PURPLE_SHULKER_BOX);
- //TODO: New Inventory Items
- //TODO: Adding flowers
- private static final Set FLOWERS = EnumSet.of(
- Material.CORNFLOWER);
-
private CheckSchemType_14(){}
- static void autoCheck(Schematic schematic, List errors, List warnings, ICheckSchemType type) {
- Clipboard clipboard;
- try {
- clipboard = schematic.load();
- } catch (Schematic.WrongVersionException e) {
- errors.add("Der Schematictyp dieser Schematic kann nicht in dieser Version geändert werden.");
- return;
- } catch (IOException | NoClipboardException e) {
- Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
- errors.add("Die Schematic konnte nicht geladen werden");
- return;
- }
-
- BlockVector3 dimensions = clipboard.getDimensions();
-
- if(dimensions.getBlockX() > type.getWidth() || dimensions.getBlockY() > type.getHeight() || dimensions.getBlockZ() > type.getDepth())
- errors.add("Das " + type.getName() + " überschreitet die Maximalmaße");
-
- Region region = clipboard.getRegion();
- BlockVector3 min = region.getMinimumPoint();
- BlockVector3 max = region.getMaximumPoint();
-
- int tnt = 0;
- int slime = 0;
- int dispenser = 0;
-
- for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
- for(int y = min.getBlockY(); y <= max.getBlockY(); y++){
- for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){
- final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z));
- final Material blockMaterial = Material.matchMaterial(block.getBlockType().getId());
-
- if(blockMaterial == Material.TNT || blockMaterial == Material.OBSIDIAN)
- tnt++;
-
- if(blockMaterial == Material.SLIME_BLOCK || blockMaterial == Material.BEDROCK)
- slime++;
-
- if(blockMaterial == Material.DISPENSER)
- dispenser++;
-
- if(INVENTORY.contains(blockMaterial)){
- checkInventory(errors, warnings, block, blockMaterial, type);
- }
-
- if(type.getForbidden().contains(blockMaterial.name()))
- errors.add("Der Block " + blockMaterial.name() + " ist verboten");
- }
- }
- }
-
- type.finalChecks(errors, tnt, slime, dispenser);
- }
-
- private static void checkInventory(List errors, List warnings, BaseBlock block, Material blockMaterial, ICheckSchemType type){
- CompoundTag nbt = block.getNbtData();
- if(nbt == null){
- warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
- return;
- }
-
- if(blockMaterial == Material.JUKEBOX && nbt.getValue().containsKey("RecordItem")){
- errors.add("Schallplatten sind auch nicht in Schallplattenspielern gestattet");
- return;
- }
-
- List items = nbt.getList("Items", CompoundTag.class);
- if(items.isEmpty())
- return; //Leeres Inventar
-
- int counter = 0;
- for(CompoundTag item : items){
- if(!item.containsKey("id")){
- warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
- continue;
- }
-
- Material t = Material.matchMaterial(item.getString("id"));
- if(t == null) //Leere Slots
- continue;
-
- if(blockMaterial == Material.DISPENSER && (t.equals(Material.FIRE_CHARGE) || t.equals(Material.ARROW)))
- counter += item.getByte("Count");
- else if(!FLOWERS.contains(t) && !(blockMaterial == Material.CHEST && t.equals(Material.TNT)))
- errors.add("In einem/r " + blockMaterial.name() + " ist das verbotene Item " + t);
- }
-
- if(counter > type.getMaxDispenserItems())
- errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
+ static void autoCheck(List errors) {
+ errors.add("In der 1.14 können keine Schematics eingesendet werden");
}
}
diff --git a/SchematicSystem_15/pom.xml b/SchematicSystem_15/pom.xml
new file mode 100644
index 0000000..365f874
--- /dev/null
+++ b/SchematicSystem_15/pom.xml
@@ -0,0 +1,53 @@
+
+
+ 4.0.0
+
+ SchematicSystem_15
+ 1.0
+
+
+ steamwar
+ SchematicSystem
+ 1.0
+
+
+
+ src
+
+
+ src
+
+ **/*.java
+ **/*.kt
+
+
+
+
+
+
+
+ steamwar
+ SchematicSystem_API
+ 1.0
+
+
+ steamwar
+ SchematicSystem_14
+ 1.0
+
+
+ steamwar
+ Spigot
+ 1.15
+ provided
+
+
+ steamwar
+ FAWE
+ 1.14
+ provided
+
+
+
\ No newline at end of file
diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java
new file mode 100644
index 0000000..bf6605c
--- /dev/null
+++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java
@@ -0,0 +1,161 @@
+package de.steamwar.schematicsystem;
+
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import com.sk89q.worldedit.math.BlockVector3;
+import com.sk89q.worldedit.regions.Region;
+import com.sk89q.worldedit.world.block.BaseBlock;
+import de.steamwar.sql.NoClipboardException;
+import de.steamwar.sql.Schematic;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+
+import java.io.IOException;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+
+class CheckSchemType_15 {
+ private static final Set INVENTORY = EnumSet.of(
+ Material.CHEST,
+ Material.TRAPPED_CHEST,
+ Material.HOPPER,
+ Material.FURNACE,
+ Material.DROPPER,
+ Material.JUKEBOX,
+ Material.DISPENSER,
+ Material.ANVIL,
+ Material.BREWING_STAND,
+ Material.BLACK_SHULKER_BOX,
+ Material.RED_SHULKER_BOX,
+ Material.WHITE_SHULKER_BOX,
+ Material.ORANGE_SHULKER_BOX,
+ Material.BLUE_SHULKER_BOX,
+ Material.LIGHT_BLUE_SHULKER_BOX,
+ Material.YELLOW_SHULKER_BOX,
+ Material.GREEN_SHULKER_BOX,
+ Material.BROWN_SHULKER_BOX,
+ Material.CYAN_SHULKER_BOX,
+ Material.GRAY_SHULKER_BOX,
+ Material.LIGHT_GRAY_SHULKER_BOX,
+ Material.LIME_SHULKER_BOX,
+ Material.MAGENTA_SHULKER_BOX,
+ Material.PINK_SHULKER_BOX,
+ Material.PURPLE_SHULKER_BOX,
+ Material.LECTERN,
+ Material.BEACON,
+ Material.BARREL);
+
+ private static final Set FLOWERS = EnumSet.of(
+ Material.CORNFLOWER,
+ Material.FERN,
+ Material.DANDELION,
+ Material.POPPY,
+ Material.BLUE_ORCHID,
+ Material.ALLIUM,
+ Material.AZURE_BLUET,
+ Material.RED_TULIP,
+ Material.ORANGE_TULIP,
+ Material.WHITE_TULIP,
+ Material.PINK_TULIP,
+ Material.OXEYE_DAISY,
+ Material.CORNFLOWER,
+ Material.LILY_OF_THE_VALLEY,
+ Material.WITHER_ROSE,
+ Material.BROWN_MUSHROOM,
+ Material.RED_MUSHROOM);
+
+ private CheckSchemType_15(){}
+
+ static void autoCheck(Schematic schematic, List errors, List warnings, ICheckSchemType type) {
+ Clipboard clipboard;
+ try {
+ clipboard = schematic.load();
+ } catch (Schematic.WrongVersionException e) {
+ errors.add("Der Schematictyp dieser Schematic kann nicht in dieser Version geändert werden.");
+ return;
+ } catch (IOException | NoClipboardException e) {
+ Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e);
+ errors.add("Die Schematic konnte nicht geladen werden");
+ return;
+ }
+
+ BlockVector3 dimensions = clipboard.getDimensions();
+
+ if(dimensions.getBlockX() > type.getWidth() || dimensions.getBlockY() > type.getHeight() || dimensions.getBlockZ() > type.getDepth())
+ errors.add("Das " + type.getName() + " überschreitet die Maximalmaße");
+
+ Region region = clipboard.getRegion();
+ BlockVector3 min = region.getMinimumPoint();
+ BlockVector3 max = region.getMaximumPoint();
+
+ int tnt = 0;
+ int slime = 0;
+ int dispenser = 0;
+
+ for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
+ for(int y = min.getBlockY(); y <= max.getBlockY(); y++){
+ for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){
+ final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z));
+ final Material blockMaterial = Material.matchMaterial(block.getBlockType().getId());
+
+ if(blockMaterial == Material.TNT || blockMaterial == Material.OBSIDIAN)
+ tnt++;
+
+ if(blockMaterial == Material.SLIME_BLOCK || blockMaterial == Material.BEDROCK)
+ slime++;
+
+ if(blockMaterial == Material.DISPENSER)
+ dispenser++;
+
+ if(INVENTORY.contains(blockMaterial)){
+ checkInventory(errors, warnings, block, blockMaterial, type);
+ }
+
+ if(type.getForbidden().contains(blockMaterial.name()))
+ errors.add("Der Block " + blockMaterial.name() + " ist verboten");
+ }
+ }
+ }
+
+ type.finalChecks(errors, tnt, slime, dispenser);
+ }
+
+ private static void checkInventory(List errors, List warnings, BaseBlock block, Material blockMaterial, ICheckSchemType type){
+ CompoundTag nbt = block.getNbtData();
+ if(nbt == null){
+ warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
+ return;
+ }
+
+ if(blockMaterial == Material.JUKEBOX && nbt.getValue().containsKey("RecordItem")){
+ errors.add("Schallplatten sind auch nicht in Schallplattenspielern gestattet");
+ return;
+ }
+
+ List items = nbt.getList("Items", CompoundTag.class);
+ if(items.isEmpty())
+ return; //Leeres Inventar
+
+ int counter = 0;
+ for(CompoundTag item : items){
+ if(!item.containsKey("id")){
+ warnings.add("Ein(e) " + blockMaterial.name() + " ist defekt");
+ continue;
+ }
+
+ Material itemType = Material.matchMaterial(item.getString("id"));
+ if(itemType == null) //Leere Slots
+ continue;
+
+ if(blockMaterial == Material.DISPENSER && (itemType.equals(Material.FIRE_CHARGE) || itemType.equals(Material.ARROW)))
+ counter += item.getByte("Count");
+ else if(!FLOWERS.contains(itemType) && !(blockMaterial == Material.CHEST && itemType.equals(Material.TNT)))
+ errors.add("In einem/r " + blockMaterial.name() + " ist das verbotene Item " + itemType);
+ }
+
+ if(counter > type.getMaxDispenserItems())
+ errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle");
+ }
+}
diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java
new file mode 100644
index 0000000..6fcc4a4
--- /dev/null
+++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.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_15 {
+ private WorldEdit_15(){}
+
+ static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
+ return WorldEdit_14.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 d65b137..94b2b47 100644
--- a/SchematicSystem_Main/pom.xml
+++ b/SchematicSystem_Main/pom.xml
@@ -62,6 +62,12 @@
1.0
provided
+
+ steamwar
+ SchematicSystem_15
+ 1.0
+ compile
+
steamwar
SchematicSystem_14
@@ -74,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 de6f1ba..85d78f5 100644
--- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java
+++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java
@@ -60,8 +60,20 @@ public class CheckSchemType implements ICheckSchemType {
public void autoCheck(Schematic schematic, List errors, List warnings) {
switch(Core.getVersion()){
+ case 15:
+ CheckSchemType_15.autoCheck(schematic, errors, warnings, this);
+ break;
case 14:
- CheckSchemType_14.autoCheck(schematic, errors, warnings, this);
+ 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 f7ac14f..cc892a2 100644
--- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java
+++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java
@@ -13,8 +13,16 @@ public class WorldEdit {
public static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException {
switch(Core.getVersion()){
+ case 15:
+ 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/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java
index c605b95..fac69a7 100644
--- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java
+++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java
@@ -126,6 +126,10 @@ class GUI {
p.closeInventory();
changeType(p, schem);
});
+ inv.setItem(5, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> {
+ p.closeInventory();
+ SchematicCommand.download(p, schem);
+ });
inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> {
p.closeInventory();
delmembers(p, schem);
diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java
index af2ed7c..8014119 100644
--- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java
+++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java
@@ -64,6 +64,9 @@ public class SchematicCommand implements CommandExecutor {
case "delmember":
delmember(player, args);
break;
+ case "download":
+ download(player, args);
+ break;
default:
help(player);
}
@@ -281,6 +284,13 @@ public class SchematicCommand implements CommandExecutor {
}
player.spigot().sendMessage(type);
+ if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){
+ TextComponent download = new TextComponent("§eDownload Schematic");
+ download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eGeneriere Downloadlink")));
+ download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + schematic.getSchemName()));
+ player.spigot().sendMessage(download);
+ }
+
List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
for(int i = checkedSchematics.size() -1; i >= 0; i--) {
if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) &&
@@ -308,6 +318,28 @@ public class SchematicCommand implements CommandExecutor {
}
}
+ private void download(Player player, String[] args){
+ if(args.length < 2){
+ help(player);
+ return;
+ }
+
+ Schematic schematic = getSchem(player, args[1]);
+ if(schematic == null)
+ return;
+
+ download(player, schematic);
+ }
+
+ static void download(Player player, Schematic schematic){
+ if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){
+ player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!");
+ return;
+ }
+
+ player.sendMessage(DownloadSchematic.getLink(schematic));
+ }
+
private void addmember(Player player, String[] args){
if(args.length < 3){
help(player);
@@ -400,6 +432,7 @@ public class SchematicCommand implements CommandExecutor {
player.sendMessage("§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic");
player.sendMessage("§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic");
player.sendMessage("§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic");
+ player.sendMessage("§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)");
player.sendMessage("§8/§eschem addmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu");
player.sendMessage("§8/§eschem delmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic");
}
diff --git a/SchematicSystem_Main/src/plugin.yml b/SchematicSystem_Main/src/plugin.yml
index ce8624a..654bc59 100644
--- a/SchematicSystem_Main/src/plugin.yml
+++ b/SchematicSystem_Main/src/plugin.yml
@@ -3,6 +3,7 @@ version: "1.0"
authors: [Yaruma3341, Lixfel]
depend: [SpigotCore, WorldEdit]
main: de.steamwar.schematicsystem.SchematicSystem
+api-version: "1.13"
commands:
schem:
diff --git a/pom.xml b/pom.xml
index 8cf978c..964414f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,8 +36,12 @@
+ SchematicSystem_8
+ SchematicSystem_9
+ SchematicSystem_10
SchematicSystem_12
SchematicSystem_14
+ SchematicSystem_15
SchematicSystem_API
SchematicSystem_Main