From 6b453dde9758bc6d4d399528209addc2b817ce1a Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 26 Nov 2022 14:23:39 -0500 Subject: 1.7.0RC1 --- .../tylermurphy/hideAndSeek/command/map/Save.java | 21 +----------- .../hideAndSeek/command/map/Status.java | 19 ---------- .../hideAndSeek/command/map/blockhunt/Enabled.java | 4 +++ .../command/map/blockhunt/blocks/Add.java | 4 +++ .../command/map/blockhunt/blocks/List.java | 5 +++ .../command/map/blockhunt/blocks/Remove.java | 4 +++ .../hideAndSeek/command/map/set/Border.java | 21 +----------- .../hideAndSeek/command/map/set/Bounds.java | 40 +++++++++++----------- .../hideAndSeek/command/map/set/Lobby.java | 19 ---------- .../hideAndSeek/command/map/set/SeekerLobby.java | 13 +++++-- .../hideAndSeek/command/map/set/Spawn.java | 29 +++++----------- 11 files changed, 59 insertions(+), 120 deletions(-) (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/map') diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java index a612026..03e23a8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Save.java @@ -1,22 +1,3 @@ -/* - * This file is part of Kenshins Hide and Seek - * - * Copyright (c) 2021 Tyler Murphy. - * - * Kenshins Hide and Seek free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * he Free Software Foundation version 3. - * - * Kenshins Hide and Seek is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - package net.tylermurphy.hideAndSeek.command.map; import net.tylermurphy.hideAndSeek.Main; @@ -53,7 +34,7 @@ public class Save implements ICommand { sender.sendMessage(errorPrefix + message("INVALID_MAP")); return; } - if (map.isSpawnNotSetup()) { + if (map.getSpawn().isNotSetup()) { sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java index c7da88a..90615e5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/Status.java @@ -1,22 +1,3 @@ -/* - * This file is part of Kenshins Hide and Seek - * - * Copyright (c) 2021 Tyler Murphy. - * - * Kenshins Hide and Seek free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * he Free Software Foundation version 3. - * - * Kenshins Hide and Seek is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - package net.tylermurphy.hideAndSeek.command.map; import net.tylermurphy.hideAndSeek.command.util.ICommand; 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 index 14ae8e0..2567427 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/blockhunt/Enabled.java @@ -20,6 +20,10 @@ 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; 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 index fbdeecb..fea08ef 100644 --- 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 @@ -20,6 +20,10 @@ 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; 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 index 18f1b3c..de783ce 100644 --- 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 @@ -1,5 +1,6 @@ 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; @@ -17,6 +18,10 @@ 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")); 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 index d2afdc1..1c16fdc 100644 --- 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 @@ -20,6 +20,10 @@ 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; 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 index f9e14f8..64bf5d4 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Border.java @@ -1,22 +1,3 @@ -/* - * This file is part of Kenshins Hide and Seek - * - * Copyright (c) 2021 Tyler Murphy. - * - * Kenshins Hide and Seek free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * he Free Software Foundation version 3. - * - * Kenshins Hide and Seek is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - package net.tylermurphy.hideAndSeek.command.map.set; import net.tylermurphy.hideAndSeek.Main; @@ -46,7 +27,7 @@ public class Border implements ICommand { sender.sendMessage(errorPrefix + message("INVALID_MAP")); return; } - if (map.isSpawnNotSetup()) { + if (map.getSpawn().isNotSetup()) { sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); return; } 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 index 960863b..3d1f036 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java @@ -1,22 +1,3 @@ -/* - * This file is part of Kenshins Hide and Seek - * - * Copyright (c) 2021 Tyler Murphy. - * - * Kenshins Hide and Seek free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * he Free Software Foundation version 3. - * - * Kenshins Hide and Seek is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - package net.tylermurphy.hideAndSeek.command.map.set; import net.tylermurphy.hideAndSeek.Main; @@ -24,6 +5,7 @@ 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; @@ -45,10 +27,14 @@ public class Bounds implements ICommand { sender.sendMessage(errorPrefix + message("INVALID_MAP")); return; } - if (map.isSpawnNotSetup()) { + 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; @@ -87,6 +73,20 @@ public class Bounds implements ICommand { } 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)); } 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 index ada76e2..6690ae9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Lobby.java @@ -1,22 +1,3 @@ -/* - * This file is part of Kenshins Hide and Seek - * - * Copyright (c) 2021 Tyler Murphy. - * - * Kenshins Hide and Seek free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * he Free Software Foundation version 3. - * - * Kenshins Hide and Seek is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - package net.tylermurphy.hideAndSeek.command.map.set; import net.tylermurphy.hideAndSeek.command.util.ICommand; 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 index 9bc0249..b6c5cf0 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java @@ -6,24 +6,33 @@ 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.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.isSpawnNotSetup()) { + 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")); + } + } }); } 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 index b983404..0baf55e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Spawn.java @@ -1,22 +1,3 @@ -/* - * This file is part of Kenshins Hide and Seek - * - * Copyright (c) 2021 Tyler Murphy. - * - * Kenshins Hide and Seek free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * he Free Software Foundation version 3. - * - * Kenshins Hide and Seek is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - package net.tylermurphy.hideAndSeek.command.map.set; import net.tylermurphy.hideAndSeek.command.util.ICommand; @@ -47,8 +28,16 @@ public class Spawn implements ICommand { 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(message("SEEKER_LOBBY_SPAWN_RESET").toString()); + sender.sendMessage(warningPrefix + message("SEEKER_LOBBY_SPAWN_RESET")); map.setSeekerLobby(Location.getDefault()); } -- cgit v1.2.3-freya