Stop EVERY explosion's damage to blocks?

Discussion in 'Spigot Plugin Development' started by BryceTheCoder, May 22, 2015.

  1. Hello everyone, I want to have a simple code that will stop EVERY explosion from damaging any blocks.

    I'm not sure what event I would put this under and how to make it stop every explosion?
    Any ideas?

    I'm thinking of using the BlockBreakEvent event, however I can't get a "broke by" then see if its equal to an explosion to cancel the event?
    Any help would help, thanks!
  2. BlockExplodeEvent
    Long live the bukkit javadocs
    • Winner Winner x 1
  3. Also remember EntityExplodeEvent in case it would be an enity causing the explosion ;)
  4. Correct, merely skip-read it and thought this would fire for every block that is broken :3

    Most explos are from entities though? Primed tnt is an entity, those pilar things are entities, creepers are entities... What block explodes itself?!
  5. Well I don't want to set the even canceled. I just want the damage to not effect any blocks. How could I do this?
  6. Use BlockExplodeEvent, this is fired when a block explodes and EntityExplodeEvent is fired when a Entity explodes (like creeper, tnt).

    So, use blockexplodeevent and get the blocklist and clear it!