BlockDetonateEvent or similar

Discussion in 'Plugin Development' started by Nitnelave, Feb 24, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Nitnelave

    Hello, everyone!

    As many of you have discovered since Bukkit was created, there is currently no event fired when a TNT block is detonated (switching from the block state to the blinking entity). And no, it is not the ExplosionPrimeEvent, which gets called just before the explosion.

    It is high time that we create such an event. I suggest BlockDetonateEvent as a name, but maybe you have better ideas?
    Some people favor moving ExplosionPrimeEvent to when the TNT block is detonated, but as some plugins actually use this event for it's current functionality, I think a better solution would be to leave it as it is and create a new event.

    Another question : If the event is canceled, should the TNT disappear or stay? There are several places it can be called : a player with flint and steel, fire, the TNT's physics (redstone) or the TNT is exploded

    I have made a pull request for both bukkit and craftBukkit (they may be a bit outdated now), so please feel free to review them and to suggest improvements.
    https://github.com/Bukkit/Bukkit/pull/708
    https://github.com/Bukkit/CraftBukkit/pull/955

    I really wish this issue can be resolved quickly, because many plugins could use such an event.

    Thank you!
     
  2. Offline

    Tirelessly

  3. Offline

    Nitnelave

  4. Offline

    Tirelessly

    No, I didn't read the post, because detonate and explode are synonymous.
     
  5. Offline

    gamerzap

    Tirelessly
    Well if he had used prime instead of detonate, which is the word that means what he means, people would be like "o use teh ExplosionPrimeEvent!!!!!!"
    Also, you really should read the post as some titles can be misleading.
     
  6. Offline

    Nitnelave

    Detonate can also mean trigger or set off, but I think we're missing the point. Any thoughts on the event?
     
  7. Offline

    gamerzap

    The event should work for creepers as well.
    (If that is possible)
     
  8. Offline

    Nitnelave

    Well, the problem is that for TNT, it's a block event, whereas for Creepers, it's an entity event. I think another event should be used for Creepers, though I see your point.
     
  9. Offline

    jorisk322

    You might want to add a link to your pull-request, for people to look at.
    Also, I agree that an event would be useful, but it will probably become the ConsumeItemEvent situation, where they say: 'What you want to do is already possible', even though this would make things a LOT easier.
     
  10. Offline

    Nitnelave

    Oops, I thought I had put them, just forgot.
    The thing is, it is NOT currently possible, I believe.
     
  11. Offline

    gamerzap

    It is for TNT if you check for every possible scenario where it could be primed and creepers if you override it's AI and call an event or do something when it starts to detonate.
     
  12. Offline

    jorisk322

    Well, you can listen for all the things that can prime tnt, but it wouldn't be very convenient.
     
  13. Offline

    Nitnelave

    For the event, a question :
    If the event is canceled, should the TNT disappear or stay? There are several places it can be called : a player with flint and steel, fire, the TNT's physics (redstone) or the TNT is exploded.
     
  14. Offline

    jorisk322

    It should stay. Cancelling the event means the server ignores what happened: An arrow isn't fired, so no projectile is created, and the arrow isn't removed from the player's inventory. The same should apply to the event you want to see added.
     
  15. Well, I don't think there's an easy event but you could listen to all possible TNT triggers... redstone event, fire, etc.
     
  16. Offline

    Nitnelave

    Yes, but depending on the events, different interpretations might be used : if the block burnt, for example, the TNT should not be there, but if it is redstone, the TNT should still be there. But then, you have no guarantee that the block is TNT or not before/after the event, if you cancel it.

    The thread is about creating an event for that, not implementing it another way.
     
  17. Offline

    jorisk322

    IMO, tnt shouldn't be flammable if it isn't going to explode. People could always just have one line of code in their plugin that would remove the block if it burns.
     
Thread Status:
Not open for further replies.

Share This Page