Skip to content

Commit

Permalink
reset target as well
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Nov 29, 2023
1 parent cca6c6b commit 8048ff6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private void onTargetAcquire(EntityTargetEvent event) {
if (globalDistanceEnabled) {
if (targetDistance > globalMaxDistance) {
event.setCancelled(true);
event.setTarget(null);
if (logIsEnabled) LogUtils.moduleLog(Level.INFO, name(),
"Cancelled target acquire for entity "+event.getEntityType()+" at "
+event.getEntity().getLocation().toBlockLocation()
Expand All @@ -99,6 +100,7 @@ private void onTargetAcquire(EntityTargetEvent event) {
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 target acquire for entity "+event.getEntityType()+" at "
+event.getEntity().getLocation().toBlockLocation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private void onTargetAcquire(EntityTargetEvent event) {
if (globalDistanceEnabled) {
if (targetDistance > globalMaxDistance) {
event.setCancelled(true);
event.setTarget(null);
if (logIsEnabled) LogUtils.moduleLog(Level.INFO, name(),
"Cancelled target acquire for entity "+event.getEntityType()+" at "
+event.getEntity().getLocation().toBlockLocation()
Expand All @@ -93,6 +94,7 @@ private void onTargetAcquire(EntityTargetEvent event) {
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 target acquire for entity "+event.getEntityType()+" at "
+event.getEntity().getLocation().toBlockLocation()
Expand Down

0 comments on commit 8048ff6

Please sign in to comment.