Example #1
0
  @Override
  public void execute(Player player, String label, String[] args) {

    if (plugin.getPermissionsManager().has(player, "simpleclans.leader.kick")) {
      ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);

      if (cp != null) {
        Clan clan = cp.getClan();

        if (clan.isLeader(player)) {
          String kicked = args[0];

          if (kicked != null) {
            if (!kicked.equals(player.getName())) {
              if (clan.isMember(kicked)) {
                if (!clan.isLeader(kicked)) {
                  clan.addBb(
                      player.getName(),
                      ChatColor.AQUA
                          + MessageFormat.format(
                              plugin.getLang("has.been.kicked.by"),
                              Helper.capitalize(kicked),
                              player.getName()));
                  clan.removePlayerFromClan(kicked);
                } else {
                  ChatBlock.sendMessage(
                      player, ChatColor.RED + plugin.getLang("you.cannot.kick.another.leader"));
                }
              } else {
                ChatBlock.sendMessage(
                    player,
                    ChatColor.RED + plugin.getLang("the.player.is.not.a.member.of.your.clan"));
              }
            } else {
              ChatBlock.sendMessage(
                  player, ChatColor.RED + plugin.getLang("you.cannot.kick.yourself"));
            }
          } else {
            ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
          }
        } else {
          ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
        }
      } else {
        ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
      }
    } else {
      ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
    }
  }
  @Override
  public void execute(CommandSender sender, String label, String[] args) {
    String headColor = plugin.getSettingsManager().getPageHeadingsColor();
    String subColor = plugin.getSettingsManager().getPageSubTitleColor();

    if (plugin.getPermissionsManager().has(sender, "simpleclans.anyone.rivalries")) {
      List<Clan> clans = plugin.getClanManager().getClans();
      plugin.getClanManager().sortClansByKDR(clans);

      ChatBlock chatBlock = new ChatBlock();

      ChatBlock.sendBlank(sender);
      ChatBlock.saySingle(
          sender,
          plugin.getSettingsManager().getServerName()
              + subColor
              + " "
              + plugin.getLang("rivalries")
              + " "
              + headColor
              + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
      ChatBlock.sendBlank(sender);
      ChatBlock.sendMessage(
          sender,
          headColor
              + plugin.getLang("legend")
              + ChatColor.DARK_RED
              + " ["
              + plugin.getLang("war")
              + "]");
      ChatBlock.sendBlank(sender);

      chatBlock.setAlignment("l", "l");
      chatBlock.addRow(plugin.getLang("clan"), plugin.getLang("rivals"));

      for (Clan clan : clans) {
        if (!clan.isVerified()) {
          continue;
        }

        chatBlock.addRow(
            "  " + ChatColor.AQUA + clan.getName(),
            clan.getRivalString(ChatColor.DARK_GRAY + ", "));
      }

      boolean more = chatBlock.sendBlock(sender, plugin.getSettingsManager().getPageSize());

      if (more) {
        plugin.getStorageManager().addChatBlock(sender, chatBlock);
        ChatBlock.sendBlank(sender);
        ChatBlock.sendMessage(
            sender,
            headColor
                + MessageFormat.format(
                    plugin.getLang("view.next.page"),
                    plugin.getSettingsManager().getCommandMore()));
      }

      ChatBlock.sendBlank(sender);
    } else {
      ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("insufficient.permissions"));
    }
  }
Example #3
0
 public boolean isShareable() {
   return tag.equalsIgnoreCase(ChatBlock.format("fieldSignShare"));
 }
Example #4
0
  public boolean extractData(Block block, String[] lines) {
    tag = ChatColor.stripColor(lines[0]);

    price = SignHelper.extractPrice(ChatColor.stripColor(lines[1]));

    if (price == 0) {
      return false;
    }

    item = SignHelper.extractItemFromParenthesis(ChatColor.stripColor(lines[1]));

    if (!isBuyable()) {
      period = ChatColor.stripColor(lines[2]);

      if (!SignHelper.isValidPeriod(period)) {
        return false;
      }

      fieldSign =
          tag.equalsIgnoreCase(ChatBlock.format("fieldSignRent"))
              || tag.equalsIgnoreCase(ChatBlock.format("fieldSignBuy"))
              || tag.equalsIgnoreCase(ChatBlock.format("fieldSignShare"));

      if (!fieldSign) {
        return false;
      }
    }

    if (item == null) {
      if (!PreciousStones.getInstance().getPermissionsManager().hasEconomy()) {
        noEconomy = true;
        return false;
      }
    }

    Block attachedBlock = SignHelper.getAttachedBlock(block);
    field = PreciousStones.getInstance().getForceFieldManager().getField(attachedBlock);

    if (field == null) {
      return false;
    }

    if (playerName != null) {
      if (!field.isOwner(playerName)) {
        return false;
      }
    }

    if (isRentable()) {
      if (!field.hasFlag(FieldFlag.RENTABLE)) {
        return false;
      }
    }

    if (isShareable()) {
      if (!field.hasFlag(FieldFlag.SHAREABLE)) {
        return false;
      }
    }

    if (isBuyable()) {
      if (!field.hasFlag(FieldFlag.BUYABLE)) {
        return false;
      }
    }

    return true;
  }
Example #5
0
 public boolean isBuyable() {
   return tag.equalsIgnoreCase(ChatBlock.format("fieldSignBuy"));
 }