summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/map')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java55
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java123
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java63
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java47
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java54
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java84
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java79
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java65
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java77
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java60
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java77
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java94
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java113
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java41
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java58
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java69
16 files changed, 1159 insertions, 0 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java
new file mode 100644
index 0000000..72f0740
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Add.java
@@ -0,0 +1,55 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collections;
+import java.util.List;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Add implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map != null) {
+ sender.sendMessage(errorPrefix + message("MAP_ALREADY_EXISTS"));
+ } else if(!args[0].matches("[a-zA-Z0-9]*") || args[0].length() < 1) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP_NAME"));
+ } else {
+ Maps.setMap(args[0], new Map(args[0]));
+ sender.sendMessage(messagePrefix + message("MAP_CREATED").addAmount(args[0]));
+ }
+ }
+
+ public String getLabel() {
+ return "add";
+ }
+
+ public String getUsage() {
+ return "<name>";
+ }
+
+ public String getDescription() {
+ return "Add a map to the plugin!";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("name")) {
+ return Collections.singletonList("name");
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java
new file mode 100644
index 0000000..209d0d6
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Debug.java
@@ -0,0 +1,123 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import com.cryptomorin.xseries.XMaterial;
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.PlayerLoader;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Debug implements ICommand {
+
+ private static final Map<Player, Map<Integer, Consumer<Player>>> debugMenuFunctions = new HashMap<>();
+
+ public void execute(Player sender, String[] args) {
+ net.tylermurphy.hideAndSeek.configuration.Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ Inventory debugMenu = createMenu(map, sender);
+ sender.openInventory(debugMenu);
+ }
+
+ private Inventory createMenu(net.tylermurphy.hideAndSeek.configuration.Map map, Player sender){
+ Map<Integer, Consumer<Player>> functions = new HashMap<>();
+ Inventory debugMenu = Main.getInstance().getServer().createInventory(null, 9, "Debug Menu");
+ debugMenu.setItem(0, createOption(functions, 0, XMaterial.LEATHER_CHESTPLATE.parseMaterial(), "&6Become a &lHider", 1, player -> {
+ if(mapSaveEnabled) {
+ if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap();
+ }
+ Main.getInstance().getBoard().addHider(player);
+ PlayerLoader.loadHider(player, map);
+ if(Main.getInstance().getGame().getStatus() != Status.STARTING)
+ PlayerLoader.resetPlayer(player, Main.getInstance().getBoard());
+ }));
+ debugMenu.setItem(1, createOption(functions, 1, XMaterial.GOLDEN_CHESTPLATE.parseMaterial(), "&cBecome a &lSeeker", 1, player -> {
+ if(mapSaveEnabled) {
+ if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap();
+ }
+ Main.getInstance().getBoard().addSeeker(player);
+ PlayerLoader.loadSeeker(player, map);
+ if(Main.getInstance().getGame().getStatus() != Status.STARTING)
+ PlayerLoader.resetPlayer(player, Main.getInstance().getBoard());
+ }));
+ debugMenu.setItem(2, createOption(functions, 2, XMaterial.IRON_CHESTPLATE.parseMaterial(), "&8Become a &lSpectator", 1, player -> {
+ if(mapSaveEnabled) {
+ if(map.getGameSpawn().getWorld() == null) map.getWorldLoader().loadMap();
+ }
+ Main.getInstance().getBoard().addSpectator(player);
+ PlayerLoader.loadSpectator(player, map);
+ }));
+ debugMenu.setItem(3, createOption(functions, 3, XMaterial.BARRIER.parseMaterial(), "&cUnload from Game", 1, player -> {
+ Main.getInstance().getBoard().remove(player);
+ PlayerLoader.unloadPlayer(player);
+ exitPosition.teleport(player);
+ }));
+ debugMenu.setItem(4, createOption(functions, 4, XMaterial.BARRIER.parseMaterial(), "&cDie In Game", 2, player -> {
+ if((Main.getInstance().getBoard().isSeeker(player) || Main.getInstance().getBoard().isHider(player)) && Main.getInstance().getGame().getStatus() == Status.PLAYING){
+ player.setHealth(0.1);
+ }
+ }));
+ if(map.isBlockHuntEnabled()) {
+ debugMenu.setItem(7, createOption(functions, 7, XMaterial.GLASS.parseMaterial(), "&dEnable Disguise", 1, player -> {
+ PlayerLoader.openBlockHuntPicker(player, map);
+ }));
+ debugMenu.setItem(8, createOption(functions, 8, XMaterial.PLAYER_HEAD.parseMaterial(), "&dDisable Disguise", 1, player -> Main.getInstance().getDisguiser().reveal(player)));
+ }
+ debugMenuFunctions.put(sender, functions);
+ return debugMenu;
+ }
+
+ private ItemStack createOption(Map<Integer, Consumer<Player>> functions, int slow, Material material, String name, int amount, Consumer<Player> callback){
+ ItemStack temp = new ItemStack(material, amount);
+ ItemMeta meta = temp.getItemMeta();
+ meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
+ temp.setItemMeta(meta);
+ functions.put(slow, callback);
+ return temp;
+ }
+
+ public static void handleOption(Player player, int slotId){
+ Main.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
+ Consumer<Player> callback = debugMenuFunctions.get(player).get(slotId);
+ if(callback != null) callback.accept(player);
+ }, 0);
+ }
+
+ public String getLabel() {
+ return "debug";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Run debug commands";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java
new file mode 100644
index 0000000..7d27642
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/GoTo.java
@@ -0,0 +1,63 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class GoTo implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ if (map.isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("MAP_NOT_SETUP").addAmount(map.getName()));
+ return;
+ }
+ switch (args[1].toLowerCase()) {
+ case "spawn":
+ map.getSpawn().teleport(sender); break;
+ case "lobby":
+ map.getLobby().teleport(sender); break;
+ case "seekerlobby":
+ map.getSeekerLobby().teleport(sender); break;
+ case "exit":
+ exitPosition.teleport(sender); break;
+ default:
+ sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1].toLowerCase()));
+ }
+ }
+
+ public String getLabel() {
+ return "goto";
+ }
+
+ public String getUsage() {
+ return "<map> <spawn>";
+ }
+
+ public String getDescription() {
+ return "Teleport to a map spawn zone";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ } else if(parameter.equals("spawn")) {
+ return Arrays.asList("spawn","lobby","seekerlobby","exit");
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java
new file mode 100644
index 0000000..ac2badf
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/List.java
@@ -0,0 +1,47 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class List implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ Collection<Map> maps = Maps.getAllMaps();
+ if(maps.size() < 1) {
+ sender.sendMessage(errorPrefix + message("NO_MAPS"));
+ return;
+ }
+ StringBuilder response = new StringBuilder(messagePrefix + message("LIST_MAPS"));
+ for(Map map : maps) {
+ response.append("\n ").append(map.getName()).append(": ").append(map.isNotSetup() ? ChatColor.RED + "NOT SETUP" : ChatColor.GREEN + "SETUP").append(ChatColor.WHITE);
+ }
+ sender.sendMessage(response.toString());
+ }
+
+ public String getLabel() {
+ return "list";
+ }
+
+ public String getUsage() {
+ return "";
+ }
+
+ public String getDescription() {
+ return "List all maps in the plugin";
+ }
+
+ public java.util.List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java
new file mode 100644
index 0000000..d681848
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Remove.java
@@ -0,0 +1,54 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Remove implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ } else if(!Maps.removeMap(args[0])){
+ sender.sendMessage(errorPrefix + message("MAP_FAIL_DELETE").addAmount(args[0]));
+ } else {
+ sender.sendMessage(messagePrefix + message("MAP_DELETED").addAmount(args[0]));
+ }
+ }
+
+ public String getLabel() {
+ return "remove";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Remove a map from the plugin!";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
new file mode 100644
index 0000000..03e23a8
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java
@@ -0,0 +1,84 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Save implements ICommand {
+
+ public static boolean runningBackup = false;
+
+ public void execute(Player sender, String[] args) {
+ if (!mapSaveEnabled) {
+ sender.sendMessage(errorPrefix + message("MAPSAVE_DISABLED"));
+ return;
+ }
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ if (map.getSpawn().isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
+ return;
+ }
+ if (map.isBoundsNotSetup()) {
+ sender.sendMessage(errorPrefix + message("ERROR_MAP_BOUNDS"));
+ return;
+ }
+ sender.sendMessage(messagePrefix + message("MAPSAVE_START"));
+ sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING"));
+ World world = map.getSpawn().load();
+ if (world == null) {
+ sender.sendMessage(warningPrefix + message("MAPSAVE_FAIL_WORLD"));
+ return;
+ }
+ world.save();
+ BukkitRunnable runnable = new BukkitRunnable() {
+ public void run() {
+ sender.sendMessage(
+ map.getWorldLoader().save()
+ );
+ runningBackup = false;
+ }
+ };
+ runnable.runTaskAsynchronously(Main.getInstance());
+ runningBackup = true;
+ }
+
+ public String getLabel() {
+ return "save";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Saves the map to its own separate playable map";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
new file mode 100644
index 0000000..90615e5
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java
@@ -0,0 +1,79 @@
+package net.tylermurphy.hideAndSeek.command.map;
+
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Status implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+
+ String msg = message("SETUP").toString();
+ int count = 0;
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ if (map.getSpawn().getBlockX() == 0 && map.getSpawn().getBlockY() == 0 && map.getSpawn().getBlockZ() == 0 || !map.getSpawn().exists()) {
+ msg = msg + "\n" + message("SETUP_GAME");
+ count++;
+ }
+ if (map.getLobby().getBlockX() == 0 && map.getLobby().getBlockY() == 0 && map.getLobby().getBlockZ() == 0 || !map.getLobby().exists()) {
+ msg = msg + "\n" + message("SETUP_LOBBY");
+ count++;
+ }
+ if (map.getSeekerLobby().getBlockX() == 0 && map.getSeekerLobby().getBlockY() == 0 && map.getSeekerLobby().getBlockZ() == 0 || !map.getSeekerLobby().exists()) {
+ msg = msg + "\n" + message("SETUP_SEEKER_LOBBY");
+ count++;
+ }
+ if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0 || !exitPosition.exists()) {
+ msg = msg + "\n" + message("SETUP_EXIT");
+ count++;
+ }
+ if (map.isBoundsNotSetup()) {
+ msg = msg + "\n" + message("SETUP_BOUNDS");
+ count++;
+ }
+ if (mapSaveEnabled && !map.getGameSpawn().exists()) {
+ msg = msg + "\n" + message("SETUP_SAVEMAP");
+ count++;
+ }
+ if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) {
+ msg = msg + "\n" + message("SETUP_BLOCKHUNT");
+ }
+ if (count < 1) {
+ sender.sendMessage(messagePrefix + message("SETUP_COMPLETE"));
+ } else {
+ sender.sendMessage(msg);
+ }
+ }
+
+ public String getLabel() {
+ return "status";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Shows what needs to be setup on a map";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java
new file mode 100644
index 0000000..2567427
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java
@@ -0,0 +1,65 @@
+package net.tylermurphy.hideAndSeek.command.map.blockhunt;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Enabled implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ boolean bool = Boolean.parseBoolean(args[1]);
+ map.setBlockhunt(bool, map.getBlockHunt());
+ Maps.setMap(map.getName(), map);
+ sender.sendMessage(messagePrefix + message("BLOCKHUNT_SET_TO")
+ .addAmount(bool ? ChatColor.GREEN + "true" : ChatColor.RED + "false") + ChatColor.WHITE);
+ }
+
+ public String getLabel() {
+ return "enabled";
+ }
+
+ public String getUsage() {
+ return "<map> <bool>";
+ }
+
+ public String getDescription() {
+ return "Sets blockhunt enabled or disabled in a current map";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ if(parameter.equals("bool")) {
+ return Arrays.asList("true", "false");
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java
new file mode 100644
index 0000000..fea08ef
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Add.java
@@ -0,0 +1,77 @@
+package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Add implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ Material block;
+ try { block = Material.valueOf(args[1]); }
+ catch (IllegalArgumentException e) {
+ sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1]));
+ return;
+ }
+ List<Material> blocks = map.getBlockHunt();
+ if(blocks.contains(block)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_BLOCK_EXISTS").addAmount(args[1]));
+ }
+ blocks.add(block);
+ map.setBlockhunt(map.isBlockHuntEnabled(), blocks);
+ Maps.setMap(map.getName(), map);
+ sender.sendMessage(messagePrefix + message("BLOCKHUNT_BLOCK_ADDED").addAmount(args[1]));
+ }
+
+ public String getLabel() {
+ return "add";
+ }
+
+ public String getUsage() {
+ return "<map> <block>";
+ }
+
+ public String getDescription() {
+ return "Add a blockhunt block to a map!";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ } else if(parameter.equals("block")) {
+ return Arrays.stream(Material.values())
+ .filter(Material::isBlock)
+ .map(Material::toString)
+ .filter(s -> s.toUpperCase().startsWith(typed.toUpperCase()))
+ .collect(Collectors.toList());
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java
new file mode 100644
index 0000000..de783ce
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/List.java
@@ -0,0 +1,60 @@
+package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class List implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ java.util.List<Material> blocks = map.getBlockHunt();
+ if(blocks.isEmpty()) {
+ sender.sendMessage(errorPrefix + message("NO_BLOCKS"));
+ return;
+ }
+ StringBuilder response = new StringBuilder(messagePrefix + message("BLOCKHUNT_LIST_BLOCKS"));
+ for(int i = 0; i < blocks.size(); i++) {
+ response.append(String.format("\n%s. %s", i, blocks.get(i).toString()));
+ }
+ sender.sendMessage(response.toString());
+ }
+
+ public String getLabel() {
+ return "list";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "List all blockhunt blocks in a map";
+ }
+
+ public java.util.List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java
new file mode 100644
index 0000000..1c16fdc
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/blocks/Remove.java
@@ -0,0 +1,77 @@
+package net.tylermurphy.hideAndSeek.command.map.blockhunt.blocks;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Config.messagePrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Remove implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (!Main.getInstance().supports(9)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_UNSUPPORTED"));
+ return;
+ }
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ Material block;
+ try { block = Material.valueOf(args[1]); }
+ catch (IllegalArgumentException e) {
+ sender.sendMessage(errorPrefix + message("COMMAND_INVALID_ARG").addAmount(args[1]));
+ return;
+ }
+ java.util.List<Material> blocks = map.getBlockHunt();
+ if(!blocks.contains(block)) {
+ sender.sendMessage(errorPrefix + message("BLOCKHUNT_BLOCK_DOESNT_EXIT").addAmount(args[1]));
+ }
+ blocks.remove(block);
+ map.setBlockhunt(map.isBlockHuntEnabled(), blocks);
+ Maps.setMap(map.getName(), map);
+ sender.sendMessage(messagePrefix + message("BLOCKHUNT_BLOCK_REMOVED").addAmount(args[1]));
+ }
+
+ public String getLabel() {
+ return "remove";
+ }
+
+ public String getUsage() {
+ return "<map> <block>";
+ }
+
+ public String getDescription() {
+ return "Remove a blockhunt block from a map!";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ } else if(parameter.equals("block")) {
+ return Arrays.stream(Material.values())
+ .filter(Material::isBlock)
+ .map(Material::toString)
+ .filter(s -> s.toUpperCase().startsWith(typed.toUpperCase()))
+ .collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
new file mode 100644
index 0000000..64bf5d4
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java
@@ -0,0 +1,94 @@
+package net.tylermurphy.hideAndSeek.command.map.set;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Border implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ if (map.getSpawn().isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
+ return;
+ }
+ if (args.length < 4) {
+ map.setWorldBorderData(0, 0, 0, 0, 0);
+ addToConfig("worldBorder.enabled",false);
+ saveConfig();
+ sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE"));
+ Main.getInstance().getGame().getCurrentMap().getWorldBorder().resetWorldBorder();
+ return;
+ }
+ int num,delay,change;
+ try { num = Integer.parseInt(args[1]); } catch (Exception e) {
+ sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0]));
+ return;
+ }
+ try { delay = Integer.parseInt(args[2]); } catch (Exception e) {
+ sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[1]));
+ return;
+ }
+ try { change = Integer.parseInt(args[3]); } catch (Exception e) {
+ sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[2]));
+ return;
+ }
+ if (num < 100) {
+ sender.sendMessage(errorPrefix + message("WORLDBORDER_MIN_SIZE"));
+ return;
+ }
+ if (change < 1) {
+ sender.sendMessage(errorPrefix + message("WORLDBORDER_CHANGE_SIZE"));
+ return;
+ }
+ map.setWorldBorderData(
+ sender.getLocation().getBlockX(),
+ sender.getLocation().getBlockZ(),
+ num,
+ delay,
+ change
+ );
+ Maps.setMap(map.getName(), map);
+ sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay).addAmount(change));
+ map.getWorldBorder().resetWorldBorder();
+ }
+
+ public String getLabel() {
+ return "border";
+ }
+
+ public String getUsage() {
+ return "<map> <*size> <*delay> <*move>";
+ }
+
+ public String getDescription() {
+ return "Sets a maps world border information";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return Collections.singletonList(parameter);
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
new file mode 100644
index 0000000..3d1f036
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
@@ -0,0 +1,113 @@
+package net.tylermurphy.hideAndSeek.command.map.set;
+
+import net.tylermurphy.hideAndSeek.Main;
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.configuration.Map;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.game.util.Status;
+import net.tylermurphy.hideAndSeek.util.Location;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Bounds implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ if (Main.getInstance().getGame().getStatus() != Status.STANDBY) {
+ sender.sendMessage(errorPrefix + message("GAME_INPROGRESS"));
+ return;
+ }
+ Map map = Maps.getMap(args[0]);
+ if(map == null) {
+ sender.sendMessage(errorPrefix + message("INVALID_MAP"));
+ return;
+ }
+ if (map.getSpawn().isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN"));
+ return;
+ }
+ if (map.getSeekerLobby().isNotSetup()) {
+ sender.sendMessage(errorPrefix + message("ERROR_GAME_SEEKER_SPAWN"));
+ return;
+ }
+ if (!sender.getWorld().getName().equals(map.getSpawnName())) {
+ sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD"));
+ return;
+ }
+ if (sender.getLocation().getBlockX() == 0 || sender.getLocation().getBlockZ() == 0) {
+ sender.sendMessage(errorPrefix + message("NOT_AT_ZERO"));
+ return;
+ }
+ boolean first = true;
+ int bxs = map.getBoundsMin().getBlockX();
+ int bzs = map.getBoundsMin().getBlockZ();
+ int bxl = map.getBoundsMax().getBlockX();
+ int bzl = map.getBoundsMax().getBlockZ();
+ if (bxs != 0 && bzs != 0 && bxl != 0 && bzl != 0) {
+ bxs = bzs = bxl = bzl = 0;
+ }
+ if (bxl == 0) {
+ bxl = sender.getLocation().getBlockX();
+ } else if (map.getBoundsMax().getX() < sender.getLocation().getBlockX()) {
+ first = false;
+ bxs = bxl;
+ bxl = sender.getLocation().getBlockX();
+ } else {
+ first = false;
+ bxs = sender.getLocation().getBlockX();
+ }
+ if (bzl == 0) {
+ bzl = sender.getLocation().getBlockZ();
+ } else if (map.getBoundsMax().getZ() < sender.getLocation().getBlockZ()) {
+ first = false;
+ bzs = bzl;
+ bzl = sender.getLocation().getBlockZ();
+ } else {
+ first = false;
+ bzs = sender.getLocation().getBlockZ();
+ }
+ map.setBoundMin(bxs, bzs);
+ map.setBoundMax(bxl, bzl);
+ if(!map.isBoundsNotSetup()) {
+ if(!map.getSpawn().isNotSetup()) {
+ if(map.getSpawn().isNotInBounds(bxs, bxl, bzs, bzl)) {
+ map.setSpawn(Location.getDefault());
+ sender.sendMessage(warningPrefix + message("WARN_SPAWN_RESET"));
+ }
+ }
+ if(!map.getSeekerLobby().isNotSetup()) {
+ if(map.getSeekerLobby().isNotInBounds(bxs, bxl, bzs, bzl)) {
+ map.setSeekerLobby(Location.getDefault());
+ sender.sendMessage(warningPrefix + message("WARN_SEEKER_SPAWN_RESET"));
+ }
+ }
+ }
+ Maps.setMap(map.getName(), map);
+ sender.sendMessage(messagePrefix + message("BOUNDS").addAmount(first ? 1 : 2));
+ }
+
+ public String getLabel() {
+ return "bounds";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Sets the map bounds for the game.";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
new file mode 100644
index 0000000..6690ae9
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java
@@ -0,0 +1,41 @@
+package net.tylermurphy.hideAndSeek.command.map.set;
+
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.util.Location;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class Lobby implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> {
+ map.setLobby(Location.from(sender));
+ });
+ }
+
+ public String getLabel() {
+ return "lobby";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Sets the maps lobby location";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
new file mode 100644
index 0000000..b6c5cf0
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java
@@ -0,0 +1,58 @@
+package net.tylermurphy.hideAndSeek.command.map.set;
+
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.util.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.warningPrefix;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class SeekerLobby implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> {
+ if(map.getSpawn().isNotSetup()) {
+ throw new RuntimeException(message("GAME_SPAWN_NEEDED").toString());
+ }
+ if(!map.getSpawnName().equals(sender.getLocation().getWorld().getName())) {
+ throw new RuntimeException(message("SEEKER_LOBBY_INVALID").toString());
+ }
+ map.setSeekerLobby(Location.from(sender));
+ if(!map.isBoundsNotSetup()) {
+ Vector boundsMin = map.getBoundsMin();
+ Vector boundsMax = map.getBoundsMax();
+ if(map.getSeekerLobby().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) {
+ sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS"));
+ }
+ }
+ });
+ }
+
+ public String getLabel() {
+ return "seekerlobby";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Sets the maps seeker lobby location";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
new file mode 100644
index 0000000..0baf55e
--- /dev/null
+++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java
@@ -0,0 +1,69 @@
+package net.tylermurphy.hideAndSeek.command.map.set;
+
+import net.tylermurphy.hideAndSeek.command.util.ICommand;
+import net.tylermurphy.hideAndSeek.command.location.LocationUtils;
+import net.tylermurphy.hideAndSeek.command.location.Locations;
+import net.tylermurphy.hideAndSeek.configuration.Maps;
+import net.tylermurphy.hideAndSeek.util.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static net.tylermurphy.hideAndSeek.configuration.Config.*;
+import static net.tylermurphy.hideAndSeek.configuration.Localization.message;
+
+public class Spawn implements ICommand {
+
+ public void execute(Player sender, String[] args) {
+ LocationUtils.setLocation(sender, Locations.GAME, args[0], map -> {
+
+ if (map.isWorldBorderEnabled() &&
+ new Vector(sender.getLocation().getX(), 0, sender.getLocation().getZ()).distance(map.getWorldBorderPos()) > 100) {
+ sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
+ throw new RuntimeException("World border not enabled or not in valid position!");
+ }
+
+ map.setSpawn(Location.from(sender));
+
+ if(!map.isBoundsNotSetup()) {
+ Vector boundsMin = map.getBoundsMin();
+ Vector boundsMax = map.getBoundsMax();
+ if(map.getSpawn().isNotInBounds(boundsMin.getBlockX(), boundsMax.getBlockX(), boundsMin.getBlockZ(), boundsMax.getBlockZ())) {
+ sender.sendMessage(warningPrefix + message("WARN_MAP_BOUNDS"));
+ }
+ }
+
+ if(map.getSeekerLobby().getWorld() != null && !map.getSeekerLobby().getWorld().equals(sender.getLocation().getWorld().getName())) {
+ sender.sendMessage(warningPrefix + message("SEEKER_LOBBY_SPAWN_RESET"));
+ map.setSeekerLobby(Location.getDefault());
+ }
+
+ if (!sender.getLocation().getWorld().getName().equals(map.getSpawnName()) && mapSaveEnabled) {
+ map.getWorldLoader().unloadMap();
+ }
+ });
+ }
+
+ public String getLabel() {
+ return "spawn";
+ }
+
+ public String getUsage() {
+ return "<map>";
+ }
+
+ public String getDescription() {
+ return "Sets the maps game spawn location";
+ }
+
+ public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) {
+ if(parameter.equals("map")) {
+ return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList());
+ }
+ return null;
+ }
+
+}