@EventHandler public void onBlockPhysics(BlockPhysicsEvent event) { if (!allowPhysics(event.getBlock())) { event.setCancelled(true); } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockPhysics(BlockPhysicsEvent event) { if (DPortal.getByBlock(plugin, event.getBlock()) != null) { event.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(ignoreCancelled = true, priority = EventPriority.HIGHEST) private void physEvent(BlockPhysicsEvent event){ if(minigame.isRegenerating() && hasRegenArea() && blockInRegenArea(event.getBlock().getLocation())){ 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(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); } }
@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); } }
@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); } }
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);