From 28db3c0844bef4e5ad00eff996bdb5cccb17ed1b Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 13 Dec 2019 15:53:40 +0100 Subject: [PATCH] Adding 1.9 and 1.10 support --- .../src/de/steamwar/inventory/SWItem_12.java | 4 +- SpigotCore_14/pom.xml | 13 +++++ .../src/de/steamwar/inventory/SWItem_14.java | 6 +++ .../src/de/steamwar/inventory/SWItem_15.java | 6 +++ .../src/de/steamwar/inventory/SWItem_8.java | 9 ++++ .../src/de/steamwar/sql/Schematic_8.java | 2 +- SpigotCore_9/pom.xml | 53 +++++++++++++++++++ .../de/steamwar/inventory/SWInventory_9.java | 13 +++++ .../src/de/steamwar/inventory/SWItem_9.java | 21 ++++++++ .../src/de/steamwar/sql/Schematic_9.java | 23 ++++++++ SpigotCore_Main/pom.xml | 12 +++++ .../de/steamwar/inventory/SWInventory.java | 6 +++ .../src/de/steamwar/inventory/SWItem.java | 24 +++++++++ .../src/de/steamwar/sql/Schematic.java | 18 +++++++ pom.xml | 2 + 15 files changed, 209 insertions(+), 3 deletions(-) create mode 100644 SpigotCore_9/pom.xml create mode 100644 SpigotCore_9/src/de/steamwar/inventory/SWInventory_9.java create mode 100644 SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java create mode 100644 SpigotCore_9/src/de/steamwar/sql/Schematic_9.java diff --git a/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java b/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java index c1a16c3..1f762f3 100644 --- a/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java +++ b/SpigotCore_12/src/de/steamwar/inventory/SWItem_12.java @@ -8,11 +8,11 @@ class SWItem_12 { private SWItem_12(){} static Material getMaterial(String material){ - return Material.valueOf(material); + return SWItem_8.getMaterial(material); } static Material getDye(){ - return Material.INK_SACK; + return SWItem_8.getDye(); } static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ diff --git a/SpigotCore_14/pom.xml b/SpigotCore_14/pom.xml index cf128c3..2e75ed7 100644 --- a/SpigotCore_14/pom.xml +++ b/SpigotCore_14/pom.xml @@ -43,6 +43,19 @@ steamwar SpigotCore_API 2.0 + compile + + + steamwar + SpigotCore_12 + 2.0 + compile + + + steamwar + SpigotCore_12 + 2.0 + compile \ No newline at end of file diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java index f83a56b..4562fcd 100644 --- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java +++ b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java @@ -1,6 +1,8 @@ package de.steamwar.inventory; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.inventory.meta.SkullMeta; class SWItem_14 { private SWItem_14(){} @@ -45,4 +47,8 @@ class SWItem_14 { return Material.BLACK_DYE; } } + + static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ + SWItem_12.setSkullOwner(player, meta); + } } diff --git a/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java b/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java index 46a5760..b03dda9 100644 --- a/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java +++ b/SpigotCore_15/src/de/steamwar/inventory/SWItem_15.java @@ -1,6 +1,8 @@ package de.steamwar.inventory; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.inventory.meta.SkullMeta; class SWItem_15 { private SWItem_15(){} @@ -12,4 +14,8 @@ class SWItem_15 { static Material getDye(int colorCode){ return SWItem_14.getDye(colorCode); } + + static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ + SWItem_12.setSkullOwner(player, meta); + } } diff --git a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java b/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java index 2b770b4..44975c7 100644 --- a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java +++ b/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java @@ -1,11 +1,20 @@ package de.steamwar.inventory; +import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.inventory.meta.SkullMeta; class SWItem_8 { private SWItem_8(){} + static Material getMaterial(String material){ + return Material.valueOf(material); + } + + static Material getDye(){ + return Material.INK_SACK; + } + static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ meta.setOwner(player.getName()); } diff --git a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java b/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java index baf66ae..d610b6a 100644 --- a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java +++ b/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java @@ -45,7 +45,7 @@ class Schematic_8 { } static Clipboard getClipboard(InputStream is) throws IOException { - return ClipboardFormat.findByAlias("mcedit").getReader(is).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); + return ClipboardFormat.SCHEMATIC.getReader(is).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); } private static WorldEditPlugin getWorldEditPlugin() { diff --git a/SpigotCore_9/pom.xml b/SpigotCore_9/pom.xml new file mode 100644 index 0000000..3a5da68 --- /dev/null +++ b/SpigotCore_9/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + + steamwar + SpigotCore + 2.0 + + + SpigotCore_9 + 2.0 + + + src + + + src + + **/*.java + **/*.kt + + + + + + + + steamwar + Spigot + 1.9 + provided + + + steamwar + WorldEdit + 1.0 + provided + + + steamwar + SpigotCore_API + 2.0 + + + steamwar + SpigotCore_8 + 2.0 + + + \ No newline at end of file diff --git a/SpigotCore_9/src/de/steamwar/inventory/SWInventory_9.java b/SpigotCore_9/src/de/steamwar/inventory/SWInventory_9.java new file mode 100644 index 0000000..24b089b --- /dev/null +++ b/SpigotCore_9/src/de/steamwar/inventory/SWInventory_9.java @@ -0,0 +1,13 @@ +package de.steamwar.inventory; + +import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftInventoryCustom; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; + +class SWInventory_9 { + private SWInventory_9(){} + + static Inventory get(Player player, int size, String title){ + return new CraftInventoryCustom(player, size, title); + } +} diff --git a/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java b/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java new file mode 100644 index 0000000..d2e6617 --- /dev/null +++ b/SpigotCore_9/src/de/steamwar/inventory/SWItem_9.java @@ -0,0 +1,21 @@ +package de.steamwar.inventory; + +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.inventory.meta.SkullMeta; + +class SWItem_9 { + private SWItem_9(){} + + static Material getMaterial(String material){ + return SWItem_8.getMaterial(material); + } + + static Material getDye(){ + return SWItem_8.getDye(); + } + + static void setSkullOwner(OfflinePlayer player, SkullMeta meta){ + SWItem_8.setSkullOwner(player, meta); + } +} diff --git a/SpigotCore_9/src/de/steamwar/sql/Schematic_9.java b/SpigotCore_9/src/de/steamwar/sql/Schematic_9.java new file mode 100644 index 0000000..9a541de --- /dev/null +++ b/SpigotCore_9/src/de/steamwar/sql/Schematic_9.java @@ -0,0 +1,23 @@ +package de.steamwar.sql; + +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import org.bukkit.entity.Player; + +import java.io.IOException; +import java.io.InputStream; + +class Schematic_9 { + private Schematic_9(){} + + static byte[] getPlayerClipboard(Player player) throws IOException, NoClipboardException { + return Schematic_8.getPlayerClipboard(player); + } + + static void setPlayerClipboard(Player player, InputStream is) throws IOException { + Schematic_8.setPlayerClipboard(player, is); + } + + static Clipboard getClipboard(InputStream is) throws IOException { + return Schematic_8.getClipboard(is); + } +} diff --git a/SpigotCore_Main/pom.xml b/SpigotCore_Main/pom.xml index e927f09..ae6b0df 100644 --- a/SpigotCore_Main/pom.xml +++ b/SpigotCore_Main/pom.xml @@ -68,6 +68,18 @@ 2.0 compile + + steamwar + SpigotCore_9 + 2.0 + compile + + + steamwar + SpigotCore_10 + 2.0 + compile + steamwar SpigotCore_12 diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java index 671a755..0ec89b9 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java @@ -28,6 +28,12 @@ public class SWInventory implements Listener { case 8: inventory = SWInventory_8.get(p, size, t); break; + case 9: + inventory = SWInventory_9.get(p, size, t); + break; + case 10: + inventory = SWInventory_10.get(p, size, t); + break; case 14: inventory = SWInventory_14.get(p, size, t); break; diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index dd7b441..74f0cc4 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -26,6 +26,18 @@ public class SWItem { case 8: SWItem_8.setSkullOwner(player, headmeta); break; + case 9: + SWItem_9.setSkullOwner(player, headmeta); + break; + case 10: + SWItem_10.setSkullOwner(player, headmeta); + break; + case 14: + SWItem_14.setSkullOwner(player, headmeta); + break; + case 15: + SWItem_15.setSkullOwner(player, headmeta); + break; default: SWItem_12.setSkullOwner(player, headmeta); } @@ -38,6 +50,12 @@ public class SWItem { public static Material getMaterial(String material){ try{ switch(Core.getVersion()){ + case 8: + return SWItem_8.getMaterial(material); + case 9: + return SWItem_9.getMaterial(material); + case 10: + return SWItem_10.getMaterial(material); case 14: return SWItem_14.getMaterial(material); case 15: @@ -52,6 +70,12 @@ public class SWItem { public static Material getDye(int colorCode){ switch(Core.getVersion()){ + case 8: + return SWItem_8.getDye(); + case 9: + return SWItem_9.getDye(); + case 10: + return SWItem_10.getDye(); case 14: return SWItem_14.getDye(colorCode); case 15: diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index 255d5e2..91c9bd4 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -162,6 +162,10 @@ public class Schematic { switch(Core.getVersion()){ case 8: return Schematic_8.getClipboard(is); + case 9: + return Schematic_9.getClipboard(is); + case 10: + return Schematic_10.getClipboard(is); case 14: return Schematic_14.getClipboard(is, schemFormat); case 15: @@ -186,6 +190,12 @@ public class Schematic { case 8: Schematic_8.setPlayerClipboard(player, is); break; + case 9: + Schematic_9.setPlayerClipboard(player, is); + break; + case 10: + Schematic_10.setPlayerClipboard(player, is); + break; case 14: Schematic_14.setPlayerClipboard(player, is, schemFormat); break; @@ -217,6 +227,14 @@ public class Schematic { newFormat = false; data = Schematic_8.getPlayerClipboard(player); break; + case 9: + newFormat = false; + data = Schematic_9.getPlayerClipboard(player); + break; + case 10: + newFormat = false; + data = Schematic_10.getPlayerClipboard(player); + break; case 14: data = Schematic_14.getPlayerClipboard(player, newFormat); break; diff --git a/pom.xml b/pom.xml index 1a1eeb5..28f9285 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,8 @@ SpigotCore_API SpigotCore_8 + SpigotCore_9 + SpigotCore_10 SpigotCore_12 SpigotCore_14 SpigotCore_15