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

@@ -18,12 +18,11 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.Collection;
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.logging.Logger;
@@ -44,24 +43,29 @@ public final class L2WorldRegion
private static final Logger _log = Logger.getLogger(L2WorldRegion.class.getName());
/** Map containing all playable characters in game in this world region. */
private final Map<Integer, L2Playable> _allPlayable = new ConcurrentHashMap<>();
private final Map<Integer, L2Playable> _allPlayable;
/** Map containing visible objects in this world region. */
private final Map<Integer, L2Object> _visibleObjects = new ConcurrentHashMap<>();
private final Map<Integer, L2Object> _visibleObjects;
private final Queue<L2WorldRegion> _surroundingRegions = new ConcurrentLinkedQueue<>();
private final List<L2WorldRegion> _surroundingRegions;
private final int _tileX, _tileY;
private boolean _active = false;
private ScheduledFuture<?> _neighborsTask = null;
private final List<L2ZoneType> _zones = new CopyOnWriteArrayList<>();
private final List<L2ZoneType> _zones;
public L2WorldRegion(int pTileX, int pTileY)
{
_allPlayable = new ConcurrentHashMap<>();
_visibleObjects = new ConcurrentHashMap<>();
_surroundingRegions = new ArrayList<>();
_tileX = pTileX;
_tileY = pTileY;
// default a newly initialized region to inactive, unless always on is specified
_active = Config.GRIDS_ALWAYS_ON;
_zones = new ArrayList<>();
}
public List<L2ZoneType> getZones()
@@ -229,7 +233,8 @@ public final class L2WorldRegion
int c = 0;
if (!isOn)
{
for (L2Object o : _visibleObjects.values())
Collection<L2Object> vObj = _visibleObjects.values();
for (L2Object o : vObj)
{
if (o instanceof L2Attackable)
{
@@ -267,7 +272,9 @@ public final class L2WorldRegion
}
else
{
for (L2Object o : _visibleObjects.values())
Collection<L2Object> vObj = _visibleObjects.values();
for (L2Object o : vObj)
{
if (o instanceof L2Attackable)
{
@@ -447,9 +454,9 @@ public final class L2WorldRegion
}
/**
* @return the list containing all L2WorldRegion around the current world region
* @return the ArrayList _surroundingRegions containing all L2WorldRegion around the current L2WorldRegion
*/
public Queue<L2WorldRegion> getSurroundingRegions()
public List<L2WorldRegion> getSurroundingRegions()
{
return _surroundingRegions;
}
@@ -475,7 +482,8 @@ public final class L2WorldRegion
public void deleteVisibleNpcSpawns()
{
_log.fine("Deleting all visible NPC's in Region: " + getName());
for (L2Object obj : _visibleObjects.values())
Collection<L2Object> vNPC = _visibleObjects.values();
for (L2Object obj : vNPC)
{
if (obj instanceof L2Npc)
{