summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2022-11-26 14:23:39 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2022-11-26 14:23:39 -0500
commit6b453dde9758bc6d4d399528209addc2b817ce1a (patch)
tree3172b2afa630621a22cc65426f6b932b1b0f912f /src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java
parentfix seeker/hider returning null (diff)
downloadkenshinshideandseek-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/Bounds.java')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/command/map/set/Bounds.java40
1 files changed, 20 insertions, 20 deletions
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 <http://www.gnu.org/licenses/>.
- *
- */
-
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));
}