示例#1
0
 @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onPistonExtend(BlockPistonExtendEvent event) {
   ZoneManager manager = m_plugin.getZoneManager();
   if (!manager.zoneExists(event.getBlock().getLocation())) {
     for (Block b : event.getBlocks()) {
       if (manager.zoneExists(b.getLocation())) {
         event.setCancelled(true);
         return;
       } else if (manager.zoneExists(b.getRelative(event.getDirection()).getLocation())) {
         event.setCancelled(true);
         return;
       }
     }
   } else {
     Zone zone = manager.getZone(event.getBlock().getLocation());
     for (Block b : event.getBlocks()) {
       if (manager.zoneExists(b.getLocation())) {
         if (!zone.getName().equals(manager.getZone(b.getLocation()).getName())) {
           event.setCancelled(true);
           return;
         }
       }
     }
   }
 }
 @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
 public void onBlockPistonExtend(BlockPistonExtendEvent e) {
   for (Block b : e.getBlocks()) {
     if (scs.getShopHandler().isShopBlock(b)) {
       e.setCancelled(true);
     }
   }
 }
示例#3
0
 @EventHandler
 public void onPistonExtend(BlockPistonExtendEvent event) {
   // Check if the event happened in a mine
   for (Mine m : mines.values()) {
     if (m.isInside(event.getBlock().getX(), event.getBlock().getY(), event.getBlock().getZ()))
       event.setCancelled(true);
   }
 }
示例#4
0
 @EventHandler
 public void onPistonPush_Appliance(final BlockPistonExtendEvent event) {
   for (Block b : event.getBlocks()) {
     if (plugin.l.containsKey(b)) {
       event.setCancelled(true);
       return;
     }
   }
 }
 @EventHandler(ignoreCancelled = true)
 public void onPistonExtend(BlockPistonExtendEvent event) {
   for (Block block : event.getBlocks()) {
     if (LotteryManager.isSignRegistered(block) || !checkBlockBroken(block)) {
       event.setCancelled(true);
       return;
     }
   }
 }
示例#6
0
 @EventHandler(ignoreCancelled = true)
 public void onBlockPistonExtend(BlockPistonExtendEvent event) {
   for (Block block : event.getBlocks()) {
     Deadbolted db = Deadbolt.get(block);
     if (db.isProtected()) {
       event.setCancelled(true);
       break;
     }
   }
 }
  /*
   * Called when a piston extends
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockPistonExtend(BlockPistonExtendEvent event) {
    ConfigurationManager cfg = plugin.getGlobalStateManager();
    WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());

    if (wcfg.useRegions) {
      if (!plugin
          .getGlobalRegionManager()
          .allows(DefaultFlag.PISTONS, event.getBlock().getLocation())) {
        event.setCancelled(true);
        return;
      }
      for (Block block : event.getBlocks()) {
        if (!plugin.getGlobalRegionManager().allows(DefaultFlag.PISTONS, block.getLocation())) {
          event.setCancelled(true);
          return;
        }
      }
    }
  }
示例#8
0
  @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
  public void onPistonExtend(BlockPistonExtendEvent event) {
    World world = event.getBlock().getWorld();
    WorldConfig worldConfig = plugin.getConfig(world);

    if (plugin.isEnabled(world) && worldConfig.FEATURE_DUNGEONS_PROTECTED.getValue()) {
      for (Block moved : event.getBlocks()) {
        if (this.isProtected(moved.getLocation())) {
          event.setCancelled(true);
          return;
        }
      }
    }
  }
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
    if (PlotManager.isPlotWorld(event.getBlock())) {
      BlockFace face = event.getDirection();

      for (Block b : event.getBlocks()) {
        String id =
            PlotManager.getPlotId(
                b.getLocation().add(face.getModX(), face.getModY(), face.getModZ()));

        if (id.equalsIgnoreCase("")) {
          event.setCancelled(true);
          return;
        }
      }
    }
  }