diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java index ed64f4d..e08fea0 100644 --- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java @@ -9,6 +9,7 @@ import org.bukkit.World; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.util.Vector; import java.io.File; import java.util.*; @@ -250,14 +251,29 @@ public class Config { TeamRedPasteZ = TeamBluePasteZ + TeamBluetoReddistanceZ; World world = Bukkit.getWorlds().get(0); + TeamBlueSpawn = new Location(world, TeamBluePasteX + 0.5 + teamBlueSpawnOffsetX, TeamBlueCornerY + 0.5 + teamBlueSpawnOffsetY, TeamBluePasteZ + 0.5 + teamBlueSpawnOffsetZ); + TeamRedSpawn = new Location(world, TeamRedPasteX + 0.5 - teamBlueSpawnOffsetX, TeamRedCornerY + 0.5 + teamBlueSpawnOffsetY, TeamRedPasteZ + 0.5 - teamBlueSpawnOffsetZ); + + Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector()); + double pitch = Math.toDegrees(v1.angle(v1.clone().setY(0))); + double yaw = Math.toDegrees(v1.clone().setY(0).angle(new Vector(0, 0, 1))); + double pitchInverted = pitch * -1; + double yawInverted = yaw + 180; + + TeamBlueSpawn.setYaw((float) yawInverted); + TeamBlueSpawn.setPitch((float) pitch); + + TeamRedSpawn.setYaw((float) yaw); + TeamRedSpawn.setPitch((float) pitchInverted); + SpecSpawn = new Location(world, TeamBluePasteX + TeamBluetoReddistanceX/2.0, TeamBlueCornerY + TeamBluetoReddistanceY/2.0 + SchemsizeY/2.0,