Skip to content

Commit

Permalink
Fix incorrect flag assignment for entity attack events
Browse files Browse the repository at this point in the history
Adjusted the conditional logic to ensure correct flag assignment when entities attack each other. This fixes a bug where the `entityAttackEntity` flag was not being set properly, potentially causing unwanted behavior in the protection system.
  • Loading branch information
NonSwag committed Aug 31, 2024
1 parent 7b469f0 commit 5b1cf57
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
var area = plugin.areaProvider().getArea(event.getDamager());
var flag = event.getDamager() instanceof Player && event.getEntity() instanceof Player
? plugin.flags.playerAttackPlayer : event.getDamager() instanceof Player
? plugin.flags.playerAttackEntity : event.getEntity() instanceof Player
? plugin.flags.playerAttackEntity : !(event.getDamager() instanceof Player)
&& event.getEntity() instanceof Player
? plugin.flags.entityAttackPlayer : plugin.flags.entityAttackEntity;
event.setCancelled(!area.getFlag(flag));
}
Expand Down

0 comments on commit 5b1cf57

Please sign in to comment.