From 76bdd8e8b3e618f896a04486eef0daf2e6343dc7 Mon Sep 17 00:00:00 2001 From: lixfel Date: Fri, 15 Feb 2019 16:32:51 +0100 Subject: [PATCH] Added Spectator Spawn Position Related to #4 Related to #8 --- src/me/yaruma/fightsystem/FightSystem.java | 9 ++++++ .../yaruma/fightsystem/utils/Coordinates.java | 32 +++++++------------ 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/me/yaruma/fightsystem/FightSystem.java b/src/me/yaruma/fightsystem/FightSystem.java index a8df71c..28cb1ae 100644 --- a/src/me/yaruma/fightsystem/FightSystem.java +++ b/src/me/yaruma/fightsystem/FightSystem.java @@ -31,6 +31,7 @@ public class FightSystem extends JavaPlugin { public Location Team1SpawnLoc = null; public Location Team2SpawnLoc = null; + public Location SpecSpawnLoc = null; public Location Team1PasteLoc = null; public Location Team2PasteLoc = null; @@ -169,6 +170,10 @@ public class FightSystem extends JavaPlugin { return Team2SpawnLoc; } + public Location getSpecSpawnLoc() { + return SpecSpawnLoc; + } + public Location getTeam1PasteLoc() { return Team1PasteLoc; } @@ -233,6 +238,10 @@ public class FightSystem extends JavaPlugin { Team2PasteLoc = team2PasteLoc; } + public void setSpecSpawnLoc(Location specSpawnLoc) { + SpecSpawnLoc = specSpawnLoc; + } + public void setArenaMinX(int arenaMinX) { ArenaMinX = arenaMinX; } diff --git a/src/me/yaruma/fightsystem/utils/Coordinates.java b/src/me/yaruma/fightsystem/utils/Coordinates.java index 65d3508..af25bbe 100644 --- a/src/me/yaruma/fightsystem/utils/Coordinates.java +++ b/src/me/yaruma/fightsystem/utils/Coordinates.java @@ -54,30 +54,20 @@ public class Coordinates { int Team2centerY = Team1centerY + Team1toTeam2distanceY; int Team2centerZ = Team1centerZ + Team1toTeam2distanceZ; - World world = Bukkit.getWorld(fileManager.getStringFromConfig("Arena.WorldName")); + FightSystem.getPlugin().setTeam1SpawnLoc(new Location(world, Team1centerX, Team1centerY + SchemsizeY, Team1centerZ)); + FightSystem.getPlugin().setTeam2SpawnLoc(new Location(world, Team1centerX, Team1centerY + SchemsizeY, Team1centerZ)); + FightSystem.getPlugin().setSpecSpawnLoc(new Location(world, Team1centerX + Team1toTeam2distanceX/2, + Team1centerY + Team1toTeam2distanceY/2 + SchemsizeY/2, + Team1centerZ + Team1toTeam2distanceZ/2)); + FightSystem.getPlugin().setTeam1PasteLoc(new Location(world, Team1centerX, Team1centerY, Team1centerZ)); + FightSystem.getPlugin().setTeam2PasteLoc(new Location(world, Team2centerX, Team2centerY, Team2centerZ)); - Location Team1SpawnLoc = new Location(world, Team1centerX, Team1centerY + SchemsizeY, Team1centerZ); - Location Team2SpawnLoc = new Location(world, Team1centerX, Team1centerY + SchemsizeY, Team1centerZ); - Location Team1PasteLoc = new Location(world, Team1centerX, Team1centerY, Team1centerZ); - Location Team2PasteLoc = new Location(world, Team2centerX, Team2centerY, Team2centerZ); - - int ArenaMinX = Team1cornerX - Schem2BorderX; - int ArenaMaxX = Team1cornerX + Team1toTeam2distanceX + Schem2BorderX; - int ArenaMinZ = Team1cornerZ - Schem2BorderZ; - int ArenaMaxZ = Team1cornerZ + Team1toTeam2distanceZ + Schem2BorderZ; - - - FightSystem.getPlugin().setTeam1SpawnLoc(Team1SpawnLoc); - FightSystem.getPlugin().setTeam2SpawnLoc(Team2SpawnLoc); - FightSystem.getPlugin().setTeam1PasteLoc(Team1PasteLoc); - FightSystem.getPlugin().setTeam2PasteLoc(Team2PasteLoc); - - FightSystem.getPlugin().setArenaMinX(ArenaMinX); - FightSystem.getPlugin().setArenaMaxX(ArenaMaxX); - FightSystem.getPlugin().setArenaMinZ(ArenaMinZ); - FightSystem.getPlugin().setArenaMaxZ(ArenaMaxZ); + FightSystem.getPlugin().setArenaMinX(Team1cornerX - Schem2BorderX); + FightSystem.getPlugin().setArenaMaxX(Team1cornerX + Team1toTeam2distanceX + Schem2BorderX); + FightSystem.getPlugin().setArenaMinZ(Team1cornerZ - Schem2BorderZ); + FightSystem.getPlugin().setArenaMaxZ(Team1cornerZ + Team1toTeam2distanceZ + Schem2BorderZ); }