From 91f20ff303dc5e6faad83177a79557051cb9d99b Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 23 Nov 2021 15:42:44 +0100 Subject: [PATCH] i hate you --- .../java/rip/tilly/bedwars/game/GameType.java | 3 +- .../rip/tilly/bedwars/game/arena/Arena.java | 6 ++++ .../tilly/bedwars/game/arena/CopiedArena.java | 6 ++++ .../bedwars/managers/arena/ArenaManager.java | 32 ++++++++++++++++++- .../runnables/ArenaCommandRunnable.java | 7 +++- 5 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/main/java/rip/tilly/bedwars/game/GameType.java b/src/main/java/rip/tilly/bedwars/game/GameType.java index abd28a7..96cb2bc 100644 --- a/src/main/java/rip/tilly/bedwars/game/GameType.java +++ b/src/main/java/rip/tilly/bedwars/game/GameType.java @@ -21,7 +21,8 @@ public enum GameType { Material.IRON_SWORD, 0, 6), V4(16, "BedWars 4v4", Arrays.asList(" ", "&9You are now a master,", "&9you can go up against", "&9the undefeated PvP bot &7(Coming soon)"), - Material.DIAMOND_SWORD, 0, 8); + Material.DIAMOND_SWORD, + 0, 8); private final int slot; private final String name; 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 42b73f1..3f599d4 100644 --- a/src/main/java/rip/tilly/bedwars/game/arena/Arena.java +++ b/src/main/java/rip/tilly/bedwars/game/arena/Arena.java @@ -42,6 +42,12 @@ public class Arena { private List diamondGenerators = new ArrayList<>(); private List emeraldGenerators = new ArrayList<>(); + private CustomLocation teamAshop; + private CustomLocation teamBshop; + + private CustomLocation teamAupgrades; + private CustomLocation teamBupgrades; + 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 63480f0..738ade8 100644 --- a/src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java +++ b/src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java @@ -31,4 +31,10 @@ public class CopiedArena { private List diamondGenerators = new ArrayList<>(); private List emeraldGenerators = new ArrayList<>(); + private CustomLocation teamAshop; + private CustomLocation teamBshop; + + private CustomLocation teamAupgrades; + private CustomLocation teamBupgrades; + } 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 e393cfd..892309b 100644 --- a/src/main/java/rip/tilly/bedwars/managers/arena/ArenaManager.java +++ b/src/main/java/rip/tilly/bedwars/managers/arena/ArenaManager.java @@ -55,6 +55,11 @@ public class ArenaManager { 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 + ".teamAupgrades"); + CustomLocation spawnA = CustomLocation.stringToLocation(a); CustomLocation spawnB = CustomLocation.stringToLocation(b); CustomLocation locMin = CustomLocation.stringToLocation(min); @@ -79,6 +84,11 @@ 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) { @@ -96,6 +106,11 @@ public class ArenaManager { 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 + ".teamAupgrades"); + CustomLocation copySpawnA = CustomLocation.stringToLocation(copyA); CustomLocation copySpawnB = CustomLocation.stringToLocation(copyB); CustomLocation copyLocMin = CustomLocation.stringToLocation(copyMin); @@ -120,6 +135,11 @@ 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, @@ -132,7 +152,12 @@ public class ArenaManager { copyTeamGeneratorLocations, copyDiamondGeneratorLocations, - copyEmeraldGeneratorLocations + copyEmeraldGeneratorLocations, + + copyLocTeamAshop, + copyLocTeamBshop, + copyLocTeamAupgrades, + copyLocTeamBupgrades ); this.plugin.getChunkClearingManager().copyArena(copiedArena); @@ -164,6 +189,11 @@ public class ArenaManager { diamondGeneratorLocations, emeraldGeneratorLocations, + locTeamAshop, + locTeamBshop, + locTeamAupgrades, + locTeamBupgrades, + enabled ); diff --git a/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java b/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java index e02d43c..d35a639 100644 --- a/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java +++ b/src/main/java/rip/tilly/bedwars/runnables/ArenaCommandRunnable.java @@ -79,7 +79,12 @@ public class ArenaCommandRunnable implements Runnable { emeraldGenerators.add(newEmeraldGenerator); } - CopiedArena copiedArena = new CopiedArena(a, b, min, max, teamAmin, teamAmax, teamBmin, teamBmax, teamGenerators, diamondGenerators, emeraldGenerators); + 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()); + + CopiedArena copiedArena = new CopiedArena(a, b, min, max, teamAmin, teamAmax, teamBmin, teamBmax, teamGenerators, diamondGenerators, emeraldGenerators, teamAshop, teamBshop, teamAupgrades, teamBupgrades); arena.addCopiedArena(copiedArena); arena.addAvailableArena(copiedArena);