From 459c4a6dc6567a95f8b6475b7b9abfdc1209030d Mon Sep 17 00:00:00 2001
From: Zoey76 <zoey_76@msn.com>
Date: Mon, 6 Mar 2017 22:03:10 -0300
Subject: [PATCH] Avoiding CopyOnWriteArrayList on L2PcInstance

---
 .../scripts/ai/group_template/FeedableBeasts.java | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/dist/game/data/scripts/ai/group_template/FeedableBeasts.java b/dist/game/data/scripts/ai/group_template/FeedableBeasts.java
index a0f291e286..4889ecc5cb 100644
--- a/dist/game/data/scripts/ai/group_template/FeedableBeasts.java
+++ b/dist/game/data/scripts/ai/group_template/FeedableBeasts.java
@@ -22,10 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import quests.Q00020_BringUpWithLove.Q00020_BringUpWithLove;
-import quests.Q00655_AGrandPlanForTamingWildBeasts.Q00655_AGrandPlanForTamingWildBeasts;
-import ai.npc.AbstractNpcAI;
-
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.actor.L2Attackable;
@@ -37,6 +33,10 @@ import com.l2jserver.gameserver.network.NpcStringId;
 import com.l2jserver.gameserver.network.serverpackets.NpcSay;
 import com.l2jserver.gameserver.util.Util;
 
+import ai.npc.AbstractNpcAI;
+import quests.Q00020_BringUpWithLove.Q00020_BringUpWithLove;
+import quests.Q00655_AGrandPlanForTamingWildBeasts.Q00655_AGrandPlanForTamingWildBeasts;
+
 /**
  * Growth-capable mobs: Polymorphing upon successful feeding.
  * @author Fulminus
@@ -423,12 +423,9 @@ public final class FeedableBeasts extends AbstractNpcAI
 		// player might have and initialize the Tamed Beast.
 		if (Util.contains(TAMED_BEASTS, nextNpcId))
 		{
-			if ((player.getTrainedBeasts() != null) && !player.getTrainedBeasts().isEmpty())
+			for (L2TamedBeastInstance oldTrained : player.getTamedBeasts())
 			{
-				for (L2TamedBeastInstance oldTrained : player.getTrainedBeasts())
-				{
-					oldTrained.deleteMe();
-				}
+				oldTrained.deleteMe();
 			}
 			
 			final L2TamedBeastInstance nextNpc = new L2TamedBeastInstance(nextNpcId, player, food - FOODSKILLDIFF, npc.getX(), npc.getY(), npc.getZ());
-- 
GitLab