From ee83bf6177570461d8e12243c5cc654e55542f53 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 2 Aug 2019 22:44:46 +0200 Subject: [PATCH] Waterheightadaption bei WarShips --- src/me/yaruma/fightsystem/fight/FightTeam.java | 10 ++++++++++ src/me/yaruma/fightsystem/utils/Config.java | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/me/yaruma/fightsystem/fight/FightTeam.java b/src/me/yaruma/fightsystem/fight/FightTeam.java index c85f55e..6edda79 100644 --- a/src/me/yaruma/fightsystem/fight/FightTeam.java +++ b/src/me/yaruma/fightsystem/fight/FightTeam.java @@ -194,6 +194,16 @@ public class FightTeam { }else{ v = paste.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset); } + if(Config.AlignWater){ + Vector it = schem.getClipboard().getMinimumPoint(); + int depth = 0; + while(!schem.getClipboard().getBlock(it).isAir()){ + depth++; + it = it.setY(it.getY()+1); + } + System.out.println(name + " " + Config.WaterDepth + " " + depth + " " + schem.getClipboard().getBlock(new Vector(0, 0, 0))); + v = v.add(0, Config.WaterDepth - depth, 0); + } schem.paste(w, v, false, true, aT).flushQueue(); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () ->{ teleportToSpawn(); diff --git a/src/me/yaruma/fightsystem/utils/Config.java b/src/me/yaruma/fightsystem/utils/Config.java index c2f8ec6..2d184fe 100644 --- a/src/me/yaruma/fightsystem/utils/Config.java +++ b/src/me/yaruma/fightsystem/utils/Config.java @@ -33,6 +33,8 @@ public class Config { public static int underArenaBorder; public static int BorderFromSchematic; public static int upperArenaBorder; + public static boolean AlignWater; + public static int WaterDepth; public static boolean OnlyPublicSchematics; public static String SchematicDirectory; @@ -116,6 +118,8 @@ public class Config { Schem2BorderZ = worldconfig.getInt("Arena.Schem2Border.z"); underArenaBorder = worldconfig.getInt("Arena.underArenaBorder"); BorderFromSchematic = worldconfig.getInt("Arena.BorderFromSchematic"); + AlignWater = worldconfig.getBoolean("Arena.AlignWater"); + WaterDepth = worldconfig.getInt("Arena.WaterDepth"); OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics"); SchematicDirectory = config.getString("Schematic.Directory");