diff options
author | tylermurphy534 <tylermurphy534@gmail.com> | 2022-10-30 21:40:59 -0400 |
---|---|---|
committer | tylermurphy534 <tylermurphy534@gmail.com> | 2022-10-30 21:40:59 -0400 |
commit | 1325e042a6e7af37669bcd32e9d7a133f2ae22e6 (patch) | |
tree | e6703c90dcdbefac6954a1f2023b78892c0dc788 /src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java | |
parent | start adding multi map support (diff) | |
download | kenshinshideandseek-1325e042a6e7af37669bcd32e9d7a133f2ae22e6.tar.gz kenshinshideandseek-1325e042a6e7af37669bcd32e9d7a133f2ae22e6.tar.bz2 kenshinshideandseek-1325e042a6e7af37669bcd32e9d7a133f2ae22e6.zip |
finish beta build of multi map support
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java index 12ac232..50932d6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/location/SetSpawnLocation.java @@ -22,9 +22,14 @@ package net.tylermurphy.hideAndSeek.command.location; import net.tylermurphy.hideAndSeek.command.ICommand; 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; @@ -41,7 +46,12 @@ public class SetSpawnLocation implements ICommand { map.setSpawn(sender.getLocation()); - if (!sender.getLocation().getWorld().getName().equals(map.getSpawn().getWorld().getName()) && mapSaveEnabled) { + 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(); } }); @@ -59,4 +69,11 @@ public class SetSpawnLocation implements ICommand { 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; + } + } |