From ab9e32a7ca59acf994cb7ce6bf39dec1121d35e3 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 18 Nov 2019 18:49:51 +0100 Subject: [PATCH] Starting 1.14 support --- .../fightsystem/utils/ColorConverter_12.java | 11 +++++ FightSystem_14/pom.xml | 42 +++++++++++++++++++ .../fightsystem/utils/ColorConverter_14.java | 11 +++++ FightSystem_Main/pom.xml | 8 +++- .../de/steamwar/fightsystem/commands/GUI.java | 10 ++--- .../steamwar/fightsystem/fight/FightTeam.java | 16 ++++--- .../fightsystem/utils/ColorConverter.java | 11 ++++- .../fightsystem/utils/WaterRemover.java | 2 +- pom.xml | 1 + 9 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 FightSystem_12/src/de/steamwar/fightsystem/utils/ColorConverter_12.java create mode 100644 FightSystem_14/pom.xml create mode 100644 FightSystem_14/src/de/steamwar/fightsystem/utils/ColorConverter_14.java diff --git a/FightSystem_12/src/de/steamwar/fightsystem/utils/ColorConverter_12.java b/FightSystem_12/src/de/steamwar/fightsystem/utils/ColorConverter_12.java new file mode 100644 index 0000000..d86d85d --- /dev/null +++ b/FightSystem_12/src/de/steamwar/fightsystem/utils/ColorConverter_12.java @@ -0,0 +1,11 @@ +package de.steamwar.fightsystem.utils; + +import org.bukkit.DyeColor; + +class ColorConverter_12 { + private ColorConverter_12(){} + + static DyeColor getSilver(){ + return DyeColor.SILVER; + } +} diff --git a/FightSystem_14/pom.xml b/FightSystem_14/pom.xml new file mode 100644 index 0000000..3019895 --- /dev/null +++ b/FightSystem_14/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + + steamwar + FightSystem + 1.0 + + + FightSystem_14 + 1.0 + + + src + + + src + + **/*.java + **/*.kt + + + + + + + + steamwar + Spigot + 1.14 + provided + + + steamwar + FightSystem_API + 1.0 + + + \ No newline at end of file diff --git a/FightSystem_14/src/de/steamwar/fightsystem/utils/ColorConverter_14.java b/FightSystem_14/src/de/steamwar/fightsystem/utils/ColorConverter_14.java new file mode 100644 index 0000000..95f6efd --- /dev/null +++ b/FightSystem_14/src/de/steamwar/fightsystem/utils/ColorConverter_14.java @@ -0,0 +1,11 @@ +package de.steamwar.fightsystem.utils; + +import org.bukkit.DyeColor; + +class ColorConverter_14 { + private ColorConverter_14(){} + + static DyeColor getSilver(){ + return DyeColor.LIGHT_GRAY; + } +} diff --git a/FightSystem_Main/pom.xml b/FightSystem_Main/pom.xml index 1ad01a1..700526f 100644 --- a/FightSystem_Main/pom.xml +++ b/FightSystem_Main/pom.xml @@ -48,7 +48,7 @@ steamwar Spigot - 1.8 + 1.14 provided @@ -63,6 +63,12 @@ 1.0 compile + + steamwar + FightSystem_14 + 1.0 + compile + steamwar FightSystem_API diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java index d57cfb2..6f39df1 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/commands/GUI.java @@ -28,11 +28,11 @@ public class GUI { static void invitation(Player p, Player target){ SWInventory inv = new SWInventory(target, 9, "Einladung von " + p.getName()); - inv.setItem(0, Material.INK_SACK, (byte)10, "§aAnnehmen", (ClickType click) ->{ + inv.setItem(0, SWItem.getDye(10), (byte)10, "§aAnnehmen", (ClickType click) ->{ Commands.acceptInvitation(target); target.closeInventory(); }); - inv.setItem(8, Material.INK_SACK, (byte)1, "§cAblehnen", (ClickType click) ->{ + inv.setItem(8, SWItem.getDye(1), (byte)1, "§cAblehnen", (ClickType click) ->{ Commands.declineInvitation(target); target.closeInventory(); }); @@ -94,11 +94,11 @@ public class GUI { SWInventory inv = new SWInventory(p, 9, Config.GameName + "-Auswahl"); inv.setItem(8, Material.REDSTONE, "§eÖffentliches " + Config.GameName, (ClickType click) -> schemDialog(p, true)); if(Config.OnlyPublicSchematics){ - inv.setItem(0, Material.INK_SACK, (byte)8, "§7Keine privaten Schematics erlaubt", (ClickType click)->{}); + inv.setItem(0, SWItem.getDye(8), (byte)8, "§7Keine privaten Schematics erlaubt", (ClickType click)->{}); }else if(Schematic.getSchemsOfType(p.getUniqueId(), Config.SchematicType).isEmpty() && !Config.test()){ - inv.setItem(0, Material.INK_SACK, (byte)8, "§7Kein privates " + Config.GameName + " vorhanden", (ClickType click)->{}); + inv.setItem(0, SWItem.getDye(8), (byte)8, "§7Kein privates " + Config.GameName + " vorhanden", (ClickType click)->{}); }else{ - inv.setItem(0, Material.CAULDRON_ITEM, "§ePrivates " + Config.GameName, (ClickType click) -> schemDialog(p, false)); + inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), "§ePrivates " + Config.GameName, (ClickType click) -> schemDialog(p, false)); } inv.setCallback(-999, (ClickType click) -> p.closeInventory()); inv.open(); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java index d6d7dff..e9feb35 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -7,7 +7,11 @@ import de.steamwar.core.Core; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.kit.KitManager; -import de.steamwar.fightsystem.utils.*; +import de.steamwar.fightsystem.utils.ColorConverter; +import de.steamwar.fightsystem.utils.FightScoreboard; +import de.steamwar.fightsystem.utils.ItemBuilder; +import de.steamwar.fightsystem.utils.TechHider; +import de.steamwar.inventory.SWItem; import de.steamwar.sql.Schematic; import de.steamwar.sql.SteamwarUser; import javafx.util.Pair; @@ -188,10 +192,10 @@ public class FightTeam implements IFightTeam{ inventory.setItem(1, new ItemBuilder(Material.AIR).build()); if(!Config.event()){ inventory.setItem(2, new ItemBuilder(Material.PAPER).removeAllAttributs().setDisplayName("§eSpieler einladen").build()); - inventory.setItem(3, new ItemBuilder(Material.FIREWORK_CHARGE).removeAllAttributs().setDisplayName("§cSpieler rauswerfen").build()); - inventory.setItem(4, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build()); + inventory.setItem(3, new ItemBuilder(Material.getMaterial("FIREWORK_CHARGE")).removeAllAttributs().setDisplayName("§cSpieler rauswerfen").build()); + inventory.setItem(4, new ItemBuilder(Material.getMaterial("INK_SACK"), (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build()); } - inventory.setItem(0, new ItemBuilder(Material.CAULDRON_ITEM).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§e" + Config.GameName + " wählen").build()); + inventory.setItem(0, new ItemBuilder(Material.getMaterial("CAULDRON_ITEM")).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§e" + Config.GameName + " wählen").build()); } public Set getPlayers() { @@ -270,13 +274,13 @@ public class FightTeam implements IFightTeam{ this.ready = ready; if(ready) { - l.getInventory().setItem(4, new ItemBuilder(Material.INK_SACK, (short) 8).removeAllAttributs().addEnchantment(Enchantment.DURABILITY,1 ).setDisplayName("§aBereit").build()); + l.getInventory().setItem(4, new ItemBuilder(SWItem.getDye(8), (short) 8).removeAllAttributs().addEnchantment(Enchantment.DURABILITY,1 ).setDisplayName("§aBereit").build()); broadcast(FightSystem.PREFIX + "§aEuer Team ist nun bereit!"); if(Fight.getOpposite(this).isReady() || Config.test()) { FightSystem.setPreRunningState(); } } else { - l.getInventory().setItem(4, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build()); + l.getInventory().setItem(4, new ItemBuilder(SWItem.getDye(10), (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build()); broadcast(FightSystem.PREFIX + "§cEuer Team ist nicht mehr bereit!"); } } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/ColorConverter.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/ColorConverter.java index 9118751..890e751 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/ColorConverter.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/ColorConverter.java @@ -1,5 +1,6 @@ package de.steamwar.fightsystem.utils; +import de.steamwar.core.Core; import org.bukkit.ChatColor; import org.bukkit.DyeColor; @@ -20,7 +21,6 @@ public class ColorConverter { chat2dye.put(ChatColor.GREEN, DyeColor.LIME); chat2dye.put(ChatColor.RED, DyeColor.RED); chat2dye.put(ChatColor.DARK_GRAY, DyeColor.GRAY); - chat2dye.put(ChatColor.GRAY, DyeColor.SILVER); chat2dye.put(ChatColor.DARK_AQUA, DyeColor.CYAN); chat2dye.put(ChatColor.DARK_PURPLE, DyeColor.PURPLE); chat2dye.put(ChatColor.DARK_BLUE, DyeColor.BLUE); @@ -28,8 +28,15 @@ public class ColorConverter { chat2dye.put(ChatColor.DARK_GREEN, DyeColor.GREEN); chat2dye.put(ChatColor.DARK_RED, DyeColor.RED); chat2dye.put(ChatColor.BLACK, DyeColor.BLACK); - //Rosa 9pink, Braun 3brown + + switch(Core.getVersion()){ + case 14: + chat2dye.put(ChatColor.GRAY, ColorConverter_14.getSilver()); + break; + default: + chat2dye.put(ChatColor.GRAY, ColorConverter_12.getSilver()); + } } public static DyeColor chat2dye(ChatColor color){ diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java index f60b26d..02c09b9 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java @@ -80,7 +80,7 @@ public class WaterRemover { if (anchor.getType() == Material.STATIONARY_WATER) collected.add(anchor); - if(visitedBlocks.size() > 50) { + if(visitedBlocks.size() > 100) { collected.clear(); return; } diff --git a/pom.xml b/pom.xml index 8d27342..0fb0790 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ FightSystem_API FightSystem_8 FightSystem_12 + FightSystem_14 FightSystem_Main