Package com.palmergames.bukkit.towny

Examples of com.palmergames.bukkit.towny.TownyException


   
    private void townUnclaim(Town town, WorldCoord worldCoord, boolean force) throws TownyException {
        try {
                final TownBlock townBlock = worldCoord.getTownBlock();
                if (town != townBlock.getTown() && !force)
                        throw new TownyException(TownySettings.getLangString("msg_area_not_own"));
               
                Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {

              @Override
              public void run() {
                TownyUniverse.getDataSource().removeTownBlock(townBlock);
              }}, 1);
               
        } catch (NotRegisteredException e) {
                throw new TownyException(TownySettings.getLangString("msg_not_claimed_1"));
        }
    }
View Full Code Here


    }
  }

  public void setTag(String text) throws TownyException {
    if (text.length() > 4)
      throw new TownyException("Tag too long");
    this.tag = text.toUpperCase();
    if (this.tag.matches(" "))
      this.tag = "";
    setChangedName(true);
  }
View Full Code Here

    return taxes;
  }

  public void setMayor(Resident mayor) throws TownyException {
    if (!hasResident(mayor))
      throw new TownyException("Mayor doesn't belong to town.");
    this.mayor = mayor;
  }
View Full Code Here

    if (homeBlock == null) {
      this.homeBlock = null;
      return false;
    }
    if (!hasTownBlock(homeBlock))
      throw new TownyException("Town has no claim over this town block.");
    this.homeBlock = homeBlock;

    // Set the world as it may have changed
    if (this.world != homeBlock.getWorld()) {
      if ((world != null) && (world.hasTown(this)))
View Full Code Here

  public TownBlock getHomeBlock() throws TownyException {
    if (hasHomeBlock())
      return homeBlock;
    else
      throw new TownyException("Town has not set a home block.");
  }
View Full Code Here

      assistants.remove(resident);
  }

  public void setSpawn(Location spawn) throws TownyException {
    if (!hasHomeBlock())
      throw new TownyException("Home Block has not been set");
    Coord spawnBlock = Coord.parseCoord(spawn);
    if (homeBlock.getX() == spawnBlock.getX() && homeBlock.getZ() == spawnBlock.getZ()) {
      this.spawn = spawn;
    } else
      throw new TownyException("Spawn is not within the homeBlock.");
  }
View Full Code Here

      return spawn;
    }

    else {
      this.spawn = null;
      throw new TownyException("Town has not set a spawn location.");
    }
  }
View Full Code Here

    return isOpen;
  }

  public void withdrawFromBank(Resident resident, int amount) throws EconomyException, TownyException {
    if (!isMayor(resident) && !hasAssistant(resident))
      throw new TownyException("You don't have access to the town's bank.");

    if (TownySettings.isUsingEconomy()) {
      if (!payTo(amount, resident, "Town Widthdraw"))
        throw new TownyException("There is not enough money in the bank.");
    } else
      throw new TownyException("Economy has not been turned on.");

  }
View Full Code Here

        TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_specify_nation_name"));
      else if (split.length == 2)
        try { // TODO: Make sure of the error catching
          Resident resident = TownyUniverse.getDataSource().getResident(player.getName());
          if (!resident.isMayor() && !resident.getTown().hasAssistant(resident))
            throw new TownyException(TownySettings.getLangString("msg_peasant_right"));
          newNation(player, split[1], resident.getTown().getName());
        } catch (TownyException x) {
          TownyMessaging.sendErrorMsg(player, x.getMessage());
        }
      else
View Full Code Here

  private void nationWithdraw(Player player, int amount) {
    Resident resident;
    Nation nation;
    try {
      if (!TownySettings.geNationBankAllowWithdrawls())
        throw new TownyException(TownySettings.getLangString("msg_err_withdraw_disabled"));

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

      resident = TownyUniverse.getDataSource().getResident(player.getName());
      nation = resident.getTown().getNation();

      nation.withdrawFromBank(resident, amount);
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.