diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-07-30 18:12:47 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-07-30 18:12:47 -0400 |
commit | 000219a5ff183e469129e5804d0a6090d6b47b26 (patch) | |
tree | 5217465c967796680cc03b11359490f638d6b78c /src/main/java/net/tylermurphy/hideAndSeek/command/map/set | |
parent | Merge branch 'main' of ssh://g.tylerm.dev:21/tylermurphy534/KenshinsHideAndSe... (diff) | |
download | kenshinshideandseek-000219a5ff183e469129e5804d0a6090d6b47b26.tar.gz kenshinshideandseek-000219a5ff183e469129e5804d0a6090d6b47b26.tar.bz2 kenshinshideandseek-000219a5ff183e469129e5804d0a6090d6b47b26.zip |
1.7.5 rc4
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/map/set')
5 files changed, 0 insertions, 375 deletions
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 deleted file mode 100644 index 2c05115..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java +++ /dev/null @@ -1,94 +0,0 @@ -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")); - map.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 deleted file mode 100644 index 3d1f036..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java +++ /dev/null @@ -1,113 +0,0 @@ -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 deleted file mode 100644 index 6690ae9..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index b6c5cf0..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java +++ /dev/null @@ -1,58 +0,0 @@ -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 deleted file mode 100644 index 0baf55e..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - } - -} |