diff --git a/src/main/java/rip/tilly/bedwars/game/arena/Arena.java b/src/main/java/rip/tilly/bedwars/game/arena/Arena.java index 3f599d4..a0ea7d5 100644 --- a/src/main/java/rip/tilly/bedwars/game/arena/Arena.java +++ b/src/main/java/rip/tilly/bedwars/game/arena/Arena.java @@ -38,16 +38,16 @@ public class Arena { private int deadZone; private int buildMax; - private List teamGenerators = new ArrayList<>(); - private List diamondGenerators = new ArrayList<>(); - private List emeraldGenerators = new ArrayList<>(); - private CustomLocation teamAshop; private CustomLocation teamBshop; private CustomLocation teamAupgrades; private CustomLocation teamBupgrades; + private List teamGenerators = new ArrayList<>(); + private List diamondGenerators = new ArrayList<>(); + private List emeraldGenerators = new ArrayList<>(); + private boolean enabled; public CopiedArena getAvailableArena() { diff --git a/src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java b/src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java index 738ade8..6c44d8d 100644 --- a/src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java +++ b/src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java @@ -27,14 +27,14 @@ public class CopiedArena { private CustomLocation teamBmin; private CustomLocation teamBmax; - private List teamGenerators = new ArrayList<>(); - private List diamondGenerators = new ArrayList<>(); - private List emeraldGenerators = new ArrayList<>(); - private CustomLocation teamAshop; private CustomLocation teamBshop; private CustomLocation teamAupgrades; private CustomLocation teamBupgrades; + private List teamGenerators = new ArrayList<>(); + private List diamondGenerators = new ArrayList<>(); + private List emeraldGenerators = new ArrayList<>(); + } diff --git a/src/main/java/rip/tilly/bedwars/managers/arena/ArenaManager.java b/src/main/java/rip/tilly/bedwars/managers/arena/ArenaManager.java index 07960c1..6684fc9 100644 --- a/src/main/java/rip/tilly/bedwars/managers/arena/ArenaManager.java +++ b/src/main/java/rip/tilly/bedwars/managers/arena/ArenaManager.java @@ -51,15 +51,15 @@ public class ArenaManager { int deadZone = section.getInt(name + ".deadZone"); int buildMax = section.getInt(name + ".buildMax"); - List teamGenerators = section.getStringList(name + ".team-generators"); - List diamondGenerators = section.getStringList(name + ".diamond-generators"); - List 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 teamGenerators = section.getStringList(name + ".team-generators"); + List diamondGenerators = section.getStringList(name + ".diamond-generators"); + List 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 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 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 copyTeamGenerators = copiedSection.getStringList(copy + ".team-generators"); - List copyDiamondGenerators = copiedSection.getStringList(copy + ".diamond-generators"); - List 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 copyTeamGenerators = copiedSection.getStringList(copy + ".team-generators"); + List copyDiamondGenerators = copiedSection.getStringList(copy + ".diamond-generators"); + List 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 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++; } } diff --git a/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java b/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java index e8b6ebd..9a26a1b 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java @@ -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; diff --git a/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java b/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java index d35a639..1460326 100644 --- a/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java +++ b/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java @@ -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);