Ejemplo n.º 1
0
  private void checkPage(String page, CommandSender sender) {
    requestList.clear();
    requestList.addAll(plugin.requestMap.entrySet());

    int pageNumber = Integer.parseInt(page);
    if (pageNumber < 0) pageNumber = 0;
    int a = pageNumber * plugin.requestsPerPage;
    sender.sendMessage(
        ChatColor.AQUA
            + "--------- "
            + plugin.requestMap.size()
            + " Requests -"
            + ChatColor.YELLOW
            + " Open "
            + ChatColor.AQUA
            + "---------");
    if (plugin.requestMap.size() == 0) sender.sendMessage(Message.parse("checkNoRequests"));
    for (int i = (pageNumber * plugin.requestsPerPage) - plugin.requestsPerPage;
        i < a && i < requestList.size();
        i++) {
      HelpRequest currentRequest = requestList.get(i).getValue();
      if (plugin.hideWhenOffline && !RTSFunctions.isUserOnline(currentRequest.getName())) {
        a++;
        continue;
      }
      substring = RTSFunctions.shortenMessage(currentRequest.getMessage());
      date = sdf.format(new java.util.Date(currentRequest.getTimestamp() * 1000));
      ChatColor online =
          (RTSFunctions.isUserOnline(currentRequest.getName())) ? ChatColor.GREEN : ChatColor.RED;
      substring =
          (currentRequest.getStatus() == 1)
              ? ChatColor.LIGHT_PURPLE + "Claimed by " + currentRequest.getModName()
              : ChatColor.GRAY + substring;
      String bungeeServer =
          (currentRequest.getBungeeCordServer().equals(BungeeCord.getServer())
              ? ""
              : "["
                  + ChatColor.GREEN
                  + currentRequest.getBungeeCordServer()
                  + ChatColor.RESET
                  + "] ");
      sender.sendMessage(
          bungeeServer
              + ChatColor.GOLD
              + "#"
              + currentRequest.getId()
              + " "
              + date
              + " by "
              + online
              + currentRequest.getName()
              + ChatColor.GOLD
              + " - "
              + substring);
    }
  }
Ejemplo n.º 2
0
  private void checkSelf(CommandSender sender) {
    int openRequests = 0;
    for (Map.Entry<Integer, HelpRequest> entry : plugin.requestMap.entrySet()) {
      if (entry.getValue().getName().equals(sender.getName())) openRequests++;
    }
    int i = 0;
    sender.sendMessage(
        ChatColor.AQUA
            + "--------- "
            + ChatColor.YELLOW
            + " You have "
            + openRequests
            + " open requests "
            + ChatColor.AQUA
            + "----------");
    if (openRequests == 0)
      sender.sendMessage(ChatColor.GOLD + "You have no open requests at this time.");
    for (Map.Entry<Integer, HelpRequest> entry : plugin.requestMap.entrySet()) {
      if (entry.getValue().getName().equals(sender.getName())) {
        i++;
        if (i > 5) break;

        HelpRequest currentRequest = entry.getValue();
        substring = RTSFunctions.shortenMessage(currentRequest.getMessage());
        date = sdf.format(new java.util.Date(currentRequest.getTimestamp() * 1000));
        ChatColor online =
            (RTSFunctions.isUserOnline(currentRequest.getName())) ? ChatColor.GREEN : ChatColor.RED;
        substring =
            (currentRequest.getStatus() == 1)
                ? ChatColor.LIGHT_PURPLE + "Claimed by " + currentRequest.getModName()
                : ChatColor.GRAY + substring;
        String bungeeServer =
            (currentRequest.getBungeeCordServer().equals(BungeeCord.getServer())
                ? ""
                : "["
                    + ChatColor.GREEN
                    + currentRequest.getBungeeCordServer()
                    + ChatColor.RESET
                    + "] ");
        sender.sendMessage(
            bungeeServer
                + ChatColor.GOLD
                + "#"
                + currentRequest.getId()
                + " "
                + date
                + " by "
                + online
                + currentRequest.getName()
                + ChatColor.GOLD
                + " - "
                + substring);
      }
    }
  }