diff options
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/location')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/LocationUtils.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/location/util/LocationUtils.java) | 2 | ||||
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/Locations.java (renamed from src/main/java/net/tylermurphy/hideAndSeek/command/location/util/Locations.java) | 2 | ||||
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/SetExitLocation.java | 61 | ||||
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java | 58 | ||||
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSeekerLobbyLocation.java | 47 | ||||
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java | 79 |
6 files changed, 2 insertions, 247 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/util/LocationUtils.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/LocationUtils.java index 69d7c26..5e4afb5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/util/LocationUtils.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/location/LocationUtils.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.command.location.util; +package net.tylermurphy.hideAndSeek.command.location; import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.configuration.Map; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/util/Locations.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/Locations.java index 35f74ea..dd73dac 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/util/Locations.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/location/Locations.java @@ -1,4 +1,4 @@ -package net.tylermurphy.hideAndSeek.command.location.util; +package net.tylermurphy.hideAndSeek.command.location; /** * @author bobby29831 diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetExitLocation.java deleted file mode 100644 index 01e1512..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetExitLocation.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.location; - -import net.tylermurphy.hideAndSeek.command.util.Command; -import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.util.Locations; -import org.bukkit.entity.Player; - -import java.util.List; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; - -public class SetExitLocation extends Command { - - public void execute(Player sender, String[] args) { - LocationUtils.setLocation(sender, Locations.EXIT, null, map -> { - addToConfig("exit.x", sender.getLocation().getBlockX()); - addToConfig("exit.y", sender.getLocation().getBlockY()); - addToConfig("exit.z", sender.getLocation().getBlockZ()); - addToConfig("exit.world", sender.getLocation().getWorld().getName()); - exitPosition = sender.getLocation(); - exitWorld = sender.getLocation().getWorld().getName(); - saveConfig(); - }); - } - - public String getLabel() { - return "setexit"; - } - - public String getUsage() { - return ""; - } - - public String getDescription() { - return "Sets hide and seeks exit location to current position and world"; - } - - public List<String> autoComplete(String parameter) { - return null; - } - -} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java deleted file mode 100644 index da41d91..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetLobbyLocation.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.location; - -import net.tylermurphy.hideAndSeek.command.util.Command; -import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.util.Locations; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.stream.Collectors; - -public class SetLobbyLocation extends Command { - - public void execute(Player sender, String[] args) { - LocationUtils.setLocation(sender, Locations.LOBBY, args[0], map -> { - map.setLobby(sender.getLocation()); - }); - } - - public String getLabel() { - return "lobby"; - } - - public String getUsage() { - return "<map>"; - } - - public String getDescription() { - return "Sets hide and seeks lobby location to current position"; - } - - public List<String> autoComplete(String parameter) { - if(parameter != null && 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/location/SetSeekerLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSeekerLobbyLocation.java deleted file mode 100644 index 8a5ebd1..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSeekerLobbyLocation.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.tylermurphy.hideAndSeek.command.location; - -import net.tylermurphy.hideAndSeek.command.util.Command; -import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.util.Locations; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.stream.Collectors; - -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - -public class SetSeekerLobbyLocation extends Command { - - public void execute(Player sender, String[] args) { - LocationUtils.setLocation(sender, Locations.SEEKER, args[0], map -> { - if(map.isSpawnNotSetup()) { - 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(sender.getLocation()); - }); - } - - public String getLabel() { - return "seekerlobby"; - } - - public String getUsage() { - return "<map>"; - } - - public String getDescription() { - return "Sets hide and seeks seeker lobby location to current position"; - } - - public List<String> autoComplete(String parameter) { - if(parameter != null && 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/location/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java deleted file mode 100644 index 82f71d1..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.location; - -import net.tylermurphy.hideAndSeek.command.util.Command; -import net.tylermurphy.hideAndSeek.command.location.util.LocationUtils; -import net.tylermurphy.hideAndSeek.command.location.util.Locations; -import net.tylermurphy.hideAndSeek.configuration.Maps; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -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 SetSpawnLocation extends Command { - - 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(sender.getLocation()); - - if(map.getSeekerLobby().getWorld() != null && !map.getSeekerLobby().getWorld().getName().equals(sender.getLocation().getWorld().getName())) { - sender.sendMessage(message("SEEKER_LOBBY_SPAWN_RESET").toString()); - map.setSeekerLobby(new Location(null, 0, 0, 0)); - } - - 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 hide and seeks spawn location to current position"; - } - - public List<String> autoComplete(String parameter) { - if(parameter != null && parameter.equals("map")) { - return Maps.getAllMaps().stream().map(net.tylermurphy.hideAndSeek.configuration.Map::getName).collect(Collectors.toList()); - } - return null; - } - -} |