Solved Getting Location of Water Placed

Discussion in 'Plugin Development' started by Smeary_Subset, Apr 6, 2022.

  1. Offline

    Smeary_Subset

    3 seconds after a player places water through emptying their water bucket, I want to delete that water source (get rid of the water by setting that Block's type to Material.AIR).

    I already know how to check for event through PlayerInteractEvent and know how to set the type. What I am having trouble with is finding the specific block the water spawns on.

    PlayerInteractEvent#getClickedBlock() returns the block that was clicked on, not the block that contains the water source. How can I use block faces or other means to solve this?
     
  2. Offline

    jcv8000

    Didn't test but looking at the docs this seems like it could work

    Code:
     Block water = event.getClickedBlock().getRelative(event.getBlockFace());
     
  3. Offline

    Smeary_Subset

Share This Page