mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-26 20:27:38 +01:00
Added antigrief check to aiming
This commit is contained in:
parent
eb0b8083de
commit
cafb73f2e7
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||||
|
|
||||||
import com.willfp.eco.util.NumberUtils;
|
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.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
@ -26,6 +27,7 @@ public class Aiming extends EcoEnchant {
|
|||||||
"aiming", EnchantmentType.SPECIAL
|
"aiming", EnchantmentType.SPECIAL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) {
|
public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) {
|
||||||
if (!(event.getEntity().getShooter() instanceof Player)) {
|
if (!(event.getEntity().getShooter() instanceof Player)) {
|
||||||
@ -74,6 +76,7 @@ public class Aiming extends EcoEnchant {
|
|||||||
.filter(entity -> entity instanceof LivingEntity)
|
.filter(entity -> entity instanceof LivingEntity)
|
||||||
.filter(entity -> !entity.equals(player))
|
.filter(entity -> !entity.equals(player))
|
||||||
.filter(entity -> !(entity instanceof Enderman))
|
.filter(entity -> !(entity instanceof Enderman))
|
||||||
|
.filter(entity -> !AntigriefManager.canInjure(player, (LivingEntity) entity))
|
||||||
.filter(entity -> {
|
.filter(entity -> {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player) {
|
||||||
return ((Player) entity).getGameMode().equals(GameMode.SURVIVAL) || ((Player) entity).getGameMode().equals(GameMode.ADVENTURE);
|
return ((Player) entity).getGameMode().equals(GameMode.SURVIVAL) || ((Player) entity).getGameMode().equals(GameMode.ADVENTURE);
|
||||||
|
Loading…
Reference in New Issue
Block a user