Пример #1
0
  /**
   * Execute the command
   *
   * @param player
   * @param arg
   */
  public void execute(Player player, String[] arg) {
    SimpleClans plugin = SimpleClans.getInstance();

    if (plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) {
      if (arg.length == 1) {
        String banned = arg[0];

        if (plugin.getSettingsManager().isBanned(banned)) {
          Player pl = Helper.matchOnePlayer(banned);

          if (pl != null) {
            ChatBlock.sendMessage(
                pl, ChatColor.AQUA + plugin.getLang("you.have.been.unbanned.from.clan.commands"));
          }

          plugin.getSettingsManager().removeBanned(banned);
          ChatBlock.sendMessage(
              player, ChatColor.AQUA + plugin.getLang("player.removed.from.the.banned.list"));
        } else {
          ChatBlock.sendMessage(
              player, ChatColor.RED + plugin.getLang("this.player.is.not.banned"));
        }
      } else {
        ChatBlock.sendMessage(
            player,
            ChatColor.RED
                + MessageFormat.format(
                    plugin.getLang("usage.ban.unban"),
                    plugin.getSettingsManager().getCommandClan()));
      }
    } else {
      ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
    }
  }
Пример #2
0
 public RivalriesCommand(SimpleClans plugin) {
   super("Rivalries");
   this.plugin = plugin;
   setArgumentRange(0, 0);
   setUsages(
       MessageFormat.format(
           plugin.getLang("usage.rivalries"), plugin.getSettingsManager().getCommandClan()));
   setIdentifiers(plugin.getLang("rivalries.command"));
 }
Пример #3
0
 public KickCommand(SimpleClans plugin) {
   super("Kick");
   this.plugin = plugin;
   setArgumentRange(1, 1);
   setUsages(
       MessageFormat.format(
           plugin.getLang("usage.kick"), plugin.getSettingsManager().getCommandClan()));
   setIdentifiers(plugin.getLang("kick.command"));
 }
Пример #4
0
 @Override
 public String getMenu(ClanPlayer cp, CommandSender sender) {
   if (plugin.getPermissionsManager().has(sender, "simpleclans.anyone.rivalries")) {
     return MessageFormat.format(
         plugin.getLang("0.rivalries.1.view.all.clan.rivalries"),
         plugin.getSettingsManager().getCommandClan(),
         ChatColor.WHITE);
   }
   return null;
 }
Пример #5
0
  /**
   * Execute the command
   *
   * @param player
   * @param arg
   */
  public void execute(Player player, String[] arg) {
    SimpleClans plugin = SimpleClans.getInstance();

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

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

        if (!clan.isLeader(player) || clan.getLeaders().size() > 1) {
          clan.addBb(
              player.getName(),
              ChatColor.AQUA
                  + MessageFormat.format(
                      plugin.getLang().getString("0.has.resigned"),
                      Helper.capitalize(player.getName())));
          clan.removePlayerFromClan(player.getName());
        } else if (clan.isLeader(player) && clan.getLeaders().size() == 1) {
          plugin
              .getClanManager()
              .serverAnnounce(
                  ChatColor.AQUA
                      + MessageFormat.format(
                          plugin.getLang().getString("clan.has.been.disbanded"), clan.getName()));
          clan.disband();
        } else {
          ChatBlock.sendMessage(
              player,
              ChatColor.RED
                  + plugin
                      .getLang()
                      .getString(
                          "last.leader.cannot.resign.you.must.appoint.another.leader.or.disband.the.clan"));
        }
      } else {
        ChatBlock.sendMessage(
            player, ChatColor.RED + plugin.getLang().getString("not.a.member.of.any.clan"));
      }
    } else {
      ChatBlock.sendMessage(
          player, ChatColor.RED + plugin.getLang().getString("insufficient.permissions"));
    }
  }
Пример #6
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"));
    }
  }
Пример #7
0
 @Override
 public String getMenu(ClanPlayer cp, CommandSender sender) {
   if (cp != null) {
     if (cp.isLeader()) {
       if (plugin.getPermissionsManager().has(sender, "simpleclans.leader.kick")) {
         return MessageFormat.format(
             plugin.getLang("0.kick.player.1.kick.a.player.from.the.clan"),
             plugin.getSettingsManager().getCommandClan(),
             ChatColor.WHITE);
       }
     }
   }
   return null;
 }
Пример #8
0
  /**
   * Execute the command
   *
   * @param player
   * @param arg
   */
  public void execute(Player player, String[] arg) {
    SimpleClans plugin = SimpleClans.getInstance();

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

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

        if (clan.isLeader(player)) {
          if (arg.length == 1) {
            Player invited = Helper.matchOnePlayer(arg[0]);

            if (invited != null) {
              if (plugin.getPermissionsManager().has(invited, "simpleclans.member.can-join")) {
                if (!invited.getName().equals(player.getName())) {
                  if (!plugin.getSettingsManager().isBanned(player.getName())) {
                    ClanPlayer cpInv = plugin.getClanManager().getClanPlayer(invited);

                    if (cpInv == null) {
                      plugin.getRequestManager().addInviteRequest(cp, invited.getName(), clan);
                      ChatBlock.sendMessage(
                          player,
                          ChatColor.AQUA
                              + MessageFormat.format(
                                  plugin.getLang().getString("has.been.asked.to.join"),
                                  Helper.capitalize(invited.getName()),
                                  clan.getName()));
                    } else {
                      ChatBlock.sendMessage(
                          player,
                          ChatColor.RED
                              + plugin
                                  .getLang()
                                  .getString("the.player.is.already.member.of.another.clan"));
                    }
                  } else {
                    ChatBlock.sendMessage(
                        player,
                        ChatColor.RED
                            + plugin
                                .getLang()
                                .getString("this.player.is.banned.from.using.clan.commands"));
                  }
                } else {
                  ChatBlock.sendMessage(
                      player,
                      ChatColor.RED + plugin.getLang().getString("you.cannot.invite.yourself"));
                }
              } else {
                ChatBlock.sendMessage(
                    player,
                    ChatColor.RED
                        + plugin
                            .getLang()
                            .getString(
                                "the.player.doesn.t.not.have.the.permissions.to.join.clans"));
              }
            } else {
              ChatBlock.sendMessage(
                  player, ChatColor.RED + plugin.getLang().getString("no.player.matched"));
            }
          } else {
            ChatBlock.sendMessage(
                player,
                ChatColor.RED
                    + MessageFormat.format(
                        plugin.getLang().getString("usage.0.invite.player"),
                        plugin.getSettingsManager().getCommandClan()));
          }
        } else {
          ChatBlock.sendMessage(
              player, ChatColor.RED + plugin.getLang().getString("no.leader.permissions"));
        }
      } else {
        ChatBlock.sendMessage(
            player, ChatColor.RED + plugin.getLang().getString("not.a.member.of.any.clan"));
      }
    } else {
      ChatBlock.sendMessage(
          player, ChatColor.RED + plugin.getLang().getString("insufficient.permissions"));
    }
  }
Пример #9
0
  @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"));
    }
  }