示例#1
0
 public static boolean checkCMD(Player player, String[] args) {
   if (args.length == 0) {
     Collection<Report> reports = WorldReport.reports.values();
     if (reports.isEmpty()) {
       player.sendMessage(GREEN + "There are no unresolved reports.");
     } else {
       player.sendMessage(GOLD + "--- Reports ---");
       for (Report report : reports) {
         player.sendMessage(report.printLine(player.getName()));
       }
     }
   } else 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 {
       player.sendMessage(report.printDetails());
     }
   } else {
     player.sendMessage(
         RED + "Wrong command syntaxis, check <report id> or none to show a list of reports");
   }
   return true;
 }
示例#2
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;
 }
示例#3
0
 public static boolean goCMD(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 {
       player.teleport(report.getLocation());
       if (player.getLocation().equals(report.getLocation())) {
         player.sendMessage(
             WorldReport.colorString(
                 "&eYou have been teleported to the report number &6" + id + "&e location."));
       }
     }
   } else {
     player.sendMessage(RED + "Wrong command syntaxis, go <report id>");
   }
   return true;
 }
示例#4
0
  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;
  }
示例#5
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;
 }
示例#6
0
 public static boolean assignCMD(Player player, String[] args) {
   if (args.length == 2) {
     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 name = args[1];
       report.setAssigned(name);
       player.sendMessage(
           WorldReport.colorString("&6The report &4" + id + "&6 has been assigned to &4" + name));
     }
   } else {
     player.sendMessage(RED + "Wrong command syntaxis, assign <report id> <new assigned>");
   }
   return true;
 }