[SPIGOT-1166] Entity damaged by block event Created: 04/Sep/15  Updated: 04/May/24  Resolved: 04/May/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Leon Assignee: Doc
Resolution: Fixed Votes: 1
Labels: None

Attachments: File TestBedExplode.jar    
Issue Links:
Relates
relates to SPIGOT-7647 getDamager() in DamageByBlockEvent re... Resolved
Plugin: The one I coded myself

 Description   

in the newest spigot, in EntityDamageByBlockEvent, the getDamager() which return the block that damaged them only returns null



 Comments   
Comment by Frank Wu [ 02/Feb/21 ]

Made a test plugin with a simple listener (uploaded in attachments):

 

@EventHandler 
public void onBedExplode(EntityDamageByBlockEvent event) { 
    Bukkit.broadcastMessage("EntityDamageByBlockEvent"); 
    Bukkit.broadcastMessage(event.getDamager().toString()); 
}

Code throws exception at second broadcast because event.getDamager() returns null.

 

Comment by Connor Smith [ 11/Dec/20 ]

This issue still exists in the latest version of spigot, specifically for Block Explosion damage (beds and respawn anchors).

Comment by Black Hole [ 04/Sep/15 ]

Looking at the code, a block is returned for DamageCause.CONTACT only.
It might be possible to return the block for DamageCause.LAVA, but does that really matter?

I don't understand, why DamageCause.VOID returns EntityDamageByBlockEvent.
The events for DamageCause.BLOCK_EXPLOSION and DamageCause.ENTITY_EXPLOSION seems a little inconsistent, too.

Comment by SpigotMC [ 04/Sep/15 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 4 version(s) behind. CraftBukkit is 5 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Tue Apr 08 01:20:45 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.