Expected behavior
it has to return damager's holding
Observed/Actual behavior
When an EntityDamageByEntityEvent occurs, getActiveItem always returns AIR (empty-handed)
Steps/models to reproduce
this is my plugin source
@eventhandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player) {
Player player = (Player) event.getDamager();
ItemStack activeItem = player.getActiveItem();
if (activeItem.getType() == Material.AIR) {
player.sendMessage("You are attacking with an empty hand!");
} else {
player.sendMessage("You are attacking with a " + activeItem.getType().name());
}
}
}
Plugin and Datapack List
just my plugin only(that has no function)
Paper version
This server is running Paper version 1.21.4-69-main@bdfad1c (2025-01-01T00:57:45Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-66-d00344a (MC: 1.21.4)
Other
getInventory().getItemInMainHand works.
Expected behavior
it has to return damager's holding
Observed/Actual behavior
When an EntityDamageByEntityEvent occurs, getActiveItem always returns AIR (empty-handed)
Steps/models to reproduce
this is my plugin source
@eventhandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player) {
Player player = (Player) event.getDamager();
ItemStack activeItem = player.getActiveItem();
Plugin and Datapack List
just my plugin only(that has no function)
Paper version
This server is running Paper version 1.21.4-69-main@bdfad1c (2025-01-01T00:57:45Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-66-d00344a (MC: 1.21.4)
Other
getInventory().getItemInMainHand works.