Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 public static boolean deleteCMD(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 {
       report.SQLDelete();
       player.sendMessage(
           WorldReport.colorString("&6The report &4" + id + "&6 has been deleted."));
     }
   } else {
     player.sendMessage(RED + "Wrong command syntaxis, delete <report id>");
   }
   return true;
 }