예제 #1
0
  public boolean execute(ICommandSender sender, String[] args) {
    IPlayer player = (IPlayer) sender;
    if (player.hasPermission(PermissionNames.ADMIN_EXPIRED)) {
      if (manager.isPlotWorld(player.getWorld())) {
        PlotMapInfo pmi = manager.getMap(player);
        if (pmi.getDaysToExpiration() != 0) {
          int page = 1;

          if (args.length == 2) {
            page = Integer.parseInt(args[1]);
          }
          List<List<Plot>> partition =
              Lists.partition(plugin.getSqlManager().getExpiredPlots(player.getWorld()), 10);
          if (partition.isEmpty()) {
            player.sendMessage(C("MsgNoPlotExpired"));
          } else {
            player.sendMessage(C("MsgExpiredPlotsPage", page, partition.size()));
            for (Plot plot : partition.get(page - 1)) {
              assert plot.getExpiredDate() != null;
              player.sendMessage(
                  plot.getId()
                      + " -> "
                      + plot.getOwner()
                      + " @ "
                      + plot.getExpiredDate().toString());
            }
          }
        } else {
          return true;
        }
      } else {
        player.sendMessage(C("NotPlotWorld"));
        return true;
      }
    } else {
      return false;
    }
    return true;
  }
예제 #2
0
  public boolean execute(ICommandSender sender, String[] args) {
    if (args.length > 1) {
      sender.sendMessage(getUsage());
      return true;
    }
    IPlayer player = (IPlayer) sender;
    if (player.hasPermission(PermissionNames.USER_INFO)) {
      IWorld world = player.getWorld();
      if (manager.isPlotWorld(world)) {
        Plot plot = manager.getPlot(player);

        if (plot == null) {
          player.sendMessage(C("MsgNoPlotFound"));
          return true;
        }
        player.sendMessage("Internal ID: " + plot.getInternalID());
        player.sendMessage(
            "ID: "
                + plot.getId().getID()
                + " "
                + C("InfoOwner")
                + ": "
                + plot.getOwner()
                + " "
                + C("InfoBiome")
                + ": "
                + plot.getBiome());
        player.sendMessage("Likes: " + plot.getLikes());
        player.sendMessage("Created: " + plot.getCreatedDate());
        final String neverExpire = C("InfoExpire") + ": " + C("WordNever");
        if (plot.getExpiredDate() == null) {
          if (plot.isFinished()) {
            if (plot.isProtected()) {
              player.sendMessage(
                  neverExpire
                      + " "
                      + C("InfoFinished")
                      + ": "
                      + C("WordYes")
                      + " "
                      + C("InfoProtected")
                      + ": "
                      + C("WordYes"));
            } else {
              player.sendMessage(
                  neverExpire
                      + " "
                      + C("InfoFinished")
                      + ": "
                      + C("WordYes")
                      + " "
                      + C("InfoProtected")
                      + ": "
                      + C("WordNo"));
            }
          } else {
            if (plot.isProtected()) {
              player.sendMessage(
                  neverExpire
                      + " "
                      + C("InfoFinished")
                      + ": "
                      + C("WordNo")
                      + " "
                      + C("InfoProtected")
                      + ": "
                      + C("WordYes"));
            } else {
              player.sendMessage(
                  neverExpire
                      + " "
                      + C("InfoFinished")
                      + ": "
                      + C("WordNo")
                      + " "
                      + C("InfoProtected")
                      + ": "
                      + C("WordNo"));
            }
          }
        } else if (plot.isProtected()) {
          if (plot.isFinished()) {
            player.sendMessage(
                neverExpire
                    + " "
                    + C("InfoFinished")
                    + ": "
                    + C("WordYes")
                    + " "
                    + C("InfoProtected")
                    + ": "
                    + C("WordYes"));
          } else {
            player.sendMessage(
                neverExpire
                    + " "
                    + C("InfoFinished")
                    + ": "
                    + C("WordNo")
                    + " "
                    + C("InfoProtected")
                    + ": "
                    + C("WordYes"));
          }
        } else if (plot.isFinished()) {
          player.sendMessage(
              C("InfoExpire")
                  + ": "
                  + plot.getExpiredDate()
                  + " "
                  + C("InfoFinished")
                  + ": "
                  + C("WordYes")
                  + " "
                  + C("InfoProtected")
                  + ": "
                  + C("WordNo"));
        } else {
          player.sendMessage(
              C("InfoExpire")
                  + ": "
                  + plot.getExpiredDate()
                  + " "
                  + C("InfoFinished")
                  + ": "
                  + C("WordNo")
                  + " "
                  + C("InfoProtected")
                  + ": "
                  + C("WordNo"));
        }

        if (!plot.getMembers().isEmpty()) {
          StringBuilder builder = new StringBuilder("Members: ");
          if (!plot.getMembers().containsKey("*")) {
            for (Map.Entry<String, Plot.AccessLevel> member : plot.getMembers().entrySet()) {
              builder
                  .append(
                      plugin
                          .getServerBridge()
                          .getOfflinePlayer(UUID.fromString(member.getKey()))
                          .getName())
                  .append(" (")
                  .append(member.getValue().toString())
                  .append(")   ");
            }
          } else {
            builder.append("*");
          }
          player.sendMessage(builder.toString());
        }

        if (!plot.getDenied().isEmpty()) {
          StringBuilder builder = new StringBuilder(C("InfoDenied"));
          builder.append(": ");
          if (!plot.getDenied().contains("*")) {
            for (String s : plot.getDenied()) {
              builder
                  .append(plugin.getServerBridge().getOfflinePlayer(UUID.fromString(s)).getName())
                  .append("  ");
            }
          } else {
            builder.append('*');
          }

          player.sendMessage(builder.toString());
        }

        if (manager.isEconomyEnabled(world)) {
          if (plot.isForSale()) {
            player.sendMessage(C("InfoForSale") + ": " + plot.getPrice());
          } else {
            player.sendMessage(C("InfoForSale") + ": " + C("WordNo"));
          }
        }

        player.sendMessage(C("WordBottom") + ": " + plot.getPlotBottomLoc().toString());
        player.sendMessage(C("WordTop") + ": " + plot.getPlotTopLoc());

      } else {
        player.sendMessage(C("MsgNotPlotWorld"));
      }
    } else {
      return false;
    }
    return true;
  }