dont know if it works

This commit is contained in:
Luca
2021-11-22 22:48:09 +01:00
parent da2fe2dbc1
commit eea0c643ea
16 changed files with 264 additions and 11 deletions

View File

@ -51,6 +51,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);
@ -60,6 +62,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) {
@ -73,6 +80,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);
@ -82,6 +91,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,
@ -90,7 +104,8 @@ public class ArenaManager {
copyLocTeamAmin,
copyLocTeamAmax,
copyLocTeamBmin,
copyLocTeamBmax
copyLocTeamBmax,
copyGeneratorLocations
);
this.plugin.getChunkClearingManager().copyArena(copiedArena);
@ -117,6 +132,7 @@ public class ArenaManager {
locTeamBmax,
deadZone,
buildMax,
generatorLocations,
enabled
);
@ -160,6 +176,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);
@ -186,6 +204,8 @@ public class ArenaManager {
fileConfig.set(copyRoot + ".teamBmin", copyTeamBmin);
fileConfig.set(copyRoot + ".teamBmax", copyTeamBmax);
fileConfig.set(copyRoot + ".generators", this.fromLocations(copiedArena.getGenerators()));
i++;
}
}
@ -240,4 +260,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;
}
}