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

@ -114,8 +114,8 @@ public class ArenaCommand implements CommandExecutor {
new SetBuildMaxCommand().executeAs(sender, cmd, label, args); new SetBuildMaxCommand().executeAs(sender, cmd, label, args);
break; break;
case "setplayergenerator": case "setteamgenerator":
new SetPlayerGeneratorCommand().executeAs(sender, cmd, label, args); new SetTeamGeneratorCommand().executeAs(sender, cmd, label, args);
break; break;
case "setdiamondgenerator": case "setdiamondgenerator":
@ -153,9 +153,6 @@ public class ArenaCommand implements CommandExecutor {
case "generate": case "generate":
new GenerateCommand().executeAs(sender, cmd, label, args); new GenerateCommand().executeAs(sender, cmd, label, args);
break;
case "generator":
new GeneratorCommand().executeAs(sender, cmd, label, args);
break; break;
} }
} }

View File

@ -1,15 +1,16 @@
package rip.tilly.bedwars.commands.arena; package rip.tilly.bedwars.commands.arena;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand; import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.generators.GeneratorType;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -27,14 +28,18 @@ public class SetDiamondGeneratorCommand extends BaseCommand {
if (arena != null) { if (arena != null) {
Location location = player.getLocation(); Location location = player.getLocation();
Generator diamondGenerator; // Generator diamondGenerator;
diamondGenerator = new Generator(location, GeneratorType.DIAMOND, false); // diamondGenerator = new Generator(location, GeneratorType.DIAMOND, false);
diamondGenerator.setActivated(true); // diamondGenerator.setActivated(true);
diamondGenerator.spawn(); // diamondGenerator.spawn();
// arena.getDiamondGenerators().add(diamondGenerator); // arena.getDiamondGenerators().add(diamondGenerator);
player.sendMessage(CC.translate("&aSuccessfully set the diamond generator for the arena called &a&l" + args[1])); player.sendMessage(ChatColor.GREEN + "Successfully set the generator point #" + this.main.getArenaManager().getArena(arena.getName()).getDiamondGenerators().size() + ".");
arena.getDiamondGenerators().add(CustomLocation.fromBukkitLocation(location));
this.saveStringsGenerators(arena);
// player.sendMessage(CC.translate("&aSuccessfully set the diamond generator for the arena called &a&l" + args[1]));
} else { } else {
player.sendMessage(CC.translate("&cThis arena does not already exist")); player.sendMessage(CC.translate("&cThis arena does not already exist"));
} }
@ -46,4 +51,10 @@ public class SetDiamondGeneratorCommand extends BaseCommand {
return tabCompletions; return tabCompletions;
} }
private void saveStringsGenerators(Arena arena) {
FileConfiguration config = this.main.getArenasConfig().getConfig();
config.set("arenas." + arena.getName() + ".diamond-generators", this.main.getArenaManager().fromLocations(arena.getDiamondGenerators()));
this.main.getArenasConfig().save();
}
} }

View File

@ -1,15 +1,16 @@
package rip.tilly.bedwars.commands.arena; package rip.tilly.bedwars.commands.arena;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand; import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.generators.GeneratorType;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -27,13 +28,17 @@ public class SetEmeraldGeneratorCommand extends BaseCommand {
if (arena != null) { if (arena != null) {
Location location = player.getLocation(); Location location = player.getLocation();
Generator emeraldGenerator; // Generator emeraldGenerator;
emeraldGenerator = new Generator(location, GeneratorType.EMERALD, false); // emeraldGenerator = new Generator(location, GeneratorType.EMERALD, false);
emeraldGenerator.spawn(); // emeraldGenerator.spawn();
// arena.getEmeraldGenerators().add(emeraldGenerator); // arena.getEmeraldGenerators().add(emeraldGenerator);
player.sendMessage(CC.translate("&aSuccessfully set the emerald generator for the arena called &a&l" + args[1])); // player.sendMessage(CC.translate("&aSuccessfully set the emerald generator for the arena called &a&l" + args[1]));
player.sendMessage(ChatColor.GREEN + "Successfully set the generator point #" + this.main.getArenaManager().getArena(arena.getName()).getEmeraldGenerators().size() + ".");
arena.getEmeraldGenerators().add(CustomLocation.fromBukkitLocation(location));
this.saveStringsGenerators(arena);
} else { } else {
player.sendMessage(CC.translate("&cThis arena does not already exist")); player.sendMessage(CC.translate("&cThis arena does not already exist"));
} }
@ -45,4 +50,10 @@ public class SetEmeraldGeneratorCommand extends BaseCommand {
return tabCompletions; return tabCompletions;
} }
private void saveStringsGenerators(Arena arena) {
FileConfiguration config = this.main.getArenasConfig().getConfig();
config.set("arenas." + arena.getName() + ".emerald-generators", this.main.getArenaManager().fromLocations(arena.getEmeraldGenerators()));
this.main.getArenasConfig().save();
}
} }

