Removed stream usage from Attackable.
This commit is contained in:
@@ -703,10 +703,19 @@ public class Attackable extends Npc
|
||||
@Override
|
||||
public void addAttackerToAttackByList(Creature creature)
|
||||
{
|
||||
if ((creature == null) || (creature == this) || getAttackByList().stream().anyMatch(o -> o.get() == creature))
|
||||
if ((creature == null) || (creature == this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (WeakReference<Creature> ref : getAttackByList())
|
||||
{
|
||||
if (ref.get() == creature)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
getAttackByList().add(new WeakReference<>(creature));
|
||||
}
|
||||
|
||||
@@ -977,7 +986,16 @@ public class Attackable extends Npc
|
||||
result.add(mostHated);
|
||||
|
||||
final Creature secondMostHatedFinal = secondMostHated;
|
||||
if (getAttackByList().stream().anyMatch(o -> o.get() == secondMostHatedFinal))
|
||||
boolean found = false;
|
||||
for (WeakReference<Creature> ref : getAttackByList())
|
||||
{
|
||||
if (ref.get() == secondMostHatedFinal)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
result.add(secondMostHated);
|
||||
}
|
||||
@@ -985,6 +1003,7 @@ public class Attackable extends Npc
|
||||
{
|
||||
result.add(null);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user