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

@ -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++;
}
}