コード例 #1
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onBlockPistonExtend(BlockPistonExtendEvent event) {
   if (event.isCancelled() || !OrebfuscatorConfig.getUpdateOnPiston()) return;
   for (Block b : event.getBlocks()) {
     OrebfuscatorThreadUpdate.Queue(b);
   }
 }
コード例 #2
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);
   }
 }
コード例 #3
0
 @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
 public void onBlockPistonExtend(BlockPistonExtendEvent e) {
   for (Block b : e.getBlocks()) {
     if (scs.getShopHandler().isShopBlock(b)) {
       e.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;
     }
   }
 }
コード例 #5
0
 @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;
     }
   }
 }
コード例 #7
0
ファイル: DynmapPlugin.java プロジェクト: CovertHoax/dynmap
 @Override
 public void onBlockPistonExtend(BlockPistonExtendEvent event) {
   if (event.isCancelled()) return;
   /* Call listeners */
   List<Listener> ll = event_handlers.get(event.getType());
   if (ll != null) {
     for (Listener l : ll) {
       ((BlockListener) l).onBlockPistonExtend(event);
     }
   }
 }
コード例 #8
0
  @EventHandler(priority = EventPriority.NORMAL)
  private void pistonMove(BlockPistonExtendEvent event) {
    int x = 0;
    int y = 0;
    int z = 0;
    if (event.getBlocks().size() > 0) {
      switch (event.getDirection()) {
        case NORTH:
          x = -1;
          y = 0;
          z = 0;
          break;

        case SOUTH:
          x = 1;
          y = 0;
          z = 0;
          break;

        case UP:
          x = 0;
          y = 1;
          z = 0;
          break;

        case DOWN:
          x = 0;
          y = -1;
          z = 0;
          break;

        case EAST:
          x = 0;
          y = 0;
          z = -1;
          break;

        case WEST:
          x = 0;
          y = 0;
          z = 1;
          break;
        default:
          x = 0;
          y = 0;
          z = 0;
          break;
      }
      for (Block block : event.getBlocks()) {
        blockSaver.checkPistonLoc(block.getLocation(), block.getLocation().add(x, y, z));
      }
    }
  }
コード例 #9
0
  /** Detect when pistons affect water or sensor components. PISTONS MAH BOI! */
  @EventHandler
  public void onBlockPistonExtend(BlockPistonExtendEvent event) {
    if (event.isCancelled()) return;

    // Get the block just at the end of the piston chain (that will be replaced when the chain is
    // pushed)
    Block endblock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1);
    BlockState b = endblock.getState();
    plugin.debugprint("Block at end of piston chain " + b.getType());
    if (plugin.isBlockStateAnUpdater(b)) {
      plugin.executeSensorsAroundBlock(b, true, event);
    }
  }
コード例 #10
0
ファイル: FilterEvents.java プロジェクト: Prodigy4532/Rixor
 @SuppressWarnings("deprecation")
 @EventHandler(priority = EventPriority.LOW)
 public void onBlockPistonExtend(BlockPistonExtendEvent event) {
   Map map = Rixor.getRotation().getSlot().getMap();
   for (Block block : event.getBlocks()) {
     BlockState newState = block.getRelative(event.getDirection()).getState();
     newState.setData(new MaterialData(block.getType(), block.getData()));
     BlockChangeEvent change =
         new BlockChangeEvent(
             event, map, null, block.getRelative(event.getDirection()).getState(), newState);
     Rixor.callEvent(change);
   }
 }
コード例 #11
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;
        }
      }
    }
  }
コード例 #12
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;
         }
       }
     }
   }
 }
コード例 #13
0
  @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;
        }
      }
    }
  }
コード例 #14
0
  /*
   * 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;
        }
      }
    }
  }