View File

@ -1,57 +0,0 @@
package rip.tilly.bedwars.commands.arena;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.generators.GeneratorType;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList;
import java.util.List;
public class SetPlayerGeneratorCommand extends BaseCommand {
private BedWars main = BedWars.getInstance();
@Override
public void executeAs(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
Arena arena = this.main.getArenaManager().getArena(args[1]);
if (arena != null) {
Location location = player.getLocation();
Generator playerGenerator;
playerGenerator = new Generator(location, GeneratorType.IRON, true);
// arena.getPlayerGenerators().add(playerGenerator);
playerGenerator = new Generator(location, GeneratorType.GOLD, true);
// arena.getPlayerGenerators().add(playerGenerator);
playerGenerator = new Generator(location, GeneratorType.EMERALD, true);
// arena.getPlayerGenerators().add(playerGenerator);
player.sendMessage(CC.translate("&aSuccessfully set the player's generator for the arena called &a&l" + args[1]));
} else {
player.sendMessage(CC.translate("&cThis arena does not already exist"));
}
}
@Override
public List<String> getTabCompletions(CommandSender sender, Command cmd, String label, String[] args) {
List<String> tabCompletions = new ArrayList<String>();
return tabCompletions;
}
}

View File

@ -10,11 +10,12 @@ import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.commands.BaseCommand; import rip.tilly.bedwars.commands.BaseCommand;
import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class GeneratorCommand extends BaseCommand { public class SetTeamGeneratorCommand extends BaseCommand {
private BedWars main = BedWars.getInstance(); private BedWars main = BedWars.getInstance();
@ -26,7 +27,25 @@ public class GeneratorCommand extends BaseCommand {
if (arena != null) { if (arena != null) {
Location location = player.getLocation(); Location location = player.getLocation();
player.sendMessage(ChatColor.GREEN + "Successfully set the generator point #" + this.main.getArenaManager().getArena(arena.getName()).getGenerators().size() + ".");
// Generator playerGenerator;
// playerGenerator = new Generator(location, GeneratorType.IRON, true);
// arena.getPlayerGenerators().add(playerGenerator);
// playerGenerator = new Generator(location, GeneratorType.GOLD, true);
// arena.getPlayerGenerators().add(playerGenerator);
// playerGenerator = new Generator(location, GeneratorType.EMERALD, true);
// arena.getPlayerGenerators().add(playerGenerator);
// player.sendMessage(CC.translate("&aSuccessfully set the player's generator for the arena called &a&l" + args[1]));
player.sendMessage(ChatColor.GREEN + "Successfully set the generator point #" + this.main.getArenaManager().getArena(arena.getName()).getTeamGenerators().size() + ".");
arena.getTeamGenerators().add(CustomLocation.fromBukkitLocation(location));
this.saveStringsGenerators(arena); this.saveStringsGenerators(arena);
} else { } else {
player.sendMessage(CC.translate("&cThis arena does not already exist")); player.sendMessage(CC.translate("&cThis arena does not already exist"));
@ -42,7 +61,7 @@ public class GeneratorCommand extends BaseCommand {
private void saveStringsGenerators(Arena arena) { private void saveStringsGenerators(Arena arena) {
FileConfiguration config = this.main.getArenasConfig().getConfig(); FileConfiguration config = this.main.getArenasConfig().getConfig();
config.set("arenas." + arena.getName() + ".generators", this.main.getArenaManager().fromLocations(arena.getGenerators())); config.set("arenas." + arena.getName() + ".team-generators", this.main.getArenaManager().fromLocations(arena.getTeamGenerators()));
this.main.getArenasConfig().save(); this.main.getArenasConfig().save();
} }
} }

View File

@ -13,6 +13,7 @@ import org.github.paperspigot.Title;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.game.arena.CopiedArena; import rip.tilly.bedwars.game.arena.CopiedArena;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.TimeUtils; import rip.tilly.bedwars.utils.TimeUtils;
@ -42,6 +43,8 @@ public class Game {
private int durationTimer; private int durationTimer;
private int winningTeamId; private int winningTeamId;
private List<Generator> activatedGenerators = new ArrayList<>();
public Game(Arena arena, GameType gameType, GameTeam... teams) { public Game(Arena arena, GameType gameType, GameTeam... teams) {
this.arena = arena; this.arena = arena;
this.gameType = gameType; this.gameType = gameType;

View File

@ -4,7 +4,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.utils.CustomLocation; import rip.tilly.bedwars.utils.CustomLocation;
import java.util.ArrayList; import java.util.ArrayList;
@ -39,6 +38,10 @@ public class Arena {
private int deadZone; private int deadZone;
private int buildMax; private int buildMax;
private List<CustomLocation> teamGenerators = new ArrayList<>();
private List<CustomLocation> diamondGenerators = new ArrayList<>();
private List<CustomLocation> emeraldGenerators = new ArrayList<>();
private boolean enabled; private boolean enabled;
public CopiedArena getAvailableArena() { public CopiedArena getAvailableArena() {

View File

@ -27,5 +27,8 @@ public class CopiedArena {
private CustomLocation teamBmin; private CustomLocation teamBmin;
private CustomLocation teamBmax; private CustomLocation teamBmax;
private List<CustomLocation> generators = new ArrayList<>(); private List<CustomLocation> teamGenerators = new ArrayList<>();
private List<CustomLocation> diamondGenerators = new ArrayList<>();
private List<CustomLocation> emeraldGenerators = new ArrayList<>();
} }

View File

@ -8,6 +8,7 @@ import rip.tilly.bedwars.events.GameEndEvent;
import rip.tilly.bedwars.game.Game; import rip.tilly.bedwars.game.Game;
import rip.tilly.bedwars.game.GameState; import rip.tilly.bedwars.game.GameState;
import rip.tilly.bedwars.game.GameTeam; import rip.tilly.bedwars.game.GameTeam;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerData;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.PlayerUtil; import rip.tilly.bedwars.utils.PlayerUtil;
@ -27,6 +28,10 @@ public class GameEndListener implements Listener {
game.setWinningTeamId(winningTeam.getId()); game.setWinningTeamId(winningTeam.getId());
for (Generator generator : game.getActivatedGenerators()) {
generator.setActivated(false);
}
game.getTeams().forEach(team -> team.allPlayers().forEach(player -> { game.getTeams().forEach(team -> team.allPlayers().forEach(player -> {
PlayerUtil.clearPlayer(player); PlayerUtil.clearPlayer(player);

View File

@ -8,6 +8,9 @@ import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.events.GameStartEvent; import rip.tilly.bedwars.events.GameStartEvent;
import rip.tilly.bedwars.game.Game; import rip.tilly.bedwars.game.Game;
import rip.tilly.bedwars.game.GameType; import rip.tilly.bedwars.game.GameType;
import rip.tilly.bedwars.game.arena.CopiedArena;
import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.generators.GeneratorType;
import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerData;
import rip.tilly.bedwars.playerdata.PlayerState; import rip.tilly.bedwars.playerdata.PlayerState;
import rip.tilly.bedwars.runnables.GameRunnable; import rip.tilly.bedwars.runnables.GameRunnable;
@ -36,6 +39,30 @@ public class GameStartListener implements Listener {
return; return;
} }
CopiedArena currentArena = game.getCopiedArena();
for (CustomLocation location : currentArena.getTeamGenerators()) {
Generator teamGen = new Generator(location.toBukkitLocation(), GeneratorType.IRON, false);
teamGen.setActivated(true);
game.getActivatedGenerators().add(teamGen);
}
for (CustomLocation location : currentArena.getDiamondGenerators()) {
Generator diaGen = new Generator(location.toBukkitLocation(), GeneratorType.DIAMOND, true);
diaGen.setActivated(true);
game.getActivatedGenerators().add(diaGen);
}
for (CustomLocation location : currentArena.getEmeraldGenerators()) {
Generator emeGen = new Generator(location.toBukkitLocation(), GeneratorType.EMERALD, true);
emeGen.setActivated(true);
game.getActivatedGenerators().add(emeGen);
}
Set<Player> gamePlayers = new HashSet<>(); Set<Player> gamePlayers = new HashSet<>();
game.getTeams().forEach(team -> team.playingPlayers().forEach(player -> { game.getTeams().forEach(team -> team.playingPlayers().forEach(player -> {
gamePlayers.add(player); gamePlayers.add(player);

View File

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

View File

@ -1,20 +1,20 @@
package rip.tilly.bedwars.menus.shop; //package rip.tilly.bedwars.menus.shop;
//
import lombok.RequiredArgsConstructor; //import lombok.RequiredArgsConstructor;
import org.bukkit.Material; //import org.bukkit.Material;
//
@RequiredArgsConstructor //@RequiredArgsConstructor
public enum ShopType { //public enum ShopType {
//
QUICK("Quick Buy"), // QUICK("Quick Buy"),
BLOCKS("Blocks"), // BLOCKS("Blocks"),
ARMOR("Armor"), // ARMOR("Armor"),
TOOLS("Tools"), // TOOLS("Tools"),
WEAPONS("Weapons"), // WEAPONS("Weapons"),
RANGED("Ranged"), // RANGED("Ranged"),
POTIONS("Potions"), // POTIONS("Potions"),
UTILITY("Utility"); // UTILITY("Utility");
//
private final String name; // private final String name;
private final Material material; // private final Material material;
} //}

View File

@ -1,10 +1,10 @@
package rip.tilly.bedwars.menus.shop; //package rip.tilly.bedwars.menus.shop;
//
import lombok.AllArgsConstructor; //import lombok.AllArgsConstructor;
import rip.tilly.bedwars.utils.menu.Button; //import rip.tilly.bedwars.utils.menu.Button;
//
@AllArgsConstructor //@AllArgsConstructor
public class ShopTypeButton extends Button { //public class ShopTypeButton extends Button {
//
private final ShopType shopType; // private final ShopType shopType;
} //}

View File

@ -1,29 +1,29 @@
package rip.tilly.bedwars.menus.shop.blocks; //package rip.tilly.bedwars.menus.shop.blocks;
//
import org.bukkit.entity.Player; //import org.bukkit.entity.Player;
import rip.tilly.bedwars.utils.CC; //import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.menu.Button; //import rip.tilly.bedwars.utils.menu.Button;
import rip.tilly.bedwars.utils.menu.Menu; //import rip.tilly.bedwars.utils.menu.Menu;
//
import java.util.HashMap; //import java.util.HashMap;
import java.util.Map; //import java.util.Map;
//
public class BlocksMenu extends Menu { //public class BlocksMenu extends Menu {
//
@Override // @Override
public boolean isUpdateAfterClick() { // public boolean isUpdateAfterClick() {
return true; // return true;
} // }
//
@Override // @Override
public String getTitle(Player player) { // public String getTitle(Player player) {
return CC.translate("&eBlocks"); // return CC.translate("&eBlocks");
} // }
//
@Override // @Override
public Map<Integer, Button> getButtons(Player player) { // public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = new HashMap<>(); // Map<Integer, Button> buttons = new HashMap<>();
//
//
} // }
} //}

View File

@ -61,13 +61,25 @@ public class ArenaCommandRunnable implements Runnable {
CustomLocation teamBmin = new CustomLocation(bMinX, arena.getTeamBmin().getY(), bMinZ, arena.getTeamBmin().getYaw(), arena.getTeamBmin().getPitch()); CustomLocation teamBmin = new CustomLocation(bMinX, arena.getTeamBmin().getY(), bMinZ, arena.getTeamBmin().getYaw(), arena.getTeamBmin().getPitch());
CustomLocation teamBmax = new CustomLocation(bMaxX, arena.getTeamBmax().getY(), bMaxZ, arena.getTeamBmax().getYaw(), arena.getTeamBmax().getPitch()); CustomLocation teamBmax = new CustomLocation(bMaxX, arena.getTeamBmax().getY(), bMaxZ, arena.getTeamBmax().getYaw(), arena.getTeamBmax().getPitch());
List<CustomLocation> generators = new ArrayList<>(); List<CustomLocation> teamGenerators = new ArrayList<>();
for (CustomLocation generator : arena.getGenerators()) { for (CustomLocation location : arena.getTeamGenerators()) {
CustomLocation newGenerator = new CustomLocation((generator.getX() + this.getOffsetX()), generator.getY(), (generator.getZ() + this.getOffsetZ()), generator.getYaw(), generator.getPitch()); CustomLocation newTeamGenerator = new CustomLocation((location.getX() + this.getOffsetX()), location.getY(), (location.getZ() + this.getOffsetZ()), location.getYaw(), location.getPitch());
generators.add(newGenerator); teamGenerators.add(newTeamGenerator);
} }
CopiedArena copiedArena = new CopiedArena(a, b, min, max, teamAmin, teamAmax, teamBmin, teamBmax, generators); List<CustomLocation> diamondGenerators = new ArrayList<>();
for (CustomLocation location : arena.getDiamondGenerators()) {
CustomLocation newDiamondGenerator = new CustomLocation((location.getX() + this.getOffsetX()), location.getY(), (location.getZ() + this.getOffsetZ()), location.getYaw(), location.getPitch());
diamondGenerators.add(newDiamondGenerator);
}
List<CustomLocation> emeraldGenerators = new ArrayList<>();
for (CustomLocation location : arena.getEmeraldGenerators()) {
CustomLocation newEmeraldGenerator = new CustomLocation((location.getX() + this.getOffsetX()), location.getY(), (location.getZ() + this.getOffsetZ()), location.getYaw(), location.getPitch());
emeraldGenerators.add(newEmeraldGenerator);
}
CopiedArena copiedArena = new CopiedArena(a, b, min, max, teamAmin, teamAmax, teamBmin, teamBmax, teamGenerators, diamondGenerators, emeraldGenerators);
arena.addCopiedArena(copiedArena); arena.addCopiedArena(copiedArena);
arena.addAvailableArena(copiedArena); arena.addAvailableArena(copiedArena);