Package com.palmergames.bukkit.towny.object

Examples of com.palmergames.bukkit.towny.object.Coord


          throw new TownyException(TownySettings.getLangString("msg_set_use_towny_off"));

        double blockCost = 0;
        List<WorldCoord> selection;
        boolean attachedToEdge = true;
        Coord key = Coord.parseCoord(plugin.getCache(player).getLastLocation());

        if (split.length == 1 && split[0].equalsIgnoreCase("outpost")) {
          if ((TownySettings.isAllowingOutposts())
            && (!plugin.isPermissions() || ((plugin.isPermissions()) && TownyUniverse.getPermissionSource().hasPermission(player, PermissionNodes.TOWNY_TOWN_CLAIM_OUTPOST.getNode())))){
View Full Code Here


                        System.out.print("[Towny] Debug: isEdgeBlock(" + worldCoord.toString() + ") = ");
               
                int[][] offset = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
                for (int i = 0; i < 4; i++)
                        try {
                                TownBlock edgeTownBlock = worldCoord.getWorld().getTownBlock(new Coord(worldCoord.getX() + offset[i][0], worldCoord.getZ() + offset[i][1]));
                                if (edgeTownBlock.isOwner(owner)) {
                                        if (TownySettings.getDebug())
                                                System.out.println("true");
                                        return true;
                                }
View Full Code Here

    //if (isRemovingTownMobs || isRemovingWorldMobs)
      for (World world : server.getWorlds()) {
        List<LivingEntity> livingEntitiesToRemove = new ArrayList<LivingEntity>();
       
        for (LivingEntity livingEntity : world.getLivingEntities()) {
          Coord coord = Coord.parseCoord(livingEntity.getLocation());
          TownyWorld townyWorld = null;
          try {
            townyWorld = TownyUniverse.getDataSource().getWorld(world.getName());
          } catch (NotRegisteredException e) {
            // TODO Auto-generated catch block
View Full Code Here

 
  public static boolean isOnEdgeOfOwnership(TownBlockOwner owner, WorldCoord worldCoord) {
        int[][] offset = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
        for (int i = 0; i < 4; i++)
            try {
                TownBlock edgeTownBlock = worldCoord.getWorld().getTownBlock(new Coord(worldCoord.getX() + offset[i][0], worldCoord.getZ() + offset[i][1]));
                if (!edgeTownBlock.isOwner(owner)) {
                    return true;
                }
            } catch (NotRegisteredException e) {
              return true;
View Full Code Here

   
    for (Player player : server.getOnlinePlayers()) {
      if (player.getHealth() <= 0)
        continue;
     
      Coord coord = Coord.parseCoord(player);
      try {
        TownyWorld world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());
        TownBlock townBlock = world.getTownBlock(coord);
         
        if (universe.isAlly(townBlock.getTown(), TownyUniverse.getDataSource().getResident(player.getName()).getTown()))
View Full Code Here

         * @param player
         */
        public void showTownStatusHere(Player player) {
                try {
            TownyWorld world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());
                        Coord coord = Coord.parseCoord(player);
                        showTownStatusAtCoord(player, world, coord);
                } catch (TownyException e) {
                        TownyMessaging.sendErrorMsg(player, e.getMessage());
                }
        }
View Full Code Here

                                    TownyMessaging.sendErrorMsg(player, e.getMessage());
                                  } catch (InvalidNameException e) {
                                    TownyMessaging.sendErrorMsg(player, e.getMessage());
                  }
                        } else if (split[0].equalsIgnoreCase("homeblock")) {
                                Coord coord = Coord.parseCoord(player);
                                TownBlock townBlock;
                                TownyWorld world;
                                try {
                                        if (plugin.getTownyUniverse().isWarTime())
                                                throw new TownyException(TownySettings.getLangString("msg_war_cannot_do"));
                                       
                    world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());
                                        if (world.getMinDistanceFromOtherTowns(coord, resident.getTown()) < TownySettings.getMinDistanceFromTownHomeblocks())
                                                throw new TownyException(TownySettings.getLangString("msg_too_close"));
                                       
                                        if (TownySettings.getMaxDistanceBetweenHomeblocks() > 0)
                                                if ((world.getMinDistanceFromOtherTowns(coord, resident.getTown()) > TownySettings.getMaxDistanceBetweenHomeblocks()) && world.hasTowns())
                                                        throw new TownyException(TownySettings.getLangString("msg_too_far"));
                                       
                    townBlock = TownyUniverse.getDataSource().getWorld(player.getWorld().getName()).getTownBlock(coord);
                    oldWorld = town.getWorld();
                                        town.setHomeBlock(townBlock);
                                        TownyMessaging.sendMsg(player, String.format(TownySettings.getLangString("msg_set_town_home"), coord.toString()));
                                } catch (TownyException e) {
                                        TownyMessaging.sendErrorMsg(player, e.getMessage());
                                        return;
                                }
                        } else if (split[0].equalsIgnoreCase("spawn"))
View Full Code Here

                        TownyWorld world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());
                       
                        if (!world.isUsingTowny())
                                throw new TownyException(TownySettings.getLangString("msg_set_use_towny_off"));
                       
                        Coord key = Coord.parseCoord(player);
                        if (world.hasTownBlock(key))
                                throw new TownyException(String.format(TownySettings.getLangString("msg_already_claimed_1"), key));
                       
                        if (world.getMinDistanceFromOtherTowns(key) < TownySettings.getMinDistanceFromTownHomeblocks())
                                throw new TownyException(TownySettings.getLangString("msg_too_close"));
View Full Code Here

   
   
    Block blockTo = block.getRelative(direction);
    Location loc = block.getLocation();
    Location locTo = blockTo.getLocation();
    Coord coord = Coord.parseCoord(loc);
    Coord coordTo = Coord.parseCoord(locTo);
   
    TownyWorld townyWorld = null;
    TownBlock CurrentTownBlock = null, destinationTownBlock = null;
   
    try {
View Full Code Here

  }
 
  private boolean onBurn(Block block) {

    Location loc = block.getLocation();
    Coord coord = Coord.parseCoord(loc);
    TownyWorld townyWorld;
   
    try {
      townyWorld = TownyUniverse.getDataSource().getWorld(loc.getWorld().getName());
     
      if (!townyWorld.isUsingTowny())
        return false;
   
      try {
       
        if (townyWorld.isWarZone(coord)) {
          if (TownyWarConfig.isAllowingFireInWarZone()) {
            return false;
          } else {
            TownyMessaging.sendDebugMsg("onBlockIgnite: Canceled " + block.getTypeId() + " from igniting within "+coord.toString()+".");
            return true;
          }
        }
       
        TownBlock townBlock = townyWorld.getTownBlock(coord);
        if ((block.getRelative(BlockFace.DOWN).getType() != Material.OBSIDIAN && !townBlock.getTown().isFire() && !townyWorld.isForceFire() && !townBlock.getPermissions().fire)
            || (block.getRelative(BlockFace.DOWN).getType() != Material.OBSIDIAN && plugin.getTownyUniverse().isWarTime() && TownySettings.isAllowWarBlockGriefing() && !townBlock.getTown().hasNation())) {
          TownyMessaging.sendDebugMsg("onBlockIgnite: Canceled " + block.getTypeId() + " from igniting within "+coord.toString()+".");
          return true;
        }
      } catch (TownyException x) {
        // Not a town so check the world setting for fire
        if (!townyWorld.isFire()) {
          TownyMessaging.sendDebugMsg("onBlockIgnite: Canceled " + block.getTypeId() + " from igniting within "+coord.toString()+".");
          return true;
        }
      }
     
    } catch (NotRegisteredException e) {
View Full Code Here

TOP

Related Classes of com.palmergames.bukkit.towny.object.Coord

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.