[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: |
|
| 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. 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):
Output (1.13):
Thanks! |