Trying to detect BlockFace

Discussion in 'Spigot Plugin Development' started by fer112233, May 21, 2016.

  1. Hi!
    I am developing a plugin and i need help getting the blockface of a block when a player break it.
    I tryed using player.getBlockFace(event.getBlock()); but not working properly.
    I want to know if player is breaking the face north, up, down.... but this method not work good.
    Thanks! and sorry for my bad english :D
  2. mention what event you're currently using might be helpful
  3. Since you cannot directly access the clicked BlockFace from BlockBreakEvent, I think you'll need to store information about the last clicked BlockFace in some data structure, then access it during BlockBreakEvent.

    Something like this:
    Code (Text):
    Map<UUID, BlockFace> lastClickedBlockFaces = new HashMap<UUID, BlockFace>();
    You can set the last clicked block face during PlayerInteractEvent.