package dev.kske.spawnfly; import org.bukkit.command.*; public class SpawnCommand implements CommandExecutor { SpawnFly spawnFly; public SpawnCommand(SpawnFly spawnFly) { this.spawnFly = spawnFly; } @Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) { if (command.getName().equals("setspawnflyarea")) { if (args.length == 6) { int[] cords = new int[6]; int cnt = 0; for (int i = 0; i < args.length; i++) { try { int value = Integer.parseInt(args[i]); cords[i] = value; // sender.sendMessage("Argument " +(i + 1) + " is " + value); cnt++; } catch (Exception e) { // sender.sendMessage("Argument " + (i + 1) + " is not valid as a // coordinate!"); } } if (cnt == 6) { spawnFly.setCoordinates(cords[0], cords[1], cords[2], cords[3], cords[4], cords[5]); } else { sender.sendMessage("Please use valid coordinates!"); } } else sender.sendMessage("Please use 6 coordinates!"); } return true; } }