Package com.palmergames.bukkit.towny

Examples of com.palmergames.bukkit.towny.TownyException


      nation = resident.getTown().getNation();

      double bankcap = TownySettings.getNationBankCap();
      if (bankcap > 0) {
        if (amount + nation.getHoldingBalance() > bankcap)
          throw new TownyException(String.format(TownySettings.getLangString("msg_err_deposit_capped"), bankcap));
      }

      if (amount < 0)
        throw new TownyException(TownySettings.getLangString("msg_err_negative_money"));

      if (!resident.payTo(amount, nation, "Nation Deposit"))
        throw new TownyException(TownySettings.getLangString("msg_insuf_funds"));

      TownyMessaging.sendNationMessage(nation, String.format(TownySettings.getLangString("msg_xx_deposited_xx"), resident.getName(), amount, "nation"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
    } catch (EconomyException x) {
View Full Code Here


  public void newNation(Player player, String name, String capitalName) {
    TownyUniverse universe = plugin.getTownyUniverse();
    try {
      if (!TownyUniverse.getPermissionSource().isTownyAdmin(player) && ((TownySettings.isNationCreationAdminOnly() && !plugin.isPermissions())
        || (plugin.isPermissions() && !TownyUniverse.getPermissionSource().hasPermission(player, PermissionNodes.TOWNY_NATION_NEW.getNode()))))
        throw new TownyException(TownySettings.getNotPermToNewNationLine());

      Town town = TownyUniverse.getDataSource().getTown(capitalName);
      if (town.hasNation())
        throw new TownyException(TownySettings.getLangString("msg_err_already_nation"));

      if (!TownySettings.isValidRegionName(name))
        throw new TownyException(String.format(TownySettings.getLangString("msg_err_invalid_name"), name));

      if (TownySettings.isUsingEconomy() && !town.pay(TownySettings.getNewNationPrice(), "New Nation Cost"))
        throw new TownyException(TownySettings.getLangString("msg_no_funds_new_nation"));

      newNation(universe, name, town);
      /*universe.newNation(name);
      Nation nation = universe.getNation(name);
      nation.addTown(town);
View Full Code Here

      Resident resident = TownyUniverse.getDataSource().getResident(player.getName());
      Town town = resident.getTown();
      Nation nation = town.getNation();
      if (!resident.isMayor())
        if (!town.hasAssistant(resident))
          throw new TownyException(TownySettings.getLangString("msg_not_mayor_ass"));

      nation.removeTown(town);

      TownyUniverse.getDataSource().saveTown(town);
      TownyUniverse.getDataSource().saveNation(nation);
View Full Code Here

        Resident resident = TownyUniverse.getDataSource().getResident(player.getName());
        Town town = resident.getTown();
        Nation nation = town.getNation();

        if (!resident.isKing())
          throw new TownyException(TownySettings.getLangString("msg_not_king"));
        if (plugin.isPermissions() && (!TownyUniverse.getPermissionSource().hasPermission(player, PermissionNodes.TOWNY_NATION_DELETE.getNode())))
          throw new TownyException(TownySettings.getLangString("msg_err_command_disable"));

        TownyUniverse.getDataSource().removeNation(nation);
        TownyMessaging.sendGlobalMessage(TownySettings.getDelNationMsg(nation));
      } catch (TownyException x) {
        TownyMessaging.sendErrorMsg(player, x.getMessage());
        return;
      }
    else
      try {
        if (!TownyUniverse.getPermissionSource().isTownyAdmin(player))
          throw new TownyException(TownySettings.getLangString("msg_err_admin_only_delete_nation"));
        Nation nation = TownyUniverse.getDataSource().getNation(split[0]);
        TownyUniverse.getDataSource().removeNation(nation);
        TownyMessaging.sendGlobalMessage(TownySettings.getDelNationMsg(nation));
      } catch (TownyException x) {
        TownyMessaging.sendErrorMsg(player, x.getMessage());
View Full Code Here

    try {
      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();
      if (!resident.isKing())
        if (!nation.hasAssistant(resident))
          throw new TownyException(TownySettings.getLangString("msg_not_king_ass"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
      return;
    }
View Full Code Here

    try {
      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();
      if (!resident.isKing())
        if (!nation.hasAssistant(resident))
          throw new TownyException(TownySettings.getLangString("msg_not_king_ass"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
      return;
    }
View Full Code Here

    Nation nation;
    try {
      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();
      if (!resident.isKing())
        throw new TownyException(TownySettings.getLangString("msg_not_king"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
      return;
    }
View Full Code Here

    Nation nation;
    try {
      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();
      if (!resident.isKing())
        throw new TownyException(TownySettings.getLangString("msg_not_king"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
      return;
    }
View Full Code Here

    try {
      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();
      if (!resident.isKing())
        if (!nation.hasAssistant(resident))
          throw new TownyException(TownySettings.getLangString("msg_not_king_ass"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
      return;
    }
View Full Code Here

    try {
      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();
      if (!resident.isKing())
        if (!nation.hasAssistant(resident))
          throw new TownyException(TownySettings.getLangString("msg_not_king_ass"));
    } catch (TownyException x) {
      TownyMessaging.sendErrorMsg(player, x.getMessage());
      return;
    }
View Full Code Here

TOP

Related Classes of com.palmergames.bukkit.towny.TownyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.