Skip to content

Commit

Permalink
Do not remove entities that have getRemoveWhenFarAway() false.
Browse files Browse the repository at this point in the history
If an entity has this set to false, then the area clear will not affect
it. @BONNe FYI
  • Loading branch information
tastybento committed Jan 5, 2021
1 parent be683f8 commit 78b10cb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.PufferFish;
import org.bukkit.inventory.ItemStack;
Expand Down Expand Up @@ -1386,9 +1387,11 @@ public void clearArea(Location loc) {
loc.getWorld().getNearbyEntities(loc, plugin.getSettings().getClearRadius(),
plugin.getSettings().getClearRadius(),
plugin.getSettings().getClearRadius()).stream()
.filter(LivingEntity.class::isInstance)
.filter(en -> Util.isHostileEntity(en)
&& !plugin.getIWM().getRemoveMobsWhitelist(loc.getWorld()).contains(en.getType())
&& !(en instanceof PufferFish))
&& !(en instanceof PufferFish)
&& ((LivingEntity)en).getRemoveWhenFarAway())
.filter(en -> en.getCustomName() == null)
.forEach(Entity::remove);
}
Expand Down

1 comment on commit 78b10cb

@BONNe
Copy link
Member

@BONNe BONNe commented on 78b10cb Jan 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to include this for entities that leave the island area.

Please sign in to comment.