This commit is contained in:
Luca 2021-11-23 16:31:00 +01:00
parent c109219759
commit 9d94899589
5 changed files with 76 additions and 49 deletions

View File

@ -38,16 +38,16 @@ public class Arena {
private int deadZone;
private int buildMax;
private List<CustomLocation> teamGenerators = new ArrayList<>();
private List<CustomLocation> diamondGenerators = new ArrayList<>();
private List<CustomLocation> emeraldGenerators = new ArrayList<>();
private CustomLocation teamAshop;
private CustomLocation teamBshop;
private CustomLocation teamAupgrades;
private CustomLocation teamBupgrades;
private List<CustomLocation> teamGenerators = new ArrayList<>();
private List<CustomLocation> diamondGenerators = new ArrayList<>();
private List<CustomLocation> emeraldGenerators = new ArrayList<>();
private boolean enabled;
public CopiedArena getAvailableArena() {

View File

@ -27,14 +27,14 @@ public class CopiedArena {
private CustomLocation teamBmin;
private CustomLocation teamBmax;
private List<CustomLocation> teamGenerators = new ArrayList<>();
private List<CustomLocation> diamondGenerators = new ArrayList<>();
private List<CustomLocation> emeraldGenerators = new ArrayList<>();
private CustomLocation teamAshop;
private CustomLocation teamBshop;
private CustomLocation teamAupgrades;
private CustomLocation teamBupgrades;
private List<CustomLocation> teamGenerators = new ArrayList<>();
private List<CustomLocation> diamondGenerators = new ArrayList<>();
private List<CustomLocation> emeraldGenerators = new ArrayList<>();
}

View File

@ -51,15 +51,15 @@ public class ArenaManager {
int deadZone = section.getInt(name + ".deadZone");
int buildMax = section.getInt(name + ".buildMax");
List<String> teamGenerators = section.getStringList(name + ".team-generators");
List<String> diamondGenerators = section.getStringList(name + ".diamond-generators");
List<String> emeraldGenerators = section.getStringList(name + ".emerald-generators");
String teamAshop = section.getString(name + ".teamAshop");
String teamBshop = section.getString(name + ".teamBshop");
String teamAupgrades = section.getString(name + ".teamAupgrades");
String teamBupgrades = section.getString(name + ".teamBupgrades");
List<String> teamGenerators = section.getStringList(name + ".team-generators");
List<String> diamondGenerators = section.getStringList(name + ".diamond-generators");
List<String> emeraldGenerators = section.getStringList(name + ".emerald-generators");
CustomLocation spawnA = CustomLocation.stringToLocation(a);
CustomLocation spawnB = CustomLocation.stringToLocation(b);
CustomLocation locMin = CustomLocation.stringToLocation(min);
@ -69,6 +69,11 @@ public class ArenaManager {
CustomLocation locTeamBmin = CustomLocation.stringToLocation(teamBmin);
CustomLocation locTeamBmax = CustomLocation.stringToLocation(teamBmax);
CustomLocation locTeamAshop = CustomLocation.stringToLocation(teamAshop);
CustomLocation locTeamBshop = CustomLocation.stringToLocation(teamBshop);
CustomLocation locTeamAupgrades = CustomLocation.stringToLocation(teamAupgrades);
CustomLocation locTeamBupgrades = CustomLocation.stringToLocation(teamBupgrades);
List<CustomLocation> teamGeneratorLocations = new ArrayList<>();
for (String location : teamGenerators) {
teamGeneratorLocations.add(CustomLocation.stringToLocation(location));
@ -84,11 +89,6 @@ public class ArenaManager {
emeraldGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
CustomLocation locTeamAshop = CustomLocation.stringToLocation(teamAshop);
CustomLocation locTeamBshop = CustomLocation.stringToLocation(teamBshop);
CustomLocation locTeamAupgrades = CustomLocation.stringToLocation(teamAupgrades);
CustomLocation locTeamBupgrades = CustomLocation.stringToLocation(teamBupgrades);
List<CopiedArena> copiedArenas = new ArrayList<>();
ConfigurationSection copiedSection = section.getConfigurationSection(name + ".copiedArenas");
if (copiedSection != null) {
@ -102,15 +102,15 @@ public class ArenaManager {
String copyTeamBmin = copiedSection.getString(copy + ".teamBmin");
String copyTeamBmax = copiedSection.getString(copy + ".teamBmax");
List<String> copyTeamGenerators = copiedSection.getStringList(copy + ".team-generators");
List<String> copyDiamondGenerators = copiedSection.getStringList(copy + ".diamond-generators");
List<String> copyEmeraldGenerators = copiedSection.getStringList(copy + ".emerald-generators");
String copyTeamAshop = section.getString(copy + ".teamAshop");
String copyTeamBshop = section.getString(copy + ".teamBshop");
String copyTeamAupgrades = section.getString(copy + ".teamAupgrades");
String copyTeamBupgrades = section.getString(copy + ".teamBupgrades");
List<String> copyTeamGenerators = copiedSection.getStringList(copy + ".team-generators");
List<String> copyDiamondGenerators = copiedSection.getStringList(copy + ".diamond-generators");
List<String> copyEmeraldGenerators = copiedSection.getStringList(copy + ".emerald-generators");
CustomLocation copySpawnA = CustomLocation.stringToLocation(copyA);
CustomLocation copySpawnB = CustomLocation.stringToLocation(copyB);
CustomLocation copyLocMin = CustomLocation.stringToLocation(copyMin);
@ -120,6 +120,12 @@ public class ArenaManager {
CustomLocation copyLocTeamBmin = CustomLocation.stringToLocation(copyTeamBmin);
CustomLocation copyLocTeamBmax = CustomLocation.stringToLocation(copyTeamBmax);
CustomLocation copyLocTeamAshop = CustomLocation.stringToLocation(copyTeamAshop);
CustomLocation copyLocTeamBshop = CustomLocation.stringToLocation(copyTeamBshop);
CustomLocation copyLocTeamAupgrades = CustomLocation.stringToLocation(copyTeamAupgrades);
CustomLocation copyLocTeamBupgrades = CustomLocation.stringToLocation(copyTeamBupgrades);
List<CustomLocation> copyTeamGeneratorLocations = new ArrayList<>();
for (String location : copyTeamGenerators) {
copyTeamGeneratorLocations.add(CustomLocation.stringToLocation(location));
@ -135,11 +141,6 @@ public class ArenaManager {
copyEmeraldGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
CustomLocation copyLocTeamAshop = CustomLocation.stringToLocation(copyTeamAshop);
CustomLocation copyLocTeamBshop = CustomLocation.stringToLocation(copyTeamBshop);
CustomLocation copyLocTeamAupgrades = CustomLocation.stringToLocation(copyTeamAupgrades);
CustomLocation copyLocTeamBupgrades = CustomLocation.stringToLocation(copyTeamBupgrades);
CopiedArena copiedArena = new CopiedArena(
copySpawnA,
copySpawnB,
@ -150,14 +151,14 @@ public class ArenaManager {
copyLocTeamBmin,
copyLocTeamBmax,
copyTeamGeneratorLocations,
copyDiamondGeneratorLocations,
copyEmeraldGeneratorLocations,
copyLocTeamAshop,
copyLocTeamBshop,
copyLocTeamAupgrades,
copyLocTeamBupgrades
copyLocTeamBupgrades,
copyTeamGeneratorLocations,
copyDiamondGeneratorLocations,
copyEmeraldGeneratorLocations
);
this.plugin.getChunkClearingManager().copyArena(copiedArena);
@ -185,15 +186,15 @@ public class ArenaManager {
deadZone,
buildMax,
teamGeneratorLocations,
diamondGeneratorLocations,
emeraldGeneratorLocations,
locTeamAshop,
locTeamBshop,
locTeamAupgrades,
locTeamBupgrades,
teamGeneratorLocations,
diamondGeneratorLocations,
emeraldGeneratorLocations,
enabled
);
@ -242,15 +243,15 @@ public class ArenaManager {
fileConfig.set(root + ".deadZone", deadZone);
fileConfig.set(root + ".buildMax", buildMax);
fileConfig.set(root + ".team-generators", this.fromLocations(arena.getTeamGenerators()));
fileConfig.set(root + ".diamond-generators", this.fromLocations(arena.getDiamondGenerators()));
fileConfig.set(root + ".emerald-generators", this.fromLocations(arena.getEmeraldGenerators()));
fileConfig.set(root + ".teamAshop", teamAshop);
fileConfig.set(root + ".teamBshop", teamBshop);
fileConfig.set(root + ".teamAupgrades", teamAupgrades);
fileConfig.set(root + ".teamBupgrades", teamBupgrades);
fileConfig.set(root + ".team-generators", this.fromLocations(arena.getTeamGenerators()));
fileConfig.set(root + ".diamond-generators", this.fromLocations(arena.getDiamondGenerators()));
fileConfig.set(root + ".emerald-generators", this.fromLocations(arena.getEmeraldGenerators()));
fileConfig.set(root + ".enabled", arena.isEnabled());
fileConfig.set(root + ".copiedArenas", null);
@ -282,15 +283,15 @@ public class ArenaManager {
fileConfig.set(copyRoot + ".teamBmin", copyTeamBmin);
fileConfig.set(copyRoot + ".teamBmax", copyTeamBmax);
fileConfig.set(copyRoot + ".team-generators", this.fromLocations(copiedArena.getTeamGenerators()));
fileConfig.set(copyRoot + ".diamond-generators", this.fromLocations(copiedArena.getDiamondGenerators()));
fileConfig.set(copyRoot + ".emerald-generators", this.fromLocations(copiedArena.getEmeraldGenerators()));
fileConfig.set(copyRoot + ".teamAshop", copyTeamAshop);
fileConfig.set(copyRoot + ".teamBshop", copyTeamBshop);
fileConfig.set(copyRoot + ".teamAupgrades", copyTeamAupgrades);
fileConfig.set(copyRoot + ".teamBupgrades", copyTeamBupgrades);
fileConfig.set(copyRoot + ".team-generators", this.fromLocations(copiedArena.getTeamGenerators()));
fileConfig.set(copyRoot + ".diamond-generators", this.fromLocations(copiedArena.getDiamondGenerators()));
fileConfig.set(copyRoot + ".emerald-generators", this.fromLocations(copiedArena.getEmeraldGenerators()));
i++;
}
}

View File

@ -21,7 +21,7 @@ public class PlayerData {
private PlayerSettings playerSettings = new PlayerSettings();
private PlayerCurrentGameData currentGameData = new PlayerCurrentGameData();
private PlayerTeam playerTeam;
private PlayerTeam playerTeam = PlayerTeam.PINK;
private final UUID uniqueId;
private boolean loaded;

View File

@ -79,12 +79,38 @@ public class ArenaCommandRunnable implements Runnable {
emeraldGenerators.add(newEmeraldGenerator);
}
CustomLocation teamAshop = new CustomLocation((arena.getTeamAshop().getX() + this.getOffsetX()), arena.getTeamAshop().getY(), (arena.getTeamAshop().getZ() + this.getOffsetZ()), arena.getTeamAshop().getYaw(), arena.getTeamAshop().getPitch());
CustomLocation teamBshop = new CustomLocation((arena.getTeamBshop().getX() + this.getOffsetX()), arena.getTeamBshop().getY(), (arena.getTeamBshop().getZ() + this.getOffsetZ()), arena.getTeamBshop().getYaw(), arena.getTeamBshop().getPitch());
CustomLocation teamAupgrades = new CustomLocation((arena.getTeamAupgrades().getX() + this.getOffsetX()), arena.getTeamAupgrades().getY(), (arena.getTeamAupgrades().getZ() + this.getOffsetZ()), arena.getTeamAupgrades().getYaw(), arena.getTeamAupgrades().getPitch());
CustomLocation teamBupgrades = new CustomLocation((arena.getTeamBupgrades().getX() + this.getOffsetX()), arena.getTeamBupgrades().getY(), (arena.getTeamBupgrades().getZ() + this.getOffsetZ()), arena.getTeamBupgrades().getYaw(), arena.getTeamBupgrades().getPitch());
double teamAshopX = arena.getTeamAshop().getX() + this.getOffsetX();
double teamAshopZ = arena.getTeamAshop().getZ() + this.getOffsetZ();
double teamBshopX = arena.getTeamBshop().getX() + this.getOffsetX();
double teamBshopZ = arena.getTeamBshop().getZ() + this.getOffsetZ();
CopiedArena copiedArena = new CopiedArena(a, b, min, max, teamAmin, teamAmax, teamBmin, teamBmax, teamGenerators, diamondGenerators, emeraldGenerators, teamAshop, teamBshop, teamAupgrades, teamBupgrades);
double teamAupgradesX = arena.getTeamAupgrades().getX() + this.getOffsetX();
double teamAupgradesZ = arena.getTeamAupgrades().getZ() + this.getOffsetZ();
double teamBupgradesX = arena.getTeamBupgrades().getX() + this.getOffsetX();
double teamBupgradesZ = arena.getTeamBupgrades().getZ() + this.getOffsetZ();
CustomLocation teamAshop = new CustomLocation(teamAshopX, arena.getTeamAshop().getY(), teamAshopZ, arena.getTeamAshop().getYaw(), arena.getTeamAshop().getPitch());
CustomLocation teamBshop = new CustomLocation(teamBshopX, arena.getTeamBshop().getY(), teamBshopZ, arena.getTeamBshop().getYaw(), arena.getTeamBshop().getPitch());
CustomLocation teamAupgrades = new CustomLocation(teamAupgradesX, arena.getTeamAupgrades().getY(), teamAupgradesZ, arena.getTeamAupgrades().getYaw(), arena.getTeamAupgrades().getPitch());
CustomLocation teamBupgrades = new CustomLocation(teamBupgradesX, arena.getTeamBupgrades().getY(), teamBupgradesZ, arena.getTeamBupgrades().getYaw(), arena.getTeamBupgrades().getPitch());
CopiedArena copiedArena = new CopiedArena(
a,
b,
min,
max,
teamAmin,
teamAmax,
teamBmin,
teamBmax,
teamAshop,
teamBshop,
teamAupgrades,
teamBupgrades,
teamGenerators,
diamondGenerators,
emeraldGenerators
);
arena.addCopiedArena(copiedArena);
arena.addAvailableArena(copiedArena);