This commit is contained in:
Trixkz
2021-11-22 16:51:23 -05:00
16 changed files with 263 additions and 15 deletions

View File

@ -52,6 +52,8 @@ public class ArenaManager {
int deadZone = section.getInt(name + ".deadZone");
int buildMax = section.getInt(name + ".buildMax");
List<String> generators = section.getStringList(name + ".generators");
CustomLocation spawnA = CustomLocation.stringToLocation(a);
CustomLocation spawnB = CustomLocation.stringToLocation(b);
CustomLocation locMin = CustomLocation.stringToLocation(min);
@ -61,6 +63,11 @@ public class ArenaManager {
CustomLocation locTeamBmin = CustomLocation.stringToLocation(teamBmin);
CustomLocation locTeamBmax = CustomLocation.stringToLocation(teamBmax);
List<CustomLocation> generatorLocations = new ArrayList<>();
for (String location : generators) {
generatorLocations.add(CustomLocation.stringToLocation(location));
}
List<CopiedArena> copiedArenas = new ArrayList<>();
ConfigurationSection copiedSection = section.getConfigurationSection(name + ".copiedArenas");
if (copiedSection != null) {
@ -74,6 +81,8 @@ public class ArenaManager {
String copyTeamBmin = copiedSection.getString(copy + ".teamBmin");
String copyTeamBmax = copiedSection.getString(copy + ".teamBmax");
List<String> copyGenerators = copiedSection.getStringList(copy + ".generators");
CustomLocation copySpawnA = CustomLocation.stringToLocation(copyA);
CustomLocation copySpawnB = CustomLocation.stringToLocation(copyB);
CustomLocation copyLocMin = CustomLocation.stringToLocation(copyMin);
@ -83,6 +92,11 @@ public class ArenaManager {
CustomLocation copyLocTeamBmin = CustomLocation.stringToLocation(copyTeamBmin);
CustomLocation copyLocTeamBmax = CustomLocation.stringToLocation(copyTeamBmax);
List<CustomLocation> copyGeneratorLocations = new ArrayList<>();
for (String location : copyGenerators) {
copyGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
CopiedArena copiedArena = new CopiedArena(
copySpawnA,
copySpawnB,
@ -91,7 +105,8 @@ public class ArenaManager {
copyLocTeamAmin,
copyLocTeamAmax,
copyLocTeamBmin,
copyLocTeamBmax
copyLocTeamBmax,
copyGeneratorLocations
);
this.plugin.getChunkClearingManager().copyArena(copiedArena);
@ -118,6 +133,7 @@ public class ArenaManager {
locTeamBmax,
deadZone,
buildMax,
generatorLocations,
enabled
);
@ -161,6 +177,8 @@ public class ArenaManager {
fileConfig.set(root + ".deadZone", deadZone);
fileConfig.set(root + ".buildMax", buildMax);
fileConfig.set(root + ".generators", this.fromLocations(arena.getGenerators()));
fileConfig.set(root + ".enabled", arena.isEnabled());
fileConfig.set(root + ".copiedArenas", null);
@ -187,6 +205,8 @@ public class ArenaManager {
fileConfig.set(copyRoot + ".teamBmin", copyTeamBmin);
fileConfig.set(copyRoot + ".teamBmax", copyTeamBmax);
fileConfig.set(copyRoot + ".generators", this.fromLocations(copiedArena.getGenerators()));
i++;
}
}
@ -241,4 +261,13 @@ public class ArenaManager {
public void setArenaGameUUIDs(CopiedArena copiedArena, UUID uuid) {
this.arenaGameUUIDs.put(copiedArena, uuid);
}
public List<String> fromLocations(List<CustomLocation> locations) {
List<String> toReturn = new ArrayList<>();
for (CustomLocation location : locations) {
toReturn.add(CustomLocation.locationToString(location));
}
return toReturn;
}
}