Use World forEach methods when possible.

This commit is contained in:
MobiusDevelopment
2020-09-02 21:32:31 +00:00
parent 0790f3d43b
commit e47e7d2759
50 changed files with 237 additions and 192 deletions

View File

@@ -419,11 +419,14 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
_isTargetable = targetable;
if (!targetable)
{
World.getInstance().getVisibleObjects(this, Creature.class, creature -> this == creature.getTarget()).forEach(creature ->
World.getInstance().forEachVisibleObject(this, Creature.class, creature ->
{
creature.setTarget(null);
creature.abortAttack();
creature.abortCast();
if (creature.getTarget() == this)
{
creature.setTarget(null);
creature.abortAttack();
creature.abortCast();
}
});
}
}