/** Detect an event where water is flowing. */ @EventHandler public void onBlockFromTo(BlockFromToEvent event) { if (event.isCancelled()) return; BlockState fromstate = event.getBlock().getState(); if (plugin.isBlockStateDetectable(fromstate)) { plugin.executeSensorsAroundBlock(fromstate, false, event); } BlockState tostate = event.getToBlock().getState(); if (plugin.isBlockStateDetectable(fromstate)) { plugin.executeSensorsAroundBlock(tostate, false, event); } }
/** 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); } }