Detect origin of TNT explosions
eric-wieser opened this issue ยท 1 comments
A lot of the time, a TNT explosion causing death could be attributed to a player. The cases this would need to cover would be:
- TNT placed in a powered redstone spot - attacker is block placer
- Switch/button activated causing TNT to light - attacker is activator (including arrows and wooden buttons)
- Pressure plates:
- if activator is player, then they are the attacker
- if activator is item drop, then dropper of item is the attacker (unless that item was dropped due to death)
- else, no attacker
- Chain reaction - Propogate TNT "ownership" when one TNT block causes another to explode
This might be rather tricky (or impossible - I'm out of touch with the bukkit API) to implement, but it'd be a neat thing to have in future.
It's funny that you mention this, because it is one of my current projects. As far as the Bukkit API is concerned, it's nearly impossible, since the ExplosionPrimeEvent is broken. This bug is fixed, however, in SportBukkit, and I am working on implementing a solution for this almost exactly as you have outlined. Some of it isn't possible (tracking redstone propogation is nearly impossible).
But great timing. I needed an issue to reference when I finally get this working :)