diff options
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java index 798b99f..45e66b9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java @@ -19,33 +19,31 @@ 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 org.bukkit.command.CommandSender; +import net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.game.util.Status; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import static net.tylermurphy.hideAndSeek.configuration.Localization.*; +import static net.tylermurphy.hideAndSeek.configuration.Config.*; +import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class SetBorder implements ICommand { - public void execute(CommandSender sender, String[] args) { - if(Game.status != Status.STANDBY) { + public void execute(Player sender, String[] args) { + if (Main.getInstance().getGame().getStatus() != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } - if(spawnPosition == null) { + if (spawnPosition == null) { sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); return; } - if(args.length < 3) { - worldborderEnabled = false; + if (args.length < 3) { + worldBorderEnabled = false; addToConfig("worldBorder.enabled",false); saveConfig(); sender.sendMessage(messagePrefix + message("WORLDBORDER_DISABLE")); - Game.resetWorldborder(spawnWorld); + Main.getInstance().getGame().getBorder().resetWorldBorder(spawnWorld); return; } int num,delay,change; @@ -61,37 +59,37 @@ public class SetBorder implements ICommand { sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[2])); return; } - if(num < 100) { + if (num < 100) { sender.sendMessage(errorPrefix + message("WORLDBORDER_MIN_SIZE")); return; } - if(change < 1) { + if (change < 1) { sender.sendMessage(errorPrefix + message("WORLDBORDER_CHANGE_SIZE")); return; } - Vector newWorldborderPosition = new Vector(); + Vector vec = new Vector(); Player player = (Player) sender; - newWorldborderPosition.setX(player.getLocation().getBlockX()); - newWorldborderPosition.setY(0); - newWorldborderPosition.setZ(player.getLocation().getBlockZ()); - if(spawnPosition.distance(newWorldborderPosition) > 100) { + vec.setX(player.getLocation().getBlockX()); + vec.setY(0); + vec.setZ(player.getLocation().getBlockZ()); + if (spawnPosition.distance(vec) > 100) { sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); return; } - worldborderPosition = newWorldborderPosition; - worldborderSize = num; - worldborderDelay = delay; - worldborderChange = change; - worldborderEnabled = true; - addToConfig("worldBorder.x", worldborderPosition.getBlockX()); - addToConfig("worldBorder.z", worldborderPosition.getBlockZ()); - addToConfig("worldBorder.delay", worldborderDelay); - addToConfig("worldBorder.size", worldborderSize); + worldBorderPosition = vec; + worldBorderSize = num; + worldBorderDelay = delay; + worldBorderChange = change; + worldBorderEnabled = true; + addToConfig("worldBorder.x", worldBorderPosition.getBlockX()); + addToConfig("worldBorder.z", worldBorderPosition.getBlockZ()); + addToConfig("worldBorder.delay", worldBorderDelay); + addToConfig("worldBorder.size", worldBorderSize); addToConfig("worldBorder.enabled", true); - addToConfig("worldBorder.move", worldborderChange); + addToConfig("worldBorder.move", worldBorderChange); sender.sendMessage(messagePrefix + message("WORLDBORDER_ENABLE").addAmount(num).addAmount(delay)); saveConfig(); - Game.resetWorldborder(spawnWorld); + Main.getInstance().getGame().getBorder().resetWorldBorder(spawnWorld); } public String getLabel() { |