/** * 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; } }
@EventHandler(priority = EventPriority.MONITOR) public void onBlockPhysics(BlockPhysicsEvent event) { if (event.isCancelled() || !OrebfuscatorConfig.getUpdateOnPhysics()) return; if (event.getBlock().getType() != Material.SAND && event.getBlock().getType() != Material.GRAVEL) return; if (!applyphysics(event.getBlock())) return; OrebfuscatorThreadUpdate.Queue(event.getBlock()); }
/** Detect when water drains. */ @EventHandler public void onBlockPhysics(BlockPhysicsEvent event) { if (event.isCancelled()) return; BlockState b = event.getBlock().getState(); // As far as I know, these are always evaporation events. if (plugin.isBlockStateDetectable(b)) { plugin.executeSensorsAroundBlock(b, true, event); } }
@Override public void onBlockPhysics(BlockPhysicsEvent event) { if (event.isCancelled()) { return; } PortalManager pm = this.plugin.getPortalManager(); MVPortal portal = pm.isPortal(null, event.getBlock().getLocation()); if (portal != null && (event.getChangedType() == Material.PORTAL || event.getBlock().getType() == Material.PORTAL)) { event.setCancelled(true); } }
public void onBlockPhysics(BlockPhysicsEvent event) { if (event.isCancelled()) { return; } // Forces diode not to update and disable itself if (event.getBlock().getTypeId() == Material.DIODE_BLOCK_ON.getId()) { ConcurrentHashMap<Block, Sensor> sensorList = SensorManager.getSensorList(); Iterator<Entry<Block, Sensor>> i = sensorList.entrySet().iterator(); while (i.hasNext()) { Entry<Block, Sensor> e = i.next(); if (SensorManager.isSign(e.getKey()) && ((GenericSensor) e.getValue()).equals(event.getBlock().getLocation())) { event.setCancelled(true); return; } } } }