Skip to content

Commit

Permalink
Use existing DamageSource of EntityDamageByEntityEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
Brokkonaut committed May 14, 2024
1 parent 26f8aec commit 23d89e2
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ public void onDamage(EntityDamageByEntityEvent e) {
List<ItemStack> stackList = new ArrayList<>();
stackList.add(stack);
stand.setLastDamageCause(e);
DamageSource damageSource = DamageSource.builder(DamageType.PLAYER_ATTACK).withCausingEntity(player).withDirectEntity(player).withDamageLocation(stand.getLocation()).build();
FireworkDeathEvent fireworkDeathEvent = new FireworkDeathEvent(stand, stackList, damageSource);
FireworkDeathEvent fireworkDeathEvent = new FireworkDeathEvent(stand, stackList, e.getDamageSource());
player.getServer().getPluginManager().callEvent(fireworkDeathEvent);
if (fireworkDeathEvent.isCancelled()) {
e.setCancelled(true);
Expand Down

0 comments on commit 23d89e2

Please sign in to comment.