• Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • The one I coded myself

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

          [SPIGOT-1166] Entity damaged by block event

          Frank Wu added a comment - - edited

          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.

           

          Frank Wu added a comment - - edited 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.  

          Connor Smith added a comment -

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

          Connor Smith added a comment - This issue still exists in the latest version of spigot, specifically for Block Explosion damage (beds and respawn anchors).

          Black Hole added a comment -

          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.

          Black Hole added a comment - 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.

          SpigotMC added a comment -

          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.

          SpigotMC added a comment - 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.

            Assignee:
            Doc
            Reporter:
            Leon
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: