Removed stream usage from Attackable.

This commit is contained in:
MobiusDevelopment 2023-01-08 14:34:48 +00:00
parent 420b8409e5
commit 6e8a72c251
26 changed files with 546 additions and 52 deletions

View File

@ -707,10 +707,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));
}
@ -981,7 +990,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);
}
@ -989,6 +1007,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -691,10 +691,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));
}
@ -965,7 +974,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);
}
@ -973,6 +991,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -691,10 +691,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));
}
@ -965,7 +974,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);
}
@ -973,6 +991,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -691,10 +691,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));
}
@ -965,7 +974,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);
}
@ -973,6 +991,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -702,10 +702,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));
}
@ -976,7 +985,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);
}
@ -984,6 +1002,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -702,10 +702,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));
}
@ -976,7 +985,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);
}
@ -984,6 +1002,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -702,10 +702,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));
}
@ -976,7 +985,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);
}
@ -984,6 +1002,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -702,10 +702,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));
}
@ -976,7 +985,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);
}
@ -984,6 +1002,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -708,10 +708,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));
}
@ -982,7 +991,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);
}
@ -990,6 +1008,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -689,10 +689,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));
}
@ -963,7 +972,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);
}
@ -971,6 +989,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -723,10 +723,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));
}
@ -997,7 +1006,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);
}
@ -1005,6 +1023,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -723,10 +723,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));
}
@ -997,7 +1006,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);
}
@ -1005,6 +1023,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -723,10 +723,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));
}
@ -997,7 +1006,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);
}
@ -1005,6 +1023,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -723,10 +723,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));
}
@ -997,7 +1006,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);
}
@ -1005,6 +1023,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -707,10 +707,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));
}
@ -981,7 +990,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);
}
@ -989,6 +1007,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -736,10 +736,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));
}
@ -1010,7 +1019,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);
}
@ -1018,6 +1036,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -743,10 +743,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));
}
@ -1017,7 +1026,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);
}
@ -1025,6 +1043,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -750,10 +750,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));
}
@ -1024,7 +1033,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);
}
@ -1032,6 +1050,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}

View File

@ -750,10 +750,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));
}
@ -1024,7 +1033,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);
}
@ -1032,6 +1050,7 @@ public class Attackable extends Npc
{
result.add(null);
}
return result;
}