Package com.palmergames.bukkit.towny

Examples of com.palmergames.bukkit.towny.TownyException


    if (split.length == 0)
      TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_invalid_name"));
    else
      try {
        if (!TownyUniverse.getPermissionSource().isTownyAdmin(player))
          throw new TownyException(TownySettings.getLangString("msg_err_admin_only_delete"));
       
        for (String name: split) {
          try {
            Resident resident = TownyUniverse.getDataSource().getResident(name);
            if (!resident.isNPC() && !plugin.isOnline(resident.getName())) {
View Full Code Here


    Town town;

    try {
      if (split.length != 2)
        throw new TownyException(String.format(TownySettings.getLangString("msg_err_invalid_input"), "Eg: givebonus [town/player] [n]"));
      try {
        town = TownyUniverse.getDataSource().getTown(split[0]);
      } catch (NotRegisteredException e) {
        town = TownyUniverse.getDataSource().getResident(split[0]).getTown();
      }
      try {
        town.setBonusBlocks(town.getBonusBlocks() + Integer.parseInt(split[1].trim()));
        TownyMessaging.sendMsg(getSender(), String.format(TownySettings.getLangString("msg_give_total"), town.getName(), split[1], town.getBonusBlocks()));
      } catch (NumberFormatException nfe) {
        throw new TownyException(TownySettings.getLangString("msg_error_must_be_int"));
      }
      TownyUniverse.getDataSource().saveTown(town);
    } catch (TownyException e) {
      throw new TownyException(e.getMessage());
    }

  }
View Full Code Here

        return;
      }
      TownyWorld world;
      try {
        if (plugin.getTownyUniverse().isWarTime())
          throw new TownyException(TownySettings.getLangString("msg_war_cannot_do"));

        world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());

        List<WorldCoord> selection;
        selection = TownyUtil.selectWorldCoordArea(null, new WorldCoord(world, Coord.parseCoord(player)), split);
View Full Code Here

    do {
      name = TownySettings.getNPCPrefix() + ++i;
      if (!TownyUniverse.getDataSource().hasResident(name))
        return name;
      if (i > 100000)
        throw new TownyException(TownySettings.getLangString("msg_err_too_many_npc"));
    } while (true);
  }
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.