From 38a4ca72a46f173e9aaffc42cfef91430e94bbf7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 16 Dec 2019 20:07:57 +0100 Subject: [PATCH 01/10] Schemdownloadlink (untested) --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 ++++ .../schematicsystem/commands/SchematicCommand.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index c605b95..9d6ba9e 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(""), "§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..7e00414 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -308,6 +308,15 @@ public class SchematicCommand implements CommandExecutor { } } + 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); -- 2.39.5 From 91b4fa1d53dbbf2bea32b9f197e216beaff99b00 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 16 Dec 2019 20:15:14 +0100 Subject: [PATCH 02/10] Schemdownloadlink (untested) --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 9d6ba9e..3b8f8f0 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -121,19 +121,23 @@ class GUI { p.closeInventory(); changeItem(p, schem); }); + if(schem.availible()) inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { p.closeInventory(); changeType(p, schem); }); + inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { p.closeInventory(); SchematicCommand.download(p, schem); }); + inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { p.closeInventory(); delmembers(p, schem); }); + inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { p.closeInventory(); delete(p, schem); -- 2.39.5 From d64ee738114e6b9d8bbd10725803f13f79a8e1f3 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 16 Dec 2019 20:21:22 +0100 Subject: [PATCH 03/10] Schemdownloadlink (untested) --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 3b8f8f0..9d6ba9e 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -121,23 +121,19 @@ class GUI { p.closeInventory(); changeItem(p, schem); }); - if(schem.availible()) inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { p.closeInventory(); changeType(p, schem); }); - inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { p.closeInventory(); SchematicCommand.download(p, schem); }); - inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { p.closeInventory(); delmembers(p, schem); }); - inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { p.closeInventory(); delete(p, schem); -- 2.39.5 From cc144f9be606b9450eaed733d1b9f51247e10f98 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 19 Dec 2019 07:18:11 +0100 Subject: [PATCH 04/10] Setting Item and adding option for chat based system --- .../schematicsystem/commands/GUI.java | 2 +- .../commands/SchematicCommand.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 9d6ba9e..fac69a7 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -126,7 +126,7 @@ class GUI { p.closeInventory(); changeType(p, schem); }); - inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { + inv.setItem(5, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> { p.closeInventory(); SchematicCommand.download(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 7e00414..cf5bad3 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(type); + } + 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,19 @@ 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!"); @@ -409,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"); } -- 2.39.5 From cd1e9f1bb5890ce7c979913499464cc1262eef88 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 19 Dec 2019 07:19:50 +0100 Subject: [PATCH 05/10] Setting Item and adding option for chat based system --- .../de/steamwar/schematicsystem/commands/SchematicCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index cf5bad3..8014119 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -288,7 +288,7 @@ public class SchematicCommand implements CommandExecutor { 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(type); + player.spigot().sendMessage(download); } List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); -- 2.39.5 From be8e2e4f902e39ea66f3e874c1ebf9d57b745dd8 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 20 Dec 2019 21:31:42 +0100 Subject: [PATCH 06/10] First 1.15 support --- .../pom.xml | 4 +-- .../schematicsystem/CheckSchemType_15.java | 32 +++++++++++++++---- .../schematicsystem/WorldEdit_15.java | 4 +-- SchematicSystem_Main/pom.xml | 2 +- .../schematicsystem/CheckSchemType.java | 4 +-- .../steamwar/schematicsystem/WorldEdit.java | 4 +-- pom.xml | 2 +- 7 files changed, 35 insertions(+), 17 deletions(-) rename {SchematicSystem_14 => SchematicSystem_15}/pom.xml (93%) rename SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java => SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java (87%) rename SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java => SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java (97%) diff --git a/SchematicSystem_14/pom.xml b/SchematicSystem_15/pom.xml similarity index 93% rename from SchematicSystem_14/pom.xml rename to SchematicSystem_15/pom.xml index 746d6d8..6bee056 100644 --- a/SchematicSystem_14/pom.xml +++ b/SchematicSystem_15/pom.xml @@ -4,7 +4,7 @@ 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 + SchematicSystem_15 1.0 @@ -35,7 +35,7 @@ steamwar Spigot - 1.14 + 1.15 provided diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java similarity index 87% rename from SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java rename to SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java index b778591..a9bf3e4 100644 --- a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java @@ -16,7 +16,7 @@ import java.util.List; import java.util.Set; import java.util.logging.Level; -class CheckSchemType_14 { +class CheckSchemType_15 { private static final Set INVENTORY = EnumSet.of( Material.CHEST, Material.TRAPPED_CHEST, @@ -42,13 +42,31 @@ class CheckSchemType_14 { 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); + Material.PURPLE_SHULKER_BOX, + Material.LECTERN, + Material.BEACON, + Material.BARREL); - private CheckSchemType_14(){} + 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; diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java similarity index 97% rename from SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java rename to SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java index 6d3336b..5dae94a 100644 --- a/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java @@ -16,8 +16,8 @@ import org.bukkit.entity.Player; import java.io.IOException; -class WorldEdit_14 { - private WorldEdit_14(){} +class WorldEdit_15 { + private WorldEdit_15(){} static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException { World weWorld = new BukkitWorld(player.getWorld()); diff --git a/SchematicSystem_Main/pom.xml b/SchematicSystem_Main/pom.xml index d65b137..8c1a28b 100644 --- a/SchematicSystem_Main/pom.xml +++ b/SchematicSystem_Main/pom.xml @@ -64,7 +64,7 @@ steamwar - SchematicSystem_14 + SchematicSystem_15 1.0 compile diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index de6f1ba..dd94a92 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -60,8 +60,8 @@ public class CheckSchemType implements ICheckSchemType { public void autoCheck(Schematic schematic, List errors, List warnings) { switch(Core.getVersion()){ - case 14: - CheckSchemType_14.autoCheck(schematic, errors, warnings, this); + case 15: + CheckSchemType_15.autoCheck(schematic, errors, warnings, this); 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..06a6fb0 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java @@ -13,8 +13,8 @@ public class WorldEdit { public static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException { switch(Core.getVersion()){ - case 14: - return WorldEdit_14.pasteSchematic(player, schematic); + case 15: + return WorldEdit_15.pasteSchematic(player, schematic); default: return WorldEdit_12.pasteSchematic(player, schematic); } diff --git a/pom.xml b/pom.xml index 8cf978c..6bef6fd 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ SchematicSystem_12 - SchematicSystem_14 + SchematicSystem_15 SchematicSystem_API SchematicSystem_Main -- 2.39.5 From a938bde40cb25b146a834afc227cd9868f1c365d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 20 Dec 2019 21:47:39 +0100 Subject: [PATCH 07/10] Readding 1.14 support --- SchematicSystem_14/pom.xml | 48 +++++++++++++++++++ .../schematicsystem/CheckSchemType_14.java | 11 +++++ .../schematicsystem/WorldEdit_14.java | 39 +++++++++++++++ SchematicSystem_15/pom.xml | 5 ++ .../schematicsystem/WorldEdit_15.java | 25 +--------- SchematicSystem_Main/pom.xml | 6 +++ .../schematicsystem/CheckSchemType.java | 3 ++ .../steamwar/schematicsystem/WorldEdit.java | 2 + pom.xml | 1 + 9 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 SchematicSystem_14/pom.xml create mode 100644 SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java create mode 100644 SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java diff --git a/SchematicSystem_14/pom.xml b/SchematicSystem_14/pom.xml new file mode 100644 index 0000000..98a4957 --- /dev/null +++ b/SchematicSystem_14/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + steamwar + SchematicSystem + 1.0 + + + SchematicSystem_14 + 1.0 + + + src + + + src + + **/*.java + **/*.kt + + + + + + + + steamwar + SchematicSystem_API + 1.0 + + + steamwar + Spigot + 1.14 + provided + + + steamwar + FAWE + 1.14 + provided + + + \ No newline at end of file diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java b/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java new file mode 100644 index 0000000..bae671f --- /dev/null +++ b/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java @@ -0,0 +1,11 @@ +package de.steamwar.schematicsystem; + +import java.util.List; + +class CheckSchemType_14 { + private CheckSchemType_14(){} + + static void autoCheck(List errors) { + errors.add("In der 1.14 können keine Schematics eingesendet werden"); + } +} diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java b/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java new file mode 100644 index 0000000..6d3336b --- /dev/null +++ b/SchematicSystem_14/src/de/steamwar/schematicsystem/WorldEdit_14.java @@ -0,0 +1,39 @@ +package de.steamwar.schematicsystem; + +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +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.math.BlockVector3; +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_14 { + private WorldEdit_14(){} + + static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException { + World weWorld = new BukkitWorld(player.getWorld()); + Location playerLocation = player.getLocation(); + Clipboard clipboard = schematic.load(); + BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()); + BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); + BlockVector3 dimensions = clipboard.getDimensions(); + BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset); + EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1); + try { + Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build()); + } catch (MaxChangedBlocksException ex) { + throw new IOException(ex); + } + e.flushQueue(); + return e; + } +} diff --git a/SchematicSystem_15/pom.xml b/SchematicSystem_15/pom.xml index 6bee056..365f874 100644 --- a/SchematicSystem_15/pom.xml +++ b/SchematicSystem_15/pom.xml @@ -32,6 +32,11 @@ SchematicSystem_API 1.0 + + steamwar + SchematicSystem_14 + 1.0 + steamwar Spigot diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java index 5dae94a..6fcc4a4 100644 --- a/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/WorldEdit_15.java @@ -1,17 +1,8 @@ package de.steamwar.schematicsystem; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; -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.math.BlockVector3; -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; @@ -20,20 +11,6 @@ class WorldEdit_15 { private WorldEdit_15(){} static EditSession pasteSchematic(Player player, Schematic schematic) throws Schematic.WrongVersionException, IOException, NoClipboardException { - World weWorld = new BukkitWorld(player.getWorld()); - Location playerLocation = player.getLocation(); - Clipboard clipboard = schematic.load(); - BlockVector3 vector = BlockVector3.at(playerLocation.getBlockX(), playerLocation.getBlockY(), playerLocation.getBlockZ()); - BlockVector3 offset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); - BlockVector3 dimensions = clipboard.getDimensions(); - BlockVector3 v = vector.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()).subtract(offset); - EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1); - try { - Operations.completeBlindly(new ClipboardHolder(clipboard).createPaste(e).to(v).build()); - } catch (MaxChangedBlocksException ex) { - throw new IOException(ex); - } - e.flushQueue(); - return e; + return WorldEdit_14.pasteSchematic(player, schematic); } } diff --git a/SchematicSystem_Main/pom.xml b/SchematicSystem_Main/pom.xml index 8c1a28b..7f5ab24 100644 --- a/SchematicSystem_Main/pom.xml +++ b/SchematicSystem_Main/pom.xml @@ -68,6 +68,12 @@ 1.0 compile + + steamwar + SchematicSystem_14 + 1.0 + compile + steamwar SchematicSystem_12 diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java index dd94a92..dcf94ca 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -63,6 +63,9 @@ public class CheckSchemType implements ICheckSchemType { case 15: CheckSchemType_15.autoCheck(schematic, errors, warnings, this); break; + case 14: + CheckSchemType_14.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 06a6fb0..10bec52 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/WorldEdit.java @@ -15,6 +15,8 @@ public class WorldEdit { switch(Core.getVersion()){ case 15: return WorldEdit_15.pasteSchematic(player, schematic); + case 14: + return WorldEdit_14.pasteSchematic(player, schematic); default: return WorldEdit_12.pasteSchematic(player, schematic); } diff --git a/pom.xml b/pom.xml index 6bef6fd..89f08c6 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,7 @@ SchematicSystem_12 + SchematicSystem_14 SchematicSystem_15 SchematicSystem_API SchematicSystem_Main -- 2.39.5 From cf9889e15f1301d544427f0a927690dc61958836 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 21 Dec 2019 20:36:46 +0100 Subject: [PATCH 08/10] Adding api-version --- SchematicSystem_Main/src/plugin.yml | 1 + 1 file changed, 1 insertion(+) 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: -- 2.39.5 From 9411a7826f00e6d4d893ccb406f521d887706aad Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 22 Dec 2019 15:57:06 +0100 Subject: [PATCH 09/10] 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 -- 2.39.5 From d26550f39f2909a1f91a09edcdefb15285428106 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 22 Dec 2019 17:20:44 +0100 Subject: [PATCH 10/10] Renaming Material --- .../schematicsystem/CheckSchemType_12.java | 14 +++++++------- .../schematicsystem/CheckSchemType_15.java | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) 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_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java index a9bf3e4..bf6605c 100644 --- a/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/CheckSchemType_15.java @@ -145,14 +145,14 @@ class CheckSchemType_15 { continue; } - Material t = Material.matchMaterial(item.getString("id")); - if(t == null) //Leere Slots + Material itemType = Material.matchMaterial(item.getString("id")); + if(itemType == null) //Leere Slots continue; - if(blockMaterial == Material.DISPENSER && (t.equals(Material.FIRE_CHARGE) || t.equals(Material.ARROW))) + if(blockMaterial == Material.DISPENSER && (itemType.equals(Material.FIRE_CHARGE) || itemType.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); + 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()) -- 2.39.5