Hopefully made arenas with generators?

This commit is contained in:
Luca
2021-11-23 10:57:52 +01:00
parent 5e63d85468
commit 03512ae139
15 changed files with 225 additions and 157 deletions

View File

@ -8,7 +8,6 @@ import org.bukkit.configuration.file.FileConfiguration;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.game.arena.CopiedArena;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.utils.CustomLocation;
import rip.tilly.bedwars.utils.config.file.Config;
@ -52,7 +51,9 @@ public class ArenaManager {
int deadZone = section.getInt(name + ".deadZone");
int buildMax = section.getInt(name + ".buildMax");
List<String> generators = section.getStringList(name + ".generators");
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);
@ -63,9 +64,19 @@ 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<CustomLocation> teamGeneratorLocations = new ArrayList<>();
for (String location : teamGenerators) {
teamGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
List<CustomLocation> diamondGeneratorLocations = new ArrayList<>();
for (String location : diamondGenerators) {
diamondGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
List<CustomLocation> emeraldGeneratorLocations = new ArrayList<>();
for (String location : emeraldGenerators) {
emeraldGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
List<CopiedArena> copiedArenas = new ArrayList<>();
@ -81,7 +92,9 @@ public class ArenaManager {
String copyTeamBmin = copiedSection.getString(copy + ".teamBmin");
String copyTeamBmax = copiedSection.getString(copy + ".teamBmax");
List<String> copyGenerators = copiedSection.getStringList(copy + ".generators");
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);
@ -92,9 +105,19 @@ 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));
List<CustomLocation> copyTeamGeneratorLocations = new ArrayList<>();
for (String location : copyTeamGenerators) {
copyTeamGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
List<CustomLocation> copyDiamondGeneratorLocations = new ArrayList<>();
for (String location : copyDiamondGenerators) {
copyDiamondGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
List<CustomLocation> copyEmeraldGeneratorLocations = new ArrayList<>();
for (String location : copyEmeraldGenerators) {
copyEmeraldGeneratorLocations.add(CustomLocation.stringToLocation(location));
}
CopiedArena copiedArena = new CopiedArena(
@ -106,7 +129,10 @@ public class ArenaManager {
copyLocTeamAmax,
copyLocTeamBmin,
copyLocTeamBmax,
copyGeneratorLocations
copyTeamGeneratorLocations,
copyDiamondGeneratorLocations,
copyEmeraldGeneratorLocations
);
this.plugin.getChunkClearingManager().copyArena(copiedArena);
@ -133,7 +159,11 @@ public class ArenaManager {
locTeamBmax,
deadZone,
buildMax,
generatorLocations,
teamGeneratorLocations,
diamondGeneratorLocations,
emeraldGeneratorLocations,
enabled
);
@ -177,7 +207,9 @@ public class ArenaManager {
fileConfig.set(root + ".deadZone", deadZone);
fileConfig.set(root + ".buildMax", buildMax);
fileConfig.set(root + ".generators", this.fromLocations(arena.getGenerators()));
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);
@ -205,7 +237,9 @@ public class ArenaManager {
fileConfig.set(copyRoot + ".teamBmin", copyTeamBmin);
fileConfig.set(copyRoot + ".teamBmax", copyTeamBmax);
fileConfig.set(copyRoot + ".generators", this.fromLocations(copiedArena.getGenerators()));
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++;
}