From cafb73f2e7eb4de02c750396a1da3b14c120b5d9 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 1 Apr 2021 15:17:50 +0100 Subject: [PATCH] Added antigrief check to aiming --- .../ecoenchants/enchantments/ecoenchants/special/Aiming.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java index ae5069df..508bd44c 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java @@ -1,6 +1,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special; import com.willfp.eco.util.NumberUtils; +import com.willfp.eco.util.integrations.antigrief.AntigriefManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; @@ -26,6 +27,7 @@ public class Aiming extends EcoEnchant { "aiming", EnchantmentType.SPECIAL ); } + @EventHandler public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) { if (!(event.getEntity().getShooter() instanceof Player)) { @@ -74,6 +76,7 @@ public class Aiming extends EcoEnchant { .filter(entity -> entity instanceof LivingEntity) .filter(entity -> !entity.equals(player)) .filter(entity -> !(entity instanceof Enderman)) + .filter(entity -> !AntigriefManager.canInjure(player, (LivingEntity) entity)) .filter(entity -> { if (entity instanceof Player) { return ((Player) entity).getGameMode().equals(GameMode.SURVIVAL) || ((Player) entity).getGameMode().equals(GameMode.ADVENTURE);