Removed stream usage from Attackable.
This commit is contained in:
		| @@ -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; | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment