Removed all ConcurrentLinkedQueue references.

This commit is contained in:
MobiusDev
2015-12-04 20:48:07 +00:00
parent 63ddbd13f6
commit 624171c088
9 changed files with 177 additions and 158 deletions

View File

@ -26,9 +26,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@ -554,6 +552,11 @@ public class AutoSpawnHandler
for (L2Npc npcInst : spawnInst.getNPCInstanceList())
{
if (npcInst == null)
{
continue;
}
npcInst.deleteMe();
SpawnTable.getInstance().deleteSpawn(npcInst.getSpawn(), false);
spawnInst.removeNpcInstance(npcInst);
@ -589,7 +592,7 @@ public class AutoSpawnHandler
protected int _lastLocIndex = -1;
private final Queue<L2Npc> _npcList = new ConcurrentLinkedQueue<>();
private final List<L2Npc> _npcList = new CopyOnWriteArrayList<>();
private final List<Location> _locList = new CopyOnWriteArrayList<>();
@ -662,9 +665,16 @@ public class AutoSpawnHandler
return _locList.toArray(new Location[_locList.size()]);
}
public Queue<L2Npc> getNPCInstanceList()
public L2Npc[] getNPCInstanceList()
{
return _npcList;
L2Npc[] ret;
synchronized (_npcList)
{
ret = new L2Npc[_npcList.size()];
_npcList.toArray(ret);
}
return ret;
}
public List<L2Spawn> getSpawns()