diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2021-12-26 16:58:18 -0600 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2021-12-26 16:58:18 -0600 |
commit | 1617bfe44ab2fc2112ee5cc6fa082b7981222c64 (patch) | |
tree | 8e3114039cdb034d5021bd4d32aecb81ce36cc05 /src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java | |
parent | 1.3.3 beta 2 (diff) | |
download | kenshinshideandseek-1617bfe44ab2fc2112ee5cc6fa082b7981222c64.tar.gz kenshinshideandseek-1617bfe44ab2fc2112ee5cc6fa082b7981222c64.tar.bz2 kenshinshideandseek-1617bfe44ab2fc2112ee5cc6fa082b7981222c64.zip |
1.3.3 beta 3
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java index c854b60..eb03625 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java @@ -2,23 +2,21 @@ package net.tylermurphy.hideAndSeek.command; import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import java.util.HashMap; -import java.util.Map; - -import net.tylermurphy.hideAndSeek.game.Status; +import net.tylermurphy.hideAndSeek.game.Game; +import net.tylermurphy.hideAndSeek.util.Status; +import net.tylermurphy.hideAndSeek.world.WorldLoader; +import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.tylermurphy.hideAndSeek.Main; - import static net.tylermurphy.hideAndSeek.configuration.Config.addToConfig; import static net.tylermurphy.hideAndSeek.configuration.Localization.*; public class SetSpawnLocation implements ICommand { public void execute(CommandSender sender, String[] args) { - if(Main.plugin.status != Status.STANDBY) { + if(Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } @@ -35,7 +33,15 @@ public class SetSpawnLocation implements ICommand { sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); return; } - spawnWorld = player.getLocation().getWorld().getName(); + World world = player.getLocation().getWorld(); + if(world == null){ + throw new RuntimeException("Unable to get world: " + spawnWorld); + } + if(!world.getName().equals(spawnWorld)){ + Game.worldLoader.unloadMap(); + Game.worldLoader = new WorldLoader(world.getName()); + } + spawnWorld = world.getName(); spawnPosition = newSpawnPosition; sender.sendMessage(messagePrefix + message("GAME_SPAWN")); addToConfig("spawns.game.x", spawnPosition.getX()); |