diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-26 14:23:39 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-26 14:23:39 -0500 |
commit | 6b453dde9758bc6d4d399528209addc2b817ce1a (patch) | |
tree | 3172b2afa630621a22cc65426f6b932b1b0f912f /src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java | |
parent | fix seeker/hider returning null (diff) | |
download | kenshinshideandseek-6b453dde9758bc6d4d399528209addc2b817ce1a.tar.gz kenshinshideandseek-6b453dde9758bc6d4d399528209addc2b817ce1a.tar.bz2 kenshinshideandseek-6b453dde9758bc6d4d399528209addc2b817ce1a.zip |
1.7.0RC1
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/map/set/SeekerLobby.java | 13 |
1 files changed, 11 insertions, 2 deletions
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")); + } + } }); } |