1.15.2 Event called when block is removed

Discussion in 'Spigot Plugin Development' started by Cubixor, Feb 1, 2020.

  1. Hi, I am searching for event which is called when a block is removed. And yes I know that there is BlockBreakEvent but it's not called when for example water destroys grass, torch destroys sand/gravel or upper part of sugar cane/bamboo/cactus is destroyed when player destroys the bottom block. If it helps: I need it to change drops of some items. Maybe there is other way to do this?
  2. Ah, right, well, as far as I know, there isn't any event for those kind of block breaks. For cactuses etc you could use BlockGrowEvent, for water destroying things and for gravity blocks dropping on torches and alike I'm not sure...
  3. Unfortunately, I have to tell you that there is no such event that gets called every time. For your use-case there's the following options:
    a) Install Paper, they have a BlockDestroyEvent
    b) check for every possible event (not as many as you might think)
    c) Runnable that checks a certain set of stored locations every time (really not that applicable here, but I wanted to mention it for completeness)
  4. for b > Is there an event triggered if a gravity block gets destroyed by a slab, torch, etc..? Because I've searched around a bit and couldn't find anything.
  5. I suppose you could check for an EntityEvent since at that time the block is a falling entity.
    Edit: indeed, EntityDamageEvent gets called when a Falling Block is about to get destroyed
    #5 Schottky, Feb 1, 2020
    Last edited: Feb 1, 2020
  6. Check out BlockPhysicsEvent or BlockEvent
  7. Right, forgot about BlockPhysicsEvent.
    BlockEvent, on the other hand, is abstract and will not be called.
    • Like Like x 1
  8. While I was searching for all these events I found BlockDropItemEvent. Does someone know when exactly it's called and will it work for all things that I need?
  9. Thought of that too, but that one's only called when a player is involved, so unfortunately it won't work :c
  10. "Called if a block broken by a player drops an item, also be called if the player breaks a multi block structure, for example a torch on top of a stone" - id imagine it does.

    Checkout the java docs for these sorts of things, BlockDropItemEvent.

    For the water bit, id assume you could use BlockFormEvent
  11. Okay, I have seen this but I just wanted to make sure. I will test it tomorrow and write if it works.
  12. BlackPhysicsEvent does that for the water bit