From cca6c6bf4a3eadd58f3d88147afbba926df9d651 Mon Sep 17 00:00:00 2001 From: xGinko Date: Wed, 29 Nov 2023 18:09:32 +0100 Subject: [PATCH] fix mistake --- .../lagpreventions/PathfindingLimits.java | 33 ------------------- .../lagpreventions/PathfindingLimits.java | 33 ------------------- 2 files changed, 66 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java index 61ef35e88..ae2128512 100644 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java @@ -11,7 +11,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityTargetEvent; import java.util.HashMap; import java.util.Map; @@ -105,36 +104,4 @@ private void onPathfind(EntityPathfindEvent event) { } } } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - private void onTargetAcquire(EntityTargetEvent event) { - if (event.getTarget() == null) return; - final double targetDistance = event.getEntity().getLocation().distance(event.getTarget().getLocation()); - - if (globalDistanceEnabled) { - if (targetDistance > globalMaxDistance) { - event.setCancelled(true); - event.setTarget(null); - if (logIsEnabled) LogUtils.moduleLog(Level.INFO, name(), - "Cancelled entity "+event.getEntityType()+" from targeting entity at " - +event.getTarget().getLocation().toBlockLocation() - +" because target is further than the global limit. Distance: "+targetDistance - ); - return; - } - } - - if (perTypeDistanceEnabled) { - final EntityType pathfindingType = event.getEntityType(); - if (limitedTypes.containsKey(pathfindingType) && targetDistance > limitedTypes.get(pathfindingType)) { - event.setCancelled(true); - event.setTarget(null); - if (logIsEnabled) LogUtils.moduleLog(Level.INFO, name(), - "Cancelled entity "+event.getEntityType()+" from targeting entity at " - +event.getTarget().getLocation().toBlockLocation() - +" because target is further than the global limit. Distance: "+targetDistance - ); - } - } - } } \ No newline at end of file diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java index 48b65b4eb..1ea81aceb 100644 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/modules/lagpreventions/PathfindingLimits.java @@ -10,7 +10,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityTargetEvent; import java.util.HashMap; import java.util.Map; @@ -99,36 +98,4 @@ private void onPathfind(EntityPathfindEvent event) { } } } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - private void onTargetAcquire(EntityTargetEvent event) { - if (event.getTarget() == null) return; - final double targetDistance = event.getEntity().getLocation().distance(event.getTarget().getLocation()); - - if (globalDistanceEnabled) { - if (targetDistance > globalMaxDistance) { - event.setCancelled(true); - event.setTarget(null); - if (logIsEnabled) LogUtils.moduleLog(Level.INFO, name(), - "Cancelled entity "+event.getEntityType()+" from targeting entity at " - +event.getTarget().getLocation().toBlockLocation() - +" because target is further than the global limit. Distance: "+targetDistance - ); - return; - } - } - - if (perTypeDistanceEnabled) { - final EntityType pathfindingType = event.getEntityType(); - if (limitedTypes.containsKey(pathfindingType) && targetDistance > limitedTypes.get(pathfindingType)) { - event.setCancelled(true); - event.setTarget(null); - if (logIsEnabled) LogUtils.moduleLog(Level.INFO, name(), - "Cancelled entity "+event.getEntityType()+" from targeting entity at " - +event.getTarget().getLocation().toBlockLocation() - +" because target is further than the global limit. Distance: "+targetDistance - ); - } - } - } } \ No newline at end of file