diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-05-13 13:42:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-13 13:42:26 -0400 |
commit | 7d152668d753c611c2f1b553332e257283fadcd6 (patch) | |
tree | 3c8ae0fc7edfac96191d80a31d38e8afc57a6113 /src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java | |
parent | parallel change on master (diff) | |
parent | typos: fix typos in CONTRIBUTING.md (diff) | |
download | kenshinshideandseek-7d152668d753c611c2f1b553332e257283fadcd6.tar.gz kenshinshideandseek-7d152668d753c611c2f1b553332e257283fadcd6.tar.bz2 kenshinshideandseek-7d152668d753c611c2f1b553332e257283fadcd6.zip |
Merge pull request #53 from bobby29831/1.4.3
Implement better coding practices
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java index d5e1cba..6a9b572 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java @@ -19,8 +19,6 @@ package net.tylermurphy.hideAndSeek.command; -import static net.tylermurphy.hideAndSeek.configuration.Config.*; - import net.tylermurphy.hideAndSeek.game.Game; import net.tylermurphy.hideAndSeek.util.Status; import net.tylermurphy.hideAndSeek.world.WorldLoader; @@ -29,34 +27,34 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import static net.tylermurphy.hideAndSeek.configuration.Config.addToConfig; -import static net.tylermurphy.hideAndSeek.configuration.Localization.*; +import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class SetSpawnLocation implements ICommand { public void execute(CommandSender sender, String[] args) { - if(Game.status != Status.STANDBY) { + if (Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } Vector newSpawnPosition = new Vector(); Player player = (Player) sender; - if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0){ + if (player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0 || player.getLocation().getBlockY() == 0) { sender.sendMessage(errorPrefix + message("NOT_AT_ZERO")); return; } newSpawnPosition.setX(player.getLocation().getBlockX()); newSpawnPosition.setY(player.getLocation().getBlockY()); newSpawnPosition.setZ(player.getLocation().getBlockZ()); - if(worldborderEnabled && newSpawnPosition.distance(worldborderPosition) > 100) { + if (worldborderEnabled && newSpawnPosition.distance(worldborderPosition) > 100) { sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); return; } World world = player.getLocation().getWorld(); - if(world == null){ + if (world == null) { throw new RuntimeException("Unable to get world: " + spawnWorld); } - if(mapSaveEnabled && !world.getName().equals(spawnWorld)){ + if (mapSaveEnabled && !world.getName().equals(spawnWorld)) { Game.worldLoader.unloadMap(); Game.worldLoader = new WorldLoader(world.getName()); } |