Package com.palmergames.bukkit.towny.object

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


    // Towny regen
    if (TownySettings.getRegenDelay() > 0) {
      if (event.getClickedBlock().getState().getData() instanceof Attachable) {
        Attachable attachable = (Attachable) event.getClickedBlock().getState().getData();
        BlockLocation attachedToBlock = new BlockLocation(event.getClickedBlock().getRelative(attachable.getAttachedFace()).getLocation());
        // Prevent attached blocks from falling off when interacting
        if (plugin.getTownyUniverse().hasProtectionRegenTask(attachedToBlock)) {
          event.setCancelled(true);
        }
      }
View Full Code Here


    Block block = event.getBlock();
   
    if (block == null)
      return;
   
    BlockLocation blockLocation = new BlockLocation(block.getLocation());
   
    // if this is a placeholder remove it, as it's no longer needed.
    if(plugin.getTownyUniverse().isPlaceholder(block)) {
      plugin.getTownyUniverse().removePlaceholder(block);
          block.setTypeId(0, false);
    }
   
    if (plugin.getTownyUniverse().hasProtectionRegenTask(blockLocation)) {
      //Cancel any physics events as we will be replacing this block
      event.setCancelled(true);
    } else {
      // Check the block below and cancel the event if that block is going to be replaced.     
      Block blockBelow = block.getRelative(BlockFace.DOWN);
      blockLocation = new BlockLocation(blockBelow.getLocation());
     
      if (plugin.getTownyUniverse().hasProtectionRegenTask(blockLocation)
          && (NeedsPlaceholder.contains(block.getType()))) {
        //System.out.print("Cancelling for Below on - " + block.getType().toString());
        event.setCancelled(true);
View Full Code Here

        //  TownyMessaging.sendErrorMsg(player, String.format(TownySettings.getLangString("msg_err_cannot_perform_action"), world.getUnclaimedZoneName()));

        long delay = TownySettings.getRegenDelay();
        if (delay > 0) {
          if (!plugin.getTownyUniverse().isPlaceholder(block)) {
            if (!plugin.getTownyUniverse().hasProtectionRegenTask(new BlockLocation(block.getLocation()))) {
              ProtectionRegenTask task = new ProtectionRegenTask(plugin.getTownyUniverse(), block, true);
              task.setTaskId(plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, task, 20 * delay));
              plugin.getTownyUniverse().addProtectionRegenTask(task);
            }
          } else {
View Full Code Here

    public ProtectionRegenTask(TownyUniverse universe, Block block, boolean update) {
        super(universe);
        this.state = block.getState();
        this.altState = null;
        this.setBlockLocation(new BlockLocation(block.getLocation()));
       
        if (update)
          if(state.getData() instanceof Door) {
              Door door = (Door)state.getData();
              Block topHalf;
View Full Code Here

        // Wilderness explosion regeneration
        if (townyWorld.isUsingTowny())
          if (townyWorld.isExpl()) {
            if (townyWorld.isUsingPlotManagementWildRevert()) {
              if (entity instanceof Creature) {
                if (!plugin.getTownyUniverse().hasProtectionRegenTask(new BlockLocation(block.getLocation()))) {
                  ProtectionRegenTask task = new ProtectionRegenTask(plugin.getTownyUniverse(), block, false);
                  task.setTaskId(plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, task, ((TownySettings.getPlotManagementWildRegenDelay() + count) * 20)));
                  plugin.getTownyUniverse().addProtectionRegenTask(task);
                  event.setYield((float) 0.0);
                }
View Full Code Here

TOP

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

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.