/* * Called when block physics occurs. */ @EventHandler(ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent event) { ConfigurationManager cfg = plugin.getGlobalStateManager(); WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld()); if (cfg.activityHaltToggle) { event.setCancelled(true); return; } int id = event.getChangedTypeId(); if (id == 13 && wcfg.noPhysicsGravel) { event.setCancelled(true); return; } if (id == 12 && wcfg.noPhysicsSand) { event.setCancelled(true); return; } if (id == 90 && 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; } } }
/** * Called when block physics occurs * * @param event Relevant event details */ @Override public void onBlockPhysics(BlockPhysicsEvent event) { if (event.isCancelled()) { return; } ConfigurationManager cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld()); int id = event.getChangedTypeId(); if (id == 13 && wcfg.noPhysicsGravel) { event.setCancelled(true); return; } if (id == 12 && wcfg.noPhysicsSand) { event.setCancelled(true); return; } if (id == 90 && wcfg.allowPortalAnywhere) { event.setCancelled(true); return; } }