/**
   * Found command.
   *
   * @param player The player.
   * @param name The name to found as.
   * @param type The type of government.
   * @return The first error.
   */
  public String doFound(MPlayer player, String name, GovType type) {
    if (!player.hasPermission("mafiacraft.citizen")) {
      return player.getLocale().localize("action.general.not-citizen");
    }

    if (!type.canFound()) {
      return player.getLocale().localize("command.government.error.found", type.getName());
    }

    double balance = player.getMoney();
    double cost = Config.getDouble("mafia.found");

    if (balance < cost) {
      return player
          .getLocale()
          .localize("command.government.error.no-money.found", StringUtils.formatCurrency(cost));
    }

    if (player.getGovernment() != null) {
      return player.getLocale().localize("action.government.error.in-gov");
    }

    name = name.trim();
    boolean result = ValidationUtils.validateName(name);
    if (!result) {
      return player.getLocale().localize("command.government.error.invalid-name", name);
    }

    if (Mafiacraft.getGovernmentManager().getGovernment(name) != null) {
      return player.getLocale().localize("action.government.error.exists");
    }

    // Found the government
    Government founded = Mafiacraft.getGovernmentManager().createGovernment(name, type);
    if (!founded.addAffiliate(player)) {
      return player.getLocale().localize("error.fatal.adding");
    }

    founded.setLeader(player);

    double startupCapital = Config.getDouble("mafia.startupcapital");
    founded.addMoney(startupCapital);

    player.sendMessage(
        MsgColor.SUCCESS
            + player
                .getLocale()
                .localize("command.government.success.founded", type.getName(), name));
    return null;
  }
  public String doCreateDivision(MPlayer player, String name) {
    if (!player.hasPermission("mafiacraft.citizen")) {
      return "You must be a citizen to use this command. "
          + "Apply for citizen on the website at "
          + MsgColor.URL
          + "http://voxton.net/"
          + ".";
    }

    Government gov = player.getGovernment();
    if (gov == null) {
      return "You are not in a government!";
    }

    if (!player.getPosition().isAtLeast(Position.VICE_LEADER)) {
      return "You do not have the proper rank to do this.";
    }

    name = name.trim();
    if (!ValidationUtils.validateName(name)) {
      return "invalid name";
    }

    if (!gov.canHaveMoreDivisions()) {
      return "The "
          + gov.getType().getName()
          + " has too many "
          + gov.getType().getLocale("divisions")
          + ". Make sure all of your "
          + gov.getType().getLocale("divisions")
          + " have greater than 5 players each.";
    }

    Division div = gov.createDivision().setManager(player.getName()).setName(name);

    gov.subtractMoney(Config.getDouble("prices.mafia.regimefound"));
    div.addMoney(Config.getDouble("mafia.regimestartup"));

    player.sendMessage(
        MsgColor.SUCCESS
            + "You have founded a "
            + gov.getType().getLocale("division")
            + " successfully.");
    return null;
  }
  public String doSetHq(MPlayer player) {
    if (!player.hasPermission("mafiacraft.citizen")) {
      return "You must be a citizen to use this command. "
          + "Apply for citizen on the website at "
          + MsgColor.URL
          + "http://voxton.net/"
          + ".";
    }

    if (!player.getPosition().isAtLeast(Position.VICE_LEADER)) {
      return "You aren't allowed to set the HQ of your government.";
    }

    Government gov = player.getGovernment();
    if (gov == null) {
      return "You aren't in a government.";
    }

    Section section = player.getSection();
    if (!section.getOwner().equals(gov)) {
      return "The HQ must be specified within HQ land.";
    }

    double needed = Config.getDouble("prices.gov.sethq");
    if (!gov.hasEnough(needed)) {
      return "Your "
          + gov.getType().getName()
          + " does not have enough money to set its HQ. (Costs "
          + needed
          + ")";
    }

    gov.setHq(player.getPoint()).subtractMoney(needed);
    player.sendMessage(
        MsgColor.SUCCESS
            + "Your "
            + gov.getType().getName()
            + " HQ has been set to your current location.");
    return null;
  }
  public String doGrant(MPlayer player, String division, String amt) {
    double amount;
    try {
      amount = Double.parseDouble(amt);
    } catch (NumberFormatException ex) {
      return "The amount you specified is an invalid number.";
    }

    if (!player.getPosition().isAtLeast(Position.OFFICER)) {
      return "You must be an officer or higher to do this.";
    }

    Government gov = player.getGovernment();
    if (gov == null) {
      return "You aren't in a government.";
    }

    Division div = gov.getDivisionByName(division);
    if (div == null) {
      return "That division does not exist within your " + gov.getType().getName() + ".";
    }

    if (!gov.transferWithCheck(div, amount)) {
      return "Your "
          + gov.getType().getName()
          + " doesn't have enough money to perform this transaction.";
    }

    player.sendMessage(
        MsgColor.SUCCESS
            + amount
            + " "
            + Config.getString("currency.namepl")
            + " have been granted to the "
            + gov.getType().getLocale("division")
            + " "
            + div.getName()
            + ".");
    return null;
  }