@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true) public void onBlockPhysics(BlockPhysicsEvent event) { Block b = event.getBlock(); Material m = b.getType(); if(m == null) return; switch(m) { case STATIONARY_WATER: case WATER: case STATIONARY_LAVA: case LAVA: case GRAVEL: case SAND: checkBlock(b, "blockphysics"); break; default: break; } } };
/** * <p>Called when the BlockType should calculate the current physics.</p> * <p>Subclasses should override {@link #updatePhysicsAfterEvent(GlowBlock)} * if they need a custom handling of the physics calculation</p> * * @param block The block */ public final void updatePhysics(GlowBlock block) { if (!block.getWorld().isInitialized()) { return; } BlockPhysicsEvent event = EventFactory.getInstance() .callEvent(new BlockPhysicsEvent(block, block.getTypeId())); if (!event.isCancelled()) { updatePhysicsAfterEvent(block); } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockPhysics(BlockPhysicsEvent event) { if (DPortal.getByBlock(plugin, event.getBlock()) != null) { event.setCancelled(true); } }
@EventHandler public void onBreak(BlockPhysicsEvent e) { // Is not triggered when the block a torch is attached to is removed if (e.getChangedType().equals(Material.TORCH)) if (e.getBlock().hasMetadata("RPGItems.Torch")) { e.setCancelled(true); // Cancelling this does not work e.getBlock().removeMetadata("RPGItems.Torch", plugin); e.getBlock().setType(Material.AIR); } }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockPhysics(final BlockPhysicsEvent event) { final Block block = event.getBlock(); if (!WaterManipulation.canPhysicsChange(block) || !EarthPassive.canPhysicsChange(block) || Illumination.isIlluminationTorch(block) || EarthAbility.getPreventPhysicsBlocks().contains(block)) { event.setCancelled(true); } // If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating. if (!event.isCancelled() && (block.getType() == Material.SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL || block.getType() == Material.DRAGON_EGG) && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR) { event.setCancelled(true); } }
/** * Check if a block is powered above a sign. * * @param event */ @EventHandler(ignoreCancelled = true) @SuppressWarnings("ucd") public void onBlockPhysics(BlockPhysicsEvent event) { if (event.getChangedType() != Material.SIGN || ! event.getBlock().isBlockIndirectlyPowered()) { return; } final Powerable myIC = this.MyPoweredICFactory.getIC(event.getBlock()); if (myIC != null) { myIC.power(); } } /*
@EventHandler public void onBlockPhysics(BlockPhysicsEvent event) { if (!allowPhysics(event.getBlock())) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent e) { if (cm.isAntiInfiniteRail && this.isDupeBlock(e.getChangedType()) && this.isRails(e.getBlock().getType())) { e.setCancelled(true); } } }
@EventHandler(ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent event) { ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager(); WorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld()); if (cfg.activityHaltToggle) { event.setCancelled(true); return; } Material id = event.getBlock().getType(); if (id == Material.GRAVEL && wcfg.noPhysicsGravel) { event.setCancelled(true); return; } if (id == Material.SAND && wcfg.noPhysicsSand) { event.setCancelled(true); return; } if (id == Material.NETHER_PORTAL && wcfg.allowPortalAnywhere) { event.setCancelled(true); return; } if (wcfg.ropeLadders && event.getBlock().getType() == Material.LADDER) { if (event.getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) { event.setCancelled(true); return; } } }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent event) { blockChangeCheck(event.getBlock().getLocation()); }
@EventHandler public void onPhysics(BlockPhysicsEvent event) { Pair<Material, Byte> md = Settings.getConfig().createMaterial; if (md == null || event.getBlock().getType() != md.getLeft()) { return; } Location loc = event.getBlock().getLocation(); Region region = RegionUtils.getAt(loc); if (region == null) { return; } if (loc.equals(region.getHeart())) { event.setCancelled(true); } }
final MCLocation blockLocation = new BukkitMCLocation(event.getBlock().getLocation()); if(locations.containsKey(blockLocation)) {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) private void physEvent(BlockPhysicsEvent event){ if(minigame.isRegenerating() && hasRegenArea() && blockInRegenArea(event.getBlock().getLocation())){ event.setCancelled(true); } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public static void onSign(BlockPhysicsEvent event) { Block block = event.getBlock(); if (!BlockUtil.isSign(block)) { return; } Sign sign = (Sign) block.getState(); Block attachedBlock = BlockUtil.getAttachedBlock(sign); if (attachedBlock.getType() == Material.AIR && ChestShopSign.isValid(sign)) { if (!block.hasMetadata(METADATA_NAME)) { return; } sendShopDestroyedEvent(sign, (Player) block.getMetadata(METADATA_NAME).get(0).value()); } }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent event) { Block block = event.getBlock(); if (block != null && block.getType().equals(Material.GRASS_PATH)) { String loc = block.getRelative(BlockFace.UP).getLocation().toString(); if (blockBehind != null) { if (blockBehind.getType().equals(Material.GLASS) || blockBehind.getType().equals(Material.ICE) || TARDISMaterials.stained_glass.contains(blockBehind.getType())) { event.setCancelled(true); event.setCancelled(true); if (blockBelow != null) { if (blockBelow.getType().equals(Material.GLASS) || blockBelow.getType().equals(Material.ICE) || plugin.getGeneralKeeper().getDoors().contains(blockBelow.getType()) || TARDISMaterials.stained_glass.contains(blockBelow.getType()) || blockBelow.getType().equals(Material.AIR) || blockBelow.getType().equals(Material.SEA_LANTERN)) { event.setCancelled(true);