[SPIGOT-4890] EntityDeathEvent fires twice when breaking an armor stand in survival mode Created: 07/May/19  Updated: 08/May/19  Resolved: 08/May/19

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

Type: Bug Priority: Minor
Reporter: Intelli Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: 1.14

Attachments: File ArmorStandBreakExample.jar     Zip Archive ArmorStandBreakExample.zip    
Version: This server is running CraftBukkit version git-Spigot-1eece4f-d203283 (MC: 1.14) (Implementing API version 1.14-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

When breaking an armor stand in survival mode, the EntityDeathEvent is triggered twice. This doesn't occur if the armor stand is broken in creative mode. This issue also doesn't occur in 1.13.

The first time the event is run, the armor stand is still listed as having it's armor equipped. The second time the event is run, the armor stand entity is listed as empty.
 
Example code:

package com.minerealm;

import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;

public class ArmorStandBreakExample extends JavaPlugin {

    protected static ArmorStandBreakExample instance;

    @Override
    public void onEnable() {
        instance = this;
        getServer().getPluginManager().registerEvents(new PluginListener(), this);
        PluginDescriptionFile pluginDescription = this.getDescription();
        System.out.println(pluginDescription.getName() + " version " + pluginDescription.getVersion() + " is enabled!");
    }

    public class PluginListener implements Listener {

        @EventHandler
        public void onEntityDeath(EntityDeathEvent event) {
            Entity entity = event.getEntity();
            if (entity instanceof ArmorStand) {
                Location location = entity.getLocation();
                System.out.println(System.currentTimeMillis() + " - Armor stand broken at " + location.getWorld().getName() + "/" + location.getBlockX() + "/" + location.getBlockY() + "/" + location.getBlockZ());
            }
        }
    }
}

Output (1.14):

[11:40:41] [Server thread/INFO]: 1557250841555 - Armor stand broken at world/-34/65/-103
[11:40:41] [Server thread/INFO]: 1557250841555 - Armor stand broken at world/-34/65/-103

Output (1.13):

[11:48:21 INFO]: 1557251301318 - Armor stand broken at world/68/66/47

Thanks!


Generated at Sat Dec 13 20:13:14 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.