Merge branch '10-team1corner-und-team2corner-sind-bislang-nicht-zwingend-immer-die-kleinsten-werte' into 'master'
Resolve "Team1corner (und team2corner) sind (bislang) nicht zwingend immer die kleinsten Werte" Closes #9 and #10 See merge request Yaruma3341/fightsystem!3
Dieser Commit ist enthalten in:
Commit
6b4b993590
@ -7,13 +7,13 @@ import me.yaruma.fightsystem.fight.FightState;
|
|||||||
import me.yaruma.fightsystem.fight.FightTeam;
|
import me.yaruma.fightsystem.fight.FightTeam;
|
||||||
import me.yaruma.fightsystem.listener.*;
|
import me.yaruma.fightsystem.listener.*;
|
||||||
import me.yaruma.fightsystem.manager.FileManager;
|
import me.yaruma.fightsystem.manager.FileManager;
|
||||||
import me.yaruma.fightsystem.utils.Coordinates;
|
|
||||||
import me.yaruma.fightsystem.utils.countdown.Countdown;
|
import me.yaruma.fightsystem.utils.countdown.Countdown;
|
||||||
import me.yaruma.fightsystem.utils.countdown.FinishSetupOver;
|
import me.yaruma.fightsystem.utils.countdown.FinishSetupOver;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -58,15 +58,15 @@ public class FightSystem extends JavaPlugin {
|
|||||||
plugin = this;
|
plugin = this;
|
||||||
this.fileManager = new FileManager(plugin);
|
this.fileManager = new FileManager(plugin);
|
||||||
this.fightManager = new FightManager();
|
this.fightManager = new FightManager();
|
||||||
this.coordinates = new Coordinates();
|
|
||||||
|
|
||||||
int schemsizeX = this.schemsizeX = fileManager.getIntegerFromConfig("Arena.Schemsize.x");
|
//Load config
|
||||||
int schemsizeY = this.schemsizeZ = fileManager.getIntegerFromConfig("Arena.Schemsize.y");
|
schemsizeX = fileManager.getIntegerFromConfig("Arena.Schemsize.x");
|
||||||
int schemsizeZ = this.schemsizeY = fileManager.getIntegerFromConfig("Arena.Schemsize.z");
|
schemsizeY = fileManager.getIntegerFromConfig("Arena.Schemsize.y");
|
||||||
|
schemsizeZ = fileManager.getIntegerFromConfig("Arena.Schemsize.z");
|
||||||
|
|
||||||
int team1cornerX = this.team1cornerX = fileManager.getIntegerFromConfig("Arena.Team1corner.x");
|
team1cornerX = fileManager.getIntegerFromConfig("Arena.Team1corner.x");
|
||||||
int team1cornerY = this.team1cornerY = fileManager.getIntegerFromConfig("Arena.Team1corner.y");
|
team1cornerY = fileManager.getIntegerFromConfig("Arena.Team1corner.y");
|
||||||
int team1cornerZ = this.team1cornerZ = fileManager.getIntegerFromConfig("Arena.Team1corner.z");
|
team1cornerZ = fileManager.getIntegerFromConfig("Arena.Team1corner.z");
|
||||||
|
|
||||||
int team1toTeam2distanceX = fileManager.getIntegerFromConfig("Arena.Team1toTeam2distance.x");
|
int team1toTeam2distanceX = fileManager.getIntegerFromConfig("Arena.Team1toTeam2distance.x");
|
||||||
int team1toTeam2distanceY = fileManager.getIntegerFromConfig("Arena.Team1toTeam2distance.y");
|
int team1toTeam2distanceY = fileManager.getIntegerFromConfig("Arena.Team1toTeam2distance.y");
|
||||||
@ -75,13 +75,58 @@ public class FightSystem extends JavaPlugin {
|
|||||||
int schem2BorderX = fileManager.getIntegerFromConfig("Arena.Schem2Border.x");
|
int schem2BorderX = fileManager.getIntegerFromConfig("Arena.Schem2Border.x");
|
||||||
int schem2BorderZ = fileManager.getIntegerFromConfig("Arena.Schem2Border.z");
|
int schem2BorderZ = fileManager.getIntegerFromConfig("Arena.Schem2Border.z");
|
||||||
|
|
||||||
|
World world = Bukkit.getWorld(fileManager.getStringFromConfig("Arena.WorldName"));
|
||||||
|
|
||||||
|
//Rotate team1corner to edge (min. x, min. y, min. z)
|
||||||
|
if(schemsizeX < 0){
|
||||||
|
schemsizeX = -schemsizeX;
|
||||||
|
team1cornerX -= 2*schemsizeX;
|
||||||
|
}
|
||||||
|
if(schemsizeY < 0){
|
||||||
|
schemsizeY = -schemsizeY;
|
||||||
|
team1cornerY -= 2*schemsizeY;
|
||||||
|
}
|
||||||
|
if(schemsizeZ < 0){
|
||||||
|
schemsizeZ = -schemsizeZ;
|
||||||
|
team1cornerZ -= 2*schemsizeZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Compute various positions
|
||||||
team2cornerX = team1toTeam2distanceX + team1cornerX;
|
team2cornerX = team1toTeam2distanceX + team1cornerX;
|
||||||
team2cornerY = team1toTeam2distanceY + team1cornerY;
|
team2cornerY = team1toTeam2distanceY + team1cornerY;
|
||||||
team2cornerZ = team1toTeam2distanceZ + schemsizeZ + 1 + team1cornerZ;
|
team2cornerZ = team1toTeam2distanceZ + team1cornerZ;
|
||||||
|
|
||||||
|
int Team1centerX = team1cornerX + schemsizeX/2;
|
||||||
|
int Team1centerY = team1cornerY;
|
||||||
|
int Team1centerZ = team1cornerZ + schemsizeZ/2;
|
||||||
|
|
||||||
|
int Team2centerX = Team1centerX + team1toTeam2distanceX;
|
||||||
|
int Team2centerY = Team1centerY + team1toTeam2distanceY;
|
||||||
|
int Team2centerZ = Team1centerZ + team1toTeam2distanceZ;
|
||||||
|
|
||||||
|
|
||||||
|
Team1SpawnLoc = new Location(world, Team1centerX, Team1centerY + schemsizeY, Team1centerZ);
|
||||||
|
Team2SpawnLoc = new Location(world, Team1centerX, Team1centerY + schemsizeY, Team1centerZ);
|
||||||
|
SpecSpawnLoc = new Location(world, Team1centerX + team1toTeam2distanceX/2,
|
||||||
|
Team1centerY + team1toTeam2distanceY/2 + schemsizeY/2,
|
||||||
|
Team1centerZ + team1toTeam2distanceZ/2);
|
||||||
|
Team1PasteLoc = new Location(world, Team1centerX, Team1centerY, Team1centerZ);
|
||||||
|
Team2PasteLoc = new Location(world, Team2centerX, Team2centerY, Team2centerZ);
|
||||||
|
|
||||||
coordinates.computePositions(schemsizeX, schemsizeY, schemsizeZ, team1cornerX, team1cornerY, team1cornerZ, team1toTeam2distanceX, team1toTeam2distanceY, team1toTeam2distanceZ, schem2BorderX, schem2BorderZ);
|
if(team1toTeam2distanceX > 0){
|
||||||
|
ArenaMinX = team1cornerX - schem2BorderX;
|
||||||
|
ArenaMaxX = team1cornerX + team1toTeam2distanceX + schemsizeX + schem2BorderX;
|
||||||
|
}else{
|
||||||
|
ArenaMinX = team1cornerX + team1toTeam2distanceX - schem2BorderX;
|
||||||
|
ArenaMaxX = team1cornerX + schemsizeX + schem2BorderX;
|
||||||
|
}
|
||||||
|
if(team1toTeam2distanceZ > 0){
|
||||||
|
ArenaMinZ = team1cornerZ - schem2BorderZ;
|
||||||
|
ArenaMaxZ = team1cornerZ + team1toTeam2distanceZ + schemsizeZ + schem2BorderZ;
|
||||||
|
}else{
|
||||||
|
ArenaMinZ = team1cornerZ + team1toTeam2distanceZ - schem2BorderZ;
|
||||||
|
ArenaMaxZ = team1cornerZ + schemsizeZ + schem2BorderZ;
|
||||||
|
}
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
@ -247,40 +292,4 @@ public class FightSystem extends JavaPlugin {
|
|||||||
public int getTeam2cornerZ() {
|
public int getTeam2cornerZ() {
|
||||||
return team2cornerZ;
|
return team2cornerZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTeam1SpawnLoc(Location team1SpawnLoc) {
|
|
||||||
Team1SpawnLoc = team1SpawnLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTeam2SpawnLoc(Location team2SpawnLoc) {
|
|
||||||
Team2SpawnLoc = team2SpawnLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTeam1PasteLoc(Location team1PasteLoc) {
|
|
||||||
Team1PasteLoc = team1PasteLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTeam2PasteLoc(Location team2PasteLoc) {
|
|
||||||
Team2PasteLoc = team2PasteLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecSpawnLoc(Location specSpawnLoc) {
|
|
||||||
SpecSpawnLoc = specSpawnLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArenaMinX(int arenaMinX) {
|
|
||||||
ArenaMinX = arenaMinX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArenaMaxX(int arenaMaxX) {
|
|
||||||
ArenaMaxX = arenaMaxX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArenaMinZ(int arenaMinZ) {
|
|
||||||
ArenaMinZ = arenaMinZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArenaMaxZ(int arenaMaxZ) {
|
|
||||||
ArenaMaxZ = arenaMaxZ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
package me.yaruma.fightsystem.utils;
|
|
||||||
|
|
||||||
import me.yaruma.fightsystem.FightSystem;
|
|
||||||
import me.yaruma.fightsystem.fight.Fight;
|
|
||||||
import me.yaruma.fightsystem.manager.FileManager;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
public class Coordinates {
|
|
||||||
|
|
||||||
FileManager fileManager = FightSystem.getPlugin().getFileManager();
|
|
||||||
|
|
||||||
public void computePositions(
|
|
||||||
int SchemsizeX, int SchemsizeY, int SchemsizeZ,
|
|
||||||
int Team1cornerX, int Team1cornerY, int Team1cornerZ,
|
|
||||||
int Team1toTeam2distanceX, int Team1toTeam2distanceY, int Team1toTeam2distanceZ,
|
|
||||||
int Schem2BorderX, int Schem2BorderZ){
|
|
||||||
|
|
||||||
if(SchemsizeX < 0){
|
|
||||||
SchemsizeX = -SchemsizeX;
|
|
||||||
Team1cornerX = -Team1cornerX;
|
|
||||||
}
|
|
||||||
if(SchemsizeY < 0){
|
|
||||||
SchemsizeY = -SchemsizeY;
|
|
||||||
Team1cornerY = -Team1cornerY;
|
|
||||||
}
|
|
||||||
if(SchemsizeZ < 0){
|
|
||||||
SchemsizeZ = -SchemsizeZ;
|
|
||||||
Team1cornerZ = -Team1cornerZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Team1toTeam2distanceX < 0){
|
|
||||||
Team1cornerX += Team1toTeam2distanceX;
|
|
||||||
Team1toTeam2distanceX = -Team1toTeam2distanceX;
|
|
||||||
}
|
|
||||||
if(Team1toTeam2distanceY < 0){
|
|
||||||
Team1cornerY += Team1toTeam2distanceY;
|
|
||||||
Team1toTeam2distanceY = -Team1toTeam2distanceY;
|
|
||||||
}
|
|
||||||
if(Team1toTeam2distanceZ < 0){
|
|
||||||
Team1cornerZ += Team1toTeam2distanceZ;
|
|
||||||
Team1toTeam2distanceZ = -Team1toTeam2distanceZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Team1corner hat nun kleinste X- Y- und Z-Koordinate
|
|
||||||
//Schemsize und Team1toTeam2distance sind nun ausschließlich positiv
|
|
||||||
|
|
||||||
int Team1centerX = Team1cornerX + SchemsizeX/2;
|
|
||||||
int Team1centerY = Team1cornerY;
|
|
||||||
int Team1centerZ = Team1cornerZ + SchemsizeZ/2;
|
|
||||||
|
|
||||||
int Team2centerX = Team1centerX + Team1toTeam2distanceX;
|
|
||||||
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));
|
|
||||||
|
|
||||||
FightSystem.getPlugin().setArenaMinX(Team1cornerX - Schem2BorderX);
|
|
||||||
FightSystem.getPlugin().setArenaMaxX(Team1cornerX + Team1toTeam2distanceX + Schem2BorderX);
|
|
||||||
FightSystem.getPlugin().setArenaMinZ(Team1cornerZ - Schem2BorderZ);
|
|
||||||
FightSystem.getPlugin().setArenaMaxZ(Team1cornerZ + Team1toTeam2distanceZ + Schem2BorderZ);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
In neuem Issue referenzieren
Einen Benutzer sperren