Package com.palmergames.bukkit.towny.object

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


      }
      return;
    }

    Block block = event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN);
    TownyWorld townyWorld = null;

    try {
      townyWorld = TownyUniverse.getDataSource().getWorld(block.getLocation().getWorld().getName());
    } catch (NotRegisteredException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // prevent players trampling crops

    if ((event.getAction() == Action.PHYSICAL) && (townyWorld.isUsingTowny())) {
      if ((block.getType() == Material.SOIL) || (block.getType() == Material.CROPS))
        if (townyWorld.isDisablePlayerTrample()) {
          event.setCancelled(true);
          return;
        }
    }
View Full Code Here


   
    Player player = event.getPlayer();

    Block block = event.getClickedBlock();
    WorldCoord worldCoord;
    TownyWorld world = null;
    //System.out.println("onPlayerInteractEvent");

    try {
      world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());
      if (block != null)
View Full Code Here

    if (!TownySettings.isSwitchId(block.getTypeId()))
      return;

    WorldCoord worldCoord;
    TownyWorld world;
    try {
      world = TownyUniverse.getDataSource().getWorld(player.getWorld().getName());
      worldCoord = new WorldCoord(world, Coord.parseCoord(block));
    } catch (NotRegisteredException e1) {
      TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_err_not_configured"));
View Full Code Here

      TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_err_not_configured"));
      return;
    }

    try {
      TownyWorld fromWorld = TownyUniverse.getDataSource().getWorld(from.getWorld().getName());
      WorldCoord fromCoord = new WorldCoord(fromWorld, Coord.parseCoord(from));
      TownyWorld toWorld = TownyUniverse.getDataSource().getWorld(to.getWorld().getName());
      WorldCoord toCoord = new WorldCoord(toWorld, Coord.parseCoord(to));
      if (!fromCoord.equals(toCoord))
        onPlayerMoveChunk(player, fromCoord, toCoord, from, to);
      else {
        //plugin.sendDebugMsg("    From: " + fromCoord);
View Full Code Here

    Player player = event.getPlayer();
    Block block = event.getBlock();
    WorldCoord worldCoord;
     
    try {
      TownyWorld world = TownyUniverse.getDataSource().getWorld(block.getWorld().getName());
      worldCoord = new WorldCoord(world, Coord.parseCoord(block));

      //Get build permissions (updates if none exist)
      boolean bDestroy = TownyUniverse.getCachePermissions().getCachePermission(player, block.getLocation(), TownyPermission.ActionType.DESTROY);
      boolean wildOverride = TownyUniverse.getPermissionSource().hasWildOverride(worldCoord.getWorld(), player, event.getBlock().getTypeId(), TownyPermission.ActionType.DESTROY);
View Full Code Here

    Player player = event.getPlayer();
    Block block = event.getBlock();
    WorldCoord worldCoord;
    try {
      TownyWorld world = TownyUniverse.getDataSource().getWorld(block.getWorld().getName());
      worldCoord = new WorldCoord(world, Coord.parseCoord(block));
     
      //Get build permissions (updates if none exist)
      boolean bBuild = TownyUniverse.getCachePermissions().getCachePermission(player, block.getLocation(), TownyPermission.ActionType.BUILD);
      boolean wildOverride = TownyUniverse.getPermissionSource().hasWildOverride(worldCoord.getWorld(), player, event.getBlock().getTypeId(), TownyPermission.ActionType.BUILD);
View Full Code Here

    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 {
      townyWorld = TownyUniverse.getDataSource().getWorld(loc.getWorld().getName());
      CurrentTownBlock = townyWorld.getTownBlock(coord);
    } catch (NotRegisteredException e) {
      //System.out.print("Failed to fetch TownBlock");
    }
   
    try {
      destinationTownBlock = townyWorld.getTownBlock(coordTo);
    } catch (NotRegisteredException e1) {
      //System.out.print("Failed to fetch TownBlockTo");
    }
   
    if (CurrentTownBlock != destinationTownBlock) {
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;
        }
      }
     
View Full Code Here

    @Override
  public void run() {
     
      List<TownyWorld> worlds = new ArrayList<TownyWorld>();
      List<Town> towns = new ArrayList<Town>();
      TownyWorld world;
     
      if (player != null) TownyMessaging.sendMsg(player, "Processing " + ((claim) ? "Town Claim..." : "Town unclaim..."));
     
      if (selection != null) {
View Full Code Here

      if (town.getWorld() == null) {
        TownyLogger.log.warning("[Towny Error] Detected an error with the world files. Attempting to repair");
        if (town.hasHomeBlock())
          try {
            TownyWorld world = town.getHomeBlock().getWorld();
            if (!world.hasTown(town)) {
              world.addTown(town);
              TownyUniverse.getDataSource().saveTown(town);
              TownyUniverse.getDataSource().saveWorld(world);
            }
          } catch (TownyException e) {
            // Error fetching homeblock
View Full Code Here

TOP

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

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.