SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'facingEnemy' (#160) from facingEnemy into master

Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2020-05-23 16:08:25 +02:00
Commit d3b1dcf8f3

Datei anzeigen

@ -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,