1.15.2 Farmland trampling event - How to know when farmland is broken?

Discussion in 'Spigot Plugin Development' started by CKitty, Jan 26, 2020.

  1. Hello. I am basically wanting to get the event when the farmland breaks. I don't know what event it fires from. I saw a lot of people talking about BlockBreakEvent, but my checks have made me doubt this event handles when farmland changes into dirt.
     
  2. Its the player interact event (or entity interact event if you are wanting for entities)
    then you check if getAction == PHYSICAL ... and you will also want to check if the clickedBlock is farmland.
     
    • Winner Winner x 1
  3. Didn't know that clickedBlock is not Null when action is physical. Thought it is only present when the hand is used.
    So it is more of getInteractedBlock().
     
  4. Basically yeah.
    It confused me at first too, but someone told me that's how its done, and it works (y)
    Magical!!!
     
    • Informative Informative x 1
  5. Thank you people, I was going mad.
     
    • Like Like x 1
    • Friendly Friendly x 1