diff options
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command')
14 files changed, 63 insertions, 63 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java index 8fb002f..446fb2d 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Join.java @@ -31,16 +31,16 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class Join implements ICommand { public void execute(CommandSender sender, String[] args) { - if(Game.isNotSetup()) { + if (Game.isNotSetup()) { sender.sendMessage(errorPrefix + message("GAME_SETUP")); return; } Player player = Bukkit.getServer().getPlayer(sender.getName()); - if(player == null) { + if (player == null) { sender.sendMessage(errorPrefix + message("COMMAND_ERROR")); return; } - if(Board.contains(player)){ + if (Board.contains(player)) { sender.sendMessage(errorPrefix + message("GAME_INGAME")); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java index e6e95ee..f508498 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Leave.java @@ -31,16 +31,16 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class Leave implements ICommand { public void execute(CommandSender sender, String[] args) { - if(Game.isNotSetup()) { + if (Game.isNotSetup()) { sender.sendMessage(errorPrefix + message("GAME_SETUP")); return; } Player player = Bukkit.getServer().getPlayer(sender.getName()); - if(player == null) { + if (player == null) { sender.sendMessage(errorPrefix + message("COMMAND_ERROR")); return; } - if(!Board.contains(player)) { + if (!Board.contains(player)) { sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME")); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java index 1ec2c71..d2ed069 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Reload.java @@ -34,7 +34,7 @@ public class Reload 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; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java index e9f1cc8..83f2580 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SaveMap.java @@ -35,22 +35,22 @@ public class SaveMap implements ICommand { public static boolean runningBackup = false; public void execute(CommandSender sender, String[] args) { - if(!mapSaveEnabled){ + if (!mapSaveEnabled) { sender.sendMessage(errorPrefix + message("MAPSAVE_DISABLED")); return; } - if(Game.status != Status.STANDBY) { + if (Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } - if(spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) { + if (spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) { sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); return; } sender.sendMessage(messagePrefix + message("MAPSAVE_START")); sender.sendMessage(warningPrefix + message("MAPSAVE_WARNING")); World world = Bukkit.getServer().getWorld(spawnWorld); - if(world == null){ + if (world == null) { throw new RuntimeException("Unable to get world: " + spawnWorld); } world.save(); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java index 8b578f0..e049a8e 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBorder.java @@ -31,15 +31,15 @@ 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) { + if (Game.status != 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) { + if (args.length < 3) { worldborderEnabled = false; addToConfig("worldBorder.enabled",false); saveConfig(); @@ -60,11 +60,11 @@ 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; } @@ -73,7 +73,7 @@ public class SetBorder implements ICommand { newWorldborderPosition.setX(player.getLocation().getBlockX()); newWorldborderPosition.setY(0); newWorldborderPosition.setZ(player.getLocation().getBlockZ()); - if(spawnPosition.distance(newWorldborderPosition) > 100) { + if (spawnPosition.distance(newWorldborderPosition) > 100) { sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java index f369f29..719d675 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetBounds.java @@ -30,31 +30,31 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class SetBounds 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; } - if(spawnPosition == null) { + if (spawnPosition == null) { sender.sendMessage(errorPrefix + message("ERROR_GAME_SPAWN")); return; } Player player = (Player) sender; - if(!player.getWorld().getName().equals(spawnWorld)){ + if (!player.getWorld().getName().equals(spawnWorld)) { sender.sendMessage(errorPrefix + message("BOUNDS_WRONG_WORLD")); return; } - if(player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0){ + if (player.getLocation().getBlockX() == 0 || player.getLocation().getBlockZ() == 0) { sender.sendMessage(errorPrefix + message("NOT_AT_ZERO")); return; } boolean first = true; - if(saveMinX != 0 && saveMinZ != 0 && saveMaxX != 0 && saveMaxZ != 0) { + if (saveMinX != 0 && saveMinZ != 0 && saveMaxX != 0 && saveMaxZ != 0) { saveMinX = 0; saveMinZ= 0; saveMaxX = 0; saveMaxZ = 0; } - if(saveMaxX == 0) { + if (saveMaxX == 0) { addToConfig("bounds.max.x", player.getLocation().getBlockX()); saveMaxX = player.getLocation().getBlockX(); - } else if(saveMaxX < player.getLocation().getBlockX()) { + } else if (saveMaxX < player.getLocation().getBlockX()) { first = false; addToConfig("bounds.max.x", player.getLocation().getBlockX()); addToConfig("bounds.min.x", saveMaxX); @@ -65,10 +65,10 @@ public class SetBounds implements ICommand { addToConfig("bounds.min.x", player.getLocation().getBlockX()); saveMinX = player.getLocation().getBlockX(); } - if(saveMaxZ == 0) { + if (saveMaxZ == 0) { addToConfig("bounds.max.z", player.getLocation().getBlockZ()); saveMaxZ = player.getLocation().getBlockZ(); - } else if(saveMaxZ < player.getLocation().getBlockZ()) { + } else if (saveMaxZ < player.getLocation().getBlockZ()) { first = false; addToConfig("bounds.max.z", player.getLocation().getBlockZ()); addToConfig("bounds.min.z", saveMaxZ); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java index e54fde6..de33b93 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java @@ -32,13 +32,13 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class SetExitLocation 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 newExitPosition = 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; } @@ -46,7 +46,7 @@ public class SetExitLocation implements ICommand { newExitPosition.setY(player.getLocation().getBlockY()); newExitPosition.setZ(player.getLocation().getBlockZ()); World world = player.getLocation().getWorld(); - if(world == null){ + if (world == null) { throw new RuntimeException("Unable to get world: " + spawnWorld); } exitWorld = world.getName(); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java index bdd8aad..a9351fd 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetLobbyLocation.java @@ -32,13 +32,13 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class SetLobbyLocation 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 newLobbyPosition = 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; } @@ -46,7 +46,7 @@ public class SetLobbyLocation implements ICommand { newLobbyPosition.setY(player.getLocation().getBlockY()); newLobbyPosition.setZ(player.getLocation().getBlockZ()); World world = player.getLocation().getWorld(); - if(world == null){ + if (world == null) { throw new RuntimeException("Unable to get world: " + spawnWorld); } lobbyWorld = world.getName(); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java index 83e0145..6a9b572 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetSpawnLocation.java @@ -33,28 +33,28 @@ 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()); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java index af06e0b..ec932d8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Setup.java @@ -35,30 +35,30 @@ public class Setup implements ICommand { String msg = message("SETUP").toString(); int count = 0; - if(spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) { + if (spawnPosition.getBlockX() == 0 && spawnPosition.getBlockY() == 0 && spawnPosition.getBlockZ() == 0) { msg = msg + "\n" + message("SETUP_GAME"); count++; } - if(lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) { + if (lobbyPosition.getBlockX() == 0 && lobbyPosition.getBlockY() == 0 && lobbyPosition.getBlockZ() == 0) { msg = msg + "\n" + message("SETUP_LOBBY"); count++; } - if(exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) { + if (exitPosition.getBlockX() == 0 && exitPosition.getBlockY() == 0 && exitPosition.getBlockZ() == 0) { msg = msg + "\n" + message("SETUP_EXIT"); count++; } - if(saveMinX == 0 || saveMinZ == 0 || saveMaxX == 0 || saveMaxZ == 0) { + if (saveMinX == 0 || saveMinZ == 0 || saveMaxX == 0 || saveMaxZ == 0) { msg = msg + "\n" + message("SETUP_BOUNDS"); count++; } - if(mapSaveEnabled) { + if (mapSaveEnabled) { File destenation = new File(Main.root + File.separator + Game.getGameWorld()); if (!destenation.exists()) { msg = msg + "\n" + message("SETUP_SAVEMAP"); count++; } } - if(count < 1) { + if (count < 1) { sender.sendMessage(messagePrefix + message("SETUP_COMPLETE")); } else { sender.sendMessage(msg); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java index 87ef2af..78f9a64 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Start.java @@ -37,26 +37,26 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class Start implements ICommand { public void execute(CommandSender sender, String[] args) { - if(Game.isNotSetup()) { + if (Game.isNotSetup()) { sender.sendMessage(errorPrefix + message("GAME_SETUP")); return; } - if(Game.status != Status.STANDBY) { + if (Game.status != Status.STANDBY) { sender.sendMessage(errorPrefix + message("GAME_INPROGRESS")); return; } - if(!Board.contains(sender)) { + if (!Board.contains(sender)) { sender.sendMessage(errorPrefix + message("GAME_NOT_INGAME")); return; } - if(Board.size() < minPlayers) { + if (Board.size() < minPlayers) { sender.sendMessage(errorPrefix + message("START_MIN_PLAYERS").addAmount(minPlayers)); return; } String seekerName; - if(args.length < 1) { + if (args.length < 1) { Optional<Player> rand = Board.getPlayers().stream().skip(new Random().nextInt(Board.size())).findFirst(); - if(!rand.isPresent()){ + if (!rand.isPresent()) { Main.plugin.getLogger().warning("Failed to select random seeker."); return; } @@ -65,12 +65,12 @@ public class Start implements ICommand { seekerName = args[0]; } Player temp = Bukkit.getPlayer(seekerName); - if(temp == null) { + if (temp == null) { sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName)); return; } Player seeker = Board.getPlayer(temp.getUniqueId()); - if(seeker == null) { + if (seeker == null) { sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(seekerName)); return; } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java index 37130d0..2a310e8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Stop.java @@ -30,11 +30,11 @@ import static net.tylermurphy.hideAndSeek.configuration.Localization.message; public class Stop implements ICommand { public void execute(CommandSender sender, String[] args) { - if(Game.isNotSetup()) { + if (Game.isNotSetup()) { sender.sendMessage(errorPrefix + "Game is not setup. Run /hs setup to see what you needed to do"); return; } - if(Game.status == Status.STARTING || Game.status == Status.PLAYING) { + if (Game.status == Status.STARTING || Game.status == Status.PLAYING) { Game.broadcastMessage(abortPrefix + message("STOP")); Game.end(); } else { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java index d362bba..916656d 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Top.java @@ -34,14 +34,14 @@ public class Top implements ICommand { public void execute(CommandSender sender, String[] args) { int page; - if(args.length == 0) page = 1; + if (args.length == 0) page = 1; else try{ page = Integer.parseInt(args[0]); - } catch(Exception e){ + } catch(Exception e) { sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(args[0])); return; } - if(page < 1){ + if (page < 1) { sender.sendMessage(errorPrefix + message("WORLDBORDER_INVALID_INPUT").addAmount(page)); return; } @@ -50,14 +50,14 @@ public class Top implements ICommand { ChatColor.WHITE, ChatColor.BOLD, ChatColor.GRAY, page, ChatColor.WHITE)); List<PlayerInfo> infos = Database.playerInfo.getInfoPage(page); int i = 1 + (page-1)*10; - if(infos == null){ + if (infos == null) { sender.sendMessage(errorPrefix + message("NO_GAME_INFO")); return; } - for(PlayerInfo info : infos){ + for(PlayerInfo info : infos) { String name = Main.plugin.getServer().getOfflinePlayer(info.uuid).getName(); ChatColor color; - switch (i){ + switch (i) { case 1: color = ChatColor.YELLOW; break; case 2: color = ChatColor.GRAY; break; case 3: color = ChatColor.GOLD; break; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java index feed663..1366f07 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/Wins.java @@ -39,9 +39,9 @@ public class Wins implements ICommand { UUID uuid; String name; - if(args.length == 0) { + if (args.length == 0) { Player player = Main.plugin.getServer().getPlayer(sender.getName()); - if(player == null){ + if (player == null) { sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(sender.getName())); return; } @@ -52,13 +52,13 @@ public class Wins implements ICommand { try { name = args[0]; uuid = UUIDFetcher.getUUID(args[0]); - } catch (Exception e){ + } catch (Exception e) { sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0])); return; } } PlayerInfo info = Database.playerInfo.getInfo(uuid); - if(info == null){ + if (info == null) { sender.sendMessage(errorPrefix + message("NO_GAME_INFO")); return; } |