public static boolean statusCMD(Player player, String[] args) { if (args.length > 1) { int id; try { id = Integer.parseInt(args[0]); } catch (NumberFormatException e) { player.sendMessage(RED + "That value is not an ID number."); return true; } Report report = WorldReport.reports.get(id); if (report == null) { player.sendMessage(RED + "Specified report doesn't exist."); } else { String status = WorldReport.join(Arrays.copyOfRange(args, 1, args.length), " "); if (status.equalsIgnoreCase(WorldReport.RESOLVED)) { report.SQLDelete(); player.sendMessage( WorldReport.colorString( "&6The report &4" + id + "&6 has been marked as resolved and has been deleted.")); } else { report.setStatus(status); player.sendMessage( WorldReport.colorString( "&6The report &4" + id + "&6 status has been set to &e" + status)); } } } else { player.sendMessage(RED + "Wrong command syntaxis, status <report id> <new status>"); } return true; }
public static boolean reportCMD(Player player, String[] args) { if (args.length == 0) { player.sendMessage(RED + "Please, write the report."); } else { long now = System.currentTimeMillis(); Location location = player.getLocation(); String summary = WorldReport.join(args, " "); String user = player.getName(); Report report = new Report(now, location, user, "Unchecked", WorldReport.UNASSIGNED, summary); report.SQLCreate(); player.sendMessage(DARK_AQUA + "Your report has been succesfully sended."); for (Player jugador : Bukkit.getServer().getOnlinePlayers()) { if (jugador.hasPermission(WorldReport.OP_PERMISSION)) { jugador.sendMessage(GOLD + "A new report has been sent."); } } } return true; }